Changeset 2933108
- Timestamp:
- 07/03/2023 02:22:48 AM (3 years ago)
- Location:
- gift4u-gift-cards-all-in-one-for-woo/trunk
- Files:
-
- 7 edited
-
CHANGELOG.txt (modified) (1 diff)
-
front/product-summary.php (modified) (1 diff)
-
gift4u-gift-cards-all-in-one-for-woo.php (modified) (8 diffs)
-
inc/classes/pdf.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
support/support.php (modified) (2 diffs)
-
vendor/mpdf/mpdf/src/Image/ImageProcessor.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gift4u-gift-cards-all-in-one-for-woo/trunk/CHANGELOG.txt
r2885506 r2933108 1 /**1.0.3 - 2023.07.03**/ 2 – Updated: Compatible with WooCommerce HPOS(COT) 3 1 4 /**1.0.2 - 2023.03.23**/ 2 5 - Added: PPDF file name in email -
gift4u-gift-cards-all-in-one-for-woo/trunk/front/product-summary.php
r2872086 r2933108 13 13 14 14 public function __construct() { 15 16 15 add_action( 'woocommerce_giftcard_add_to_cart', 'woocommerce_simple_add_to_cart' ); 17 16 add_filter( 'woocommerce_product_single_add_to_cart_text', [ $this, 'change_atc_text_to_update_cart' ], 10, 2 ); -
gift4u-gift-cards-all-in-one-for-woo/trunk/gift4u-gift-cards-all-in-one-for-woo.php
r2885506 r2933108 5 5 * Description: Unlock the potential of gift card products and see how they attract customers. Easily create, sell, and manage a WooCommerce gift card with a few simple steps. 6 6 * Author: VillaTheme 7 * Version: 1.0. 27 * Version: 1.0.3 8 8 * Author URI: http://villatheme.com 9 9 * Text Domain: gift4u-gift-cards-all-in-one-for-woo … … 11 11 * Copyright 2023 VillaTheme.com. All rights reserved. 12 12 * Requires at least: 5.0 13 * Tested up to: 6. 113 * Tested up to: 6.2 14 14 * WC requires at least: 5.0 15 * WC tested up to: 7. 515 * WC tested up to: 7.8 16 16 * Requires PHP: 7.0 17 17 */ … … 29 29 private static $args = []; 30 30 31 protected $checker;32 33 31 public function __construct() { 34 32 add_action( 'plugins_loaded', [ $this, 'init' ] ); 35 add_action( 'admin_notices', [ $this, 'plugin_require_notice' ] );36 33 register_activation_hook( __FILE__, [ $this, 'active' ] ); 34 add_action( 'before_woocommerce_init', [ $this, 'custom_order_tables_declare_compatibility' ] ); 37 35 } 38 36 … … 43 41 44 42 self::$args = [ 45 'version' => '1.0. 2',43 'version' => '1.0.3', 46 44 'plugin_name' => 'GIFT4U - Gift Cards All in One for Woo', 47 45 'slug' => 'gift4u-gift-cards-all-in-one-for-woo', … … 62 60 63 61 public function init() { 64 $this->checker = new \WP_Error(); 65 global $wp_version; 66 $php_require = '7.0'; 67 $wp_require = '5.0'; 68 $wc_require = '5.0'; 69 70 if ( version_compare( phpversion(), $php_require, '<' ) ) { 71 $this->checker->add( '', sprintf( '%s %s', esc_html__( 'require PHP version at least', 'giftcard' ), $php_require ) ); 62 if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) { 63 include_once GiftCard::get( 'plugin_dir' ) . 'support/support.php'; 72 64 } 73 65 74 if ( version_compare( $wp_version, $wp_require, '<' ) ) { 75 $this->checker->add( '', sprintf( '%s %s', esc_html__( 'require WordPress version at least', 'giftcard' ), $wp_require ) ); 76 } 66 $environment = new \VillaTheme_Require_Environment( [ 67 'plugin_name' => GiftCard::get( 'plugin_name' ), 68 'php_version' => '7.0', 69 'wp_version' => '5.0', 70 'wc_version' => '5.0', 71 'require_plugins' => [ 72 [ 73 'slug' => 'woocommerce', 74 'name' => 'WooCommerce', 75 ], 76 ] 77 ] 78 ); 77 79 78 if ( ! class_exists( 'WooCommerce' ) ) { 79 $this->checker->add( '', esc_html__( 'require WooCommerce installed and activated', 'giftcard' ) ); 80 } 81 82 $wc_version = get_option( 'woocommerce_version' ); 83 if ( version_compare( $wc_version, $wc_require, '<' ) ) { 84 $this->checker->add( '', sprintf( '%s %s', esc_html__( 'require WooCommerce version at least', 'giftcard' ), $wc_require ) ); 85 } 86 87 if ( $this->checker->has_errors() ) { 80 if ( $environment->has_error() ) { 88 81 return; 89 82 } … … 92 85 93 86 $this->load_text_domain(); 94 95 $this->load_classes(); 87 Load_Classes::instance(); 96 88 } 97 89 … … 99 91 $activation = new Activation(); 100 92 $activation->install( $network_wide ); 101 }102 103 protected function load_classes() {104 Load_Classes::instance();105 }106 107 public function plugin_require_notice() {108 if ( ! $this->checker->has_errors() ) {109 return;110 }111 112 $messages = $this->checker->get_error_messages();113 foreach ( $messages as $message ) {114 printf( "<div id='message' class='error'><p>%s %s</p></div>", esc_html( GiftCard::get( 'plugin_name' ) ), wp_kses_post( $message ) );115 }116 93 } 117 94 … … 135 112 } 136 113 114 public function custom_order_tables_declare_compatibility() { 115 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 116 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 117 } 118 } 137 119 } 138 120 -
gift4u-gift-cards-all-in-one-for-woo/trunk/inc/classes/pdf.php
r2885506 r2933108 181 181 ] ); 182 182 183 printf( "<div style='%s'>%s</div>", esc_attr( $styles ), esc_html( $text->content ) );183 printf( "<div style='%s'>%s</div>", esc_attr( $styles ), wp_kses_post( $text->content ) ); 184 184 } 185 185 } -
gift4u-gift-cards-all-in-one-for-woo/trunk/readme.txt
r2885506 r2933108 246 246 == Changelog == 247 247 248 /**1.0.3 - 2023.07.03**/ 249 – Updated: Compatible with WooCommerce HPOS(COT) 250 248 251 /**1.0.2 - 2023.03.23**/ 249 252 - Added: PPDF file name in email -
gift4u-gift-cards-all-in-one-for-woo/trunk/support/support.php
r2872086 r2933108 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 ) { … … 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 } -
gift4u-gift-cards-all-in-one-for-woo/trunk/vendor/mpdf/mpdf/src/Image/ImageProcessor.php
r2872104 r2933108 203 203 try { 204 204 $data = $this->assetFetcher->fetchDataFromPath($file, $orig_srcpath); 205 206 if ( empty( $data ) && function_exists( 'wp_remote_get' ) ) { 207 $r = wp_remote_get( $file ); 208 $data = wp_remote_retrieve_body( $r ); 209 } 205 210 } catch (\Mpdf\Exception\AssetFetchingException $e) { 206 211 return $this->imageError($orig_srcpath, $firstTime, $e->getMessage());
Note: See TracChangeset
for help on using the changeset viewer.