Plugin Directory

Changeset 2984099


Ignore:
Timestamp:
10/26/2023 01:25:08 AM (2 years ago)
Author:
thanhtd
Message:

Update

Location:
eu-cookies-bar/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • eu-cookies-bar/trunk/CHANGELOG.txt

    r2870518 r2984099  
     1/*1.0.13 - 2023.10.26*/
     2- Updated: Compatible with WP 6.3
     3
    14/*1.0.12 - 2023.02.24*/
    25- Fixed: Use force_balance_tags for eu-cookie-bar content
  • eu-cookies-bar/trunk/eu-cookies-bar.php

    r2870518 r2984099  
    44 * Plugin URI: https://villatheme.com/extensions/eu-cookies-bar
    55 * Description: Simple cookie bar to make your website GDPR(General Data Protection Regulation) compliant(EU Cookie Law) and more.
    6  * Version: 1.0.12
     6 * Version: 1.0.13
    77 * Author: VillaTheme
    88 * Author URI: http://villatheme.com
     
    1010 * Copyright 2018-2023 VillaTheme.com. All rights reserved.
    1111 * Requires at least: 4.4
    12  * Tested up to: 6.1
     12 * Tested up to: 6.3
    1313 * Requires PHP: 7.0
    1414 **/
     
    1717    exit;
    1818}
    19 define( 'EU_COOKIES_BAR_VERSION', '1.0.12' );
    20 
    21 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    22 $init_file = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . "eu-cookies-bar" . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR . "define.php";
    23 require_once $init_file;
     19define( 'EU_COOKIES_BAR_VERSION', '1.0.13' );
    2420
    2521/**
     
    2925    public function __construct() {
    3026        register_activation_hook( __FILE__, array( $this, 'install' ) );
     27        add_action( 'plugins_loaded', [ $this, 'init' ] );
     28    }
     29
     30    public function init() {
     31        $plugin_dir = plugin_dir_path( __FILE__ );
     32
     33        if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) {
     34            include_once $plugin_dir . 'includes/support.php';
     35        }
     36
     37        $environment = new \VillaTheme_Require_Environment( [
     38                'plugin_name' => 'EU Cookies Bar',
     39                'php_version' => '7.0',
     40                'wp_version'  => '5.0',
     41            ]
     42        );
     43
     44        if ( $environment->has_error() ) {
     45            return;
     46        }
     47
     48        require_once $plugin_dir . 'includes/define.php';
    3149    }
    3250
  • eu-cookies-bar/trunk/includes/data.php

    r2793920 r2984099  
    1919        $this->params = $eu_cookies_bar_settings;
    2020        $privacy_page = get_option( 'wp_page_for_privacy_policy', '' );
     21        $privacy      = '';
     22
    2123        if ( (int) $privacy_page > 0 ) {
    22             $privacy = get_post( $privacy_page )->post_content;
     24            $post = get_post( $privacy_page );
     25            if ( $post ) {
     26                $privacy = $post->post_content;
     27            }
    2328        } else {
    2429            $privacy = '<header>
     
    144149        return isset( $this->params[ $name ] ) ? apply_filters( 'eu_cookies_bar_get_' . $name, $this->params[ $name ] ) : false;
    145150    }
     151
    146152    public static function get_instance( $new = false ) {
    147153        if ( $new || null === self::$instance ) {
  • eu-cookies-bar/trunk/includes/support.php

    r2819411 r2984099  
    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 ) {
     
    702703            $wp_admin_bar->add_node( array(
    703704                '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>',
    705706                'parent' => 'villatheme',
    706707                'href'   => add_query_arg( array( '_villatheme_nonce' => wp_create_nonce( 'villatheme_hide_toolbar' ) ) ),
     
    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. <br><a href='%s' target='_blank' class='button button-primary' style='vertical-align: middle; margin-top: 5px;'>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. <br> <a href='%s' target='_blank' class='button button-primary' style='vertical-align: middle; margin-top: 5px;'>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}
  • eu-cookies-bar/trunk/readme.txt

    r2870518 r2984099  
    44Tags: eu cookies bar, eu cookie law, eu cookie banner, cookies gdpr, cookie consent, cookie popup, cookie policy generator, for wordpress
    55Requires at least: 4.4
    6 Tested up to: 6.1
     6Tested up to: 6.3
    77Requires PHP: 7.0
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.