From d92baadf83f2937e50b395e549cdc2ec8e342011 Mon Sep 17 00:00:00 2001 From: kurudrive Date: Thu, 18 Apr 2024 01:36:16 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E5=85=AC=E9=96=8B=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E5=81=B4=E3=81=AB=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=AA=E3=81=84=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/add_plugin_link_to_adminbar.php | 31 ++++++++++++ readme.txt | 3 ++ tests/test-add-plugin-link-to-adminbar.php | 55 ++++++++++++++++++++++ vkExUnit.php | 2 +- 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 tests/test-add-plugin-link-to-adminbar.php diff --git a/inc/add_plugin_link_to_adminbar.php b/inc/add_plugin_link_to_adminbar.php index 549c8cd05..ba94a4d65 100644 --- a/inc/add_plugin_link_to_adminbar.php +++ b/inc/add_plugin_link_to_adminbar.php @@ -3,6 +3,10 @@ add_action( 'admin_bar_menu', 'veu_plugin_link_to_adminbar',100 ); function veu_plugin_link_to_adminbar( $wp_admin_bar ) { + if ( ! veu_is_add_plugin_link_to_adminbar( $GLOBALS['wp_version'], is_admin() ) ){ + return; + } + // 「有効化設定」は edit_theme_options 権限にはアクセスさせない if ( current_user_can( 'activate_plugins' ) ) { @@ -18,3 +22,30 @@ function veu_plugin_link_to_adminbar( $wp_admin_bar ) { } } + +/** + * プラグインページへのリンクを追加するかどうか + * Whether or not to add a link to the plugin page. + * + * これくらい veu_plugin_link_to_adminbar に書きたいところだが、PHPUnit でテストするために関数化 + * + * @param string $wp_version + * @param bool $is_admin + * + * @return bool + */ +function veu_is_add_plugin_link_to_adminbar( $wp_version, $is_admin = false ){ + + if ( $is_admin ){ + // 管理画面ではバージョンに関係なく追加 + return true; + } else { + // 公開画面 + if ( version_compare( $wp_version, '6.5', '>=' ) ) { + // WordPress 6.5 以上の場合はコアが追加してくるので何もしない + return false; + } else { + return true; + } + } +} diff --git a/readme.txt b/readme.txt index 32872eb37..b9f0cfc6d 100644 --- a/readme.txt +++ b/readme.txt @@ -81,6 +81,9 @@ e.g. == Changelog == += 9.97.2 = +[ Bug fix ] In WordPress 6.5, a link to the plugin page has been added to the admin bar on the front end by default. Consequently, ExUnit has been modified to no longer add this link on the front end. + = 9.97.1 = [ Bug fix ][ Child page index ] In the case of automatically inserting the child page list without using a block, the issue where all pages were displayed in WordPress 6.5 has been fixed. [ Design Bug Fix ][ Faq ] Fix stitching styles in Group blocks. diff --git a/tests/test-add-plugin-link-to-adminbar.php b/tests/test-add-plugin-link-to-adminbar.php new file mode 100644 index 000000000..0e9820315 --- /dev/null +++ b/tests/test-add-plugin-link-to-adminbar.php @@ -0,0 +1,55 @@ + '6.5 / 公開画面', + 'wp_version' => '6.5', + 'is_admin' => false, + 'expected' => false, + ), + array( + 'title' => '6.5 / 管理画面', + 'wp_version' => '6.5', + 'is_admin' => true, + 'expected' => true, + ), + array( + 'title' => '6.4 / 公開画面', + 'wp_version' => '6.4', + 'is_admin' => false, + 'expected' => true, + ), + + ); + + // print PHP_EOL; + // print '------------------------------------' . PHP_EOL; + // print 'test_veu_is_add_plugin_link_to_adminbar' . PHP_EOL; + // print '------------------------------------' . PHP_EOL; + foreach ( $tests as $key => $test_value ) { + + // 現在表示中のURLを取得 + $acutual = veu_is_add_plugin_link_to_adminbar( $test_value['wp_version'], $test_value['is_admin'] ); + + // print PHP_EOL; + // print 'title :' . $test_value['title'] . PHP_EOL; + // print 'actual :' . $acutual . PHP_EOL; + // print 'expected :' . $test_value['expected'] . PHP_EOL; + + // PHPunit + $this->assertEquals( $test_value['expected'], $acutual ); + } + } +} diff --git a/vkExUnit.php b/vkExUnit.php index 11170242c..c006b1c6f 100644 --- a/vkExUnit.php +++ b/vkExUnit.php @@ -3,7 +3,7 @@ * Plugin Name: VK All in One Expansion Unit * Plugin URI: https://ex-unit.nagoya * Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more! - * Version: 9.97.1.1 + * Version: 9.97.2.0 * Requires PHP: 7.4 * Requires at least: 5.9 * Author: Vektor,Inc. From ae70032190caaf093f5aa052eb433cdaff95aba7 Mon Sep 17 00:00:00 2001 From: kurudrive Date: Thu, 18 Apr 2024 01:45:39 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=82=92=E9=96=A2=E6=95=B0=E3=81=8B=E3=82=89=E5=8F=96?= =?UTF-8?q?=E5=BE=97=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/add_plugin_link_to_adminbar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/add_plugin_link_to_adminbar.php b/inc/add_plugin_link_to_adminbar.php index ba94a4d65..783568574 100644 --- a/inc/add_plugin_link_to_adminbar.php +++ b/inc/add_plugin_link_to_adminbar.php @@ -41,7 +41,7 @@ function veu_is_add_plugin_link_to_adminbar( $wp_version, $is_admin = false ){ return true; } else { // 公開画面 - if ( version_compare( $wp_version, '6.5', '>=' ) ) { + if ( version_compare( get_bloginfo( 'version' ), '6.5', '>=' ) ) { // WordPress 6.5 以上の場合はコアが追加してくるので何もしない return false; } else { From d6aeb8407fb5edf0159a5abfccd5265d3fbd22c8 Mon Sep 17 00:00:00 2001 From: kurudrive Date: Thu, 18 Apr 2024 01:56:12 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[=20=E3=83=86=E3=82=B9=E3=83=88=20]=20?= =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test-add-plugin-link-to-adminbar.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test-add-plugin-link-to-adminbar.php b/tests/test-add-plugin-link-to-adminbar.php index 0e9820315..4b5747df3 100644 --- a/tests/test-add-plugin-link-to-adminbar.php +++ b/tests/test-add-plugin-link-to-adminbar.php @@ -34,19 +34,19 @@ function test_veu_is_add_plugin_link_to_adminbar() { ); - // print PHP_EOL; - // print '------------------------------------' . PHP_EOL; - // print 'test_veu_is_add_plugin_link_to_adminbar' . PHP_EOL; - // print '------------------------------------' . PHP_EOL; + print PHP_EOL; + print '------------------------------------' . PHP_EOL; + print 'test_veu_is_add_plugin_link_to_adminbar' . PHP_EOL; + print '------------------------------------' . PHP_EOL; foreach ( $tests as $key => $test_value ) { // 現在表示中のURLを取得 $acutual = veu_is_add_plugin_link_to_adminbar( $test_value['wp_version'], $test_value['is_admin'] ); - // print PHP_EOL; - // print 'title :' . $test_value['title'] . PHP_EOL; - // print 'actual :' . $acutual . PHP_EOL; - // print 'expected :' . $test_value['expected'] . PHP_EOL; + print PHP_EOL; + print 'title :' . $test_value['title'] . PHP_EOL; + print 'actual :' . $acutual . PHP_EOL; + print 'expected :' . $test_value['expected'] . PHP_EOL; // PHPunit $this->assertEquals( $test_value['expected'], $acutual ); From eba19cddee0b222cb17f51a218e76e6511aed0a8 Mon Sep 17 00:00:00 2001 From: kurudrive Date: Thu, 18 Apr 2024 02:04:44 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E9=96=A2=E6=95=B0=E6=8C=87=E5=AE=9A=E3=81=99?= =?UTF-8?q?=E3=82=8B=E8=A8=98=E8=BF=B0=E3=83=9F=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/add_plugin_link_to_adminbar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/add_plugin_link_to_adminbar.php b/inc/add_plugin_link_to_adminbar.php index 783568574..06cf38aa6 100644 --- a/inc/add_plugin_link_to_adminbar.php +++ b/inc/add_plugin_link_to_adminbar.php @@ -3,7 +3,7 @@ add_action( 'admin_bar_menu', 'veu_plugin_link_to_adminbar',100 ); function veu_plugin_link_to_adminbar( $wp_admin_bar ) { - if ( ! veu_is_add_plugin_link_to_adminbar( $GLOBALS['wp_version'], is_admin() ) ){ + if ( ! veu_is_add_plugin_link_to_adminbar( get_bloginfo( 'version' ), is_admin() ) ){ return; } @@ -41,7 +41,7 @@ function veu_is_add_plugin_link_to_adminbar( $wp_version, $is_admin = false ){ return true; } else { // 公開画面 - if ( version_compare( get_bloginfo( 'version' ), '6.5', '>=' ) ) { + if ( version_compare( $wp_version, '6.5', '>=' ) ) { // WordPress 6.5 以上の場合はコアが追加してくるので何もしない return false; } else {