Plugin Directory

Changeset 2701059


Ignore:
Timestamp:
03/29/2022 07:46:26 AM (4 years ago)
Author:
flothemesplugins
Message:

version fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • flopictime/trunk/pictimewp.php

    r2497943 r2701059  
    1717 * Plugin URI:        https://flothemes.com/pic-time/
    1818 * Description:       Easily add any Pic-Time project into a blog post or page within your website.
    19  * Version:           1.0.8
     19 * Version:           1.0.9
    2020 * Author:            Flothemes
    2121 * Author URI:        https://flothemes.com
     
    2727
    2828// If this file is called directly, abort.
    29 if ( ! defined( 'WPINC' ) ) {
    30     die;
     29if (! defined('WPINC')) {
     30    die;
    3131}
    3232
    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() {
     33if (!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__);
    3638
    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
    3841
    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');
    4144
    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');
    4448
    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            }
    4853
    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    }
    6763}
    6864
     
    7167
    7268
    73 if( !function_exists('get_plugin_data') ){
    74   require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     69if (!function_exists('get_plugin_data')) {
     70    require_once(ABSPATH . 'wp-admin/includes/plugin.php');
    7571}
    7672
    7773
    7874
    79 $plugin_data = get_plugin_data( plugin_dir_path( __FILE__ ) . 'pictimewp.php' );
     75$plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'pictimewp.php');
    8076
    81 if(isset($plugin_data['Version'])) {
    82     $plugin_version = $plugin_data['Version'];
    83 }else{
    84     $plugin_version = '1.0.0';
     77if (isset($plugin_data['Version'])) {
     78    $plugin_version = $plugin_data['Version'];
     79} else {
     80    $plugin_version = '1.0.0';
    8581}
    8682
    87 define( 'FLOPT_VERSION', $plugin_version );
    88 define( 'FLOPT_DIR_URL', plugin_dir_url(__FILE__) );
     83define('FLOPT_VERSION', $plugin_version);
     84define('FLOPT_DIR_URL', plugin_dir_url(__FILE__));
    8985
    9086
     
    9288$pta = false;
    9389
    94 if(is_admin()) {
     90if (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')) {
    9592
    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');
    9797
    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             */
    102107
    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/');
    112109
    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    }
    123115}
    124116
    125 if($plugin_data['Name'] == 'FloPicTime Pro') {
    126   $is_pro_version = true;
    127 }else{
    128     $is_pro_version = true;
     117if ($plugin_data['Name'] == 'FloPicTime Pro') {
     118    $is_pro_version = true;
     119} else {
     120    $is_pro_version = true;
    129121}
    130 define( 'FLOPT_IS_PRO', $is_pro_version );
     122define('FLOPT_IS_PRO', $is_pro_version);
    131123
    132124
     
    135127 * This action is documented in includes/class-pictimewp-activator.php
    136128 */
    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     }
     129if (!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    }
    142135}
    143136
     
    147140 * This action is documented in includes/class-pictimewp-deactivator.php
    148141 */
    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     }
     142if (!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    }
    154148}
    155 register_activation_hook( __FILE__, 'flopt_activate' );
    156 register_deactivation_hook( __FILE__, 'flopt_deactivate' );
     149register_activation_hook(__FILE__, 'flopt_activate');
     150register_deactivation_hook(__FILE__, 'flopt_deactivate');
    157151
    158152/**
     
    160154 * admin-specific hooks, and public-facing site hooks.
    161155 */
    162 require plugin_dir_path( __FILE__ ) . 'includes/class-pictimewp.php';
     156require plugin_dir_path(__FILE__) . 'includes/class-pictimewp.php';
    163157
    164158/**
     
    171165 * @since    1.0.0
    172166 */
    173 if(!function_exists('flopt_run')) {
    174     function flopt_run() {
    175 
    176         $plugin = new Pictimewp();
    177         $plugin->run();
    178 
    179     }
     167if (!function_exists('flopt_run')) {
     168    function flopt_run()
     169    {
     170        $plugin = new Pictimewp();
     171        $plugin->run();
     172    }
    180173}
    181174flopt_run();
Note: See TracChangeset for help on using the changeset viewer.