', $alert );
}
- }
// 許可されたHTMLタグで再度サニタイズ
return apply_filters( 'veu_promotion_alert_content', $alert );
@@ -465,11 +458,12 @@ public static function get_alert_content() {
*/
public static function display_alert_filter( $content ) {
- // アラートを取得
- $alert = self::get_alert_content();
-
- // 文頭にアラートを追加
- $content = $alert . $content;
+ if ( self::is_display( get_the_ID() ) ){
+ // アラートを取得
+ $alert = self::get_alert_content();
+ // 文頭にアラートを追加
+ $content = $alert . $content;
+ }
return $content;
}
@@ -479,12 +473,15 @@ public static function display_alert_filter( $content ) {
*/
public static function display_alert_action() {
- // アラートを取得
- $alert = self::get_alert_content();
- // 許可されたHTMLタグ
- $allowed_html = self::kses_allowed();
-
- echo wp_kses( $alert, $allowed_html );
+ if ( self::is_display( get_the_ID() ) ){
+ // アラートを取得
+ $alert = self::get_alert_content();
+ // 許可されたHTMLタグ
+ $allowed_html = self::kses_allowed();
+ echo wp_kses( $alert, $allowed_html );
+ } else {
+ return;
+ }
}
/**
diff --git a/tests/test-promotion-alert.php b/tests/test-promotion-alert.php
index 8624c528..6a0d1f7f 100644
--- a/tests/test-promotion-alert.php
+++ b/tests/test-promotion-alert.php
@@ -422,50 +422,6 @@ public function test_get_alert_content() {
),
'correct' => '
',
),
- array(
- 'name' => 'No text and content / display:hide',
- 'options' => array(
- 'alert-text' => '',
- 'alert-content' => '',
- 'alert-display' => array(
- 'post' => 'hide',
- ),
- ),
- 'correct' => '',
- ),
- array(
- 'name' => 'No content / display:hide',
- 'options' => array(
- 'alert-text' => 'aaaa',
- 'alert-content' => '',
- 'alert-display' => array(
- 'post' => 'hide',
- ),
- ),
- 'correct' => '',
- ),
- array(
- 'name' => 'No text / display:hide',
- 'options' => array(
- 'alert-text' => '',
- 'alert-content' => 'bbbb',
- 'alert-display' => array(
- 'post' => 'hide',
- ),
- ),
- 'correct' => '',
- ),
- array(
- 'name' => 'Normal text and content / display:hide',
- 'options' => array(
- 'alert-text' => 'aaaa',
- 'alert-content' => 'bbbb',
- 'alert-display' => array(
- 'post' => 'hide',
- ),
- ),
- 'correct' => '',
- ),
// XSS属性の削除をテスト
array(
'name' => 'XSS content',
diff --git a/vkExUnit.php b/vkExUnit.php
index 8b0d31b3..02d220da 100644
--- a/vkExUnit.php
+++ b/vkExUnit.php
@@ -18,7 +18,7 @@
*/
/*
-Copyright 2015-2024 Vektor,Inc. ( email : kurudrive@gmail.com )
+Copyright 2015-2024 Vektor,Inc. ( email : vk-develop@vektor-inc.co.jp )
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as