Changeset 3447168
- Timestamp:
- 01/26/2026 02:44:31 PM (2 months ago)
- Location:
- woo-product-table/trunk
- Files:
-
- 23 deleted
- 4 edited
-
admin/menu_plugin_setting_link.php (modified) (2 diffs)
-
admin/page-loader.php (modified) (4 diffs)
-
framework (deleted)
-
includes/functions.php (modified) (3 diffs)
-
languages/woo-product-table-bn_BD.l10n.php (deleted)
-
languages/woo-product-table-da_DK.l10n.php (deleted)
-
languages/woo-product-table-de_DE.l10n.php (deleted)
-
languages/woo-product-table-de_DE_formal.l10n.php (deleted)
-
languages/woo-product-table-en_GB.l10n.php (deleted)
-
languages/woo-product-table-en_US.l10n.php (deleted)
-
languages/woo-product-table-es_ES.l10n.php (deleted)
-
languages/woo-product-table-fr_FR.l10n.php (deleted)
-
languages/woo-product-table-hi_IN.l10n.php (deleted)
-
languages/woo-product-table-hr.l10n.php (deleted)
-
languages/woo-product-table-id_ID.l10n.php (deleted)
-
languages/woo-product-table-it_IT.l10n.php (deleted)
-
languages/woo-product-table-nb_NO.l10n.php (deleted)
-
languages/woo-product-table-nl_BE.l10n.php (deleted)
-
languages/woo-product-table-nl_NL.l10n.php (deleted)
-
languages/woo-product-table-pl_PL.l10n.php (deleted)
-
languages/woo-product-table-ru_RU.l10n.php (deleted)
-
languages/woo-product-table-sk_SK.l10n.php (deleted)
-
languages/woo-product-table-tr_TR.l10n.php (deleted)
-
languages/woo-product-table-uk.l10n.php (deleted)
-
languages/woo-product-table-zh_CN.l10n.php (deleted)
-
vendor (deleted)
-
woo-product-table.php (modified) (39 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-product-table/trunk/admin/menu_plugin_setting_link.php
r3399653 r3447168 7 7 * For showing configure or add new link on plugin page 8 8 * It was actually an individual file, now combine at 4.1.1 9 * @param type$links9 * @param array $links 10 10 * @return type 11 11 */ … … 22 22 } 23 23 } 24 add_filter( 'plugins_api_result', 'wpt_browse_plugin_result', 1, 3 ); 25 function 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’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 38 38 add_filter('admin_body_class', [$this, 'body_class']); 39 39 add_action( 'admin_enqueue_scripts', [$this, 'admin_enqueue_scripts'] ); 40 40 41 41 } 42 42 … … 59 59 } 60 60 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 } 62 69 } 63 70 … … 148 155 include $this->page_folder_dir . 'browse-plugins.php'; 149 156 } 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 150 172 public function addons_list_html() 151 173 { … … 305 327 { 306 328 return; 307 if( wpt_is_old_dir() ) return;308 329 309 330 if( $this->is_premium_installed ) return; -
woo-product-table/trunk/includes/functions.php
r3420662 r3447168 36 36 } 37 37 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 not53 * Specifically check 'WC_Min_Max_Quantity' folder/dir in plugins path54 *55 * @return boolean56 */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 65 38 /** 66 39 * Check is premium version active or not … … 71 44 */ 72 45 function 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; 76 48 } 77 49 /** … … 81 53 */ 82 54 function wpt_is_premium_installed(){ 83 return wpt_fs()->is_premium();55 if( defined( 'WPT_PRO_DEV_VERSION' ) ) return true; 84 56 } 85 57 -
woo-product-table/trunk/woo-product-table.php
r3437512 r3447168 1 1 <?php 2 3 2 /** 4 3 * Plugin Name: Product Table for WooCommerce … … 26 25 * Text Domain: woo-product-table 27 26 * Domain Path: /languages/ 27 * @fs_premium_only /premium/premium-loader.php, /premium/ 28 28 * 29 29 * @package WPT_Product_Table 30 30 */ 31 31 32 use CA_Framework\WPT_Required_Plugin_Control; 33 32 34 // don't load directly 33 if ( !defined( 'ABSPATH' ) ) { 34 die( '-1' ); 35 } 35 if ( ! defined( 'ABSPATH' ) ) { 36 die( '-1' ); 37 } 38 36 39 /** 37 40 * Defining constant 38 41 */ 39 if ( !defined( 'WPT_PLUGIN_BASE_FOLDER' ) ){42 if( ! defined( 'WPT_PLUGIN_BASE_FOLDER' ) ){ 40 43 define( 'WPT_PLUGIN_BASE_FOLDER', plugin_basename( dirname( __FILE__ ) ) ); 41 44 } 42 if ( !defined( 'WPT_DEV_VERSION' ) ) { 45 46 if( ! defined( 'WPT_DEV_VERSION' ) ){ 43 47 define( 'WPT_DEV_VERSION', '5.1.1.0' ); 44 48 } 45 if ( !defined( 'WPT_CAPABILITY' ) ) { 49 50 if( ! defined( 'WPT_CAPABILITY' ) ){ 46 51 $wpt_capability = apply_filters( 'wpt_menu_capability', 'manage_wpt_product_table' ); 47 52 define( 'WPT_CAPABILITY', $wpt_capability ); 48 53 } 49 if ( !defined( 'WPT_PLUGIN' ) ) { 50 define( 'WPT_PLUGIN', plugin_basename( __FILE__ ) ); 51 } 52 if ( !defined( 'WPT_PLUGIN_BASE_FILE' ) ) { 54 55 if( ! defined( 'WPT_PLUGIN' ) ){ 56 define( 'WPT_PLUGIN', plugin_basename( __FILE__ ) ); 57 } 58 59 60 if( ! defined( 'WPT_PLUGIN_BASE_FILE' ) ){ 53 61 define( 'WPT_PLUGIN_BASE_FILE', plugin_basename( __FILE__ ) ); 54 62 } 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 64 if( ! defined( 'WPT_BASE_URL' ) ){ 65 define( "WPT_BASE_URL", plugins_url() . '/'. plugin_basename( dirname( __FILE__ ) ) . '/' ); 66 } 67 68 if( ! defined( 'WPT_ASSETS_URL' ) ){ 59 69 define( "WPT_ASSETS_URL", WPT_BASE_URL . 'assets/' ); 60 70 } 61 if ( !defined( 'WPT_DIR_BASE' ) ) { 71 72 if( ! defined( 'WPT_DIR_BASE' ) ){ 62 73 define( "WPT_DIR_BASE", dirname( __FILE__ ) . '/' ); 63 74 } 64 if ( !defined( 'WPT_BASE_DIR' ) ){75 if( ! defined( 'WPT_BASE_DIR' ) ){ 65 76 define( "WPT_BASE_DIR", str_replace( '\\', '/', WPT_DIR_BASE ) ); 66 77 } 67 if ( !defined( 'WPT_PLUGIN_FOLDER_NAME' ) ) { 68 define( "WPT_PLUGIN_FOLDER_NAME", plugin_basename( dirname( __FILE__ ) ) ); 69 //aDDED TO NEW VERSION70 } 71 if ( !defined( 'WPT_PLUGIN_FILE_NAME' ) ) { 72 define( "WPT_PLUGIN_FILE_NAME", __FILE__ ); 73 //aDDED TO NEW VERSION74 } 75 if ( !defined( 'WPT_OPTION_KEY' ) ){76 define( "WPT_OPTION_KEY", 'wpt_configure_options' ); 77 //aDDED TO NEW VERSION 78 } 78 79 if( ! defined( 'WPT_PLUGIN_FOLDER_NAME' ) ){ 80 define( "WPT_PLUGIN_FOLDER_NAME",plugin_basename( dirname( __FILE__ ) ) ); //aDDED TO NEW VERSION 81 } 82 83 if( ! defined( 'WPT_PLUGIN_FILE_NAME' ) ){ 84 define( "WPT_PLUGIN_FILE_NAME", __FILE__ ); //aDDED TO NEW VERSION 85 } 86 if( ! defined( 'WPT_OPTION_KEY' ) ){ 87 define( "WPT_OPTION_KEY", 'wpt_configure_options' ); //aDDED TO NEW VERSION 88 } 89 79 90 //Check if previous Premium plugin available 80 91 $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 130 95 /** 131 96 * Default Configuration for WOO Product Table Pro … … 140 105 * @since 1.0.0 141 106 */ 142 include_once ABSPATH . 'wp-admin/includes/plugin.php'; 143 if ( !class_exists( 'WPT_Product_Table' ) ) { 107 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 108 109 if( ! class_exists('WPT_Product_Table') ){ 110 144 111 /** 145 112 * Main Manager Class for WOO Product Table Plugin. … … 148 115 * Already set $_instance, So no need again call 149 116 */ 150 class WPT_Product_Table { 117 class WPT_Product_Table{ 118 151 119 public $text_domain_applied = false; 152 153 120 /** 154 121 * To set Default Value for Woo Product Table, So that, we can set Default Value in Plugin Start and … … 158 125 */ 159 126 public static $default = array(); 160 127 161 128 /* 162 * List of Path163 *164 * @since 1.0.0165 * @var array166 */129 * List of Path 130 * 131 * @since 1.0.0 132 * @var array 133 */ 167 134 protected $paths = array(); 168 135 169 136 /** 170 137 * Set like Constant static array … … 175 142 */ 176 143 private static $constant = array(); 177 144 178 145 /** 179 146 * Property for Shortcode Storing … … 182 149 */ 183 150 public static $shortCode; 184 151 185 152 /** 186 153 * Minimum PHP Version … … 191 158 */ 192 159 const MINIMUM_PHP_VERSION = '7.0'; 193 160 194 161 /** 195 162 * check minimum Woo Product Table Pro Version … … 202 169 */ 203 170 const MINIMUM_WPT_PRO_VERSION = '7.0.7'; 204 171 172 205 173 /** 206 174 * Only for Admin Section, Collumn Array … … 211 179 public static $columns_array = array(); 212 180 181 213 182 /** 214 183 * Only for Admin Section, Disable Collumn Array … … 218 187 */ 219 188 public static $colums_disable_array = array(); 220 189 221 190 /** 222 191 * Only for Admin when create a new Post for Product Table … … 234 203 */ 235 204 public static $style_form_options = array(); 236 237 /** 238 * Core singleton class239 * @var self - pattern realization240 */205 206 /** 207 * Core singleton class 208 * @var self - pattern realization 209 */ 241 210 private static $_instance; 242 243 /** 244 * Set Plugin Mode as 1 for Giving Data to UPdate Options245 *246 * @var type Int247 */211 212 /** 213 * Set Plugin Mode as 1 for Giving Data to UPdate Options 214 * 215 * @var type Int 216 */ 248 217 protected static $mode = 1; 249 250 /**251 * Get the instane of WPT_Product_Table252 *253 * @return self254 */218 219 /** 220 * Get the instane of WPT_Product_Table 221 * 222 * @return self 223 */ 255 224 public static function getInstance() { 256 if ( ! self::$_instance instanceof self) {225 if ( ! ( self::$_instance instanceof self ) ) { 257 226 self::$_instance = new self(); 258 227 } 259 228 return self::$_instance; 260 229 } 261 230 231 262 232 public function __construct() { 263 global $wpt_old_pro_dir; 233 264 234 /** 265 235 * Include Autoloader … … 269 239 include_once dirname( __FILE__ ) . '/autoloader.php'; 270 240 include_once dirname( __FILE__ ) . '/includes/functions.php'; 241 242 243 271 244 add_action( 'plugins_loaded', [$this, 'plugins_loaded'] ); 272 245 add_action( 'init', [$this, 'include_defaults'] ); 273 246 add_action( 'init', 'wpt_product_table_blocks_init' ); 274 247 } 275 276 248 public function include_defaults() { 249 277 250 $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' ), 310 283 ); 284 311 285 $column_array = apply_filters( 'wpto_default_column_arr', $column_array ); 312 self::$columns_array = $column_array;286 self::$columns_array = $column_array; 313 287 $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', 320 294 ); 295 321 296 /** 322 297 * Filter for Default Enabled Column … … 324 299 */ 325 300 $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; 327 302 /** 328 303 * @since 1.7 … … 331 306 'product_id', 332 307 'serial_number', 333 'description', 334 //has been removed at V5.2 308 'description', //has been removed at V5.2 335 309 'tags', 336 310 'weight', … … 351 325 'blank', 352 326 ); 327 353 328 global $shortCodeText; 354 329 /** … … 359 334 $shortCodeText = apply_filters( 'wpto_shortcode_text', $shortCodeText ); 360 335 self::$shortCode = $shortCodeText; 336 361 337 /** 362 338 * Set Default Value For Every where, … … 365 341 */ 366 342 $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' ), 402 380 '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' ), 418 398 'search_order_placeholder' => __( 'Select inner Item.', 'woo-product-table' ), 419 399 ); 420 400 $default = apply_filters( 'wpto_default_configure', $default ); 421 401 self::$default = $default; 422 } 423 424 public function plugins_loaded() { 402 403 404 } 405 public function plugins_loaded(){ 406 407 425 408 // 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 } 429 413 } 430 });431 global $wpt_old_pro_dir; 414 ); 415 432 416 $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 437 423 // Check for required PHP version 438 424 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' ] ); 440 426 return; 441 427 } 442 $dir = dirname( __FILE__ ); 443 //dirname( __FILE__ ) 428 429 $dir = dirname( __FILE__ ); //dirname( __FILE__ ) 430 431 444 432 /** 445 433 * See $path_args for Set Path and set Constant … … 448 436 */ 449 437 $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 . '/' ), 454 442 ); 455 443 /** … … 458 446 * @since 1.0.0 459 447 */ 460 $this->setPath( $path_args ); 448 $this->setPath($path_args); 449 461 450 /** 462 451 * Set Constant … … 464 453 * @since 1.0.0 465 454 */ 466 $this->setConstant( $path_args ); 455 $this->setConstant($path_args); 456 457 467 458 do_action( 'wpt_load' ); 459 468 460 //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 481 466 //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 491 469 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 500 481 //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'); 502 483 } 503 484 //Coll elementor Module, If installed Elementor 504 485 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 512 494 /** 513 495 * Not activated this, Even file still not added to this directory … … 524 506 */ 525 507 //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 527 510 // 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 531 516 $shortcode = new WOO_PRODUCT_TABLE\Inc\Shortcode(); 532 517 $shortcode->run(); 518 533 519 $compatible = new WOO_PRODUCT_TABLE\Compatible\Compatible_Loader(); 534 $compatible->run(); 520 $compatible->run(); 521 535 522 /** 536 523 * Include WPML Integration … … 543 530 * @link https://wpml.org/documentation/ 544 531 */ 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 548 536 do_action( 'wpt_loaded' ); 549 537 } 550 538 539 540 551 541 /** 552 542 * Admin notice … … 559 549 */ 560 550 public function admin_notice_minimum_php_version() { 551 561 552 $message = sprintf( 562 553 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ … … 564 555 '<strong>' . esc_html__( 'Woo Product Table', 'woo-product-table' ) . '</strong>', 565 556 '<strong>' . esc_html__( 'PHP', 'woo-product-table' ) . '</strong>', 566 self::MINIMUM_PHP_VERSION557 self::MINIMUM_PHP_VERSION 567 558 ); 559 568 560 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', wp_kses_post( $message ) ); 561 569 562 } 570 563 … … 576 569 */ 577 570 public static function detectDevice( $userAgent = null ) { 578 return new Mobile_Detect( null, $userAgent);571 return new Mobile_Detect( null, $userAgent ); 579 572 } 580 573 … … 589 582 $this->paths = $path_array; 590 583 } 591 584 592 585 private function setConstant( $contanst_array ) { 593 586 self::$constant = $this->paths; 594 587 } 595 596 588 /** 597 589 * Set Path as like Constant Will Return Full Path … … 616 608 return $path; 617 609 } 618 619 610 /** 620 611 * Update Options when Installing … … 627 618 ob_start(); 628 619 //check current value 620 629 621 $role = get_role( 'administrator' ); 622 630 623 $role->add_cap( 'edit_wpt_product_table' ); 631 624 $role->add_cap( 'edit_wpt_product_tables' ); … … 636 629 $role->add_cap( 'delete_wpt_product_table' ); 637 630 $role->add_cap( 'manage_wpt_product_table' ); 631 632 638 633 //Configuration Data Update 639 634 $current_value = get_option( WPT_OPTION_KEY ); 640 635 $default_value = self::$default; 641 if ( empty( $current_value ) ){636 if( empty( $current_value ) ){ 642 637 update_option( WPT_OPTION_KEY, $default_value ); 643 638 return; 644 639 } 645 if ( is_array( $current_value ) && is_array( $default_value ) ) { 640 641 if( is_array( $current_value ) && is_array( $default_value ) ){ 646 642 $updated = array_merge( $default_value, $current_value ); 647 643 update_option( WPT_OPTION_KEY, $updated ); 648 644 return; 649 645 } 646 650 647 // wp_redirect(admin_url( 'edit.php?post_type=wpt_product_table&page=wpt-getting-start' )); 648 651 649 /** 652 650 * Install timestamp save on database … … 658 656 $timestamp_key = 'wpt_install_timestamp'; 659 657 $timestamp_get = get_option( $timestamp_key, false ); 660 if ( empty( $timestamp_get ) ){658 if( empty( $timestamp_get ) ){ 661 659 update_option( $timestamp_key, time() ); 662 660 } 661 663 662 // Flush rewrite rules 664 663 flush_rewrite_rules(); 665 664 } 666 665 667 666 /** 668 667 * Plugin Uninsall Activation Hook … … 674 673 //Nothing for now 675 674 } 676 675 677 676 /** 678 677 * Getting full Plugin data. We have used __FILE__ for the main plugin file. … … 681 680 * @return Array Returnning Array of full Plugin's data for This Woo Product Table plugin 682 681 */ 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 687 686 /** 688 687 * Getting Version by this Function/Method … … 694 693 return $data['Version']; 695 694 } 696 695 697 696 /** 698 697 * Getting Version by this Function/Method … … 711 710 * @return variable 712 711 */ 713 public static function getDefault( $indexKey = false ) {712 public static function getDefault( $indexKey = false ){ 714 713 $default = self::$default; 715 if ( $indexKey && isset( $default[$indexKey] ) ){714 if( $indexKey && isset( $default[$indexKey] ) ){ 716 715 return $default[$indexKey]; 717 716 } … … 719 718 } 720 719 721 } 722 723 } 720 } 721 722 } 723 724 724 725 new WPT_Product_Table(); 725 if ( !function_exists( 'wpt_product_table_blocks_init' ) ) { 726 727 728 729 if( ! function_exists( 'wpt_product_table_blocks_init' ) ){ 730 726 731 /** 727 732 * Registers the block using a `blocks-manifest.php` file, which improves the performance of block type registration. … … 733 738 */ 734 739 function wpt_product_table_blocks_init() { 740 735 741 /** 736 742 * Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s) … … 744 750 return; 745 751 } 752 746 753 /** 747 754 * Registers the block(s) metadata from the `blocks-manifest.php` file. … … 758 765 * @see https://developer.wordpress.org/reference/functions/register_block_type/ 759 766 */ 760 $manifest_data = (require __DIR__ . '/build/blocks-manifest.php');767 $manifest_data = require __DIR__ . '/build/blocks-manifest.php'; 761 768 foreach ( array_keys( $manifest_data ) as $block_type ) { 762 769 register_block_type( __DIR__ . "/build/{$block_type}" ); 763 770 } 764 771 } 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 775 register_activation_hook( __FILE__, array( 'WPT_Product_Table','install' ) ); 776 register_deactivation_hook( __FILE__, array( 'WPT_Product_Table','uninstall' ) );
Note: See TracChangeset
for help on using the changeset viewer.