Plugin Directory

Changeset 3468488


Ignore:
Timestamp:
02/24/2026 09:54:46 AM (5 weeks ago)
Author:
codersaiful
Message:

version updated freemius removeddd andd issue fixed

Location:
wc-quantity-plus-minus-button
Files:
112 added
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • wc-quantity-plus-minus-button/trunk/admin/html/topbar.php

    r3386381 r3468488  
    3434                <?php if( ! $this->is_premium){ ?>
    3535                    <a class="wqpmb-btn wqpmb-has-icon wqpmb-checkout-button"
    36                         href="<?php echo esc_url( wqpmb_fs()->checkout_url() ) ?>"
     36                        href="https://codeastrology.com/downloads/category/premium/"
    3737                        target="_blank">
    3838                        <span class="wqpmb_icon-bag"></span>
    39                         Checkout
     39                        Products
    4040                    </a>
    4141                <?php } ?>
    42                     <a class="wqpmb-btn wqpmb-has-icon"
    4342
    44                         href="https://customers.freemius.com/store/9916/websites" target="_blank">
    45                         <span><i class="wqpmb_icon-user"></i></span>
    46                         Store Login
    47                     </a>
    4843            </div>
    4944        </div>
  • wc-quantity-plus-minus-button/trunk/admin/page-loader.php

    r3386381 r3468488  
    44use WQPMB\Core\Base;
    55use WQPMB\Admin\Premium_Placeholder as Placeholder;
    6 // use WQPMB\Admin\Freemius_Customizer as Freemius_Customizer;
    76
    87class Page_Loader extends Base
     
    2827    public function __construct()
    2928    {
    30         $this->is_premium = wqpmb_fs()->is_premium();
     29        $this->is_premium = wqpmb_is_premium();
    3130        /**
    3231         * No need to call construct
     
    4746        $placeholder->run();
    4847
    49         // if( ! $this->is_premium ){
    50         //     new Freemius_Customizer();
    51            
    52         // }
    5348    }
    5449
     
    9792            wp_localize_script( $this->plugin_prefix . '-admin-script', 'WQPMB_ADMIN_DATA', $WQPMB_ADMIN_DATA );
    9893           
    99 
     94            $this->live_chat_script();
    10095            add_filter('admin_footer_text',[$this, 'admin_footer_text']);
    10196           
     
    121116    }
    122117
     118    /**
     119     * Adding live chat script in admin footer
     120     *
     121     * @return void
     122     */
     123    protected function live_chat_script()
     124    {
     125        /**
     126         * how to disable live chat
     127         * add_filter('wpt_live_chat_bool','__return_false');
     128         */
     129        $live_chat_bool = apply_filters( 'wpt_live_chat_bool', true );
     130        if( ! $live_chat_bool ) return;
     131        ?>
     132        <!--Start of Tawk.to Script-->
     133        <script type="text/javascript">
     134        var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
     135        (function(){
     136        var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
     137        s1.async=true;
     138        s1.src='https://embed.tawk.to/628f5d4f7b967b1179915ad7/1g4009033';
     139        s1.charset='UTF-8';
     140        s1.setAttribute('crossorigin','*');
     141        s0.parentNode.insertBefore(s1,s0);
     142        })();
     143        </script>
     144        <!--End of Tawk.to Script-->
     145        <?php
     146    }
    123147    public function admin_footer_text($text)
    124148    {
  • wc-quantity-plus-minus-button/trunk/admin/premium-placeholder.php

    r3386381 r3468488  
    99    public function __construct()
    1010    {
    11         $this->is_premium = wqpmb_fs()->can_use_premium_code__premium_only();
     11        $this->is_premium = wqpmb_is_premium();
    1212    }
    1313
     
    8181           
    8282            <div class="wqpmb-premium-cta">
    83                 <a href="<?php echo esc_url( wqpmb_fs()->get_upgrade_url() ); ?>" class="wqpmb-premium-button">
     83                <a href="https://codeastrology.com/downloads/" class="wqpmb-premium-button">
    8484                    <span class="wqpmb_icon-basket-1"></span>
    8585                    <?php echo esc_html__( 'Upgrade to Premium', 'wc-quantity-plus-minus-button' ); ?>
  • wc-quantity-plus-minus-button/trunk/autoloader.php

    r2799841 r3468488  
    44
    55defined('ABSPATH') || exit;
    6 
    7 /**
    8  * Autoloader: All class will call from here by AutoLoader
    9  *
    10  * @author Saiful Islam<[email protected]>
    11  * @since 1.1.2.0
    12  * @package WQPMB
    13  * @link https://www.php.net/manual/en/language.oop5.autoload.php Autoloader Function
    14  */
    15 class Autoloader {
    16    
     6if( ! class_exists('WQPMB\Autoloader') ) {
    177
    188    /**
    19      * Run autoloader.
     9     * Autoloader: All class will call from here by AutoLoader
    2010     *
    21      * Register a function as `__autoload()` implementation.
    22      *
    23      * @since 1.0.0
    24      * @access public
    25      * @static
     11     * @author Saiful Islam<[email protected]>
     12     * @since 1.1.2.0
     13     * @package WQPMB
     14     * @link https://www.php.net/manual/en/language.oop5.autoload.php Autoloader Function
    2615     */
    27     public static function run() {
    28         spl_autoload_register([ __CLASS__ , 'autoload' ]);
    29     }
     16    class Autoloader {
     17       
    3018
    31     /**
    32      * Autoload.
    33      *
    34      * For a given class, check if it exist and load it.
    35      *
    36      * @since 1.0.0
    37      * @access private
    38      * @static
    39      *
    40      * @param string $class Class name.
    41      */
    42     private static function autoload( $class ) {
    43        
    44         if (0 !== strpos( $class, __NAMESPACE__ ) ) {
    45             return;
     19        /**
     20         * Run autoloader.
     21         *
     22         * Register a function as `__autoload()` implementation.
     23         *
     24         * @since 1.0.0
     25         * @access public
     26         * @static
     27         */
     28        public static function run() {
     29            spl_autoload_register([ __CLASS__ , 'autoload' ]);
    4630        }
    4731
     32        /**
     33         * Autoload.
     34         *
     35         * For a given class, check if it exist and load it.
     36         *
     37         * @since 1.0.0
     38         * @access private
     39         * @static
     40         *
     41         * @param string $class Class name.
     42         */
     43        private static function autoload( $class ) {
     44           
     45            if (0 !== strpos( $class, __NAMESPACE__ ) ) {
     46                return;
     47            }
    4848
    49         $filename = strtolower(
    50                 preg_replace(
    51                         ['/\b' . __NAMESPACE__ . '\\\/', '/_/', '/\\\/'], ['', '-', DIRECTORY_SEPARATOR], $class
    52                 )
    53         );
    5449
    55        
    56         $_dir = str_replace( '\\', '/', dirname( __FILE__ ) . '/' );
    57         $_filename = $_dir . $filename . '.php';
    58         $_filename = realpath( $_filename );
     50            $filename = strtolower(
     51                    preg_replace(
     52                            ['/\b' . __NAMESPACE__ . '\\\/', '/_/', '/\\\/'], ['', '-', DIRECTORY_SEPARATOR], $class
     53                    )
     54            );
    5955
    60         if ( is_readable( $_filename ) ) {
    61             require_once $_filename;
     56           
     57            $_dir = str_replace( '\\', '/', dirname( __FILE__ ) . '/' );
     58            $_filename = $_dir . $filename . '.php';
     59            $_filename = realpath( $_filename );
     60
     61            if ( is_readable( $_filename ) ) {
     62                require_once $_filename;
     63            }
     64
    6265        }
    6366
    6467    }
    6568
     69    Autoloader::run();
     70
    6671}
    67 
    68 Autoloader::run();
  • wc-quantity-plus-minus-button/trunk/includes/functions.php

    r3386381 r3468488  
    2424   }
    2525}
     26
     27
     28if( ! function_exists( 'wqpmb_fs' ) ){
     29    function wqpmb_fs(){
     30        return new class {
     31                public function __call($name, $arguments)
     32                {
     33                    return null;
     34                }
     35
     36            };
     37    }
     38}
     39
     40/**
     41 * Check is premium version active or not
     42 *
     43 * even old pro version(WC_Min_Max_Quantity) is active then also return true
     44 *
     45 * @return boolean
     46 */
     47function wqpmb_is_premium(){
     48    return defined('WQPMB_PRO_ADDON_VERSION');
     49}
     50/**
     51 * Check is premium version installed or not
     52 *
     53 * @return boolean
     54 */
     55function wqpmb_is_premium_installed(){
     56    return wqpmb_is_premium();
     57}
     58
    2659
    2760if( !function_exists( 'wqpmb_locate_template' ) ){
  • wc-quantity-plus-minus-button/trunk/init.php

    r3386381 r3468488  
    11<?php
    2 
    32/**
    43 * Plugin Name: Quantity Plus Minus Button for WooCommerce
     
    98 * Author URI: https://codeastrology.com/
    109 *
    11  * Version: 2.0.0
     10 * Version: 2.0.5
    1211 * Requires at least:    4.0.0
    1312 * Tested up to:         6.8
     
    1716 * Text Domain: wc-quantity-plus-minus-button
    1817 * Domain Path: /languages
     18 * @fs_premium_only /premium/premium-loader.php, /premium/
    1919 *
    2020 * License: GPL3+
    2121 * License URI: http://www.gnu.org/licenses/gpl.html
    2222 */
    23 if ( !defined( 'ABSPATH' ) ) {
    24     die;
    25 }
     23if ( ! defined( 'ABSPATH' ) ) {
     24    die();
     25}
     26
     27
    2628if ( !defined( 'WQPMB_VERSION' ) ) {
    27     define( 'WQPMB_VERSION', '2.0.0.0' );
    28 }
     29    define( 'WQPMB_VERSION', '2.0.5.0' );
     30}
     31
    2932if ( !defined( 'WQPMB_NAME' ) ) {
    3033    define( 'WQPMB_NAME', 'Quantity Plus Minus Button for WooCommerce' );
    3134}
     35
    3236if ( !defined( 'WQPMB_BASE_NAME' ) ) {
    3337    define( 'WQPMB_BASE_NAME', plugin_basename( __FILE__ ) );
    3438}
     39
    3540if ( !defined( 'WQPMB_MENU_SLUG' ) ) {
    36     // define( 'WQPMB_MENU_SLUG', 'ua-quanity-plus-minus-button' );
    3741    define( 'WQPMB_MENU_SLUG', 'wqpmb-settings' );
    3842}
     43
    3944if ( !defined( 'WQPMB_MENU_NAME' ) ) {
    40     define( 'WQPMB_MENU_NAME', __( 'Plus Minus Button', 'wc-quantity-plus-minus-button' ) );
    41 }
     45    define( 'WQPMB_MENU_NAME', 'Plus Minus Button' );
     46}
     47
    4248if ( !defined( 'WQPMB_BASE_URL' ) ) {
    43     define( "WQPMB_BASE_URL", plugins_url() . '/' . plugin_basename( dirname( __FILE__ ) ) . '/' );
    44 }
     49    define( "WQPMB_BASE_URL", plugins_url() . '/'. plugin_basename( dirname( __FILE__ ) ) . '/' );
     50}
     51
    4552if ( !defined( 'WQPMB_MAIN_FILE' ) ) {
    4653    define( "WQPMB_MAIN_FILE", __FILE__ );
     
    4956    define( "WQPMB_BASE_DIR", str_replace( '\\', '/', dirname( __FILE__ ) ) );
    5057}
    51 include_once ABSPATH . 'wp-admin/includes/plugin.php';
    52 /**
    53  * Freemius integration
    54  *
    55  */
    56 if ( function_exists( 'wqpmb_fs' ) ) {
    57     wqpmb_fs()->set_basename( false, __FILE__ );
    58 } else {
     58
     59include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     60
     61$wqpmb_old_pro_dir = trailingslashit( WP_PLUGIN_DIR ) . 'wc-quantity-plus-minus-button-pro';
     62
     63
     64
     65if( ! class_exists( 'WQPMB_Button' ) ){
     66
     67    include_once dirname( __FILE__ ) . '/autoloader.php';
     68    if( ! function_exists( 'wqpmb_is_premium' ) ){
     69    include_once dirname( __FILE__ ) . '/includes/functions.php'; 
     70    }
     71
     72    class WQPMB_Button {
     73        /**
     74         * Core singleton class
     75         * @var self - pattern realization
     76         */
     77        private static $_instance;
     78
     79        /**
     80         * Option names Array, We have used to option key for WP Option table
     81         *
     82         * @var type Array
     83         */
     84        public static $option = array(
     85            'option' => 'wqpmb_configs',
     86            'css'    => 'wqpmb_css',
     87        );
     88
     89        /**
     90         * CSS selector for Plus Minus Button tag
     91         *
     92         * @var type String
     93         */
     94        public static $css_selector = '.qib-button-wrapper button.qib-button';
     95
     96        //,.qib-button-wrapper .quantity input.input-text.qty.text
     97        public static $input_css_selector = '.qib-button-wrapper .quantity input.input-text.qty.text';
     98
     99        /**
     100         * Trying to commit and push something
     101         * Minimum PHP Version
     102         *
     103         * @since 1.0.0
     104         *
     105         * @var string Minimum PHP version required to run the plugin.
     106         */
     107        const MINIMUM_PHP_VERSION = '5.6';
     108
     109        /*
     110        * List of Path
     111        *
     112        * @since 1.0.0
     113        * @var array
     114        */
     115        protected $paths = array();
     116
     117        /**
     118         * Set like Constant static array
     119         * Get this by getPath() method
     120         * Set this by setConstant() method
     121         * 
     122         * @var type array
     123         */
     124        private static $constant = array();
     125
     126        /**
     127         * Set Path
     128         *
     129         * @param type $path_array
     130         *
     131         * @since 1.0.0
     132         */
     133        public function setPath( $path_array ) {
     134            $this->paths = $path_array;
     135        }
     136
     137        /**
     138         *
     139         * @param type $contanst_array
     140         */
     141        private function setConstant( $contanst_array ) {
     142            self::$constant = $this->paths;
     143        }
     144
     145        /**
     146         * Set Path as like Constant Will Return Full Path
     147         * Name should like Constant and full Capitalize
     148         *
     149         * @param type $name
     150         * @return string
     151         */
     152        public function path( $name, $_complete_full_file_path = false ) {
     153            $path = $this->paths[$name] . $_complete_full_file_path;
     154            return $path;
     155        }
     156
     157        /**
     158         * To Get Full path to Anywhere based on Constant
     159         *
     160         * @param type $constant_name
     161         * @return type String
     162         */
     163        public static function getPath( $constant_name = false ) {
     164            $path = self::$constant[$constant_name];
     165            return $path;
     166        }
     167
     168        /**
     169         * Getting full Plugin data. We have used __FILE__ for the main plugin file.
     170         *
     171         * @since V 1.5
     172         * @return Array Returnning Array of full Plugin's data for This Woo Product Table plugin
     173         */
     174        public static function getPluginData() {
     175            return get_plugin_data( __FILE__ );
     176        }
     177
     178        /**
     179         * Getting Version by this Function/Method
     180         *
     181         * @return type static String
     182         */
     183        public static function getVersion() {
     184            $data = self::getPluginData();
     185            return $data['Version'];
     186        }
     187
     188        /**
     189         * Getting Version by this Function/Method
     190         *
     191         * @return type static String
     192         */
     193        public static function getName() {
     194            $data = self::getPluginData();
     195            return $data['Name'];
     196        }
     197
     198        /**
     199         * Create instance
     200         */
     201        public static function getInstance() {
     202            if ( !self::$_instance instanceof self ) {
     203                self::$_instance = new self();
     204            }
     205            return self::$_instance;
     206        }
     207
     208        public function __construct() {
     209            // Declare compatibility with custom order tables for WooCommerce.
     210            add_action( 'before_woocommerce_init', function () {
     211                if ( class_exists( '\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil' ) ) {
     212                    \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     213                }
     214            } );
     215            $is_woocommerce = is_plugin_active( 'woocommerce/woocommerce.php' );
     216            if ( !$is_woocommerce ) {
     217                add_action( 'admin_notices', [$this, 'admin_notice_missing_main_plugin'] );
     218                return;
     219            }
     220            // Check for required PHP version
     221            if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
     222                add_action( 'admin_notices', [$this, 'admin_notice_minimum_php_version'] );
     223                return;
     224            }
     225            add_action( 'plugins_loaded', function () {
     226                load_plugin_textdomain( 'wc-quantity-plus-minus-button', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     227            } );
     228            $dir = dirname( __FILE__ );
     229           
     230            /**
     231             * See $path_args for Set Path and set Constant
     232             *
     233             * @since 1.0.0
     234             */
     235            $path_args = array(
     236                'PLUGIN_BASE_FOLDER' => plugin_basename( $dir ),
     237                'PLUGIN_BASE_FILE'   => plugin_basename( __FILE__ ),
     238                'BASE_URL'           => plugins_url() . '/' . plugin_basename( $dir ) . '/',
     239                'BASE_DIR'           => str_replace( '\\', '/', $dir . '/' ),
     240            );
     241            /**
     242             * Set Path Full with Constant as Array
     243             *
     244             * @since 1.0.0
     245             */
     246            $this->setPath( $path_args );
     247            /**
     248             * Set Constant
     249             *
     250             * @since 1.0.0
     251             */
     252            $this->setConstant( $path_args );
     253           
     254            include_once $this->path( 'BASE_DIR', 'includes/admin-menu.php' );
     255            include_once $this->path( 'BASE_DIR', 'includes/load-scripts.php' );
     256            if ( is_admin() ) {
     257                $admin_page = new \WQPMB\Admin\Page_Loader();
     258                $admin_page->run();
     259            }
     260
     261            WQPMB\Includes\Feature_Loader::run();
     262        }
     263
     264        public function admin_notice_missing_main_plugin() {
     265            if ( isset( $_GET['activate'] ) ) {
     266                unset($_GET['activate']);
     267            }
     268            $message = sprintf(
     269                /* translators: 1: Plugin name 2: Plugin name */
     270                esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'wc-quantity-plus-minus-button' ),
     271                '<strong>' . WQPMB_NAME . '</strong>',
     272                '<strong><a href="' . esc_url( 'https://wordpress.org/plugins/woocommerce/' ) . '" target="_blank">' . esc_html__( 'WooCommerce', 'wc-quantity-plus-minus-button' ) . '</a></strong>'
     273            );
     274            printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message );
     275        }
     276
     277        public function admin_notice_minimum_php_version() {
     278            if ( isset( $_GET['activate'] ) ) {
     279                unset($_GET['activate']);
     280            }
     281            $message = sprintf(
     282                /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
     283                esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'wc-quantity-plus-minus-button' ),
     284                '<strong>' . WQPMB_NAME . '</strong>',
     285                '<strong>' . esc_html__( 'PHP', 'wc-quantity-plus-minus-button' ) . '</strong>',
     286                self::MINIMUM_PHP_VERSION
     287            );
     288            printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message );
     289        }
     290
     291        public static function defaultDatas() {
     292            $default_data = array(
     293                'on_off'              => 'on',
     294                'css'                 => false,
     295                'quantiy_box_archive' => 1,
     296            );
     297            return $default_data;
     298        }
     299
     300        /**
     301         * Activation Hook for WordPress
     302         */
     303        public static function install() {
     304            $default_data = self::defaultDatas();
     305            $option_key = self::$option['option'];
     306            $css_key = self::$option['css'];
     307            $saved_data = get_option( $option_key );
     308            if ( empty( $saved_data ) ) {
     309                update_option( $option_key, $default_data );
     310            }
     311        }
     312
     313        /**
     314         * Deactivation Hook for WordPress
     315         */
     316        public static function uninstall() {
     317            //Nothing for now
     318            return;
     319        }
     320
     321    }
     322   
     323}
     324WQPMB_Button::getInstance();   
     325
     326if ( !function_exists( 'wqpmb_load_textdomain' ) ) {
    59327    /**
    60      * DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE
    61      * `function_exists` CALL ABOVE TO PROPERLY WORK.
    62      */
    63     if ( !function_exists( 'wqpmb_fs' ) ) {
    64         // Create a helper function for easy SDK access.
    65         function wqpmb_fs() {
    66             global $wqpmb_fs;
    67             if ( !isset( $wqpmb_fs ) ) {
    68                 // Include Freemius SDK.
    69                 require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
    70                 $wqpmb_fs = fs_dynamic_init( array(
    71                     'id'              => '21188',
    72                     'slug'            => 'wc-quantity-plus-minus-button',
    73                     'type'            => 'plugin',
    74                     'public_key'      => 'pk_b1d0dd3dec8813c5bc4918992d07a',
    75                     'is_premium'      => false,
    76                     'has_addons'      => false,
    77                     'has_paid_plans'  => true,
    78                     'trial'           => array(
    79                         'days'               => 10,
    80                         'is_require_payment' => true,
    81                     ),
    82                     'has_affiliation' => 'selected',
    83                     'menu'            => array(
    84                         'slug'       => 'wqpmb-settings',
    85                         'first-path' => 'admin.php?page=wqpmb-settings',
    86                     ),
    87                     'is_live'         => true,
    88                 ) );
    89             }
    90             return $wqpmb_fs;
    91         }
    92 
    93         // Init Freemius.
    94         wqpmb_fs();
    95         // Signal that SDK was initiated.
    96         do_action( 'wqpmb_fs_loaded' );
    97     }
    98     // ... Your plugin's main file logic ...
    99 }
    100 WQPMB_Button::getInstance();
    101 class WQPMB_Button {
    102     /**
    103      * Core singleton class
    104      * @var self - pattern realization
    105      */
    106     private static $_instance;
    107 
    108     /**
    109      * Option names Array, We have used to option key for WP Option table
     328     * Loads the plugin's translated strings.
    110329     *
    111      * @var type Array
    112      */
    113     public static $option = array(
    114         'option' => 'wqpmb_configs',
    115         'css'    => 'wqpmb_css',
    116     );
    117 
    118     /**
    119      * CSS selector for Plus Minus Button tag
    120      *
    121      * @var type String
    122      */
    123     public static $css_selector = '.qib-button-wrapper button.qib-button';
    124 
    125     //,.qib-button-wrapper .quantity input.input-text.qty.text
    126     public static $input_css_selector = '.qib-button-wrapper .quantity input.input-text.qty.text';
    127 
    128     /**
    129      * Trying to commit and push something
    130      * Minimum PHP Version
     330     * This function loads the text domain for the 'product-sync-master-sheet' plugin,
     331     * enabling translation of plugin strings based on the current locale. It looks for
     332     * the translation files in the '/languages' directory of the plugin.
    131333     *
    132334     * @since 1.0.0
    133      *
    134      * @var string Minimum PHP version required to run the plugin.
    135335     */
    136     const MINIMUM_PHP_VERSION = '5.6';
    137 
    138     /*
    139      * List of Path
    140      *
    141      * @since 1.0.0
    142      * @var array
    143      */
    144     protected $paths = array();
    145 
    146     /**
    147      * Set like Constant static array
    148      * Get this by getPath() method
    149      * Set this by setConstant() method
    150      * 
    151      * @var type array
    152      */
    153     private static $constant = array();
    154 
    155     /**
    156      * Set Path
    157      *
    158      * @param type $path_array
    159      *
    160      * @since 1.0.0
    161      */
    162     public function setPath( $path_array ) {
    163         $this->paths = $path_array;
     336    function wqpmb_load_textdomain() {
     337        load_plugin_textdomain(
     338            'wc-quantity-plus-minus-button',
     339            false,
     340            dirname( plugin_basename( __FILE__ ) ) . '/languages/'
     341        );
    164342    }
    165 
    166     /**
    167      *
    168      * @param type $contanst_array
    169      */
    170     private function setConstant( $contanst_array ) {
    171         self::$constant = $this->paths;
    172     }
    173 
    174     /**
    175      * Set Path as like Constant Will Return Full Path
    176      * Name should like Constant and full Capitalize
    177      *
    178      * @param type $name
    179      * @return string
    180      */
    181     public function path( $name, $_complete_full_file_path = false ) {
    182         $path = $this->paths[$name] . $_complete_full_file_path;
    183         return $path;
    184     }
    185 
    186     /**
    187      * To Get Full path to Anywhere based on Constant
    188      *
    189      * @param type $constant_name
    190      * @return type String
    191      */
    192     public static function getPath( $constant_name = false ) {
    193         $path = self::$constant[$constant_name];
    194         return $path;
    195     }
    196 
    197     /**
    198      * Getting full Plugin data. We have used __FILE__ for the main plugin file.
    199      *
    200      * @since V 1.5
    201      * @return Array Returnning Array of full Plugin's data for This Woo Product Table plugin
    202      */
    203     public static function getPluginData() {
    204         return get_plugin_data( __FILE__ );
    205     }
    206 
    207     /**
    208      * Getting Version by this Function/Method
    209      *
    210      * @return type static String
    211      */
    212     public static function getVersion() {
    213         $data = self::getPluginData();
    214         return $data['Version'];
    215     }
    216 
    217     /**
    218      * Getting Version by this Function/Method
    219      *
    220      * @return type static String
    221      */
    222     public static function getName() {
    223         $data = self::getPluginData();
    224         return $data['Name'];
    225     }
    226 
    227     /**
    228      * Create instance
    229      */
    230     public static function getInstance() {
    231         if ( !self::$_instance instanceof self ) {
    232             self::$_instance = new self();
    233         }
    234         return self::$_instance;
    235     }
    236 
    237     public function __construct() {
    238         // Declare compatibility with custom order tables for WooCommerce.
    239         add_action( 'before_woocommerce_init', function () {
    240             if ( class_exists( '\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil' ) ) {
    241                 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
    242             }
    243         } );
    244         $is_woocommerce = is_plugin_active( 'woocommerce/woocommerce.php' );
    245         if ( !$is_woocommerce ) {
    246             add_action( 'admin_notices', [$this, 'admin_notice_missing_main_plugin'] );
    247             return;
    248         }
    249         // Check for required PHP version
    250         if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
    251             add_action( 'admin_notices', [$this, 'admin_notice_minimum_php_version'] );
    252             return;
    253         }
    254         add_action( 'plugins_loaded', function () {
    255             load_plugin_textdomain( 'wc-quantity-plus-minus-button', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    256         } );
    257         $dir = dirname( __FILE__ );
    258         include_once $dir . '/autoloader.php';
    259         /**
    260          * See $path_args for Set Path and set Constant
    261          *
    262          * @since 1.0.0
    263          */
    264         $path_args = array(
    265             'PLUGIN_BASE_FOLDER' => plugin_basename( $dir ),
    266             'PLUGIN_BASE_FILE'   => plugin_basename( __FILE__ ),
    267             'BASE_URL'           => plugins_url() . '/' . plugin_basename( $dir ) . '/',
    268             'BASE_DIR'           => str_replace( '\\', '/', $dir . '/' ),
    269         );
    270         /**
    271          * Set Path Full with Constant as Array
    272          *
    273          * @since 1.0.0
    274          */
    275         $this->setPath( $path_args );
    276         /**
    277          * Set Constant
    278          *
    279          * @since 1.0.0
    280          */
    281         $this->setConstant( $path_args );
    282         include_once $this->path( 'BASE_DIR', 'includes/functions.php' );
    283         include_once $this->path( 'BASE_DIR', 'includes/admin-menu.php' );
    284         include_once $this->path( 'BASE_DIR', 'includes/load-scripts.php' );
    285         if ( is_admin() ) {
    286             $admin_page = new \WQPMB\Admin\Page_Loader();
    287             $admin_page->run();
    288         }
    289         $pro_file = dirname( __FILE__ ) . '/premium/premium-loader.php';
    290         if ( wqpmb_fs()->can_use_premium_code__premium_only() && file_exists( $pro_file ) ) {
    291             require_once $pro_file;
    292         }
    293         WQPMB\Includes\Feature_Loader::run();
    294     }
    295 
    296     public function admin_notice_missing_main_plugin() {
    297         if ( isset( $_GET['activate'] ) ) {
    298             unset($_GET['activate']);
    299         }
    300         $message = sprintf(
    301             /* translators: 1: Plugin name 2: Plugin name */
    302             esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'wc-quantity-plus-minus-button' ),
    303             '<strong>' . WQPMB_NAME . '</strong>',
    304             '<strong><a href="' . esc_url( 'https://wordpress.org/plugins/woocommerce/' ) . '" target="_blank">' . esc_html__( 'WooCommerce', 'wc-quantity-plus-minus-button' ) . '</a></strong>'
    305          );
    306         printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message );
    307     }
    308 
    309     public function admin_notice_minimum_php_version() {
    310         if ( isset( $_GET['activate'] ) ) {
    311             unset($_GET['activate']);
    312         }
    313         $message = sprintf(
    314             /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
    315             esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'wc-quantity-plus-minus-button' ),
    316             '<strong>' . WQPMB_NAME . '</strong>',
    317             '<strong>' . esc_html__( 'PHP', 'wc-quantity-plus-minus-button' ) . '</strong>',
    318             self::MINIMUM_PHP_VERSION
    319         );
    320         printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message );
    321     }
    322 
    323     public static function defaultDatas() {
    324         $default_data = array(
    325             'on_off'              => 'on',
    326             'css'                 => false,
    327             'quantiy_box_archive' => 1,
    328         );
    329         return $default_data;
    330     }
    331 
    332     /**
    333      * Activation Hook for WordPress
    334      */
    335     public static function install() {
    336         $default_data = self::defaultDatas();
    337         $option_key = self::$option['option'];
    338         $css_key = self::$option['css'];
    339         $saved_data = get_option( $option_key );
    340         if ( empty( $saved_data ) ) {
    341             update_option( $option_key, $default_data );
    342         }
    343     }
    344 
    345     /**
    346      * Deactivation Hook for WordPress
    347      */
    348     public static function uninstall() {
    349         //Nothing for now
    350         return;
    351     }
    352 
    353 }
    354 
    355 /**
    356 * Plugin Install and Uninstall
    357 */
     343    add_action( 'init', 'wqpmb_load_textdomain' );
     344
     345}
     346
    358347register_activation_hook( __FILE__, array('WQPMB_Button', 'install') );
    359348register_deactivation_hook( __FILE__, array('WQPMB_Button', 'uninstall') );
  • wc-quantity-plus-minus-button/trunk/readme.txt

    r3386382 r3468488  
    55Requires at least: 4.0.0
    66Tested up to: 6.8
    7 Stable tag: 2.0.0
     7Stable tag: 2.0.5
    88Requires PHP: 5.4
    99License: GPL3+
     
    154154== Change log ==
    155155
     156= 2.0.5 =
     157* Fixed: text-domain issue fixed.
     158* Bug fixed.
     159
    156160= 2.0.0 =
    157161* Fixed: fatal error issue has been fixed.
Note: See TracChangeset for help on using the changeset viewer.