Changeset 3346842
- Timestamp:
- 08/19/2025 08:41:24 AM (8 months ago)
- Location:
- cookie-optimizer
- Files:
-
- 13 deleted
- 7 edited
- 46 copied
-
tags/1.0.5 (copied) (copied from cookie-optimizer/trunk)
-
tags/1.0.5/app/Includes/CookieOptBanner.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptBanner.php) (4 diffs)
-
tags/1.0.5/app/Includes/CookieOptBannerPreview.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptBannerPreview.php)
-
tags/1.0.5/app/Includes/CookieOptBaseInc.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptBaseInc.php)
-
tags/1.0.5/app/Includes/CookieOptCookiePolicy.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptCookiePolicy.php)
-
tags/1.0.5/app/Includes/CookieOptDashboard.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptDashboard.php)
-
tags/1.0.5/app/Includes/CookieOptLanguages.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptLanguages.php)
-
tags/1.0.5/app/Includes/CookieOptOther.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptOther.php)
-
tags/1.0.5/app/Includes/CookieOptPermission.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptPermission.php)
-
tags/1.0.5/app/Includes/CookieOptPublishSettings.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptPublishSettings.php)
-
tags/1.0.5/app/Includes/CookieOptTagManagement.php (copied) (copied from cookie-optimizer/trunk/app/Includes/CookieOptTagManagement.php)
-
tags/1.0.5/app/Includes/FeatureManager/FeatureUser/CookieIOptPackageBase.php (copied) (copied from cookie-optimizer/trunk/app/Includes/FeatureManager/FeatureUser/CookieIOptPackageBase.php)
-
tags/1.0.5/app/Includes/FeatureManager/FeatureUser/CookieOptBasic.php (copied) (copied from cookie-optimizer/trunk/app/Includes/FeatureManager/FeatureUser/CookieOptBasic.php)
-
tags/1.0.5/app/Includes/FeatureManager/FeatureUser/CookieOptFree.php (copied) (copied from cookie-optimizer/trunk/app/Includes/FeatureManager/FeatureUser/CookieOptFree.php)
-
tags/1.0.5/app/Includes/FeatureManager/FeatureUser/CookieOptManager.php (copied) (copied from cookie-optimizer/trunk/app/Includes/FeatureManager/FeatureUser/CookieOptManager.php)
-
tags/1.0.5/app/Includes/FeatureManager/FeatureUser/CookieOptPro.php (copied) (copied from cookie-optimizer/trunk/app/Includes/FeatureManager/FeatureUser/CookieOptPro.php)
-
tags/1.0.5/app/Services/CookieOptBannerService.php (copied) (copied from cookie-optimizer/trunk/app/Services/CookieOptBannerService.php)
-
tags/1.0.5/app/Services/CookieOptDashboardService.php (copied) (copied from cookie-optimizer/trunk/app/Services/CookieOptDashboardService.php)
-
tags/1.0.5/app/Services/CookieOptPolicyServices.php (copied) (copied from cookie-optimizer/trunk/app/Services/CookieOptPolicyServices.php)
-
tags/1.0.5/app/Services/CookieOptPublishSettingsService.php (copied) (copied from cookie-optimizer/trunk/app/Services/CookieOptPublishSettingsService.php)
-
tags/1.0.5/app/Services/CookiePermissionService.php (copied) (copied from cookie-optimizer/trunk/app/Services/CookiePermissionService.php)
-
tags/1.0.5/app/Services/ViewHelper/CookieOptBannerView.php (deleted)
-
tags/1.0.5/constants.php (copied) (copied from cookie-optimizer/trunk/constants.php) (1 diff)
-
tags/1.0.5/cookie-opt.php (copied) (copied from cookie-optimizer/trunk/cookie-opt.php) (3 diffs)
-
tags/1.0.5/functions.php (copied) (copied from cookie-optimizer/trunk/functions.php)
-
tags/1.0.5/languages/cookie-opt-ja.mo (copied) (copied from cookie-optimizer/trunk/languages/cookie-opt-ja.mo)
-
tags/1.0.5/languages/cookie-opt-ja.po (copied) (copied from cookie-optimizer/trunk/languages/cookie-opt-ja.po)
-
tags/1.0.5/languages/cookie-opt.pot (copied) (copied from cookie-optimizer/trunk/languages/cookie-opt.pot)
-
tags/1.0.5/languages/cookie-optimizer-ja.mo (deleted)
-
tags/1.0.5/languages/cookie-optimizer-ja.po (deleted)
-
tags/1.0.5/languages/cookie-optimizer.mo (deleted)
-
tags/1.0.5/languages/cookie-optimizer.pot (deleted)
-
tags/1.0.5/package.json (deleted)
-
tags/1.0.5/public/assets/css/banner.css (deleted)
-
tags/1.0.5/public/assets/css/cookie_permission_custom.css (deleted)
-
tags/1.0.5/public/assets/css/dashboard.css (deleted)
-
tags/1.0.5/public/assets/css/page_policy_render.css (copied) (copied from cookie-optimizer/trunk/public/assets/css/page_policy_render.css)
-
tags/1.0.5/public/assets/css/policy.css (deleted)
-
tags/1.0.5/public/assets/css/publish_setting.css (deleted)
-
tags/1.0.5/public/assets/css/tag_management.css (deleted)
-
tags/1.0.5/public/build/assets/css/app.css (copied) (copied from cookie-optimizer/trunk/public/build/assets/css/app.css)
-
tags/1.0.5/public/build/assets/css/banner.css (copied) (copied from cookie-optimizer/trunk/public/build/assets/css/banner.css)
-
tags/1.0.5/public/build/assets/js/banner.js (copied) (copied from cookie-optimizer/trunk/public/build/assets/js/banner.js)
-
tags/1.0.5/public/build/assets/js/cookie-policy.js (copied) (copied from cookie-optimizer/trunk/public/build/assets/js/cookie-policy.js)
-
tags/1.0.5/public/build/assets/js/cookie-scan.js (copied) (copied from cookie-optimizer/trunk/public/build/assets/js/cookie-scan.js)
-
tags/1.0.5/public/build/assets/js/cookie_startup.js (copied) (copied from cookie-optimizer/trunk/public/build/assets/js/cookie_startup.js)
-
tags/1.0.5/public/build/manifest.json (copied) (copied from cookie-optimizer/trunk/public/build/manifest.json)
-
tags/1.0.5/readme.txt (copied) (copied from cookie-optimizer/trunk/readme.txt) (2 diffs)
-
tags/1.0.5/table/create_table.php (copied) (copied from cookie-optimizer/trunk/table/create_table.php)
-
tags/1.0.5/templates/banner/banner_main.php (copied) (copied from cookie-optimizer/trunk/templates/banner/banner_main.php)
-
tags/1.0.5/templates/banner/banner_preview.php (copied) (copied from cookie-optimizer/trunk/templates/banner/banner_preview.php)
-
tags/1.0.5/templates/cookie_permissions/cookie_permission_banner.php (deleted)
-
tags/1.0.5/templates/cookie_permissions/partials/cookie_opt_setting_data_setup.php (modified) (1 diff)
-
tags/1.0.5/templates/cookie_policy/cookie-policy-page-for-render.php (copied) (copied from cookie-optimizer/trunk/templates/cookie_policy/cookie-policy-page-for-render.php)
-
tags/1.0.5/templates/module/notice.php (copied) (copied from cookie-optimizer/trunk/templates/module/notice.php)
-
tags/1.0.5/templates/module/notice_up_plan.php (copied) (copied from cookie-optimizer/trunk/templates/module/notice_up_plan.php)
-
tags/1.0.5/templates/publish_setting/index.php (copied) (copied from cookie-optimizer/trunk/templates/publish_setting/index.php)
-
tags/1.0.5/uninstall.php (copied) (copied from cookie-optimizer/trunk/uninstall.php) (1 diff)
-
tags/1.0.5/vendor/composer/autoload_classmap.php (copied) (copied from cookie-optimizer/trunk/vendor/composer/autoload_classmap.php)
-
tags/1.0.5/vendor/composer/autoload_static.php (copied) (copied from cookie-optimizer/trunk/vendor/composer/autoload_static.php)
-
trunk/app/Includes/CookieOptBanner.php (modified) (4 diffs)
-
trunk/constants.php (modified) (1 diff)
-
trunk/cookie-opt.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/cookie_permissions/partials/cookie_opt_setting_data_setup.php (modified) (1 diff)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cookie-optimizer/tags/1.0.5/app/Includes/CookieOptBanner.php
r3346172 r3346842 26 26 $package_user = $package->packageType(); 27 27 if ($package_user !== 'LOCK' && !$package->checkLimitPackage()) { 28 add_action('template_redirect', [$this, 'prepare_cookie_and_banner_logic'], 0); 28 29 add_action('wp_enqueue_scripts', [$this, 'register_enqueue_script']); 29 add_action('wp_head', [$this, 'my_banner_in_content']); 30 if (function_exists('wp_body_open')) { 31 add_action('wp_body_open', [$this, 'my_banner_in_content'], 10); 32 } else { 33 add_action('wp_footer', [$this, 'my_banner_in_content'], 10); 34 } 30 35 } 31 36 } … … 73 78 if (isset($_POST['none']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['none'])), 'none_handle_banner')) { 74 79 $type = sanitize_text_field(wp_unslash($_POST['type'])); //phpcs:ignore WordPress.Security 75 // $cookie_category = isset($_POST['cookie_category']) ? sanitize_text_field(wp_unslash($_POST['cookie_category'])) : null;76 80 $this->CookieOptBanner_service->statisticBanner($type); 77 81 return wp_send_json( … … 152 156 wp_enqueue_script('cookie-custom-banner-js'); 153 157 } 158 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 = [ 175 'action' => 0, 176 'type' => $banner['regulation'] === 'ja' ? '1' : '', 177 'necessary' => 1, 178 'functional' => 0, 179 'socialmedia' => 0, 180 'performance' => 0, 181 ]; 182 183 $options = [ 184 'expires' => $banner['regulation'] === 'ja' ? time() + 31556926 : 0, 185 'path' => '/', 186 'domain' => '', 187 'secure' => false, 188 'httponly' => false, 189 'samesite' => 'Lax', 190 ]; 191 setcookie(COOKIE_OPT_NAME, wp_json_encode($array), $options); 192 } 193 } 194 154 195 public function my_banner_in_content() 155 196 { … … 157 198 if ($is_banner_active != 1) 158 199 return null; 200 159 201 $banner = $this->CookiePermissionService->getDataBannerToShow(); 160 202 161 $banner['display'] = false; 162 163 $cookieRaw = isset($_COOKIE[COOKIE_OPT_NAME]) ? $_COOKIE[COOKIE_OPT_NAME] : null; 164 $dataCookie = json_decode(urldecode(stripslashes(sanitize_text_field(wp_unslash($cookieRaw)))), true); 165 166 if (!is_array($dataCookie) || !isset($dataCookie['action'])) { 167 // Cookie invalid -> set default 168 $array = [ 169 'action' => 0, 170 'type' => $banner['regulation'] == 'ja' ? '1' : '', 171 'necessary' => 1, 172 'functional' => 0, 173 'socialmedia' => 0, 174 'performance' => 0, 175 ]; 176 $expires_or_options = $banner['regulation'] == 'ja' ? time() + 31556926 : 0; 177 $json = wp_json_encode($array); 178 setcookie(COOKIE_OPT_NAME, $json, $expires_or_options, '/', "", false, false); 179 } else { 180 // Cookie valid and exist 181 if ($dataCookie['action'] != 0) { 182 $banner['display'] = true; 183 } 184 } 185 186 $condition_status = $banner['conditional']['status']; 187 $rules_show = $banner['conditional']['rules']['show']; 188 $rules_hide = $banner['conditional']['rules']['hide']; 189 190 if (!$rules_show || !$rules_hide) { 191 $this->render_banner($banner); 192 return; 193 } 194 if ($condition_status) { 195 if (!empty($rules_show)) { 196 foreach ($rules_show as $rule) { 197 $check = $this->CookiePermissionService->checkParam($rule); 198 if (!$check) { 199 break; 200 } 201 $this->render_banner($banner); 202 return; 203 $condition_status = (bool)($banner['conditional']['status'] ?? false); 204 $rules_show = $banner['conditional']['rules']['show'] ?? []; 205 $rules_hide = $banner['conditional']['rules']['hide'] ?? []; 206 207 $anyMatch = function (array $rules): bool { 208 foreach ($rules as $rule) { 209 if ($this->CookiePermissionService->checkParam($rule)) { 210 return true; 203 211 } 204 212 } 205 if (!empty($rules_hide)) { 206 foreach ($rules_hide as $rule) { 207 $check = $this->CookiePermissionService->checkParam($rule); 208 if ($check) { 209 break; 210 } 211 $this->render_banner($banner); 212 return; 213 } 214 } 215 } 216 $this->render_banner($banner); 213 return false; 214 }; 215 216 if (!$condition_status) { 217 $this->render_banner($banner); 218 return; 219 } 220 221 if (!empty($rules_hide) && $anyMatch($rules_hide)) { 222 return; 223 } 224 if (empty($rules_show) || $anyMatch($rules_show)) { 225 $this->render_banner($banner); 226 return; 227 } 217 228 return; 218 229 } -
cookie-optimizer/tags/1.0.5/constants.php
r3346172 r3346842 2 2 3 3 // Plugin version and mode 4 define('VERSION', '1.0. 4');4 define('VERSION', '1.0.5'); 5 5 6 6 // Plugin directory details -
cookie-optimizer/tags/1.0.5/cookie-opt.php
r3346178 r3346842 12 12 * Plugin URI: https://manage.medipartner.jp 13 13 * Description: Cookieをユーザーに見える化し、各法律にする準拠バナー同意ソリューション 14 * Version: 1.0. 414 * Version: 1.0.5 15 15 * Requires at least: 5.3 16 16 * Requires PHP: 7.3 … … 51 51 * 52 52 * @class CookieOpt 53 * @version 1.0. 453 * @version 1.0.5 54 54 */ 55 55 class CookieOpt … … 76 76 */ 77 77 public $defaults = [ 78 'version' => '1.0. 4',78 'version' => '1.0.5', 79 79 ]; 80 80 -
cookie-optimizer/tags/1.0.5/readme.txt
r3346172 r3346842 5 5 Requires PHP: 7.3 6 6 Tested up to: 6.7 7 Stable tag: 1.0. 47 Stable tag: 1.0.5 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 65 65 == Changelog == 66 66 67 = 1.0. 4=67 = 1.0.5 = 68 68 Initial release 69 69 -
cookie-optimizer/tags/1.0.5/templates/cookie_permissions/partials/cookie_opt_setting_data_setup.php
r3264201 r3346842 685 685 <?php foreach ($data['setting']['all_page'] as $key => $item): ?> 686 686 <option <?php $this->propSelected($rule['value'], $item->ID) ?> 687 value="<?php e sc_attr($item->ID) ?>">687 value="<?php echo esc_attr($item->ID) ?>"> 688 688 <?php echo esc_html($item->post_title); ?> 689 689 </option> -
cookie-optimizer/tags/1.0.5/uninstall.php
r3346172 r3346842 19 19 * 20 20 * @link https://cookieoptimizer.net 21 * @since 1.0. 421 * @since 1.0.5 22 22 * 23 23 * @package Cookie Optimizer -
cookie-optimizer/trunk/app/Includes/CookieOptBanner.php
r3346172 r3346842 26 26 $package_user = $package->packageType(); 27 27 if ($package_user !== 'LOCK' && !$package->checkLimitPackage()) { 28 add_action('template_redirect', [$this, 'prepare_cookie_and_banner_logic'], 0); 28 29 add_action('wp_enqueue_scripts', [$this, 'register_enqueue_script']); 29 add_action('wp_head', [$this, 'my_banner_in_content']); 30 if (function_exists('wp_body_open')) { 31 add_action('wp_body_open', [$this, 'my_banner_in_content'], 10); 32 } else { 33 add_action('wp_footer', [$this, 'my_banner_in_content'], 10); 34 } 30 35 } 31 36 } … … 73 78 if (isset($_POST['none']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['none'])), 'none_handle_banner')) { 74 79 $type = sanitize_text_field(wp_unslash($_POST['type'])); //phpcs:ignore WordPress.Security 75 // $cookie_category = isset($_POST['cookie_category']) ? sanitize_text_field(wp_unslash($_POST['cookie_category'])) : null;76 80 $this->CookieOptBanner_service->statisticBanner($type); 77 81 return wp_send_json( … … 152 156 wp_enqueue_script('cookie-custom-banner-js'); 153 157 } 158 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 = [ 175 'action' => 0, 176 'type' => $banner['regulation'] === 'ja' ? '1' : '', 177 'necessary' => 1, 178 'functional' => 0, 179 'socialmedia' => 0, 180 'performance' => 0, 181 ]; 182 183 $options = [ 184 'expires' => $banner['regulation'] === 'ja' ? time() + 31556926 : 0, 185 'path' => '/', 186 'domain' => '', 187 'secure' => false, 188 'httponly' => false, 189 'samesite' => 'Lax', 190 ]; 191 setcookie(COOKIE_OPT_NAME, wp_json_encode($array), $options); 192 } 193 } 194 154 195 public function my_banner_in_content() 155 196 { … … 157 198 if ($is_banner_active != 1) 158 199 return null; 200 159 201 $banner = $this->CookiePermissionService->getDataBannerToShow(); 160 202 161 $banner['display'] = false; 162 163 $cookieRaw = isset($_COOKIE[COOKIE_OPT_NAME]) ? $_COOKIE[COOKIE_OPT_NAME] : null; 164 $dataCookie = json_decode(urldecode(stripslashes(sanitize_text_field(wp_unslash($cookieRaw)))), true); 165 166 if (!is_array($dataCookie) || !isset($dataCookie['action'])) { 167 // Cookie invalid -> set default 168 $array = [ 169 'action' => 0, 170 'type' => $banner['regulation'] == 'ja' ? '1' : '', 171 'necessary' => 1, 172 'functional' => 0, 173 'socialmedia' => 0, 174 'performance' => 0, 175 ]; 176 $expires_or_options = $banner['regulation'] == 'ja' ? time() + 31556926 : 0; 177 $json = wp_json_encode($array); 178 setcookie(COOKIE_OPT_NAME, $json, $expires_or_options, '/', "", false, false); 179 } else { 180 // Cookie valid and exist 181 if ($dataCookie['action'] != 0) { 182 $banner['display'] = true; 183 } 184 } 185 186 $condition_status = $banner['conditional']['status']; 187 $rules_show = $banner['conditional']['rules']['show']; 188 $rules_hide = $banner['conditional']['rules']['hide']; 189 190 if (!$rules_show || !$rules_hide) { 191 $this->render_banner($banner); 192 return; 193 } 194 if ($condition_status) { 195 if (!empty($rules_show)) { 196 foreach ($rules_show as $rule) { 197 $check = $this->CookiePermissionService->checkParam($rule); 198 if (!$check) { 199 break; 200 } 201 $this->render_banner($banner); 202 return; 203 $condition_status = (bool)($banner['conditional']['status'] ?? false); 204 $rules_show = $banner['conditional']['rules']['show'] ?? []; 205 $rules_hide = $banner['conditional']['rules']['hide'] ?? []; 206 207 $anyMatch = function (array $rules): bool { 208 foreach ($rules as $rule) { 209 if ($this->CookiePermissionService->checkParam($rule)) { 210 return true; 203 211 } 204 212 } 205 if (!empty($rules_hide)) { 206 foreach ($rules_hide as $rule) { 207 $check = $this->CookiePermissionService->checkParam($rule); 208 if ($check) { 209 break; 210 } 211 $this->render_banner($banner); 212 return; 213 } 214 } 215 } 216 $this->render_banner($banner); 213 return false; 214 }; 215 216 if (!$condition_status) { 217 $this->render_banner($banner); 218 return; 219 } 220 221 if (!empty($rules_hide) && $anyMatch($rules_hide)) { 222 return; 223 } 224 if (empty($rules_show) || $anyMatch($rules_show)) { 225 $this->render_banner($banner); 226 return; 227 } 217 228 return; 218 229 } -
cookie-optimizer/trunk/constants.php
r3346172 r3346842 2 2 3 3 // Plugin version and mode 4 define('VERSION', '1.0. 4');4 define('VERSION', '1.0.5'); 5 5 6 6 // Plugin directory details -
cookie-optimizer/trunk/cookie-opt.php
r3346178 r3346842 12 12 * Plugin URI: https://manage.medipartner.jp 13 13 * Description: Cookieをユーザーに見える化し、各法律にする準拠バナー同意ソリューション 14 * Version: 1.0. 414 * Version: 1.0.5 15 15 * Requires at least: 5.3 16 16 * Requires PHP: 7.3 … … 51 51 * 52 52 * @class CookieOpt 53 * @version 1.0. 453 * @version 1.0.5 54 54 */ 55 55 class CookieOpt … … 76 76 */ 77 77 public $defaults = [ 78 'version' => '1.0. 4',78 'version' => '1.0.5', 79 79 ]; 80 80 -
cookie-optimizer/trunk/readme.txt
r3346172 r3346842 5 5 Requires PHP: 7.3 6 6 Tested up to: 6.7 7 Stable tag: 1.0. 47 Stable tag: 1.0.5 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 65 65 == Changelog == 66 66 67 = 1.0. 4=67 = 1.0.5 = 68 68 Initial release 69 69 -
cookie-optimizer/trunk/templates/cookie_permissions/partials/cookie_opt_setting_data_setup.php
r3264201 r3346842 685 685 <?php foreach ($data['setting']['all_page'] as $key => $item): ?> 686 686 <option <?php $this->propSelected($rule['value'], $item->ID) ?> 687 value="<?php e sc_attr($item->ID) ?>">687 value="<?php echo esc_attr($item->ID) ?>"> 688 688 <?php echo esc_html($item->post_title); ?> 689 689 </option> -
cookie-optimizer/trunk/uninstall.php
r3346172 r3346842 19 19 * 20 20 * @link https://cookieoptimizer.net 21 * @since 1.0. 421 * @since 1.0.5 22 22 * 23 23 * @package Cookie Optimizer
Note: See TracChangeset
for help on using the changeset viewer.