PluginProbe
Video Player for YouTube – Embed Videos Your Visitors Will Love to Watch / 2.1.0
Video Player for YouTube – Embed Videos Your Visitors Will Love to Watch v2.1.0
2.1.1 2.1.0 trunk 1.0 1.1 1.2 1.4.2 1.5.2 1.5.5 1.6.1 1.6.2 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9
yt-player / yt-player.php

yt-player.php in Video Player for YouTube – Embed Videos Your Visitors Will Love to Watch 2.1.0, at yt-player.php

127 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Video Player for YouTube – Embed Videos Your Visitors Will Love to Watch
5 * Plugin URI: http://bplugins.com
6 * Description: A simple, accessible, fully customizable & user friendly YouTube Video Player for Wordpress.
7 * Version: 2.1.0
8 * Author: bPlugins
9 * Author URI: http://abuhayatpolash.com
10 * License: GPLv3
11 * Text Domain: yt-player
12 * Domain Path: /languages
13 */
14 if ( !defined( 'ABSPATH' ) ) {
15 exit;
16 // Exit if accessed directly.
17 }
18 //--------------Fremius Integration------------------
19 if ( function_exists( 'ytp_fs' ) ) {
20 ytp_fs()->set_basename( false, __FILE__ );
21 return;
22 } else {
23 // DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
24 if ( !function_exists( 'ytp_fs' ) ) {
25 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
26 function ytp_fs() {
27 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
28 global $ytp_fs;
29 if ( !isset( $ytp_fs ) ) {
30 // Activate multisite network integration.
31 if ( !defined( 'WP_FS__PRODUCT_5836_MULTISITE' ) ) {
32 define( 'WP_FS__PRODUCT_5836_MULTISITE', true );
33 }
34 // Include Freemius SDK.
35 require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
36 // if ( file_exists( dirname(__FILE__) . '/vendor/freemius/start.php' ) ) {
37 // require_once dirname(__FILE__) . '/vendor/freemius/start.php';
38 // } else if ( file_exists( dirname(__FILE__) . '/vendor/freemius-lite/start.php' ) ) {
39 // require_once dirname(__FILE__) . '/vendor/freemius-lite/start.php';
40 // }
41 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
42 $ytp_fs = fs_dynamic_init( array(
43 'id' => '5836',
44 'slug' => 'yt-player',
45 'type' => 'plugin',
46 'public_key' => 'pk_829fc74e7bb67d3d555c68048933d',
47 'is_premium' => false,
48 'has_addons' => false,
49 'has_paid_plans' => true,
50 'trial' => array(
51 'days' => 7,
52 'is_require_payment' => true,
53 ),
54 'menu' => array(
55 'slug' => 'edit.php?post_type=ytplayer',
56 'first-path' => 'edit.php?post_type=ytplayer&page=dashboard',
57 'support' => false,
58 ),
59 'is_live' => true,
60 'is_org_compliant' => true,
61 ) );
62 }
63 return $ytp_fs;
64 }
65
66 // Init Freemius.
67 ytp_fs();
68 // Signal that SDK was initiated.
69 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
70 do_action( 'ytp_fs_loaded' );
71 }
72 }
73 /*Some Set-up*/
74 if ( !defined( 'YTP_PLUGIN_DIR' ) ) {
75 define( 'YTP_PLUGIN_DIR', plugin_dir_url( __FILE__ ) );
76 }
77 if ( !defined( 'YTP_DIR_PATH' ) ) {
78 define( 'YTP_DIR_PATH', plugin_dir_path( __FILE__ ) );
79 }
80 if ( !defined( 'YTP_PLUGIN_VERSION' ) ) {
81 define( 'YTP_PLUGIN_VERSION', ( isset( $_SERVER['HTTP_HOST'] ) && $_SERVER['HTTP_HOST'] === 'localhost' ? time() : '2.1.0' ) );
82 }
83 if ( !defined( 'YTP_IMPORT_VER' ) ) {
84 define( 'YTP_IMPORT_VER', '1.0.0' );
85 }
86 if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
87 require_once dirname( __FILE__ ) . '/vendor/autoload.php';
88 }
89 require_once plugin_dir_path( __FILE__ ) . 'inc/LicenseActivation.php';
90 require_once plugin_dir_path( __FILE__ ) . '/youtube-player.php';
91 add_action( 'plugins_loaded', function () {
92 // load_plugin_textdomain('yt-player', false, dirname(plugin_basename(__FILE__)) . '/languages'); // Removed because WP automatically loads translations since 4.6
93 if ( !class_exists( 'CSF' ) ) {
94 require_once __DIR__ . '/vendor/codestar-framework/codestar-framework.php';
95 require_once __DIR__ . '/youtube-player.php';
96 }
97 if ( class_exists( 'YTP\\Init' ) ) {
98 YTP\Init::register_services();
99 }
100 } );
101 add_action( 'init', function () {
102 // import data
103 if ( get_option( 'ytp_import_ver', '0' ) < YTP_IMPORT_VER ) {
104 $players = new WP_Query(array(
105 'post_type' => 'ytplayer',
106 'post_status' => 'any',
107 'posts_per_page' => -1,
108 ));
109 while ( $players->have_posts() ) {
110 $players->the_post();
111 $id = get_the_ID();
112 if ( !get_post_meta( $id, 'isGutenberg', true ) ) {
113 update_post_meta( $id, 'isGutenberg', true );
114 }
115 }
116 }
117 } );
118 if ( !function_exists( 'ytp_import_btn' ) ) {
119 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
120 function ytp_import_btn( $links ) {
121 array_unshift( $links, '<a id="ytp_import_btn" href="#">Import</a>' );
122 return $links;
123 }
124
125 }
126 $plugin = plugin_basename( __FILE__ );
127 add_filter( "plugin_action_links_{$plugin}", 'ytp_import_btn' );