| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* @link https://plugins360.com |
| 7 |
* @since 1.0.0 |
| 8 |
* @package Automatic_YouTube_Gallery |
| 9 |
* |
| 10 |
* @wordpress-plugin |
| 11 |
* Plugin Name: Automatic YouTube Gallery |
| 12 |
* Plugin URI: https://plugins360.com/automatic-youtube-gallery/ |
| 13 |
* Description: Embed YouTube videos, playlists, channels, live streams & Shorts in a responsive video gallery that stays up to date automatically. |
| 14 |
* Version: 2.9.1 |
| 15 |
* Author: Team Plugins360 |
| 16 |
* Author URI: https://plugins360.com |
| 17 |
* License: GPL-2.0+ |
| 18 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 19 |
* Text Domain: automatic-youtube-gallery |
| 20 |
* Domain Path: /languages |
| 21 |
* |
| 22 |
*/ |
| 23 |
// Exit if accessed directly |
| 24 |
if ( !defined( 'WPINC' ) ) { |
| 25 |
die; |
| 26 |
} |
| 27 |
if ( function_exists( 'ayg_fs' ) ) { |
| 28 |
ayg_fs()->set_basename( false, __FILE__ ); |
| 29 |
return; |
| 30 |
} |
| 31 |
// Current version of the plugin |
| 32 |
if ( !defined( 'AYG_VERSION' ) ) { |
| 33 |
define( 'AYG_VERSION', '2.9.1' ); |
| 34 |
} |
| 35 |
// Unique identifier of the plugin |
| 36 |
if ( !defined( 'AYG_SLUG' ) ) { |
| 37 |
define( 'AYG_SLUG', 'automatic-youtube-gallery' ); |
| 38 |
} |
| 39 |
// Path to the plugin directory |
| 40 |
if ( !defined( 'AYG_DIR' ) ) { |
| 41 |
define( 'AYG_DIR', plugin_dir_path( __FILE__ ) ); |
| 42 |
} |
| 43 |
// URL of the plugin |
| 44 |
if ( !defined( 'AYG_URL' ) ) { |
| 45 |
define( 'AYG_URL', plugin_dir_url( __FILE__ ) ); |
| 46 |
} |
| 47 |
// The plugin file name |
| 48 |
if ( !defined( 'AYG_FILE_NAME' ) ) { |
| 49 |
define( 'AYG_FILE_NAME', plugin_basename( __FILE__ ) ); |
| 50 |
} |
| 51 |
if ( !function_exists( 'ayg_fs' ) ) { |
| 52 |
// Create a helper function for easy SDK access |
| 53 |
function ayg_fs() { |
| 54 |
global $ayg_fs; |
| 55 |
if ( !isset( $ayg_fs ) ) { |
| 56 |
// Activate multisite network integration |
| 57 |
if ( !defined( 'WP_FS__PRODUCT_2922_MULTISITE' ) ) { |
| 58 |
define( 'WP_FS__PRODUCT_2922_MULTISITE', true ); |
| 59 |
} |
| 60 |
// Include Freemius SDK |
| 61 |
require_once dirname( __FILE__ ) . '/vendor/freemius/start.php'; |
| 62 |
$ayg_fs = fs_dynamic_init( array( |
| 63 |
'id' => '2922', |
| 64 |
'slug' => 'automatic-youtube-gallery', |
| 65 |
'type' => 'plugin', |
| 66 |
'public_key' => 'pk_7734619fa98d4e2b76a390a890739', |
| 67 |
'is_premium' => false, |
| 68 |
'premium_suffix' => 'Premium', |
| 69 |
'has_addons' => false, |
| 70 |
'has_paid_plans' => true, |
| 71 |
'trial' => array( |
| 72 |
'days' => 7, |
| 73 |
'is_require_payment' => false, |
| 74 |
), |
| 75 |
'menu' => array( |
| 76 |
'slug' => 'automatic-youtube-gallery', |
| 77 |
'first-path' => 'admin.php?page=automatic-youtube-gallery', |
| 78 |
), |
| 79 |
'is_live' => true, |
| 80 |
'is_org_compliant' => true, |
| 81 |
) ); |
| 82 |
} |
| 83 |
return $ayg_fs; |
| 84 |
} |
| 85 |
|
| 86 |
// Init Freemius |
| 87 |
ayg_fs(); |
| 88 |
// Signal that SDK was initiated |
| 89 |
do_action( 'ayg_fs_loaded' ); |
| 90 |
} |
| 91 |
if ( !function_exists( 'activate_ayg' ) ) { |
| 92 |
/** |
| 93 |
* The code that runs during plugin activation. |
| 94 |
* This action is documented in includes/activator.php |
| 95 |
*/ |
| 96 |
function activate_ayg( $network_wide ) { |
| 97 |
if ( is_multisite() && $network_wide ) { |
| 98 |
deactivate_plugins( AYG_FILE_NAME ); |
| 99 |
wp_die( __( 'Sorry, this plugin cannot be activated network-wide. Please activate it individually on each site where it is needed.', 'automatic-youtube-gallery' ), __( 'Network Activation Not Allowed', 'automatic-youtube-gallery' ), array( |
| 100 |
'back_link' => true, |
| 101 |
) ); |
| 102 |
} |
| 103 |
require_once AYG_DIR . 'includes/activator.php'; |
| 104 |
AYG_Activator::activate(); |
| 105 |
} |
| 106 |
|
| 107 |
register_activation_hook( __FILE__, 'activate_ayg' ); |
| 108 |
} |
| 109 |
if ( !function_exists( 'deactivate_ayg' ) ) { |
| 110 |
/** |
| 111 |
* The code that runs during plugin deactivation. |
| 112 |
* This action is documented in includes/deactivator.php |
| 113 |
*/ |
| 114 |
function deactivate_ayg() { |
| 115 |
require_once AYG_DIR . 'includes/deactivator.php'; |
| 116 |
AYG_Deactivator::deactivate(); |
| 117 |
} |
| 118 |
|
| 119 |
register_deactivation_hook( __FILE__, 'deactivate_ayg' ); |
| 120 |
} |
| 121 |
if ( !function_exists( 'run_ayg' ) ) { |
| 122 |
/** |
| 123 |
* Begins execution of the plugin. |
| 124 |
* |
| 125 |
* Since everything within the plugin is registered via hooks, |
| 126 |
* then kicking off the plugin from this point in the file does |
| 127 |
* not affect the page life cycle. |
| 128 |
* |
| 129 |
* @since 1.0.0 |
| 130 |
*/ |
| 131 |
function run_ayg() { |
| 132 |
require_once AYG_DIR . 'includes/init.php'; |
| 133 |
$plugin = new AYG_Init(); |
| 134 |
$plugin->run(); |
| 135 |
} |
| 136 |
|
| 137 |
run_ayg(); |
| 138 |
} |
| 139 |
if ( !function_exists( 'ayg_fs_uninstall_cleanup' ) ) { |
| 140 |
/** |
| 141 |
* Plugin uninstall cleanup. |
| 142 |
* |
| 143 |
* @since 1.0.0 |
| 144 |
*/ |
| 145 |
function ayg_fs_uninstall_cleanup() { |
| 146 |
global $wpdb; |
| 147 |
// Delete all the plugin transients |
| 148 |
$transient_keys = array_filter( (array) get_option( 'ayg_transient_keys' ) ); |
| 149 |
foreach ( $transient_keys as $key ) { |
| 150 |
delete_transient( sanitize_key( $key ) ); |
| 151 |
} |
| 152 |
// Delete all the plugin options |
| 153 |
delete_option( 'ayg_general_settings' ); |
| 154 |
delete_option( 'ayg_strings_settings' ); |
| 155 |
delete_option( 'ayg_gallery_settings' ); |
| 156 |
delete_option( 'ayg_player_settings' ); |
| 157 |
delete_option( 'ayg_livestream_settings' ); |
| 158 |
delete_option( 'ayg_seo_settings' ); |
| 159 |
delete_option( 'ayg_privacy_settings' ); |
| 160 |
delete_option( 'ayg_gallery_page_ids' ); |
| 161 |
delete_option( 'ayg_channel_ids' ); |
| 162 |
delete_option( 'ayg_playlist_ids' ); |
| 163 |
delete_option( 'ayg_transient_keys' ); |
| 164 |
delete_option( 'ayg_version' ); |
| 165 |
// Delete our custom database tables |
| 166 |
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ayg_videos" ); |
| 167 |
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ayg_galleries" ); |
| 168 |
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ayg_gallery_relationships" ); |
| 169 |
} |
| 170 |
|
| 171 |
ayg_fs()->add_action( 'after_uninstall', 'ayg_fs_uninstall_cleanup' ); |
| 172 |
} |