Skip to content

Commit

Permalink
Merge pull request #1151 from vektor-inc/fix/phpcs/root-php
Browse files Browse the repository at this point in the history
PHP CS のルール設定 & ルートの PHP を修正 & 一部テキストドメインを修正
  • Loading branch information
kurudrive authored Dec 28, 2024
2 parents 74af983 + 7db0f18 commit ca3320c
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 133 deletions.
15 changes: 9 additions & 6 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@

<!-- Rules: Check PHP version compatibility -->
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.3-"/>
<config name="testVersion" value="5.6-"/>
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>

<!-- Rules: WordPress Coding Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="4.6"/>
<config name="minimum_supported_wp_version" value="6.5"/>
<rule ref="WordPress"></rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
<property name="prefixes" type="array" value="my-plugin"/>
</properties>
<exclude-pattern>.</exclude-pattern>
</rule>
<rule ref="WordPress.NamingConventions">
<exclude-pattern>.</exclude-pattern>
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
Expand All @@ -44,4 +44,7 @@
<property name="blank_line_check" value="true"/>
</properties>
</rule>
<rule ref="Squiz.PHP.CommentedOutCode.Found">
<exclude-pattern>.</exclude-pattern>
</rule>
</ruleset>
8 changes: 4 additions & 4 deletions delete-old-option-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
*/
function veu_disable_old_packages() {
$options = veu_get_common_options();
// 古いパッケージのリスト
// 古いパッケージのリスト.
$old_packages = array(
'vk-blocks',
'tiny_mce_style_tags',
'bootstrap',
'metaKeyword',
'icon',
);
// 有効化オプションを削除
// 有効化オプションを削除.
if ( ! empty( $options ) ) {
foreach ( $old_packages as $old_package ) {
unset( $options[ 'active_' . $old_package ] );
Expand All @@ -32,7 +32,7 @@ function veu_disable_old_packages() {
* Delete Old Options
*/
function veu_delete_old_options() {
// Meta キーワードを削除
// Meta キーワードを削除.
$old_options = array(
'vkExUnit_icon_settings',
'vkExUnit_common_keywords',
Expand All @@ -49,7 +49,7 @@ function veu_delete_old_options() {
*/
function veu_delete_old_metas() {
global $wpdb;
// Meta キーワードを削除
// Meta キーワードを削除.
$old_metas = array(
'vkExUnit_metaKeyword',
);
Expand Down
2 changes: 1 addition & 1 deletion inc/other-widget/widget-taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function widget( $args, $instance ) {
$tax_args = array(
'echo' => 1,
'class' => 'veu_widget_taxonmomy',
'show_option_none' => __( 'Any', 'vk-filter-search-pro' ),
'show_option_none' => __( 'Any', 'vk-all-in-one-expansion-unit' ),
'option_none_value' => '',
'show_count' => false,
'hide_empty' => $instance['hide_empty'],
Expand Down
2 changes: 1 addition & 1 deletion inc/post-type-manager/package/class.post-type-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function add_post_type_get_help_notice() {
<li><a href="https://training.vektor-inc.co.jp/courses/x-t9-custom-post-type/" target="_blank">' . __( 'Vektor Training: X-T9 Setup Guide for Custom Post Types', 'vk-all-in-one-expansion-unit' ) . '</a></li>
<li><a href="https://training.vektor-inc.co.jp/courses/lightning-basic-settings/lessons/lightning-custom-post-type-lightning/" target="_blank">' . __( 'Vektor Training: Lightning Basic Settings for Custom Post Types', 'vk-all-in-one-expansion-unit' ) . '</a></li>
</ul>
<p><a href="' . $dismiss_url . '" target="_parent">' . esc_html__( 'Dismiss this notice', 'vk-blocks' ) . '</a></p>
<p><a href="' . $dismiss_url . '" target="_parent">' . esc_html__( 'Dismiss this notice', 'vk-all-in-one-expansion-unit' ) . '</a></p>
</div>'
);
}
Expand Down
85 changes: 55 additions & 30 deletions initialize.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
* Initialize VK All in One Expansion Unit
*
* @package VK All in One Expansion Unit
*/

/*
Delete old function data
Load modules
Add vkExUnit css
Add vkExUnit js
/*-------------------------------------------*/
*/

/*
Delete old function data
/*-------------------------------------------*/
*/
$options = get_option( 'veu_deprecated' );
if ( empty( $options['9.72.0'] ) ) {
require VEU_DIRECTORY_PATH . '/delete-old-option-meta.php';
Expand All @@ -18,8 +24,7 @@

/*
Load modules
/*
-------------------------------------------*/
*/
// ./admin/admin.php は veu_load_packages() の中に入れると
// * ExUnit のカスタマイズパネルが出なくなる
// * ExUnit_Custom_Html の読み込みでエラーになる
Expand All @@ -31,45 +36,56 @@
* @return void
*/
function veu_load_packages() {
// after_setup_theme を経由して veu-package-manager.php を読み込まないと
// 6.7 で _load_textdomain_just_in_time のエラーが出る
// after_setup_theme を経由して veu-package-manager.php を読み込まないと.
// 6.7 で _load_textdomain_just_in_time のエラーが出る.
require_once VEU_DIRECTORY_PATH . '/veu-package-manager.php';
// template-tags-veuでpackageの関数を使うので package-managerを先に読み込んでいる
// template-tags-veuでpackageの関数を使うので package-managerを先に読み込んでいる.
require_once VEU_DIRECTORY_PATH . '/inc/template-tags/template-tags-config.php';
require_once VEU_DIRECTORY_PATH . '/inc/common-block.php';
require VEU_DIRECTORY_PATH . '/inc/footer-copyright-change.php';
veu_package_include(); // package_manager.php
veu_package_include(); // package_manager.php.
}
add_action( 'after_setup_theme', 'veu_load_packages' );

/*
Add vkExUnit css
/*-------------------------------------------*/
add_action( 'after_setup_theme', 'veu_load_css_action' );
/**
* Add vkExUnit css
*/
function veu_load_css_action() {
$hook_point = apply_filters( 'veu_enqueue_point_common_css', 'wp_enqueue_scripts' );
// priority 5 : possible to overwrite from theme design skin
// priority 5 : possible to overwrite from theme design skin.
add_action( $hook_point, 'veu_print_css', 5 );
}
add_action( 'after_setup_theme', 'veu_load_css_action' );

add_action( 'wp_enqueue_scripts', 'vwu_register_css', 3 );
add_action( 'admin_enqueue_scripts', 'vwu_register_css', 3 );
/**
* Regisyter vkExUnit css
*/
function vwu_register_css() {
$options = veu_get_common_options();

wp_register_style( 'vkExUnit_common_style', plugins_url( '', __FILE__ ) . '/assets/css/vkExUnit_style.css', array(), VEU_VERSION, 'all' );
}
add_action( 'wp_enqueue_scripts', 'vwu_register_css', 3 );
add_action( 'admin_enqueue_scripts', 'vwu_register_css', 3 );

/**
* Print vkExUnit css
*/
function veu_print_css() {
wp_enqueue_style( 'vkExUnit_common_style' );
}

/**
* Print vkExUnit editor css
*/
function veu_print_editor_css() {
add_editor_style( plugins_url( '', __FILE__ ) . '/assets/css/vkExUnit_editor_style.css' );
}
add_action( 'after_setup_theme', 'veu_print_editor_css' );

// ブロックエディタ用のCSS読み込み( ↑ だけだと効かない )
/**
* ブロックエディタ用のCSS読み込み( ↑ だけだと効かない )
*/
function veu_print_block_editor_css() {
wp_register_style(
'veu-block-editor',
Expand All @@ -80,10 +96,9 @@ function veu_print_block_editor_css() {
}
add_action( 'init', 'veu_print_block_editor_css' );

/*
Add vkExUnit js
-------------------------------------------*/
add_action( 'wp_enqueue_scripts', 'veu_print_js' );
/**
* Print Js
*/
function veu_print_js() {

$options = apply_filters( 'vkExUnit_master_js_options', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
Expand All @@ -92,9 +107,10 @@ function veu_print_js() {
wp_localize_script( 'vkExUnit_master-js', 'vkExOpt', apply_filters( 'vkExUnit_localize_options', $options ) );
wp_enqueue_script( 'vkExUnit_master-js' );
}
add_action( 'wp_enqueue_scripts', 'veu_print_js' );

/**
* change old options
* Change old options
*/
function change_old_options() {
$option = get_option( 'vkExUnit_pagespeeding' );
Expand All @@ -117,31 +133,40 @@ function change_old_options() {
}
add_action( 'after_setup_theme', 'change_old_options', 4 );

/**
* Change enqueue point to footer
*
* @param string $enqueue_point enqueue point.
* @return string
*/
function veu_change_enqueue_point_to_footer( $enqueue_point ) {
$enqueue_point = 'wp_footer';
return $enqueue_point;
}

/**
* Inline styles
*/
function veu_inline_styles() {
$dynamic_css = ':root {
--ver_page_top_button_url:url(' . VEU_DIRECTORY_URI . '/assets/images/to-top-btn-icon.svg' . ');
--ver_page_top_button_url:url(' . VEU_DIRECTORY_URI . '/assets/images/to-top-btn-icon.svg);
}
@font-face {
font-weight: normal;
font-style: normal;
font-family: "vk_sns";
src: url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.eot?-bq20cj' . '");
src: url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.eot?#iefix-bq20cj' . '") format("embedded-opentype"),
url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.woff?-bq20cj' . '") format("woff"),
url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.ttf?-bq20cj' . '") format("truetype"),
url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.svg?-bq20cj#vk_sns' . '") format("svg");
src: url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.eot?-bq20cj");
src: url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.eot?#iefix-bq20cj") format("embedded-opentype"),
url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.woff?-bq20cj") format("woff"),
url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.ttf?-bq20cj") format("truetype"),
url("' . VEU_DIRECTORY_URI . '/inc/sns/icons/fonts/vk_sns.svg?-bq20cj#vk_sns") format("svg");
}';

// delete before after space
// delete before after space.
$dynamic_css = trim( $dynamic_css );
// convert tab and br to space
// convert tab and br to space.
$dynamic_css = preg_replace( '/[\n\r\t]/', '', $dynamic_css );
// Change multiple spaces to single space
// Change multiple spaces to single space.
$dynamic_css = preg_replace( '/\s(?=\s)/', '', $dynamic_css );
wp_add_inline_style( 'vkExUnit_common_style', $dynamic_css );
}
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ e.g.

== Changelog ==

[ Bud Fix ][ Taxonomy Widget / Post Type Manager ] Fix Translate Text Domain.
[ Bug Fix ][ CSS Customize ] Fix PHP warning on the settings screen of Contact Form 7.

= 9.100.7 =
Expand Down
5 changes: 5 additions & 0 deletions uninstaller.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
/**
* Uninstall VK All in One Expansion Unit
*
* @package VK All in One Expansion Unit
*/

$vkExUnit_options = veu_get_common_options();
if ( ! $vkExUnit_options['delete_options_at_deactivate'] ) {
Expand Down
Loading

0 comments on commit ca3320c

Please sign in to comment.