Changeset 2933111
- Timestamp:
- 07/03/2023 02:40:58 AM (3 years ago)
- Location:
- woo-boost-sales/trunk
- Files:
-
- 5 edited
-
CHANGELOG.txt (modified) (1 diff)
-
admin/bundles.php (modified) (1 diff)
-
includes/support.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
woo-boost-sales.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-boost-sales/trunk/CHANGELOG.txt
r2809542 r2933111 1 /**1.2.9 – 2023.07.03*/ 2 – Updated: Compatible with WooCommerce HPOS(COT) 3 1 4 /**1.2.8 - 2022.11.02*/ 2 5 - Updated: Compatibility check with WP 6.1 and WC 7 -
woo-boost-sales/trunk/admin/bundles.php
r2767627 r2933111 376 376 377 377 public function admin_enqueue_scripts() { 378 wp_enqueue_style( 'wbs-wcpb-admin-styles', VI_WOO_BOOSTSALES_CSS . 'bundle-admin.css' );379 378 wp_enqueue_script( 'jquery-ui-tabs' ); 380 379 381 380 $screen = get_current_screen(); 382 381 if ( 'product' == $screen->id ) { 382 wp_enqueue_style( 'wbs-wcpb-admin-styles', VI_WOO_BOOSTSALES_CSS . 'bundle-admin.css' ); 383 383 wp_enqueue_script( 'jquery-ui-sortable' ); 384 384 wp_enqueue_script( 'woo-boost-sales', VI_WOO_BOOSTSALES_JS . 'bundles.js', array( 'jquery' ) ); -
woo-boost-sales/trunk/includes/support.php
r2809542 r2933111 8 8 /** 9 9 * Class VillaTheme_Support 10 * 1.1. 710 * 1.1.8 11 11 */ 12 12 class VillaTheme_Support { 13 13 protected $plugin_base_name; 14 14 protected $ads_data; 15 protected $version = '1.1.7'; 15 protected $version = '1.1.8'; 16 protected $data = []; 16 17 17 18 public function __construct( $data ) { … … 702 703 $wp_admin_bar->add_node( array( 703 704 'id' => 'villatheme_hide_toolbar', 704 'title' => '<span style="font-family:dashicons"class="dashicons dashicons-dismiss"></span><span class="villatheme-hide-toolbar-button-title">Hide VillaTheme toolbar</span>',705 'title' => '<span class="dashicons dashicons-dismiss"></span><span class="villatheme-hide-toolbar-button-title">Hide VillaTheme toolbar</span>', 705 706 'parent' => 'villatheme', 706 707 'href' => add_query_arg( array( '_villatheme_nonce' => wp_create_nonce( 'villatheme_hide_toolbar' ) ) ), … … 941 942 } 942 943 } 944 945 if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) { 946 class VillaTheme_Require_Environment { 947 948 protected $args; 949 protected $plugin_name; 950 protected $notices = []; 951 952 public function __construct( $args ) { 953 if ( ! did_action( 'plugins_loaded' ) ) { 954 _doing_it_wrong( 'VillaTheme_Require_Environment', sprintf( 955 /* translators: %s: plugins_loaded */ 956 __( 'VillaTheme_Require_Environment should not be run before the %s hook.' ), 957 '<code>plugins_loaded</code>' 958 ), '6.2.0' ); 959 } 960 961 $args = wp_parse_args( $args, [ 962 'plugin_name' => '', 963 'php_version' => '', 964 'wp_version' => '', 965 'wc_verison' => '', 966 'require_plugins' => [], 967 ] ); 968 969 $this->plugin_name = $args['plugin_name']; 970 971 $this->check( $args ); 972 973 add_action( 'admin_notices', [ $this, 'notice' ] ); 974 } 975 976 protected function check( $args ) { 977 if ( ! function_exists( 'install_plugin_install_status' ) ) { 978 require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; 979 } 980 981 if ( ! function_exists( 'is_plugin_active' ) ) { 982 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 983 } 984 985 if ( ! empty( $args['php_version'] ) ) { 986 $compatible_php = is_php_version_compatible( $args['php_version'] ); 987 if ( ! $compatible_php ) { 988 $this->notices[] = sprintf( "PHP version at least %s.", esc_html( $args['php_version'] ) ); 989 } 990 } 991 992 if ( ! empty( $args['wp_version'] ) ) { 993 $compatible_wp = is_wp_version_compatible( $args['wp_version'] ); 994 if ( ! $compatible_wp ) { 995 $this->notices[] = sprintf( "WordPress version at least %s.", esc_html( $args['wp_version'] ) ); 996 } 997 } 998 999 if ( ! empty( $args['require_plugins'] ) ) { 1000 foreach ( $args['require_plugins'] as $plugin ) { 1001 if ( empty( $plugin['version'] ) ) { 1002 $plugin['version'] = ''; 1003 } 1004 1005 $status = install_plugin_install_status( $plugin ); 1006 $require_plugin_name = $plugin['name'] ?? ''; 1007 1008 $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; 1009 $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; 1010 1011 $compatible_php = is_php_version_compatible( $requires_php ); 1012 $compatible_wp = is_wp_version_compatible( $requires_wp ); 1013 1014 if ( ! $compatible_php || ! $compatible_wp ) { 1015 continue; 1016 } 1017 1018 switch ( $status['status'] ) { 1019 1020 case 'install': 1021 $this->notices[] = sprintf( "%s to be installed. <a href='%s' target='_blank' class='button button-primary' style='vertical-align: middle'>Install %s</a>", 1022 esc_html( $require_plugin_name ), 1023 esc_url( ! empty( $status['url'] ) ? $status['url'] : '#' ), 1024 esc_html( $require_plugin_name ) ); 1025 1026 break; 1027 1028 default: 1029 1030 if ( ! is_plugin_active( $status['file'] ) && current_user_can( 'activate_plugin', $status['file'] ) ) { 1031 $activate_url = add_query_arg( 1032 [ 1033 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), 1034 'action' => 'activate', 1035 'plugin' => $status['file'], 1036 ], 1037 network_admin_url( 'plugins.php' ) 1038 ); 1039 1040 $this->notices[] = sprintf( "%s is installed and activated. <a href='%s' target='_blank' class='button button-primary' style='vertical-align: middle'>Active %s</a>", 1041 esc_html( $require_plugin_name ), 1042 esc_url( $activate_url ), 1043 esc_html( $require_plugin_name ) ); 1044 1045 } 1046 1047 if ( $plugin['slug'] == 'woocommerce' && ! empty( $args['wc_version'] ) && is_plugin_active( $status['file'] ) ) { 1048 $wc_current_version = get_option( 'woocommerce_version' ); 1049 if ( ! version_compare( $wc_current_version, $args['wc_version'], '>=' ) ) { 1050 $this->notices[] = sprintf( "WooCommerce version at least %s.", esc_html( $args['wc_version'] ) ); 1051 } 1052 } 1053 1054 break; 1055 } 1056 } 1057 } 1058 } 1059 1060 public function notice() { 1061 $screen = get_current_screen(); 1062 1063 if ( ! current_user_can( 'manage_options' ) || $screen->id === 'update' ) { 1064 return; 1065 } 1066 1067 if ( ! empty( $this->notices ) ) { 1068 ?> 1069 <div class="error"> 1070 <?php 1071 if ( count( $this->notices ) > 1 ) { 1072 printf( "<p>%s requires:</p>", esc_html( $this->plugin_name ) ); 1073 ?> 1074 <ol> 1075 <?php 1076 foreach ( $this->notices as $notice ) { 1077 printf( "<li>%s</li>", wp_kses_post( $notice ) ); 1078 } 1079 ?> 1080 </ol> 1081 <?php 1082 } else { 1083 printf( "<p>%s requires %s</p>", esc_html( $this->plugin_name ), wp_kses_post( current( $this->notices ) ) ); 1084 } 1085 ?> 1086 </div> 1087 <?php 1088 } 1089 } 1090 1091 public function has_error() { 1092 return ! empty( $this->notices ); 1093 } 1094 } 1095 } -
woo-boost-sales/trunk/readme.txt
r2869101 r2933111 264 264 265 265 == Changelog == 266 267 /**1.2.9 – 2023.07.03*/ 268 – Updated: Compatible with WooCommerce HPOS(COT) 269 266 270 /**1.2.8 - 2022.11.02*/ 267 271 - Updated: Compatibility check with WP 6.1 and WC 7 -
woo-boost-sales/trunk/woo-boost-sales.php
r2869101 r2933111 4 4 * Plugin URI: https://villatheme.com/extensions/woocommerce-boost-sales/ 5 5 * Description: Increases sales from every order by using Up-sell and Cross-sell techniques for your online store. 6 * Version: 1.2. 86 * Version: 1.2.9 7 7 * Author: VillaTheme 8 8 * Author URI: http://villatheme.com … … 14 14 */ 15 15 16 define( 'VI_WOO_BOOSTSALES_VERSION', '1.2.8' );17 16 if ( ! defined( 'ABSPATH' ) ) { 18 17 exit; 19 18 } 20 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 21 if ( is_plugin_active( 'woocommerce-boost-sales/woocommerce-boost-sales.php' ) ) { 22 return; 23 } 24 if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) { 25 $init_file = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . "woo-boost-sales" . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR . "define.php"; 26 require_once $init_file; 27 } 19 20 define( 'VI_WOO_BOOSTSALES_VERSION', '1.2.9' ); 28 21 29 22 … … 34 27 public function __construct() { 35 28 register_activation_hook( __FILE__, array( $this, 'install' ) ); 36 add_action( 'admin_notices', array( $this, 'global_note' ) ); 29 add_action( 'plugins_loaded', array( $this, 'init' ) ); 30 add_action( 'before_woocommerce_init', [ $this, 'custom_order_tables_declare_compatibility' ] ); 37 31 } 38 32 39 function global_note() { 40 if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) { 41 ?> 42 <div id="message" class="error"> 43 <p><?php esc_html_e( 'Please install and activate WooCommerce to use Boost Sales for WooCommerce.', 'woo-boost-sales' ); ?></p> 44 </div> 45 <?php 33 public function init() { 34 $include_dir = plugin_dir_path( __FILE__ ) . 'includes/'; 35 if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) { 36 include_once $include_dir . 'support.php'; 37 } 38 39 if ( is_plugin_active( 'woocommerce-boost-sales/woocommerce-boost-sales.php' ) ) { 40 return; 41 } 42 43 $environment = new \VillaTheme_Require_Environment( [ 44 'plugin_name' => 'Boost Sales for WooCommerce', 45 'php_version' => '7.0', 46 'wp_version' => '5.0', 47 'wc_version' => '5.0', 48 'require_plugins' => [ [ 'slug' => 'woocommerce', 'name' => 'WooCommerce' ] ] 49 ] 50 ); 51 52 if ( $environment->has_error() ) { 53 return; 54 } 55 56 require_once $include_dir . "define.php"; 57 } 58 59 public function custom_order_tables_declare_compatibility() { 60 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 61 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 46 62 } 47 63 } 48 49 64 50 65 /**
Note: See TracChangeset
for help on using the changeset viewer.