Plugin Directory

Changeset 3447168


Ignore:
Timestamp:
01/26/2026 02:44:31 PM (2 months ago)
Author:
codersaiful
Message:

plugins unnecessary file has been removed

Location:
woo-product-table/trunk
Files:
23 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • woo-product-table/trunk/admin/menu_plugin_setting_link.php

    r3399653 r3447168  
    77     * For showing configure or add new link on plugin page
    88     * It was actually an individual file, now combine at 4.1.1
    9      * @param type $links
     9     * @param array $links
    1010     * @return type
    1111     */
     
    2222    }                                       
    2323}
     24add_filter( 'plugins_api_result', 'wpt_browse_plugin_result', 1, 3 );
     25function wpt_browse_plugin_result( $res, $action, $args ){
     26   
     27    if ( $action !== 'query_plugins' ) {
     28            return $res;
     29    }
     30   
     31    //phpcs:ignore WordPress.Security.NonceVerification.Recommended - Not needed for this read-only request
     32    if( isset( $_GET['page'] ) && $_GET['page'] == 'wpt-browse-plugins' ){
     33        //Will Continue
     34    }else{
     35        return $res;
     36    }
     37    $browse_plugins = get_transient( 'codersaiful_browse_plugins' );
     38
     39    if( $browse_plugins ){
     40        return $browse_plugins;//As $res
     41    }
     42   
     43   
     44   
     45    $wp_version = get_bloginfo( 'version', 'display' );
     46    $action = 'query_plugins';
     47    $args = array(
     48        'page' => 1,
     49        'wp_version' => $wp_version
     50    );
     51    $args['author']          = 'codersaiful';
     52    $url = 'http://api.wordpress.org/plugins/info/1.2/';
     53    $url = add_query_arg(
     54            array(
     55                    'action'  => $action,
     56                    'request' => $args,
     57            ),
     58            $url
     59    );
     60
     61    $http_url = $url;
     62    $ssl      = wp_http_supports( array( 'ssl' ) );
     63    if ( $ssl ) {
     64            $url = set_url_scheme( $url, 'https' );
     65    }
     66
     67    $http_args = array(
     68            'timeout'    => 15,
     69            'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
     70    );
     71    $request   = wp_remote_get( $url, $http_args );
     72
     73    if ( $ssl && is_wp_error( $request ) ) {
     74            if ( ! wp_is_json_request() ) {
     75                    trigger_error(
     76                            sprintf(
     77                                    /* translators: %s: Support forums URL. */
     78                                    __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
     79                                    __( 'https://wordpress.org/support/forums/' )
     80                            ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
     81                            headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
     82                    );
     83            }
     84
     85            $request = wp_remote_get( $http_url, $http_args );
     86    }
     87
     88
     89    $res = json_decode( wp_remote_retrieve_body( $request ), true );
     90    if ( is_array( $res ) ) {
     91            // Object casting is required in order to match the info/1.0 format.
     92            $res = (object) $res;
     93            set_transient( 'codersaiful_browse_plugins' , $res, 32000);
     94    }
     95   
     96    return $res;
     97}
  • woo-product-table/trunk/admin/page-loader.php

    r3437512 r3447168  
    3838        add_filter('admin_body_class', [$this, 'body_class']);
    3939        add_action( 'admin_enqueue_scripts', [$this, 'admin_enqueue_scripts'] );
    40        
     40
    4141    }
    4242
     
    5959        }
    6060       
    61 
     61       
     62        add_submenu_page( $this->main_slug, esc_html__( 'Browse Plugins', 'woo-product-table' ),  esc_html__( 'Browse Plugins', 'woo-product-table' ), WPT_CAPABILITY, 'wpt-browse-plugins', [$this, 'browse_plugins_html'] );
     63        if( ! $this->is_pro ){
     64            //Get Premium link
     65            add_submenu_page( $this->main_slug, esc_html__( 'Get Premium', 'woo-product-table' ),  esc_html__( 'Get Premium', 'woo-product-table' ), 'read', 'https://wooproducttable.com/pricing/' );
     66            // add_submenu_page( $this->main_slug, esc_html__( 'Addons', 'woo-product-table' ),  esc_html__( 'Addons', 'woo-product-table' ), WPT_CAPABILITY, 'woo-product-table-addons-list', [$this, 'addons_list_html'] );
     67            // add_submenu_page( $this->main_slug, esc_html__( 'Tutorials', 'woo-product-table' ),  esc_html__( 'Tutorials', 'woo-product-table' ), WPT_CAPABILITY, 'woo-product-table-tutorial-page', [$this, 'html_tutorial_page'] );
     68        }
    6269    }
    6370
     
    148155        include $this->page_folder_dir . 'browse-plugins.php';
    149156    }
     157
     158    //Browse plugin only user codersaiful
     159    public function plugins_api_result( $res, $action, $args ) {
     160        if ( 'plugin_information' !== $action ) {
     161            return $res;
     162        }
     163
     164        // Check for our plugin slug
     165        if ( 'woo-product-table' === $args->slug ) {
     166            // Modify the plugin information as needed
     167            $res->download_link = 'https://downloads.wordpress.org/plugin/woo-product-table.zip';
     168        }
     169        return $res;
     170    }
     171
    150172    public function addons_list_html()
    151173    {
     
    305327    {
    306328        return;
    307         if( wpt_is_old_dir() ) return;
    308329
    309330        if( $this->is_premium_installed ) return;
  • woo-product-table/trunk/includes/functions.php

    r3420662 r3447168  
    3636}
    3737
    38 
    39 if( ! function_exists( 'wpt_fs' ) ){
    40     function wpt_fs(){
    41         return new class {
    42                 public function __call($name, $arguments)
    43                 {
    44                     return null;
    45                 }
    46 
    47             };
    48     }
    49 }
    50 
    51 /**
    52  * Check old pro dir exit or not
    53  * Specifically check 'WC_Min_Max_Quantity' folder/dir in plugins path
    54  *
    55  * @return boolean
    56  */
    57 function wpt_is_old_dir(){
    58     global $wpt_old_pro_dir;
    59     if( is_dir( $wpt_old_pro_dir ) ){
    60         return true;
    61     }
    62     return false;
    63 }
    64 
    6538/**
    6639 * Check is premium version active or not
     
    7144 */
    7245function wpt_is_premium(){
    73     if( wpt_is_old_dir() && defined( 'WPT_PRO_DEV_VERSION' ) ) return true;
    74    
    75     return wpt_fs()->can_use_premium_code__premium_only();
     46    if( defined( 'WPT_PRO_DEV_VERSION' ) ) return true;
     47    return false;
    7648}
    7749/**
     
    8153 */
    8254function wpt_is_premium_installed(){
    83     return wpt_fs()->is_premium();
     55    if( defined( 'WPT_PRO_DEV_VERSION' ) ) return true;
    8456}
    8557
  • woo-product-table/trunk/woo-product-table.php

    r3437512 r3447168  
    11<?php
    2 
    32/**
    43 * Plugin Name: Product Table for WooCommerce
     
    2625 * Text Domain: woo-product-table
    2726 * Domain Path: /languages/
     27 * @fs_premium_only /premium/premium-loader.php, /premium/
    2828 *
    2929 * @package WPT_Product_Table
    3030 */
     31
    3132use CA_Framework\WPT_Required_Plugin_Control;
     33
    3234// don't load directly
    33 if ( !defined( 'ABSPATH' ) ) {
    34     die( '-1' );
    35 }
     35if ( ! defined( 'ABSPATH' ) ) {
     36    die( '-1' );
     37}
     38
    3639/**
    3740 * Defining constant
    3841 */
    39 if ( !defined( 'WPT_PLUGIN_BASE_FOLDER' ) ) {
     42if( ! defined( 'WPT_PLUGIN_BASE_FOLDER' ) ){
    4043    define( 'WPT_PLUGIN_BASE_FOLDER', plugin_basename( dirname( __FILE__ ) ) );
    4144}
    42 if ( !defined( 'WPT_DEV_VERSION' ) ) {
     45
     46if( ! defined( 'WPT_DEV_VERSION' ) ){
    4347    define( 'WPT_DEV_VERSION', '5.1.1.0' );
    4448}
    45 if ( !defined( 'WPT_CAPABILITY' ) ) {
     49
     50if( ! defined( 'WPT_CAPABILITY' ) ){
    4651    $wpt_capability = apply_filters( 'wpt_menu_capability', 'manage_wpt_product_table' );
    4752    define( 'WPT_CAPABILITY', $wpt_capability );
    4853}
    49 if ( !defined( 'WPT_PLUGIN' ) ) {
    50     define( 'WPT_PLUGIN', plugin_basename( __FILE__ ) );
    51 }
    52 if ( !defined( 'WPT_PLUGIN_BASE_FILE' ) ) {
     54
     55if( ! defined( 'WPT_PLUGIN' ) ){
     56    define( 'WPT_PLUGIN', plugin_basename( __FILE__ ) );
     57}
     58
     59
     60if( ! defined( 'WPT_PLUGIN_BASE_FILE' ) ){
    5361    define( 'WPT_PLUGIN_BASE_FILE', plugin_basename( __FILE__ ) );
    5462}
    55 if ( !defined( 'WPT_BASE_URL' ) ) {
    56     define( "WPT_BASE_URL", plugins_url() . '/' . plugin_basename( dirname( __FILE__ ) ) . '/' );
    57 }
    58 if ( !defined( 'WPT_ASSETS_URL' ) ) {
     63
     64if( ! defined( 'WPT_BASE_URL' ) ){
     65    define( "WPT_BASE_URL", plugins_url() . '/'. plugin_basename( dirname( __FILE__ ) ) . '/' );
     66}
     67
     68if( ! defined( 'WPT_ASSETS_URL' ) ){
    5969    define( "WPT_ASSETS_URL", WPT_BASE_URL . 'assets/' );
    6070}
    61 if ( !defined( 'WPT_DIR_BASE' ) ) {
     71
     72if( ! defined( 'WPT_DIR_BASE' ) ){
    6273    define( "WPT_DIR_BASE", dirname( __FILE__ ) . '/' );
    6374}
    64 if ( !defined( 'WPT_BASE_DIR' ) ) {
     75if( ! defined( 'WPT_BASE_DIR' ) ){
    6576    define( "WPT_BASE_DIR", str_replace( '\\', '/', WPT_DIR_BASE ) );
    6677}
    67 if ( !defined( 'WPT_PLUGIN_FOLDER_NAME' ) ) {
    68     define( "WPT_PLUGIN_FOLDER_NAME", plugin_basename( dirname( __FILE__ ) ) );
    69     //aDDED TO NEW VERSION
    70 }
    71 if ( !defined( 'WPT_PLUGIN_FILE_NAME' ) ) {
    72     define( "WPT_PLUGIN_FILE_NAME", __FILE__ );
    73     //aDDED TO NEW VERSION
    74 }
    75 if ( !defined( 'WPT_OPTION_KEY' ) ) {
    76     define( "WPT_OPTION_KEY", 'wpt_configure_options' );
    77     //aDDED TO NEW VERSION
    78 }
     78
     79if( ! defined( 'WPT_PLUGIN_FOLDER_NAME' ) ){
     80    define( "WPT_PLUGIN_FOLDER_NAME",plugin_basename( dirname( __FILE__ ) ) ); //aDDED TO NEW VERSION
     81}
     82
     83if( ! defined( 'WPT_PLUGIN_FILE_NAME' ) ){
     84    define( "WPT_PLUGIN_FILE_NAME", __FILE__ ); //aDDED TO NEW VERSION
     85}
     86if( ! defined( 'WPT_OPTION_KEY' ) ){
     87    define( "WPT_OPTION_KEY", 'wpt_configure_options' ); //aDDED TO NEW VERSION
     88}
     89
    7990//Check if previous Premium plugin available
    8091$wpt_old_pro_dir = trailingslashit( WP_PLUGIN_DIR ) . 'woo-product-table-pro';
    81 /**
    82  * Freemius integration
    83  *
    84  */
    85 if ( !is_dir( $wpt_old_pro_dir ) && function_exists( 'wpt_fs' ) ) {
    86     wpt_fs()->set_basename( false, __FILE__ );
    87 } else {
    88     if ( !is_dir( $wpt_old_pro_dir ) ) {
    89         /**
    90          * DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE
    91          * `function_exists` CALL ABOVE TO PROPERLY WORK.
    92          */
    93         if ( !function_exists( 'wpt_fs' ) ) {
    94             // Create a helper function for easy SDK access.
    95             function wpt_fs() {
    96                 global $wpt_fs;
    97                 if ( !isset( $wpt_fs ) ) {
    98                     // Include Freemius SDK.
    99                     require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
    100                     $wpt_fs = fs_dynamic_init( array(
    101                         'id'              => '21561',
    102                         'slug'            => 'woo-product-table',
    103                         'type'            => 'plugin',
    104                         'public_key'      => 'pk_0b66652cde65151264dde60ae48bb',
    105                         'is_premium'      => false,
    106                         'has_addons'      => false,
    107                         'has_paid_plans'  => true,
    108                         'trial'           => array(
    109                             'days'               => 10,
    110                             'is_require_payment' => true,
    111                         ),
    112                         'has_affiliation' => 'selected',
    113                         'menu'            => array(
    114                             'slug'       => 'edit.php?post_type=wpt_product_table',
    115                             'first-path' => 'edit.php?post_type=wpt_product_table',
    116                         ),
    117                         'is_live'         => true,
    118                     ) );
    119                 }
    120                 return $wpt_fs;
    121             }
    122 
    123             // Init Freemius.
    124             wpt_fs();
    125             // Signal that SDK was initiated.
    126             do_action( 'wpt_fs_loaded' );
    127         }
    128     }
    129 }
     92
     93
     94
    13095/**
    13196 * Default Configuration for WOO Product Table Pro
     
    140105* @since 1.0.0
    141106*/
    142 include_once ABSPATH . 'wp-admin/includes/plugin.php';
    143 if ( !class_exists( 'WPT_Product_Table' ) ) {
     107include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     108
     109if( ! class_exists('WPT_Product_Table') ){
     110
    144111    /**
    145112     * Main Manager Class for WOO Product Table Plugin.
     
    148115     * Already set $_instance, So no need again call
    149116     */
    150     class WPT_Product_Table {
     117    class WPT_Product_Table{
     118       
    151119        public $text_domain_applied = false;
    152 
    153120        /**
    154121         * To set Default Value for Woo Product Table, So that, we can set Default Value in Plugin Start and
     
    158125         */
    159126        public static $default = array();
    160 
     127       
    161128        /*
    162          * List of Path
    163          *
    164          * @since 1.0.0
    165          * @var array
    166          */
     129        * List of Path
     130        *
     131        * @since 1.0.0
     132        * @var array
     133        */
    167134        protected $paths = array();
    168 
     135       
    169136        /**
    170137         * Set like Constant static array
     
    175142         */
    176143        private static $constant = array();
    177 
     144       
    178145        /**
    179146         * Property for Shortcode Storing
     
    182149         */
    183150        public static $shortCode;
    184 
     151       
    185152        /**
    186153         * Minimum PHP Version
     
    191158         */
    192159        const MINIMUM_PHP_VERSION = '7.0';
    193 
     160       
    194161        /**
    195162         * check minimum Woo Product Table Pro Version
     
    202169         */
    203170        const MINIMUM_WPT_PRO_VERSION = '7.0.7';
    204 
     171       
     172       
    205173        /**
    206174         * Only for Admin Section, Collumn Array
     
    211179        public static $columns_array = array();
    212180
     181       
    213182        /**
    214183         * Only for Admin Section, Disable Collumn Array
     
    218187         */
    219188        public static $colums_disable_array = array();
    220 
     189       
    221190        /**
    222191         * Only for Admin when create a new Post for Product Table
     
    234203         */
    235204        public static $style_form_options = array();
    236 
    237         /**
    238          * Core singleton class
    239          * @var self - pattern realization
    240          */
     205       
     206        /**
     207        * Core singleton class
     208        * @var self - pattern realization
     209        */
    241210        private static $_instance;
    242 
    243         /**
    244          * Set Plugin Mode as 1 for Giving Data to UPdate Options
    245          *
    246          * @var type Int
    247          */
     211       
     212        /**
     213            * Set Plugin Mode as 1 for Giving Data to UPdate Options
     214            *
     215            * @var type Int
     216            */
    248217        protected static $mode = 1;
    249 
    250         /**
    251          * Get the instane of WPT_Product_Table
    252          *
    253          * @return self
    254          */
     218       
     219            /**
     220            * Get the instane of WPT_Product_Table
     221            *
     222            * @return self
     223            */
    255224        public static function getInstance() {
    256             if ( !self::$_instance instanceof self ) {
     225            if ( ! ( self::$_instance instanceof self ) ) {
    257226                self::$_instance = new self();
    258227            }
    259228            return self::$_instance;
    260229        }
    261 
     230       
     231       
    262232        public function __construct() {
    263             global $wpt_old_pro_dir;
     233
    264234            /**
    265235             * Include Autoloader
     
    269239            include_once dirname( __FILE__ ) . '/autoloader.php';
    270240            include_once dirname( __FILE__ ) . '/includes/functions.php';
     241
     242
     243
    271244            add_action( 'plugins_loaded', [$this, 'plugins_loaded'] );
    272245            add_action( 'init', [$this, 'include_defaults'] );
    273246            add_action( 'init', 'wpt_product_table_blocks_init' );
    274247        }
    275 
    276248        public function include_defaults() {
     249           
    277250            $column_array = array(
    278                 'tick'              => __( 'Tick', 'woo-product-table' ),
    279                 'check'             => __( 'Check', 'woo-product-table' ),
    280                 'thumbnails'        => __( 'Thumbnails', 'woo-product-table' ),
    281                 'product_title'     => __( 'Products', 'woo-product-table' ),
    282                 'category'          => __( 'Category', 'woo-product-table' ),
    283                 'tags'              => __( 'Tags', 'woo-product-table' ),
    284                 'sku'               => __( 'SKU', 'woo-product-table' ),
    285                 'weight'            => __( 'Weight(kg)', 'woo-product-table' ),
    286                 'length'            => __( 'Length(cm)', 'woo-product-table' ),
    287                 'width'             => __( 'Width(cm)', 'woo-product-table' ),
    288                 'height'            => __( 'Height(cm)', 'woo-product-table' ),
    289                 'rating'            => __( 'Rating', 'woo-product-table' ),
    290                 'stock'             => __( 'Stock', 'woo-product-table' ),
    291                 'price'             => __( 'Price', 'woo-product-table' ),
    292                 'wishlist'          => __( 'Wish List', 'woo-product-table' ),
    293                 'quantity'          => __( 'Quantity', 'woo-product-table' ),
    294                 'total'             => __( 'Total Price', 'woo-product-table' ),
    295                 'message'           => __( 'Short Message', 'woo-product-table' ),
    296                 'quick_view'        => __( 'Quick View', 'woo-product-table' ),
    297                 'quick'             => __( 'Quick', 'woo-product-table' ),
    298                 'date'              => __( 'Date', 'woo-product-table' ),
    299                 'modified_date'     => __( 'Modified Date', 'woo-product-table' ),
    300                 'attribute'         => __( 'Attributes', 'woo-product-table' ),
    301                 'variations'        => __( 'Variations', 'woo-product-table' ),
    302                 'quoterequest'      => __( 'Quote Request', 'woo-product-table' ),
    303                 'description'       => __( 'Description', 'woo-product-table' ),
    304                 'short_description' => __( 'Short Description', 'woo-product-table' ),
    305                 'blank'             => __( 'Blank', 'woo-product-table' ),
    306                 'product_id'        => __( 'ID', 'woo-product-table' ),
    307                 'serial_number'     => __( 'SL', 'woo-product-table' ),
    308                 'action'            => __( 'Action', 'woo-product-table' ),
    309                 'buy_link'          => __( 'Buy Link', 'woo-product-table' ),
     251                'tick'         => __( 'Tick', 'woo-product-table' ),
     252                'check'         => __( 'Check', 'woo-product-table' ),
     253                'thumbnails'    => __( 'Thumbnails', 'woo-product-table' ),
     254                'product_title' => __( 'Products', 'woo-product-table' ),
     255                'category'      => __( 'Category', 'woo-product-table' ),
     256                'tags'          => __( 'Tags', 'woo-product-table' ),
     257                'sku'           => __( 'SKU', 'woo-product-table' ),
     258                'weight'        => __( 'Weight(kg)', 'woo-product-table' ),
     259                'length'        => __( 'Length(cm)', 'woo-product-table' ),
     260                'width'         => __( 'Width(cm)', 'woo-product-table' ),
     261                'height'        => __( 'Height(cm)', 'woo-product-table' ),
     262                'rating'        => __( 'Rating', 'woo-product-table' ),
     263                'stock'         => __( 'Stock', 'woo-product-table' ),
     264                'price'         => __( 'Price', 'woo-product-table' ),
     265                'wishlist'      => __( 'Wish List', 'woo-product-table' ),
     266                'quantity'      => __( 'Quantity', 'woo-product-table' ),
     267                'total'         => __( 'Total Price', 'woo-product-table' ),
     268                'message'       => __( 'Short Message', 'woo-product-table' ),
     269                'quick_view'    => __( 'Quick View', 'woo-product-table' ),
     270                'quick'         => __( 'Quick', 'woo-product-table' ), //Yith Quick View actually
     271                'date'          => __( 'Date', 'woo-product-table' ),
     272                'modified_date' => __( 'Modified Date', 'woo-product-table' ),
     273                'attribute'     => __( 'Attributes', 'woo-product-table' ),
     274                'variations'    => __( 'Variations', 'woo-product-table' ),
     275                'quoterequest'  => __( 'Quote Request', 'woo-product-table' ),
     276                'description'   =>  __( 'Description', 'woo-product-table' ), //has been removed at V5.2 //Again start at 6.0.25 //Again added
     277                'short_description'   =>  __( 'Short Description', 'woo-product-table' ), //Added at v2.9.4
     278                'blank'         => __( 'Blank', 'woo-product-table' ),
     279                'product_id'    => __( 'ID', 'woo-product-table' ),
     280                'serial_number' => __( 'SL', 'woo-product-table' ),
     281                'action'        => __( 'Action', 'woo-product-table' ),
     282                'buy_link'        => __( 'Buy Link', 'woo-product-table' ),
    310283            );
     284
    311285            $column_array = apply_filters( 'wpto_default_column_arr', $column_array );
    312             self::$columns_array = $column_array;
     286            self::$columns_array =  $column_array;
    313287            $default_enabled_col_array = array(
    314                 'tick'          => 'tick',
    315                 'thumbnails'    => 'thumbnails',
    316                 'product_title' => 'product_title',
    317                 'quantity'      => 'quantity',
    318                 'price'         => 'price',
    319                 'action'        => 'action',
     288                'tick'         => 'tick', 
     289                'thumbnails'    => 'thumbnails', 
     290                'product_title' => 'product_title', 
     291                'quantity'      => 'quantity', 
     292                'price'         => 'price', 
     293                'action'        => 'action', 
    320294            );
     295
    321296            /**
    322297             * Filter for Default Enabled Column
     
    324299             */
    325300            $default_enabled_col_array = apply_filters( 'wpto_default_enable_column_arr', $default_enabled_col_array, $column_array );
    326             self::$default_enable_columns_array = $default_enabled_col_array;
     301            self::$default_enable_columns_array =  $default_enabled_col_array;
    327302            /**
    328303             * @since 1.7
     
    331306                'product_id',
    332307                'serial_number',
    333                 'description',
    334                 //has been removed at V5.2
     308                'description',  //has been removed at V5.2
    335309                'tags',
    336310                'weight',
     
    351325                'blank',
    352326            );
     327
    353328            global $shortCodeText;
    354329            /**
     
    359334            $shortCodeText = apply_filters( 'wpto_shortcode_text', $shortCodeText );
    360335            self::$shortCode = $shortCodeText;
     336
    361337            /**
    362338             * Set Default Value For Every where,
     
    365341             */
    366342            $default = array(
    367                 'custom_message_on_single_page' => true,
    368                 'disable_plugin_noti'           => 'on',
    369                 'footer_cart'                   => 'always_hide',
    370                 'footer_cart_size'              => '74',
    371                 'footer_bg_color'               => '#0a7f9c',
    372                 'footer_possition'              => 'footer_possition',
    373                 'item_count'                    => 'all',
    374                 'sort_mini_filter'              => 'ASC',
    375                 'sort_searchbox_filter'         => '0',
    376                 'custom_add_to_cart'            => 'add_cart_left_icon',
    377                 'thumbs_image_size'             => 80,
    378                 'thumbs_lightbox'               => '1',
    379                 'popup_notice'                  => '1',
    380                 'disable_cat_tag_link'          => '0',
    381                 'product_link_target'           => '_blank',
    382                 'product_not_founded'           => __( 'Products not found!', 'woo-product-table' ),
    383                 'load_more_text'                => __( 'Load more', 'woo-product-table' ),
    384                 'quick_view_btn_text'           => __( 'Quick View', 'woo-product-table' ),
    385                 'loading_more_text'             => __( 'Loading..', 'woo-product-table' ),
    386                 'search_button_text'            => __( 'Search', 'woo-product-table' ),
    387                 'search_keyword_text'           => __( 'Search Keyword', 'woo-product-table' ),
    388                 'disable_loading_more'          => 'load_more_hidden',
    389                 'instant_search_filter'         => '0',
    390                 'empty_cart_text'               => __( 'Empty Cart', 'woo-product-table' ),
    391                 'filter_text'                   => __( 'Filter:', 'woo-product-table' ),
    392                 'filter_reset_button'           => __( 'Reset', 'woo-product-table' ),
    393                 'instant_search_text'           => __( 'Instant Search..', 'woo-product-table' ),
    394                 'yith_browse_list'              => __( 'Browse the list', 'woo-product-table' ),
    395                 'yith_add_to_quote_text'        => __( 'Add to Quote', 'woo-product-table' ),
    396                 'yith_add_to_quote_adding'      => __( 'Adding..', 'woo-product-table' ),
    397                 'yith_add_to_quote_added'       => __( 'Quoted', 'woo-product-table' ),
    398                 'item'                          => __( 'Item', 'woo-product-table' ),
    399                 'items'                         => __( 'Items', 'woo-product-table' ),
    400                 'add2cart_all_added_text'       => __( 'Added', 'woo-product-table' ),
    401                 'right_combination_message'     => __( 'Not available', 'woo-product-table' ),
     343                'custom_message_on_single_page'=>  true,
     344                // 'column_sort'=>  'on',
     345                'disable_plugin_noti'=>  'on',
     346                'footer_cart'           =>  'always_hide', //always_show
     347                'footer_cart_size'      =>  '74',
     348                'footer_bg_color'       =>  '#0a7f9c',
     349                'footer_possition'      =>  'footer_possition',
     350                'item_count'            =>  'all',
     351                'sort_mini_filter'      =>  'ASC',
     352                'sort_searchbox_filter' =>  '0', //'ASC',
     353                'custom_add_to_cart'    =>  'add_cart_left_icon',
     354                'thumbs_image_size'     =>  80,
     355                'thumbs_lightbox'       => '1',
     356                'popup_notice'          => '1',
     357                'disable_cat_tag_link'  =>  '0',
     358                'product_link_target'   =>  '_blank',
     359                'product_not_founded'   =>  __( 'Products not found!', 'woo-product-table' ),
     360                'load_more_text'        =>  __( 'Load more', 'woo-product-table' ),
     361                'quick_view_btn_text'   =>  __( 'Quick View', 'woo-product-table' ),
     362                'loading_more_text'     =>  __( 'Loading..', 'woo-product-table' ),
     363                'search_button_text'    =>  __( 'Search', 'woo-product-table' ),
     364                'search_keyword_text'   =>  __( 'Search Keyword', 'woo-product-table' ),
     365                'disable_loading_more'  =>  'load_more_hidden',//'normal',//Load More
     366                'instant_search_filter' =>  '0',
     367                //Message Config
     368                'empty_cart_text'       => __( 'Empty Cart', 'woo-product-table' ), //Added at 3.0.1.0
     369                'filter_text'           =>  __( 'Filter:', 'woo-product-table' ),
     370                'filter_reset_button'   =>  __( 'Reset', 'woo-product-table' ),
     371                'instant_search_text'   =>  __( 'Instant Search..', 'woo-product-table' ),
     372                'yith_browse_list'      =>  __( 'Browse the list', 'woo-product-table' ),
     373                'yith_add_to_quote_text'=>  __( 'Add to Quote', 'woo-product-table' ),
     374                'yith_add_to_quote_adding'=>  __( 'Adding..', 'woo-product-table' ),
     375                'yith_add_to_quote_added' =>  __( 'Quoted', 'woo-product-table' ),
     376                'item'                  =>  __( 'Item', 'woo-product-table' ), //It will use at custom.js file for Chinging
     377                'items'                 =>  __( 'Items', 'woo-product-table' ), //It will use at custom.js file for Chinging
     378                'add2cart_all_added_text'=>  __( 'Added', 'woo-product-table' ), //It will use at custom.js file for Chinging
     379                'right_combination_message' => __( 'Not available', 'woo-product-table' ),
    402380                'right_combination_message_alt' => __( 'Product variations is not set Properly. Price empty or out of stock.', 'woo-product-table' ),
    403                 'no_more_query_message'         => __( 'There is no more products based on current Query.', 'woo-product-table' ),
    404                 'select_all_items_message'      => __( 'Please select all items.', 'woo-product-table' ),
    405                 'please_choose_items'           => __( 'Please select some items.', 'woo-product-table' ),
    406                 'out_of_stock_message'          => __( 'Out of Stock', 'woo-product-table' ),
    407                 'adding_in_progress'            => __( 'Adding in Progress', 'woo-product-table' ),
    408                 'no_right_combination'          => __( 'No Right Combination', 'woo-product-table' ),
    409                 'sorry_out_of_stock'            => __( 'Sorry! Out of Stock!', 'woo-product-table' ),
    410                 'type_your_message'             => __( 'Type your Message.', 'woo-product-table' ),
    411                 'sorry_plz_right_combination'   => __( 'Sorry, Please choose right combination.', 'woo-product-table' ),
    412                 'all_selected_direct_checkout'  => 'no',
    413                 'product_direct_checkout'       => 'no',
    414                 'search_box_title'              => __( 'Product Search & Filter', 'woo-product-table' ),
    415                 'search_box_searchkeyword'      => __( 'Search Keyword', 'woo-product-table' ),
    416                 'search_box_orderby'            => __( 'Sort By', 'woo-product-table' ),
    417                 'search_box_order'              => __( 'Order', 'woo-product-table' ),
     381                'no_more_query_message' => __( 'There is no more products based on current Query.', 'woo-product-table' ),
     382                'select_all_items_message' => __( 'Please select all items.', 'woo-product-table' ),
     383                'please_choose_items' => __( 'Please select some items.', 'woo-product-table' ),
     384                'out_of_stock_message'  => __( 'Out of Stock', 'woo-product-table' ),
     385                'adding_in_progress'    =>  __( 'Adding in Progress', 'woo-product-table' ),
     386                'no_right_combination'  =>  __( 'No Right Combination', 'woo-product-table' ),
     387                'sorry_out_of_stock'    =>  __( 'Sorry! Out of Stock!', 'woo-product-table' ),
     388                'type_your_message'     =>  __( 'Type your Message.', 'woo-product-table' ),
     389                'sorry_plz_right_combination' =>    __( 'Sorry, Please choose right combination.', 'woo-product-table' ),
     390               
     391                'all_selected_direct_checkout' => 'no',
     392                'product_direct_checkout' => 'no',
     393
     394                'search_box_title' => __( 'Product Search & Filter', 'woo-product-table' ),
     395                'search_box_searchkeyword' => __( 'Search Keyword', 'woo-product-table' ),
     396                'search_box_orderby'    => __( 'Sort By', 'woo-product-table' ),
     397                'search_box_order'      => __( 'Order', 'woo-product-table' ),
    418398                'search_order_placeholder'      => __( 'Select inner Item.', 'woo-product-table' ),
    419399            );
    420400            $default = apply_filters( 'wpto_default_configure', $default );
    421401            self::$default = $default;
    422         }
    423 
    424         public function plugins_loaded() {
     402
     403       
     404        }
     405        public function plugins_loaded(){
     406
     407           
    425408            // Declare compatibility with custom order tables for WooCommerce.
    426             add_action( 'before_woocommerce_init', function () {
    427                 if ( class_exists( '\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil' ) ) {
    428                     \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     409            add_action( 'before_woocommerce_init', function(){
     410                    if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
     411                        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
     412                    }
    429413                }
    430             } );
    431             global $wpt_old_pro_dir;
     414            );
     415
    432416            $wpt_premium_loader = dirname( __FILE__ ) . '/premium/premium-loader.php';
    433             if ( wpt_fs()->can_use_premium_code__premium_only() && file_exists( $wpt_premium_loader ) && !is_dir( $wpt_old_pro_dir ) ) {
    434                 //wcmmq_fs()->can_use_premium_code__premium_only() &&
    435                 include_once $wpt_premium_loader;
    436             }
     417            if ( file_exists( $wpt_premium_loader ) ) {
     418                // include_once $wpt_premium_loader;
     419            }
     420
     421       
     422           
    437423            // Check for required PHP version
    438424            if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
    439                 add_action( 'admin_notices', [$this, 'admin_notice_minimum_php_version'] );
     425                add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
    440426                return;
    441427            }
    442             $dir = dirname( __FILE__ );
    443             //dirname( __FILE__ )
     428
     429            $dir = dirname( __FILE__ ); //dirname( __FILE__ )
     430
     431
    444432            /**
    445433             * See $path_args for Set Path and set Constant
     
    448436             */
    449437            $path_args = array(
    450                 'PLUGIN_BASE_FOLDER' => plugin_basename( $dir ),
    451                 'PLUGIN_BASE_FILE'   => plugin_basename( __FILE__ ),
    452                 'BASE_URL'           => trailingslashit( plugins_url( '', __FILE__ ) ),
    453                 'BASE_DIR'           => str_replace( '\\', '/', $dir . '/' ),
     438                'PLUGIN_BASE_FOLDER'     => plugin_basename( $dir ),
     439                'PLUGIN_BASE_FILE'       => plugin_basename( __FILE__ ),
     440                'BASE_URL'               => trailingslashit( plugins_url( '',__FILE__) ),
     441                'BASE_DIR'               => str_replace( '\\', '/', $dir . '/' ),
    454442            );
    455443            /**
     
    458446             * @since 1.0.0
    459447             */
    460             $this->setPath( $path_args );
     448            $this->setPath($path_args);
     449
    461450            /**
    462451             * Set Constant
     
    464453             * @since 1.0.0
    465454             */
    466             $this->setConstant( $path_args );
     455            $this->setConstant($path_args);
     456           
     457
    467458            do_action( 'wpt_load' );
     459
    468460            //why this file outside of is_admin() actually if we want to show preview, need load outside.
    469             include_once $this->path( 'BASE_DIR', 'admin/wpt_product_table_post.php' );
    470             if ( is_admin() ) {
    471                 /**
    472                  * Including CA_Framework
    473                  *
    474                  * @since 3.1.3.1
    475                  * @author Saiful <[email protected]>
    476                  */
    477                 require_once WPT_DIR_BASE . '/framework/handle.php';
    478                 if ( WPT_Required::fail() ) {
    479                     return;
    480                 }
     461            include_once $this->path('BASE_DIR','admin/wpt_product_table_post.php');
     462            if( is_admin() ){
     463           
     464 
     465
    481466                //A solution for recommended plugin check issue
    482                 add_action( 'init', function () {
    483                     /**
    484                      * Including CA_Framework
    485                      *
    486                      * @since 3.1.3.1
    487                      * @author Saiful <[email protected]>
    488                      */
    489                     require_once WPT_DIR_BASE . '/framework/recommeded.php';
    490                     WOO_Product_Table\Framework\Recommeded::check();
     467                add_action( 'init', function(){
     468
    491469                    new WOO_PRODUCT_TABLE\Admin\Admin_Loader();
    492                 } );
    493                 include_once $this->path( 'BASE_DIR', 'admin/post_metabox.php' );
    494                 include_once $this->path( 'BASE_DIR', 'admin/duplicate.php' );
    495                 include_once $this->path( 'BASE_DIR', 'admin/functions.php' );
    496                 //Added at V7.0.0 @date
    497                 include_once $this->path( 'BASE_DIR', 'admin/menu_plugin_setting_link.php' );
    498                 include_once $this->path( 'BASE_DIR', 'admin/admin-enqueue.php' );
    499                 //has removed
     470                });
     471
     472               
     473               
     474
     475                include_once $this->path('BASE_DIR','admin/post_metabox.php');
     476                include_once $this->path('BASE_DIR','admin/duplicate.php');
     477                include_once $this->path('BASE_DIR','admin/functions.php'); //Added at V7.0.0 @date
     478               
     479                include_once $this->path('BASE_DIR','admin/menu_plugin_setting_link.php');
     480                include_once $this->path('BASE_DIR','admin/admin-enqueue.php');  //has removed
    500481                //Admin Section Action Hook, which we can Control from Addon
    501                 include_once $this->path( 'BASE_DIR', 'admin/action-hook.php' );
     482                include_once $this->path('BASE_DIR','admin/action-hook.php');
    502483            }
    503484            //Coll elementor Module, If installed Elementor
    504485            if ( did_action( 'elementor/loaded' ) ) {
    505                 include_once $this->path( 'BASE_DIR', 'modules/elementor.php' );
    506                 //Elementor Widget for Table using Elementor
    507             }
    508             if ( !class_exists( 'Mobile_Detect' ) ) {
    509                 include_once $this->path( 'BASE_DIR', 'modules/Mobile_Detect.php' );
    510                 //MObile or Table Defice Detector
    511             }
     486
     487                include_once $this->path('BASE_DIR','modules/elementor.php'); //Elementor Widget for Table using Elementor
     488            }   
     489               
     490            if( ! class_exists( 'Mobile_Detect' ) ){
     491                include_once $this->path('BASE_DIR','modules/Mobile_Detect.php'); //MObile or Table Defice Detector
     492            }
     493           
    512494            /**
    513495             * Not activated this, Even file still not added to this directory
     
    524506             */
    525507            //include_once $this->path('BASE_DIR','includes/wpt_product_table_post.php');
    526             include_once $this->path( 'BASE_DIR', 'includes/enqueue.php' );
     508            include_once $this->path('BASE_DIR','includes/enqueue.php');
     509           
    527510            // Include Export Handler
    528             include_once $this->path( 'BASE_DIR', 'includes/export/export-handler.php' );
    529             include_once $this->path( 'BASE_DIR', 'includes/helper-functions.php' );
    530             include_once $this->path( 'BASE_DIR', 'includes/shortcode.php' );
     511            include_once $this->path('BASE_DIR','includes/export/export-handler.php');
     512           
     513            include_once $this->path('BASE_DIR','includes/helper-functions.php');
     514            include_once $this->path('BASE_DIR','includes/shortcode.php');
     515
    531516            $shortcode = new WOO_PRODUCT_TABLE\Inc\Shortcode();
    532517            $shortcode->run();
     518
    533519            $compatible = new WOO_PRODUCT_TABLE\Compatible\Compatible_Loader();
    534             $compatible->run();
     520            $compatible->run();
     521
    535522            /**
    536523             * Include WPML Integration
     
    543530             * @link https://wpml.org/documentation/
    544531             */
    545             if ( has_filter( 'wpml_current_language' ) ) {
    546                 include_once $this->path( 'BASE_DIR', 'wpml/init.php' );
    547             }
     532            if( has_filter( 'wpml_current_language' ) ){
     533                include_once $this->path('BASE_DIR','wpml/init.php');
     534            }
     535           
    548536            do_action( 'wpt_loaded' );
    549537        }
    550 
     538           
     539       
     540           
    551541        /**
    552542         * Admin notice
     
    559549         */
    560550        public function admin_notice_minimum_php_version() {
     551
    561552            $message = sprintf(
    562553                /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
     
    564555                '<strong>' . esc_html__( 'Woo Product Table', 'woo-product-table' ) . '</strong>',
    565556                '<strong>' . esc_html__( 'PHP', 'woo-product-table' ) . '</strong>',
    566                 self::MINIMUM_PHP_VERSION
     557                    self::MINIMUM_PHP_VERSION
    567558            );
     559
    568560            printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', wp_kses_post( $message ) );
     561
    569562        }
    570563
     
    576569         */
    577570        public static function detectDevice( $userAgent = null ) {
    578             return new Mobile_Detect(null, $userAgent);
     571            return new Mobile_Detect( null, $userAgent );
    579572        }
    580573
     
    589582            $this->paths = $path_array;
    590583        }
    591 
     584       
    592585        private function setConstant( $contanst_array ) {
    593586            self::$constant = $this->paths;
    594587        }
    595 
    596588        /**
    597589         * Set Path as like Constant Will Return Full Path
     
    616608            return $path;
    617609        }
    618 
    619610        /**
    620611         * Update Options when Installing
     
    627618            ob_start();
    628619            //check current value
     620
    629621            $role = get_role( 'administrator' );
     622
    630623            $role->add_cap( 'edit_wpt_product_table' );
    631624            $role->add_cap( 'edit_wpt_product_tables' );
     
    636629            $role->add_cap( 'delete_wpt_product_table' );
    637630            $role->add_cap( 'manage_wpt_product_table' );
     631
     632
    638633            //Configuration Data Update
    639634            $current_value = get_option( WPT_OPTION_KEY );
    640635            $default_value = self::$default;
    641             if ( empty( $current_value ) ) {
     636            if( empty( $current_value ) ){
    642637                update_option( WPT_OPTION_KEY, $default_value );
    643638                return;
    644639            }
    645             if ( is_array( $current_value ) && is_array( $default_value ) ) {
     640           
     641            if( is_array( $current_value ) && is_array( $default_value ) ){
    646642                $updated = array_merge( $default_value, $current_value );
    647643                update_option( WPT_OPTION_KEY, $updated );
    648644                return;
    649645            }
     646
    650647            // wp_redirect(admin_url( 'edit.php?post_type=wpt_product_table&page=wpt-getting-start' ));
     648
    651649            /**
    652650             * Install timestamp save on database
     
    658656            $timestamp_key = 'wpt_install_timestamp';
    659657            $timestamp_get = get_option( $timestamp_key, false );
    660             if ( empty( $timestamp_get ) ) {
     658            if( empty( $timestamp_get ) ){
    661659                update_option( $timestamp_key, time() );
    662660            }
     661           
    663662            // Flush rewrite rules
    664663            flush_rewrite_rules();
    665664        }
    666 
     665   
    667666        /**
    668667         * Plugin Uninsall Activation Hook
     
    674673            //Nothing for now
    675674        }
    676 
     675   
    677676        /**
    678677         * Getting full Plugin data. We have used __FILE__ for the main plugin file.
     
    681680         * @return Array Returnning Array of full Plugin's data for This Woo Product Table plugin
    682681         */
    683         public static function getPluginData() {
    684             return get_plugin_data( __FILE__ );
    685         }
    686 
     682        public static function getPluginData(){
     683        return get_plugin_data( __FILE__ );
     684        }
     685   
    687686        /**
    688687         * Getting Version by this Function/Method
     
    694693            return $data['Version'];
    695694        }
    696 
     695   
    697696        /**
    698697         * Getting Version by this Function/Method
     
    711710         * @return variable
    712711         */
    713         public static function getDefault( $indexKey = false ) {
     712        public static function getDefault( $indexKey = false ){
    714713            $default = self::$default;
    715             if ( $indexKey && isset( $default[$indexKey] ) ) {
     714            if( $indexKey && isset( $default[$indexKey] ) ){
    716715                return $default[$indexKey];
    717716            }
     
    719718        }
    720719
    721     }
    722 
    723 }
     720    }   
     721       
     722}
     723
     724
    724725new WPT_Product_Table();
    725 if ( !function_exists( 'wpt_product_table_blocks_init' ) ) {
     726
     727
     728
     729if( ! function_exists( 'wpt_product_table_blocks_init' ) ){
     730
    726731    /**
    727732     * Registers the block using a `blocks-manifest.php` file, which improves the performance of block type registration.
     
    733738     */
    734739    function wpt_product_table_blocks_init() {
     740       
    735741        /**
    736742         * Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s)
     
    744750            return;
    745751        }
     752
    746753        /**
    747754         * Registers the block(s) metadata from the `blocks-manifest.php` file.
     
    758765         * @see https://developer.wordpress.org/reference/functions/register_block_type/
    759766         */
    760         $manifest_data = (require __DIR__ . '/build/blocks-manifest.php');
     767        $manifest_data = require __DIR__ . '/build/blocks-manifest.php';
    761768        foreach ( array_keys( $manifest_data ) as $block_type ) {
    762769            register_block_type( __DIR__ . "/build/{$block_type}" );
    763770        }
    764771    }
    765 
    766 }
    767 if ( !function_exists( 'wpt_lan_load_textdomain' ) ) {
    768     /**
    769      * Loads the plugin's translated strings.
    770      *
    771      * This function loads the text domain for the 'product-sync-master-sheet' plugin,
    772      * enabling translation of plugin strings based on the current locale. It looks for
    773      * the translation files in the '/languages' directory of the plugin.
    774      *
    775      * @since 1.0.0
    776      */
    777     function wpt_lan_load_textdomain() {
    778         load_plugin_textdomain( 'woo-product-table', false, __DIR__ . '/languages/' );
    779     }
    780 
    781     add_action( 'plugins_loaded', 'wpt_lan_load_textdomain' );
    782 }
    783 register_activation_hook( __FILE__, array('WPT_Product_Table', 'install') );
    784 register_deactivation_hook( __FILE__, array('WPT_Product_Table', 'uninstall') );
     772}
     773
     774
     775register_activation_hook( __FILE__, array( 'WPT_Product_Table','install' ) );
     776register_deactivation_hook( __FILE__, array( 'WPT_Product_Table','uninstall' ) );
Note: See TracChangeset for help on using the changeset viewer.