Changeset 2701059
- Timestamp:
- 03/29/2022 07:46:26 AM (4 years ago)
- File:
-
- 1 edited
-
flopictime/trunk/pictimewp.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flopictime/trunk/pictimewp.php
r2497943 r2701059 17 17 * Plugin URI: https://flothemes.com/pic-time/ 18 18 * Description: Easily add any Pic-Time project into a blog post or page within your website. 19 * Version: 1.0. 819 * Version: 1.0.9 20 20 * Author: Flothemes 21 21 * Author URI: https://flothemes.com … … 27 27 28 28 // If this file is called directly, abort. 29 if ( ! defined( 'WPINC' )) {30 die;29 if (! defined('WPINC')) { 30 die; 31 31 } 32 32 33 if(!function_exists('flo_maybe_deactivate_flo_pictime')) { 34 // deactivate the free version when the Pro version is activated 35 function flo_maybe_deactivate_flo_pictime() { 33 if (!function_exists('flo_maybe_deactivate_flo_pictime')) { 34 // deactivate the free version when the Pro version is activated 35 function flo_maybe_deactivate_flo_pictime() 36 { 37 $plugin_dirname = dirname(__FILE__); 36 38 37 $plugin_dirname = dirname(__FILE__); 39 if (is_admin() && strpos($plugin_dirname, 'flopictime-pro') !== false) { 40 // we will disable 'flopictime' only if we are installing flopictime-pro 38 41 39 if(is_admin() && strpos($plugin_dirname, 'flopictime-pro') !== false ){ 40 // we will disable 'flopictime' only if we are installing flopictime-pro 42 // this should make the 'is_plugin_active' function available 43 include_once(ABSPATH . 'wp-admin/includes/plugin.php'); 41 44 42 // this should make the 'is_plugin_active' function available 43 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 45 if (function_exists('is_plugin_active')) { 46 if (is_plugin_active('flopictime/pictimewp.php')) { 47 deactivate_plugins('flopictime/pictimewp.php'); 44 48 45 if(function_exists('is_plugin_active')){ 46 if ( is_plugin_active( 'flopictime/pictimewp.php' ) ) { 47 deactivate_plugins('flopictime/pictimewp.php'); 49 // reload the current page to avoid warnings 50 header("Location: ".$_SERVER['REQUEST_URI']); 51 } 52 } 48 53 49 // reload the current page to avoid warnings 50 header("Location: ".$_SERVER['REQUEST_URI']); 51 } 52 } 53 54 if(function_exists('is_plugin_active_for_network')){ 55 if ( is_plugin_active_for_network( 'flopictime/pictimewp.php' ) ) { 56 57 deactivate_plugins('flopictime/pictimewp.php'); 58 // reload the current page to avoid warnings 59 header("Location: ".$_SERVER['REQUEST_URI']); 60 61 } 62 } 63 64 65 } 66 } 54 if (function_exists('is_plugin_active_for_network')) { 55 if (is_plugin_active_for_network('flopictime/pictimewp.php')) { 56 deactivate_plugins('flopictime/pictimewp.php'); 57 // reload the current page to avoid warnings 58 header("Location: ".$_SERVER['REQUEST_URI']); 59 } 60 } 61 } 62 } 67 63 } 68 64 … … 71 67 72 68 73 if ( !function_exists('get_plugin_data') ){74 require_once( ABSPATH . 'wp-admin/includes/plugin.php');69 if (!function_exists('get_plugin_data')) { 70 require_once(ABSPATH . 'wp-admin/includes/plugin.php'); 75 71 } 76 72 77 73 78 74 79 $plugin_data = get_plugin_data( plugin_dir_path( __FILE__ ) . 'pictimewp.php');75 $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'pictimewp.php'); 80 76 81 if (isset($plugin_data['Version'])) {82 $plugin_version = $plugin_data['Version'];83 } else{84 $plugin_version = '1.0.0';77 if (isset($plugin_data['Version'])) { 78 $plugin_version = $plugin_data['Version']; 79 } else { 80 $plugin_version = '1.0.0'; 85 81 } 86 82 87 define( 'FLOPT_VERSION', $plugin_version);88 define( 'FLOPT_DIR_URL', plugin_dir_url(__FILE__));83 define('FLOPT_VERSION', $plugin_version); 84 define('FLOPT_DIR_URL', plugin_dir_url(__FILE__)); 89 85 90 86 … … 92 88 $pta = false; 93 89 94 if(is_admin()) { 90 if (is_admin()) { 91 if (isset($plugin_data['Name']) && $plugin_data['Name'] == 'FloPicTime Pro' && file_exists(plugin_dir_path(__FILE__) . 'api-manager/am-license-menu.php')) { 95 92 96 if ( isset($plugin_data['Name']) && $plugin_data['Name'] == 'FloPicTime Pro' && file_exists(plugin_dir_path(__FILE__) . 'api-manager/am-license-menu.php')) { 93 // Load the API Key library if it is not already loaded. Must be placed in the root plugin file. 94 if (! class_exists('PT_License_Menu')) { 95 // Load WC_AM_Client class if it exists. 96 require_once(plugin_dir_path(__FILE__) . 'api-manager/am-license-menu.php'); 97 97 98 // Load the API Key library if it is not already loaded. Must be placed in the root plugin file. 99 if ( ! class_exists( 'PT_License_Menu' ) ) { 100 // Load WC_AM_Client class if it exists. 101 require_once( plugin_dir_path( __FILE__ ) . 'api-manager/am-license-menu.php' ); 98 /** 99 * @param string $file Must be __FILE__ from the root plugin file, or theme functions file. 100 * @param string $software_title Must be exactly the same as the Software Title in the product. 101 * @param string $software_version This product's current software version. 102 * @param string $plugin_or_theme 'plugin' or 'theme' 103 * @param string $api_url The URL to the site that is running the API Manager. Example: https://www.toddlahman.com/ 104 * 105 * @return \AM_License_Submenu|null 106 */ 102 107 103 /** 104 * @param string $file Must be __FILE__ from the root plugin file, or theme functions file. 105 * @param string $software_title Must be exactly the same as the Software Title in the product. 106 * @param string $software_version This product's current software version. 107 * @param string $plugin_or_theme 'plugin' or 'theme' 108 * @param string $api_url The URL to the site that is running the API Manager. Example: https://www.toddlahman.com/ 109 * 110 * @return \AM_License_Submenu|null 111 */ 108 PT_License_Menu::instance(__FILE__, 'FloPicTime Pro', $plugin_version, 'plugin', 'https://flothemes.com/'); 112 109 113 PT_License_Menu::instance( __FILE__, 'FloPicTime Pro', $plugin_version, 'plugin', 'https://flothemes.com/' ); 114 115 if ( flo_pta() ) { 116 $pta = true; 117 } 118 } 119 120 } 121 122 110 if (flo_pta()) { 111 $pta = true; 112 } 113 } 114 } 123 115 } 124 116 125 if ($plugin_data['Name'] == 'FloPicTime Pro') {126 $is_pro_version = true;127 } else{128 $is_pro_version = true;117 if ($plugin_data['Name'] == 'FloPicTime Pro') { 118 $is_pro_version = true; 119 } else { 120 $is_pro_version = true; 129 121 } 130 define( 'FLOPT_IS_PRO', $is_pro_version);122 define('FLOPT_IS_PRO', $is_pro_version); 131 123 132 124 … … 135 127 * This action is documented in includes/class-pictimewp-activator.php 136 128 */ 137 if(!function_exists('flopt_activate')) { 138 function flopt_activate() { 139 require_once plugin_dir_path( __FILE__ ) . 'includes/class-pictimewp-activator.php'; 140 Pictimewp_Activator::activate(); 141 } 129 if (!function_exists('flopt_activate')) { 130 function flopt_activate() 131 { 132 require_once plugin_dir_path(__FILE__) . 'includes/class-pictimewp-activator.php'; 133 Pictimewp_Activator::activate(); 134 } 142 135 } 143 136 … … 147 140 * This action is documented in includes/class-pictimewp-deactivator.php 148 141 */ 149 if(!function_exists('flopt_deactivate')) { 150 function flopt_deactivate() { 151 require_once plugin_dir_path( __FILE__ ) . 'includes/class-pictimewp-deactivator.php'; 152 Pictimewp_Deactivator::deactivate(); 153 } 142 if (!function_exists('flopt_deactivate')) { 143 function flopt_deactivate() 144 { 145 require_once plugin_dir_path(__FILE__) . 'includes/class-pictimewp-deactivator.php'; 146 Pictimewp_Deactivator::deactivate(); 147 } 154 148 } 155 register_activation_hook( __FILE__, 'flopt_activate');156 register_deactivation_hook( __FILE__, 'flopt_deactivate');149 register_activation_hook(__FILE__, 'flopt_activate'); 150 register_deactivation_hook(__FILE__, 'flopt_deactivate'); 157 151 158 152 /** … … 160 154 * admin-specific hooks, and public-facing site hooks. 161 155 */ 162 require plugin_dir_path( __FILE__) . 'includes/class-pictimewp.php';156 require plugin_dir_path(__FILE__) . 'includes/class-pictimewp.php'; 163 157 164 158 /** … … 171 165 * @since 1.0.0 172 166 */ 173 if(!function_exists('flopt_run')) { 174 function flopt_run() { 175 176 $plugin = new Pictimewp(); 177 $plugin->run(); 178 179 } 167 if (!function_exists('flopt_run')) { 168 function flopt_run() 169 { 170 $plugin = new Pictimewp(); 171 $plugin->run(); 172 } 180 173 } 181 174 flopt_run();
Note: See TracChangeset
for help on using the changeset viewer.