From fe79daa89dc8bfacb81b9cbee1c65b65ff42d510 Mon Sep 17 00:00:00 2001 From: drill-lancer Date: Mon, 2 Dec 2024 10:15:25 +0900 Subject: [PATCH 1/5] fix: format --- .husky/pre-commit | 3 - .husky/pre-push | 1 + .phpcs.xml | 6 +- admin/admin-active-setting-page.php | 42 +- admin/admin-main-setting-page.php | 30 +- admin/admin-post-metabox.php | 7 +- admin/admin.php | 85 +-- admin/admin_bar.php | 2 - admin/class-veu-metabox-insert-items.php | 5 +- admin/class-veu-metabox.php | 6 +- admin/customizer.php | 5 +- admin/disable-guide.php | 7 +- composer.json | 20 +- composer.lock | 542 +++++++++++++++++- delete-old-option-meta.php | 78 +-- inc/add-body-class.php | 1 - inc/add_archive_loop_before_widget_area.php | 1 - inc/add_menu_to_block_reuse.php | 2 +- inc/add_plugin_link_to_adminbar.php | 18 +- .../class-vk-article-structure-data.php | 10 +- inc/auto-eyecatch/auto-eyecatch.php | 7 +- inc/auto-eyecatch/class-veu-auto-eyecatch.php | 6 +- .../class-veu-metabox-eyecatch.php | 2 - inc/call-to-action/call-to-action-config.php | 4 +- .../package/block/build/block.asset.php | 5 +- inc/call-to-action/package/block/index.php | 31 +- .../package/class-veu-metabox-cta.php | 11 +- .../package/class-vk-call-to-action.php | 29 +- .../package/widget-call-to-action.php | 37 +- .../block/build/block.asset.php | 5 +- inc/child-page-index/block/index.php | 70 ++- inc/child-page-index/child-page-index.php | 2 - inc/common-block.php | 26 +- .../block/build/block.asset.php | 5 +- inc/contact-section/block/index.php | 22 +- inc/contact-section/contact-section.php | 20 +- inc/contact-section/customizer.php | 2 +- inc/contactform7-asset-optimize.php | 12 +- inc/css-customize/css-customize-single.php | 4 +- inc/default-thumbnail/customize.php | 16 +- .../default-thumbnail-admin.php | 2 +- inc/default-thumbnail/default-thumbnail.php | 33 +- inc/disable-dashbord.php | 6 +- inc/disable-emojis.php | 2 +- inc/disable-xml-sitemap.php | 2 +- inc/footer-copyright-change.php | 1 - inc/google_analytics/ga_admin.php | 2 +- inc/google_analytics/google_analytics.php | 14 +- .../class-icon-accessibility.php | 48 +- inc/icon-accessibility/icon-accessibility.php | 4 +- inc/insert-ads.php | 52 +- inc/meta-description.php | 12 +- inc/nav-menu-class-custom.php | 13 +- inc/noindex/class-veu-metabox-noindex.php | 2 - inc/noindex/noindex.php | 157 ++--- .../class-veu-other-widget-admin-control.php | 2 +- inc/other-widget/class-veu-widget-control.php | 20 +- inc/other-widget/common.php | 1 - inc/other-widget/other-widget.php | 20 +- inc/other-widget/template/admin_setting.php | 2 +- inc/other-widget/widget-3pr-area.php | 40 +- inc/other-widget/widget-archives.php | 28 +- inc/other-widget/widget-banner.php | 2 +- inc/other-widget/widget-button.php | 38 +- inc/other-widget/widget-new-posts.php | 14 +- inc/other-widget/widget-page.php | 59 +- inc/other-widget/widget-pr-blocks.php | 190 +++--- inc/other-widget/widget-profile.php | 357 ++++++------ .../widget-side-child-page-list.php | 2 - inc/other-widget/widget-taxonomies.php | 63 +- .../class-page-exclude-from-list-pages.php | 6 +- .../page-exclude-from-list-pages.php | 4 +- .../block/build/block.asset.php | 5 +- inc/page-list-ancestor/block/index.php | 24 +- inc/page-list-ancestor/page-list-ancestor.php | 40 +- inc/pagetop-btn/pagetop-btn.php | 51 +- .../package/class.post-type-manager.php | 64 +-- .../post-type-manager-config.php | 5 +- inc/promotion-alert/config.php | 8 +- .../class-veu-promotion-alert-metabox.php | 76 ++- .../package/class-veu-promotion-alert.php | 50 +- inc/related_posts/related_posts.php | 5 +- inc/sitemap-page/block/build/block.asset.php | 5 +- inc/sitemap-page/block/index.php | 64 +-- .../class-veu-metabox-sitemap.php | 2 - .../sitemap-page-admin-main-setting.php | 48 +- inc/sitemap-page/sitemap-page-helpers.php | 9 +- inc/sitemap-page/sitemap-page.php | 2 - inc/sns/block/build/block.asset.php | 5 +- inc/sns/block/index.php | 79 ++- inc/sns/class-veu-metabox-sns-button.php | 2 - inc/sns/class-veu-metabox-sns-title.php | 2 - inc/sns/function-sns-btns.php | 32 +- inc/sns/function_follow.php | 20 +- inc/sns/function_og.php | 10 +- inc/sns/sns.php | 49 +- inc/sns/sns_admin.php | 26 +- inc/sns/sns_customizer.php | 90 +-- inc/sns/widget-fb-page-plugin.php | 23 +- inc/sns/widget-twitter.php | 51 +- .../package/template-tags-veu.php | 37 +- inc/template-tags/package/template-tags.php | 7 - inc/template-tags/template-tags-config.php | 6 +- .../vk-css-optimize-config.php | 6 +- inc/vk-google-tag-manager/admin-page.php | 8 +- inc/vk-google-tag-manager/admin.php | 11 +- inc/vk-google-tag-manager/config.php | 10 +- .../package/class-vk-google-tag-manager.php | 63 +- .../class-vk-website-structure-data.php | 10 +- inc/wp-title/config.php | 7 +- .../package/class-veu-metabox-head-title.php | 2 - inc/wp-title/package/wp-title.php | 2 - initialize.php | 25 +- package.json | 3 +- tests/bootstrap.php | 10 +- tests/test-add-plugin-link-to-adminbar.php | 20 +- tests/test-article-structure.php | 250 ++++---- tests/test-change-old-options.php | 16 +- tests/test-child-page-index.php | 12 +- tests/test-css-customize.php | 8 +- tests/test-cta-default-display.php | 4 +- tests/test-cta.php | 50 +- tests/test-get-common-options-default.php | 16 +- tests/test-icon-accessibility.php | 18 +- tests/test-insert-item-meta-box-display.php | 1 - tests/test-make-ga-script.php | 54 +- tests/test-package_manager.php | 10 +- tests/test-page-list-ancestor.php | 344 +++++------ tests/test-parent-meta-box-display.php | 1 - tests/test-promotion-alert.php | 18 +- tests/test-sns-btn-style.php | 3 - tests/test-sns-btns.php | 174 +++--- tests/test-sns-title.php | 33 +- tests/test-template-tags.php | 1 - tests/test-website-structure.php | 20 +- tests/test-widget-btn.php | 1 - tests/test-widget-page.php | 186 +++--- tests/test-widget-profile.php | 100 ++-- tests/test-widget-title.php | 1 - tests/test-wp-title.php | 31 +- 140 files changed, 2664 insertions(+), 2147 deletions(-) create mode 100644 .husky/pre-push diff --git a/.husky/pre-commit b/.husky/pre-commit index 20d0d06e5..3867a0feb 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npm run lint diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 000000000..a845b850f --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1 @@ +npm run lint \ No newline at end of file diff --git a/.phpcs.xml b/.phpcs.xml index 067d574fe..b264a710b 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -26,9 +26,7 @@ - - - + @@ -38,7 +36,7 @@ - + diff --git a/admin/admin-active-setting-page.php b/admin/admin-active-setting-page.php index bbfc665f0..88586de46 100644 --- a/admin/admin-active-setting-page.php +++ b/admin/admin-active-setting-page.php @@ -28,26 +28,31 @@ foreach ( $vkExUnit_packages as $package ) : $active = veu_package_is_enable( $package['name'] ); - if ( ! empty( $package['section_title'] ) ){ + if ( ! empty( $package['section_title'] ) ) { echo '' . $package['section_title'] . ''; } else { - ?> + ?> - + - /> + ?> +/> @@ -58,25 +63,24 @@ $i = 0; if ( $count ) : foreach ( $package['attr'] as $att ) : - if ( - // パッケージが有効化されている + if ( // パッケージが有効化されている $active || // 有効ではないが enable only が false のとき empty( $att['enable_only'] ) ) : - ?> - 1 && $i >= 1 ) ? ' | ' : ''; ?> + ?> + 1 && $i >= 1 ) ? ' | ' : ''; ?> > - + > + - @@ -85,7 +89,7 @@ if ( is_array( $package['description'] ) ) : foreach ( $package['description'] as $desk ) { echo wp_kses_post( $desk ); } else : - ?> + ?>

@@ -93,7 +97,7 @@ - @@ -109,7 +113,7 @@
@@ -123,7 +127,7 @@ if ( veu_content_filter_state() == 'loop_end' ) { echo 'checked';} ?> - /> +/> diff --git a/admin/admin-main-setting-page.php b/admin/admin-main-setting-page.php index dd7c87c57..6c999bf3a 100644 --- a/admin/admin-main-setting-page.php +++ b/admin/admin-main-setting-page.php @@ -1,13 +1,13 @@ メイン設定 メニューを追加 - Main Setting Page _ ページのフレーム( メニューとメインエリア両方 ) - Main Setting Page _ メインエリアの中身 +Main Setting Page _ ExUnit > メイン設定 メニューを追加 +Main Setting Page _ ページのフレーム( メニューとメインエリア両方 ) +Main Setting Page _ メインエリアの中身 /* - Main Setting Page _ ExUnit > メイン設定 メニューを追加 +Main Setting Page _ ExUnit > メイン設定 メニューを追加 /*-------------------------------------------*/ use VektorInc\VK_Admin\VkAdmin; @@ -18,7 +18,7 @@ function veu_add_main_setting() { __( 'Main setting', 'vk-all-in-one-expansion-unit' ), // Name of page __( 'Main setting', 'vk-all-in-one-expansion-unit' ), // Label in menu 'activate_plugins', // veu_get_capability_required()でないのは edit_theme_options権限を付与したユーザーにもアクセスさせないためにactivate_pluginsにしている。 - // $capability_required, // Capability + // $capability_required, // Capability 'vkExUnit_main_setting', // ユニークなこのサブメニューページの識別子 'veu_render_main_frame' // メニューページのコンテンツを出力する関数 ); @@ -29,7 +29,7 @@ function veu_add_main_setting() { /* - Main Setting Page _ ページのフレーム( メニューとメインエリア両方 ) +Main Setting Page _ ページのフレーム( メニューとメインエリア両方 ) /*-------------------------------------------*/ function veu_render_main_frame() { @@ -65,11 +65,10 @@ function veu_render_main_frame() { } VkAdmin::admin_page_frame( $get_page_title, 'vkExUnit_the_main_setting_body', $get_logo_html, $get_menu_html ); - } /* - Main Setting Page _ メインエリアの中身 +Main Setting Page _ メインエリアの中身 /*-------------------------------------------*/ function vkExUnit_the_main_setting_body() { global $vkExUnit_options;?> @@ -79,7 +78,6 @@ function vkExUnit_the_main_setting_body() { if ( is_array( $vkExUnit_options ) ) { echo '
'; // jsでfirst-child取得用 foreach ( $vkExUnit_options as $vkoption ) { - if ( empty( $vkoption['render_page'] ) ) { continue; } @@ -90,19 +88,16 @@ function vkExUnit_the_main_setting_body() { echo ''; } echo '
'; - } else { - - echo __( 'Activated Packages is noting. please activate some package.', 'vk-all-in-one-expansion-unit' ); - + echo __( 'Activated Packages is noting. please activate some package.', 'vk-all-in-one-expansion-unit' ); } - echo ''; + echo ''; } /* - Main Setting Page _ 値をアップデート - Main Setting Page で複数のoption値が送信される。 - それらをループしながらサニタイズしながらアップデートする +Main Setting Page _ 値をアップデート +Main Setting Page で複数のoption値が送信される。 +それらをループしながらサニタイズしながらアップデートする /*-------------------------------------------*/ function veu_main_sanitaize_and_update( $_post ) { @@ -141,6 +136,7 @@ function veu_main_sanitaize_and_update( $_post ) { */ /** * [vkExUnit_register_setting description] + * * @param string $tab_label 管理画面に表示される機能の名前 * @param string $option_name option保存値 * @param string $sanitize_callback 保存時のサニタイズ関数 diff --git a/admin/admin-post-metabox.php b/admin/admin-post-metabox.php index 5229811d7..d7cc78386 100644 --- a/admin/admin-post-metabox.php +++ b/admin/admin-post-metabox.php @@ -1,16 +1,15 @@ add_node( array( 'parent' => 'veu_adminlink', @@ -34,7 +33,6 @@ function vkExUnit_adminbar_link( $wp_admin_bar ) { 'href' => admin_url() . 'admin.php?page=vkExUnit_setting_page', ) ); - } $wp_admin_bar->add_node( diff --git a/admin/class-veu-metabox-insert-items.php b/admin/class-veu-metabox-insert-items.php index 1051409f7..ec3e258bc 100644 --- a/admin/class-veu-metabox-insert-items.php +++ b/admin/class-veu-metabox-insert-items.php @@ -1,6 +1,6 @@ args ); - } public function metabox_body( $display = true ) { do_action( 'veu_metabox_insert_items' ); } - - } // class VEU_Metabox_Insert_Items { $veu_metabox_insert_items = new VEU_Metabox_Insert_Items(); diff --git a/admin/class-veu-metabox.php b/admin/class-veu-metabox.php index 74cbcfb8f..1b5bda1cb 100644 --- a/admin/class-veu-metabox.php +++ b/admin/class-veu-metabox.php @@ -39,7 +39,6 @@ public function __construct( $args = array() ) { // 通常メタボックスの追加タイミングは admin_menu だが, // ここでは admin_init でないと反映されないため add_action( 'admin_init', array( $this, 'add_individual_metabox' ) ); - } else { // Parent metabox activate @@ -57,12 +56,11 @@ public function __construct( $args = array() ) { } add_action( 'save_post', array( $this, 'save_custom_field' ) ); - } public function add_sub_parent_metabox_insert_items() { // 子ページリストやサイトマップなど「挿入アイテムの設定」を読み込むための子metaboxを読み込む - require_once dirname( __FILE__ ) . '/class-veu-metabox-insert-items.php'; + require_once __DIR__ . '/class-veu-metabox-insert-items.php'; } @@ -115,7 +113,6 @@ public function the_meta_section() { echo ''; echo ''; } - } // if ( is_array( $this->args['post_types'] ) && in_array( $now_post_type, $this->args['post_types'] ) ) { /** @@ -182,6 +179,5 @@ public function save_custom_field( $post_id ) { if ( ! empty( $_POST[ $this->args['cf_name'] ] ) ) { add_post_meta( $post_id, $this->args['cf_name'], $_POST[ $this->args['cf_name'] ] ); } - } } // class VEU_Metabox { diff --git a/admin/customizer.php b/admin/customizer.php index 3ed2c6f61..247be3c8c 100644 --- a/admin/customizer.php +++ b/admin/customizer.php @@ -31,8 +31,8 @@ function veu_customize_register( $wp_customize ) { require_once VEU_DIRECTORY_PATH . '/admin/class-exunit-custom-text-control.php'; /* - Add ExUnit Panel - /*-------------------------------------------*/ + Add ExUnit Panel + /*-------------------------------------------*/ $wp_customize->add_panel( 'veu_setting', array( @@ -42,5 +42,4 @@ function veu_customize_register( $wp_customize ) { 'title' => veu_get_prefix_customize_panel() . ' ' . __( 'Settings', 'vk-all-in-one-expansion-unit' ), ) ); - } diff --git a/admin/disable-guide.php b/admin/disable-guide.php index 5efb6a8d5..36f32622a 100644 --- a/admin/disable-guide.php +++ b/admin/disable-guide.php @@ -13,14 +13,14 @@ function vkExUnit_adminbar_disable( $wp_admin_bar ) { if ( is_user_logged_in() && ! is_admin() && current_user_can( 'administrator' ) || current_user_can( 'editor' ) ) { $args = array( 'id' => 'veu_disable_admin_edit', - 'title' => __( 'Edit Guide', 'vk-all-in-one-expansion-unit' ).' : SHOWHIDE', + 'title' => __( 'Edit Guide', 'vk-all-in-one-expansion-unit' ) . ' : SHOWHIDE', 'meta' => array( 'class' => 'veu_admin_bar_disable_button' ), ); $wp_admin_bar->add_node( $args ); } } -add_action( 'wp_head','vkExUnit_adminbar_edit_header' ); +add_action( 'wp_head', 'vkExUnit_adminbar_edit_header' ); function vkExUnit_adminbar_edit_header() { if ( is_user_logged_in() && ! is_admin() && current_user_can( 'administrator' ) || current_user_can( 'editor' ) ) { ?>