WP6.0 対応チェック

軽微な修正
・テンプレートのミスタイプの修正
・メソッドの戻り型指定の追加
・不要な変数代入の削除
・ファイルインクルードの条件追加
This commit is contained in:
2022-05-28 19:50:26 +09:00
parent 7b67bdf5f4
commit 6f064eaafa
3 changed files with 442 additions and 428 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ Plugin URI: https://develop.n-k-y.net/wordpress/wp_plugin/apop/
Author: NBK45 Author: NBK45
Author URI: https://develop.n-k-y.net Author URI: https://develop.n-k-y.net
Description: Archive Post Order Plus は「最新の投稿」「検索結果」「カテゴリー」「タグ」「カスタム分類」の投稿記事の表示順をドラッグで並べ替えて設定するプラグインです。 Description: Archive Post Order Plus は「最新の投稿」「検索結果」「カテゴリー」「タグ」「カスタム分類」の投稿記事の表示順をドラッグで並べ替えて設定するプラグインです。
Version: 1.2.0 Version: 1.2.1
License: GPLv2 License: GPLv2
Text Domain: ArchivePostOrderPlus Text Domain: ArchivePostOrderPlus
Domain Path: /languages Domain Path: /languages
+9 -8
View File
@@ -69,7 +69,7 @@ if ( ! class_exists( 'APOP_UI' ) ) {
); );
} }
private static function get_all_custom_posts() { private static function get_all_custom_posts(): array {
$custom_posts = array_values(get_post_types(array('public' => true, '_builtin' => false))); $custom_posts = array_values(get_post_types(array('public' => true, '_builtin' => false)));
$custom_post_data = array(); $custom_post_data = array();
foreach ($custom_posts as $custom_post) { foreach ($custom_posts as $custom_post) {
@@ -259,10 +259,11 @@ value="' . esc_html( $sort_num ) . '">
public static function disp_tax_setting($key, $title, $order_name) { public static function disp_tax_setting($key, $title, $order_name) {
$tax_data = APOP_UI::get_all_taxonomies($key); $tax_data = APOP_UI::get_all_taxonomies($key);
if (count($tax_data) > 0) { if (count($tax_data) > 0) {
$order_name = $order_name;
$order_tax = $key == 'post_tag' ? 'tag' : $key; $order_tax = $key == 'post_tag' ? 'tag' : $key;
echo '<tr><th scope="row">' . esc_html($title) . '</th><td>'; echo '<tr><th scope="row">' . esc_html($title) . '</th><td>';
if (isset($tax_data, $order_name, $order_tax)) {
include APOP_PLUGIN_PATH . 'template/setting_parts_taxonomy.php'; include APOP_PLUGIN_PATH . 'template/setting_parts_taxonomy.php';
}
echo '</td></tr>'; echo '</td></tr>';
} }
} }
@@ -270,10 +271,10 @@ value="' . esc_html( $sort_num ) . '">
public static function disp_customposts_setting($key, $title, $order_name) { public static function disp_customposts_setting($key, $title, $order_name) {
$custom_post_data = APOP_UI::get_all_custom_posts(); $custom_post_data = APOP_UI::get_all_custom_posts();
if (count($custom_post_data) > 0) { if (count($custom_post_data) > 0) {
$order_name = $order_name;
$order = $key;
echo '<tr><th scope="row">' . esc_html($title) . '</th><td>'; echo '<tr><th scope="row">' . esc_html($title) . '</th><td>';
if (isset($custom_post_data, $order_name, $key)) {
include APOP_PLUGIN_PATH . 'template/setting_parts_customposts.php'; include APOP_PLUGIN_PATH . 'template/setting_parts_customposts.php';
}
echo '</td></tr>'; echo '</td></tr>';
} }
} }
@@ -341,7 +342,7 @@ value="' . esc_html( $sort_num ) . '">
$name_value_type = '_' . $name_key . '[' . $target_key . '][field][value_type]'; $name_value_type = '_' . $name_key . '[' . $target_key . '][field][value_type]';
$name_custom_field_type = '_' . $name_key . '[' . $target_key . '][field][custom_field_type]'; $name_custom_field_type = '_' . $name_key . '[' . $target_key . '][field][custom_field_type]';
$custom_field_val_1 = $custom_field_type == '1' ? $meta_key : ''; $custom_field_val_1 = $custom_field_type == '1' ? $meta_key : '';
$custom_field_val_2 = $custom_field_type == '2' ? $meta_key : '';; $custom_field_val_2 = $custom_field_type == '2' ? $meta_key : '';
echo '<div class="sort-custom-field"> echo '<div class="sort-custom-field">
<div class="sort-custom-field-types"> <div class="sort-custom-field-types">
<div class="sort-custom-field-inner-label"> <div class="sort-custom-field-inner-label">
@@ -356,7 +357,7 @@ value="' . esc_html( $sort_num ) . '">
name="' . esc_attr($name_custom_field_type) . '" name="' . esc_attr($name_custom_field_type) . '"
value="2"' . esc_attr(self::set_search_normal_checked($custom_field_type, '2')) . '>' . __('Add', APOP_DOMAIN) . '</label> value="2"' . esc_attr(self::set_search_normal_checked($custom_field_type, '2')) . '>' . __('Add', APOP_DOMAIN) . '</label>
</div>'; </div>';
echo '<input type="text" class="select-custom-field-input custom_field_key_select" name="' . esc_attr( $name_meta_key ) . '" . value="' . esc_attr( $custom_field_val_1 ) . '" required> echo '<input type="text" class="select-custom-field-input custom_field_key_select" name="' . esc_attr($name_meta_key) . '" value="' . esc_attr($custom_field_val_1) . '" required>
<input type="text" class="custom_field_key" name="' . esc_attr($name_meta_key) . '" value="' . esc_attr($custom_field_val_2) . '" required> <input type="text" class="custom_field_key" name="' . esc_attr($name_meta_key) . '" value="' . esc_attr($custom_field_val_2) . '" required>
</div> </div>
<div class="custom-field-select-alert"></div> <div class="custom-field-select-alert"></div>
@@ -424,7 +425,7 @@ value="' . esc_html( $sort_num ) . '">
} }
} }
private static function set_search_normal_target_keys( $post_apop_search_order_param ) { private static function set_search_normal_target_keys($post_apop_search_order_param): array {
$set_keys = array( $set_keys = array(
'date', 'date',
@@ -450,7 +451,6 @@ value="' . esc_html( $sort_num ) . '">
if ($param == $default) { if ($param == $default) {
return ' checked="checked"'; return ' checked="checked"';
} }
return ''; return '';
} }
@@ -461,6 +461,7 @@ value="' . esc_html( $sort_num ) . '">
if ($type == 'str') { if ($type == 'str') {
return filter_input(INPUT_POST, $var_name, FILTER_SANITIZE_STRING); return filter_input(INPUT_POST, $var_name, FILTER_SANITIZE_STRING);
} }
return '';
} }
public static function create_normal_sort_list($name_key, $order_param) { public static function create_normal_sort_list($name_key, $order_param) {
+16 -3
View File
@@ -2,9 +2,9 @@
Contributors: nbk45 Contributors: nbk45
Tags: latest posts order,categories post order,tags post order,custom taxonomy post order Tags: latest posts order,categories post order,tags post order,custom taxonomy post order
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.9 Tested up to: 6.0
Requires PHP: 7.0 Requires PHP: 7.4
Stable tag: 1.2.0 Stable tag: 1.2.1
License: GPLv2 or later License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -82,6 +82,19 @@ screenshot-7.png
screenshot-8.png screenshot-8.png
== Changelog == == Changelog ==
= 1.2.1 =
confirm WordPress6.0
Fix template typos.
Add method return type specification.
Delete unnecessary variable assignments.
Add condition to file include.
WordPress6.0動作確認
テンプレートのミスタイプの修正
メソッドの戻り型指定の追加
不要な変数代入の削除
ファイルインクルードの条件追加
= 1.2.0 = = 1.2.0 =
confirm WordPress5.9 confirm WordPress5.9
Fixed Notice error in custom post archive. Fixed Notice error in custom post archive.