Plugin Directory

Changeset 3347352


Ignore:
Timestamp:
08/20/2025 06:51:40 AM (8 months ago)
Author:
cookieopt2024
Message:

feedback version 1.0.6

Location:
cookie-optimizer
Files:
13 deleted
7 edited
47 copied

Legend:

Unmodified
Added
Removed
  • cookie-optimizer/tags/1.0.6/app/Includes/CookieOptBanner.php

    r3346842 r3347352  
    2626            $package_user = $package->packageType();
    2727            if ($package_user !== 'LOCK' && !$package->checkLimitPackage()) {
    28                 add_action('template_redirect', [$this, 'prepare_cookie_and_banner_logic'], 0);
    2928                add_action('wp_enqueue_scripts', [$this, 'register_enqueue_script']);
    3029                if (function_exists('wp_body_open')) {
     
    107106
    108107            $expires = ($type === 3) ? 0 : time() + (365 * 24 * 60 * 60); // 1 year
    109 
    110             setcookie(COOKIE_OPT_NAME, $cookie_value, $expires, "/");
     108            $options = [
     109                'expires'  => $expires,
     110                'path'     => '/',
     111                'domain'   => '',
     112                'secure'   => false,
     113                'httponly' => false,
     114                'samesite' => 'Lax',
     115            ];
     116
     117            setcookie(COOKIE_OPT_NAME, wp_unslash($cookie_value), $options);
    111118
    112119            wp_send_json_success([
     
    157164    }
    158165
    159     public function prepare_cookie_and_banner_logic(){
    160         if (is_admin() || is_feed() || is_robots() || (defined('REST_REQUEST') && REST_REQUEST)) {
    161             return;
    162         }
    163 
    164         $cookieRaw = $_COOKIE[COOKIE_OPT_NAME] ?? null;
    165         $dataCookie = null;
    166 
    167         if ($cookieRaw) {
    168             $decoded = urldecode(wp_unslash($cookieRaw));
    169             $dataCookie = json_decode($decoded, true);
    170         }
    171 
    172         if (!is_array($dataCookie) || !isset($dataCookie['action'])) {
    173             $banner = $this->CookiePermissionService->getDataBannerToShow();
    174             $array = [
     166    public function my_banner_in_content()
     167    {
     168        $is_banner_active = get_option('cookie_opt_banner_active');
     169        if ($is_banner_active != 1)
     170            return null;
     171
     172        $banner = $this->CookiePermissionService->getDataBannerToShow();
     173
     174        $cookie_raw = $_COOKIE[COOKIE_OPT_NAME] ?? null;
     175        $data_cookie = null;
     176
     177        if ($cookie_raw) {
     178            $decoded = urldecode(wp_unslash($cookie_raw));
     179            $data_cookie = json_decode($decoded, true);
     180        }
     181
     182        if (!is_array($data_cookie) || !isset($data_cookie['action'])) {
     183            $data_cookie = [
    175184                'action'      => 0,
    176185                'type'        => $banner['regulation'] === 'ja' ? '1' : '',
     
    189198                'samesite' => 'Lax',
    190199            ];
    191             setcookie(COOKIE_OPT_NAME, wp_json_encode($array), $options);
    192         }
    193     }
    194 
    195     public function my_banner_in_content()
    196     {
    197         $is_banner_active = get_option('cookie_opt_banner_active');
    198         if ($is_banner_active != 1)
    199             return null;
    200 
    201         $banner = $this->CookiePermissionService->getDataBannerToShow();
     200
     201            setcookie(COOKIE_OPT_NAME, wp_json_encode($data_cookie), $options);
     202        }
     203
     204        if ($data_cookie['action'] == 1) {
     205            return;
     206        }
    202207
    203208        $condition_status = (bool)($banner['conditional']['status'] ?? false);
     
    222227            return;
    223228        }
     229
    224230        if (empty($rules_show) || $anyMatch($rules_show)) {
    225231            $this->render_banner($banner);
  • cookie-optimizer/tags/1.0.6/app/Services/CookiePermissionService.php

    r3309701 r3347352  
    176176        'position' => '',
    177177        'animation' => '',
    178         'target' => '_blank'
     178        'target' => '_blank',
     179        'hidden' => false
    179180    ];
    180181
  • cookie-optimizer/tags/1.0.6/constants.php

    r3346842 r3347352  
    22
    33// Plugin version and mode
    4 define('VERSION', '1.0.5');
     4define('VERSION', '1.0.6');
    55
    66// Plugin directory details
  • cookie-optimizer/tags/1.0.6/cookie-opt.php

    r3346842 r3347352  
    1212 * Plugin URI: https://manage.medipartner.jp
    1313 * Description: Cookieをユーザーに見える化し、各法律にする準拠バナー同意ソリューション
    14  * Version: 1.0.5
     14 * Version: 1.0.6
    1515 * Requires at least: 5.3
    1616 * Requires PHP: 7.3
     
    5151 *
    5252 * @class CookieOpt
    53  * @version 1.0.5
     53 * @version 1.0.6
    5454 */
    5555class CookieOpt
     
    7676     */
    7777    public $defaults = [
    78         'version' => '1.0.5',
     78        'version' => '1.0.6',
    7979    ];
    8080
  • cookie-optimizer/tags/1.0.6/readme.txt

    r3346842 r3347352  
    55Requires PHP: 7.3
    66Tested up to: 6.7   
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6565== Changelog ==
    6666
    67 = 1.0.5 =
     67= 1.0.6 =
    6868Initial release
    6969
  • cookie-optimizer/tags/1.0.6/templates/banner/banner_main.php

    r3304586 r3347352  
    1111?>
    1212
    13 <div class="modal <?php $this->propClass($data['display'], true, 'coop-display--none') ?>">
     13<div class="modal <?php $this->propClass($data['hidden'], true, 'coop-display--none') ?>">
    1414    <input id="none_view" type="hidden" name="none" value="<?php echo esc_attr($none); ?>">
    15     <input id="display_banner" hidden value="<?php echo $data['display'] == 0 ? 'show' : 'hide' ?>">
     15    <input id="display_banner" hidden value="<?php echo $data['hidden'] == true ? 'hide' : 'show' ?>">
    1616
    1717    <div data-banner="banner-main" class="coop-banner <?php echo esc_attr($data['position']) ?>"
  • cookie-optimizer/tags/1.0.6/uninstall.php

    r3346842 r3347352  
    1919 *
    2020 * @link       https://cookieoptimizer.net
    21  * @since      1.0.5
     21 * @since      1.0.6
    2222 *
    2323 * @package    Cookie Optimizer
  • cookie-optimizer/trunk/app/Includes/CookieOptBanner.php

    r3346842 r3347352  
    2626            $package_user = $package->packageType();
    2727            if ($package_user !== 'LOCK' && !$package->checkLimitPackage()) {
    28                 add_action('template_redirect', [$this, 'prepare_cookie_and_banner_logic'], 0);
    2928                add_action('wp_enqueue_scripts', [$this, 'register_enqueue_script']);
    3029                if (function_exists('wp_body_open')) {
     
    107106
    108107            $expires = ($type === 3) ? 0 : time() + (365 * 24 * 60 * 60); // 1 year
    109 
    110             setcookie(COOKIE_OPT_NAME, $cookie_value, $expires, "/");
     108            $options = [
     109                'expires'  => $expires,
     110                'path'     => '/',
     111                'domain'   => '',
     112                'secure'   => false,
     113                'httponly' => false,
     114                'samesite' => 'Lax',
     115            ];
     116
     117            setcookie(COOKIE_OPT_NAME, wp_unslash($cookie_value), $options);
    111118
    112119            wp_send_json_success([
     
    157164    }
    158165
    159     public function prepare_cookie_and_banner_logic(){
    160         if (is_admin() || is_feed() || is_robots() || (defined('REST_REQUEST') && REST_REQUEST)) {
    161             return;
    162         }
    163 
    164         $cookieRaw = $_COOKIE[COOKIE_OPT_NAME] ?? null;
    165         $dataCookie = null;
    166 
    167         if ($cookieRaw) {
    168             $decoded = urldecode(wp_unslash($cookieRaw));
    169             $dataCookie = json_decode($decoded, true);
    170         }
    171 
    172         if (!is_array($dataCookie) || !isset($dataCookie['action'])) {
    173             $banner = $this->CookiePermissionService->getDataBannerToShow();
    174             $array = [
     166    public function my_banner_in_content()
     167    {
     168        $is_banner_active = get_option('cookie_opt_banner_active');
     169        if ($is_banner_active != 1)
     170            return null;
     171
     172        $banner = $this->CookiePermissionService->getDataBannerToShow();
     173
     174        $cookie_raw = $_COOKIE[COOKIE_OPT_NAME] ?? null;
     175        $data_cookie = null;
     176
     177        if ($cookie_raw) {
     178            $decoded = urldecode(wp_unslash($cookie_raw));
     179            $data_cookie = json_decode($decoded, true);
     180        }
     181
     182        if (!is_array($data_cookie) || !isset($data_cookie['action'])) {
     183            $data_cookie = [
    175184                'action'      => 0,
    176185                'type'        => $banner['regulation'] === 'ja' ? '1' : '',
     
    189198                'samesite' => 'Lax',
    190199            ];
    191             setcookie(COOKIE_OPT_NAME, wp_json_encode($array), $options);
    192         }
    193     }
    194 
    195     public function my_banner_in_content()
    196     {
    197         $is_banner_active = get_option('cookie_opt_banner_active');
    198         if ($is_banner_active != 1)
    199             return null;
    200 
    201         $banner = $this->CookiePermissionService->getDataBannerToShow();
     200
     201            setcookie(COOKIE_OPT_NAME, wp_json_encode($data_cookie), $options);
     202        }
     203
     204        if ($data_cookie['action'] == 1) {
     205            return;
     206        }
    202207
    203208        $condition_status = (bool)($banner['conditional']['status'] ?? false);
     
    222227            return;
    223228        }
     229
    224230        if (empty($rules_show) || $anyMatch($rules_show)) {
    225231            $this->render_banner($banner);
  • cookie-optimizer/trunk/app/Services/CookiePermissionService.php

    r3309701 r3347352  
    176176        'position' => '',
    177177        'animation' => '',
    178         'target' => '_blank'
     178        'target' => '_blank',
     179        'hidden' => false
    179180    ];
    180181
  • cookie-optimizer/trunk/constants.php

    r3346842 r3347352  
    22
    33// Plugin version and mode
    4 define('VERSION', '1.0.5');
     4define('VERSION', '1.0.6');
    55
    66// Plugin directory details
  • cookie-optimizer/trunk/cookie-opt.php

    r3346842 r3347352  
    1212 * Plugin URI: https://manage.medipartner.jp
    1313 * Description: Cookieをユーザーに見える化し、各法律にする準拠バナー同意ソリューション
    14  * Version: 1.0.5
     14 * Version: 1.0.6
    1515 * Requires at least: 5.3
    1616 * Requires PHP: 7.3
     
    5151 *
    5252 * @class CookieOpt
    53  * @version 1.0.5
     53 * @version 1.0.6
    5454 */
    5555class CookieOpt
     
    7676     */
    7777    public $defaults = [
    78         'version' => '1.0.5',
     78        'version' => '1.0.6',
    7979    ];
    8080
  • cookie-optimizer/trunk/readme.txt

    r3346842 r3347352  
    55Requires PHP: 7.3
    66Tested up to: 6.7   
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6565== Changelog ==
    6666
    67 = 1.0.5 =
     67= 1.0.6 =
    6868Initial release
    6969
  • cookie-optimizer/trunk/templates/banner/banner_main.php

    r3304586 r3347352  
    1111?>
    1212
    13 <div class="modal <?php $this->propClass($data['display'], true, 'coop-display--none') ?>">
     13<div class="modal <?php $this->propClass($data['hidden'], true, 'coop-display--none') ?>">
    1414    <input id="none_view" type="hidden" name="none" value="<?php echo esc_attr($none); ?>">
    15     <input id="display_banner" hidden value="<?php echo $data['display'] == 0 ? 'show' : 'hide' ?>">
     15    <input id="display_banner" hidden value="<?php echo $data['hidden'] == true ? 'hide' : 'show' ?>">
    1616
    1717    <div data-banner="banner-main" class="coop-banner <?php echo esc_attr($data['position']) ?>"
  • cookie-optimizer/trunk/uninstall.php

    r3346842 r3347352  
    1919 *
    2020 * @link       https://cookieoptimizer.net
    21  * @since      1.0.5
     21 * @since      1.0.6
    2222 *
    2323 * @package    Cookie Optimizer
Note: See TracChangeset for help on using the changeset viewer.