Plugin Directory

Changeset 2933107


Ignore:
Timestamp:
07/03/2023 02:16:44 AM (3 years ago)
Author:
thanhtd
Message:

Update

Location:
epow-custom-product-options-for-woocommerce/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • epow-custom-product-options-for-woocommerce/trunk/CHANGELOG.txt

    r2859364 r2933107  
     1/**1.0.3 - 2023.07.03 **/
     2– Updated: Compatible with WooCommerce HPOS(COT)
     3
    14/**1.0.2 - 2023.02.03 **/
    25-Fix: Decimal of number input
  • epow-custom-product-options-for-woocommerce/trunk/epow-custom-product-options-for-woocommerce.php

    r2869082 r2933107  
    44 * Plugin URI: https://villatheme.com/extensions/epow-custom-product-options-for-woocommerce/
    55 * Description: EPOW - Custom Product Options for WooCommerce: Add & Design custom options for your Woo products; full customization settings for a visual and catchy appearance on frontend; user-friendly and easy to use.
    6  * Version: 1.0.2
     6 * Version: 1.0.3
    77 * Author: VillaTheme
    88 * Author URI: https://villatheme.com
     
    1111 * Copyright 2022 - 2023 VillaTheme.com. All rights reserved.
    1212 * Requires at least: 5.0
    13  * Tested up to: 6.1
     13 * Tested up to: 6.2
    1414 * WC requires at least: 5.0
    15  * WC tested up to: 7.3
     15 * WC tested up to: 7.8
    1616 * Requires PHP: 7.0
    1717 **/
     
    2828
    2929define( 'EPOW_CONST', [
    30     'version'     => '1.0.2',
     30    'version'     => '1.0.3',
    3131    'plugin_name' => 'EPOW - Custom Product Options for WooCommerce',
    3232    'slug'        => 'epow',
     
    5050            add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
    5151            add_action( 'admin_notices', [ $this, 'plugin_require_notice' ] );
     52            add_action( 'before_woocommerce_init', [ $this, 'custom_order_tables_declare_compatibility' ] );
    5253        }
    5354
    5455        public function plugins_loaded() {
    55             $this->checker = new \WP_Error();
    56             global $wp_version;
    57             $php_require = '7.0';
    58             $wp_require  = '5.0';
    59             $wc_require  = '5.0';
    60 
    61             if ( version_compare( phpversion(), $php_require, '<' ) ) {
    62                 $this->checker->add( '', sprintf( '%s %s', esc_html__( 'require PHP version at least', 'epow-custom-product-options-for-woocommerce' ), $php_require ) );
     56            if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) {
     57                include_once EPOW_CONST['plugin_dir'] . 'inc/support.php';
    6358            }
    6459
    65             if ( version_compare( $wp_version, $wp_require, '<' ) ) {
    66                 $this->checker->add( '', sprintf( '%s %s', esc_html__( 'require WordPress version at least', 'epow-custom-product-options-for-woocommerce' ), $wp_require ) );
    67             }
     60            $environment = new \VillaTheme_Require_Environment( [
     61                    'plugin_name'     => EPOW_CONST['plugin_name'],
     62                    'php_version'     => '7.0',
     63                    'wp_version'      => '5.0',
     64                    'wc_version'      => '5.0',
     65                    'require_plugins' => [
     66                        [
     67                            'slug' => 'woocommerce',
     68                            'name' => 'WooCommerce',
     69                        ],
     70                    ]
     71                ]
     72            );
    6873
    69             if ( ! class_exists( 'WooCommerce' ) ) {
    70                 $this->checker->add( '', esc_html__( 'require WooCommerce installed and activated', 'wepoi-woocommerce-point-reward' ) );
    71             }
    72 
    73             $wc_version = get_option( 'woocommerce_version' );
    74             if ( version_compare( $wc_version, $wc_require, '<' ) ) {
    75                 $this->checker->add( '', sprintf( '%s %s', esc_html__( 'require WooCommerce version at least', 'epow-custom-product-options-for-woocommerce' ), $wc_require ) );
    76             }
    77 
    78             if ( $this->checker->has_errors() ) {
     74            if ( $environment->has_error() ) {
    7975                return;
    8076            }
    8177
    82             $this->init();
    83         }
    84 
    85         public function init() {
    8678            $this->load_text_domain();
    8779            $this->load_classes();
     
    10092
    10193        public function load_classes() {
    102             require_once EPOW_CONST['plugin_dir'] . 'inc/support.php';
    103 
    10494            Enqueue::instance();
    10595            Admin::instance();
     
    125115
    126116        public function support() {
    127             if ( class_exists( 'VillaTheme_Support' ) ) {
    128                 new \VillaTheme_Support(
    129                     array(
    130                         'support'    => 'https://wordpress.org/support/plugin/',
    131                         'docs'       => '',
    132                         'review'     => '',
    133                         'pro_url'    => '',
    134                         'css'        => EPOW_CONST['css_url'],
    135                         'image'      => EPOW_CONST['img_url'],
    136                         'slug'       => 'epow-custom-product-options-for-woocommerce',
    137                         'menu_slug'  => 'edit.php?post_type=epow_global_form',
    138                         'version'    => EPOW_CONST['version'],
    139                         'survey_url' => ''
    140                     )
    141                 );
     117            if ( ! class_exists( 'VillaTheme_Support' ) ) {
     118                require_once EPOW_CONST['plugin_dir'] . 'inc/support.php';
     119            }
     120
     121            new \VillaTheme_Support(
     122                array(
     123                    'support'    => 'https://wordpress.org/support/plugin/',
     124                    'docs'       => '',
     125                    'review'     => '',
     126                    'pro_url'    => '',
     127                    'css'        => EPOW_CONST['css_url'],
     128                    'image'      => EPOW_CONST['img_url'],
     129                    'slug'       => 'epow-custom-product-options-for-woocommerce',
     130                    'menu_slug'  => 'edit.php?post_type=epow_global_form',
     131                    'version'    => EPOW_CONST['version'],
     132                    'survey_url' => ''
     133                )
     134            );
     135        }
     136
     137        public function custom_order_tables_declare_compatibility() {
     138            if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     139                \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
    142140            }
    143141        }
    144 
    145142    }
    146143
  • epow-custom-product-options-for-woocommerce/trunk/frontend/frontend.php

    r2816921 r2933107  
    397397            }
    398398        }
    399         error_log( print_r( $field_data, true ) );
    400399
    401400        $item->add_meta_data( '_epow_data', $field_data );
  • epow-custom-product-options-for-woocommerce/trunk/inc/support.php

    r2816921 r2933107  
    88    /**
    99     * Class VillaTheme_Support
    10      * 1.1.7
     10     * 1.1.8
    1111     */
    1212    class VillaTheme_Support {
    1313        protected $plugin_base_name;
    1414        protected $ads_data;
    15         protected $version = '1.1.7';
     15        protected $version = '1.1.8';
     16        protected $data = [];
    1617
    1718        public function __construct( $data ) {
     
    723724                array(
    724725                    'id'          => 'could_not_understand',
    725                     'text'        => esc_html__( 'I couldn\'t understand how to make it work', 'epow-custom-product-options-for-woocommerce' ),
     726                    'text'        => __( 'I couldn\'t understand how to make it work', 'viwec-email-template-customizer' ),
    726727                    'type'        => 'textarea',
    727                     'placeholder' => esc_html__( 'Would you like us to assist you?', 'epow-custom-product-options-for-woocommerce' )
     728                    'placeholder' => __( 'Would you like us to assist you?', 'viwec-email-template-customizer' )
    728729                ),
    729730                array(
    730731                    'id'          => 'found_better_plugin',
    731                     'text'        => esc_html__( 'I found a better plugin', 'epow-custom-product-options-for-woocommerce' ),
     732                    'text'        => __( 'I found a better plugin', 'viwec-email-template-customizer' ),
    732733                    'type'        => 'text',
    733                     'placeholder' => esc_html__( 'Which plugin?', 'epow-custom-product-options-for-woocommerce' )
     734                    'placeholder' => __( 'Which plugin?', 'viwec-email-template-customizer' )
    734735                ),
    735736                array(
    736737                    'id'          => 'not_have_that_feature',
    737                     'text'        => esc_html__( 'The plugin is great, but I need specific feature that you don\'t support', 'epow-custom-product-options-for-woocommerce' ),
     738                    'text'        => __( 'The plugin is great, but I need specific feature that you don\'t support', 'viwec-email-template-customizer' ),
    738739                    'type'        => 'textarea',
    739                     'placeholder' => esc_html__( 'Could you tell us more about that feature?', 'epow-custom-product-options-for-woocommerce' )
     740                    'placeholder' => __( 'Could you tell us more about that feature?', 'viwec-email-template-customizer' )
    740741                ),
    741742                array(
    742743                    'id'          => 'is_not_working',
    743                     'text'        => esc_html__( 'The plugin is not working', 'epow-custom-product-options-for-woocommerce' ),
     744                    'text'        => __( 'The plugin is not working', 'viwec-email-template-customizer' ),
    744745                    'type'        => 'textarea',
    745                     'placeholder' => esc_html__( 'Could you tell us a bit more whats not working?', 'epow-custom-product-options-for-woocommerce' )
     746                    'placeholder' => __( 'Could you tell us a bit more whats not working?', 'viwec-email-template-customizer' )
    746747                ),
    747748                array(
    748749                    'id'          => 'looking_for_other',
    749                     'text'        => esc_html__( 'It\'s not what I was looking for', 'epow-custom-product-options-for-woocommerce' ),
     750                    'text'        => __( 'It\'s not what I was looking for', 'viwec-email-template-customizer' ),
    750751                    'type'        => 'textarea',
    751752                    'placeholder' => 'Could you tell us a bit more?'
     
    753754                array(
    754755                    'id'          => 'did_not_work_as_expected',
    755                     'text'        => esc_html__( 'The plugin didn\'t work as expected', 'epow-custom-product-options-for-woocommerce' ),
     756                    'text'        => __( 'The plugin didn\'t work as expected', 'viwec-email-template-customizer' ),
    756757                    'type'        => 'textarea',
    757                     'placeholder' => esc_html__( 'What did you expect?', 'epow-custom-product-options-for-woocommerce' )
     758                    'placeholder' => __( 'What did you expect?', 'viwec-email-template-customizer' )
    758759                ),
    759760                array(
    760761                    'id'          => 'other',
    761                     'text'        => esc_html__( 'Other', 'epow-custom-product-options-for-woocommerce' ),
     762                    'text'        => __( 'Other', 'viwec-email-template-customizer' ),
    762763                    'type'        => 'textarea',
    763                     'placeholder' => esc_html__( 'Could you tell us a bit more?', 'epow-custom-product-options-for-woocommerce' )
     764                    'placeholder' => __( 'Could you tell us a bit more?', 'viwec-email-template-customizer' )
    764765                ),
    765766            );
     
    782783                    <div class="villatheme-deactivate-modal-wrap">
    783784                        <div class="villatheme-deactivate-modal-header">
    784                             <h3><?php esc_html_e( 'If you have a moment, please let us know why you are deactivating:', 'epow-custom-product-options-for-woocommerce' ); ?></h3>
     785                            <h3><?php esc_html_e( 'If you have a moment, please let us know why you are deactivating:', 'viwec-email-template-customizer' ); ?></h3>
    785786                        </div>
    786787                        <div class="villatheme-deactivate-modal-body">
     
    797798                        </div>
    798799                        <div class="villatheme-deactivate-modal-footer">
    799                             <a href="#" class="dont-bother-me"><?php esc_html_e( 'I rather wouldn\'t say', 'epow-custom-product-options-for-woocommerce' ); ?></a>
    800                             <button class="button-primary villatheme-deactivate-submit disabled"><?php esc_html_e( 'Submit & Deactivate', 'epow-custom-product-options-for-woocommerce' ); ?></button>
    801                             <button class="button-secondary villatheme-model-cancel"><?php esc_html_e( 'Cancel', 'epow-custom-product-options-for-woocommerce' ); ?></button>
     800                            <a href="#" class="dont-bother-me"><?php esc_html_e( 'I rather wouldn\'t say', 'viwec-email-template-customizer' ); ?></a>
     801                            <button class="button-primary villatheme-deactivate-submit disabled"><?php esc_html_e( 'Submit & Deactivate', 'viwec-email-template-customizer' ); ?></button>
     802                            <button class="button-secondary villatheme-model-cancel"><?php esc_html_e( 'Cancel', 'viwec-email-template-customizer' ); ?></button>
    802803                        </div>
    803804                    </div>
     
    941942    }
    942943}
     944
     945if ( ! 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}
  • epow-custom-product-options-for-woocommerce/trunk/readme.txt

    r2869082 r2933107  
    55Requires PHP: 7.0
    66Requires at least: 5.0
    7 Tested up to: 6.1
     7Tested up to: 6.2
    88Stable tag: 1.0.0
    99License: GPLv2 or later
     
    255255== Changelog ==
    256256
     257/**1.0.3 - 2023.07.03 **/
     258– Updated: Compatible with WooCommerce HPOS(COT)
     259
    257260/**1.0.2 - 2023.02.03 **/
    258261-Fix: Decimal of number input
Note: See TracChangeset for help on using the changeset viewer.