WP PLUGIN エスケープ処理の修正

・echo時にエスケープするようメソッド修正
・HTMLタグないのエスケープをesc_attr()に変更
This commit is contained in:
2021-06-19 09:18:48 +09:00
parent f9fe860c81
commit ff1dcdc5f4
8 changed files with 144 additions and 148 deletions
+7 -11
View File
@@ -16,7 +16,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
<form action="" method="post">
<?php wp_nonce_field( 'sh_options' ); ?>
<input id="apop_submit_type" type="hidden" name="apop_submit_type"
value="<?php echo esc_html( $submit_type ); ?>">
value="<?php echo esc_attr( $submit_type ); ?>">
<div class="post-order-box">
<div class="list-orders-outer">
<div class="list-orders-inner">
@@ -27,13 +27,12 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
?>
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
<hr>
<p>並べ替えを登録するには「変更を保存」をクリックしてください</p>
<div class="sort_box">
<?php list( $list, $alert) = APOP_UI::create_search_normal_list( 'normal' ); ?>
<p><?php echo esc_html( $alert ); ?></p>
<div class="enable_box">
<h4>有効</h4>
<ul class="post-order-list search_normal_sort">
<?php echo $list; ?>
<?php APOP_UI::create_search_normal_list( 'normal' ); ?>
</ul>
</div>
<div class="disable_box">
@@ -42,9 +41,8 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
</div>
</div>
<div class="sort_box">
<div class="no_registered_exp">&#9632;は未登録項目です。ドラッグして並び順を変更後に「変更を保存」をクリックしてください。</div>
<ul class="post-order-list drag_sort">
<?php echo APOP_UI::get_all_search_normal_posts( 'normal' ); ?>
<?php APOP_UI::get_all_search_normal_posts( 'normal' ); ?>
</ul>
</div>
</div>
@@ -60,13 +58,12 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
?>
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
<hr>
<p>並べ替えを登録するには「変更を保存」をクリックしてください</p>
<div class="sort_box">
<?php list( $list, $alert) = APOP_UI::create_search_normal_list( 'search' ); ?>
<p><?php echo esc_html( $alert ); ?></p>
<div class="enable_box">
<h4>有効</h4>
<ul class="post-order-list search_normal_sort">
<?php echo $list; ?>
<?php APOP_UI::create_search_normal_list( 'search' ); ?>
</ul>
</div>
<div class="disable_box">
@@ -75,9 +72,8 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
</div>
</div>
<div class="sort_box">
<div class="no_registered_exp">&#9632;は未登録項目です。ドラッグして並び順を変更後に「変更を保存」をクリックしてください。</div>
<ul class="post-order-list drag_sort">
<?php echo APOP_UI::get_all_search_normal_posts( 'search' ); ?>
<?php APOP_UI::get_all_search_normal_posts( 'search' ); ?>
</ul>
</div>
</div>
+3 -3
View File
@@ -1,11 +1,11 @@
<?php if ( isset( $order_target, $order_target_type ) ): ?>
<ul class="sort_menu_list"
data-order_target="<?php echo esc_html($order_target); ?>">
data-order_target="<?php echo esc_attr( $order_target ); ?>">
<li><label>
<input class="sort_menu" type="radio" name="<?php echo esc_html($order_target_type); ?>"
<input class="sort_menu" type="radio" name="<?php echo esc_attr( $order_target_type ); ?>"
value="1"<?php checked( $order_target, 1 ); ?>>標準+カスタムフィールドソート</label></li>
<li><label>
<input class="sort_menu" type="radio" name="<?php echo esc_html($order_target_type); ?>"
<input class="sort_menu" type="radio" name="<?php echo esc_attr( $order_target_type ); ?>"
value="2"<?php checked( $order_target, 2 ); ?>>ドラッグソート</label></li>
</ul>
<?php endif;
+8 -7
View File
@@ -2,7 +2,6 @@
<?php foreach ( $tax_lists as $tax_key => $tax_list ) : ?>
<div class="list-orders-outer">
<?php if ( count( $tax_list ) > 0 ): ?>
<div class="no_registered_exp">&#9632;は未登録項目です。ドラッグして並び順を変更後に「変更を保存」をクリックしてください。</div>
<?php foreach ( $tax_list as $tax_data ): ?>
<div class="list-orders-inner">
<h3><?php echo esc_html( $tax_data->name ); ?></h3>
@@ -15,33 +14,35 @@
}
?>
<ul class="sort_menu_list"
data-order_target="<?php echo esc_html( $order_target ); ?>">
data-order_target="<?php echo esc_attr( $order_target ); ?>">
<li>
<label>
<input class="sort_menu" type="radio"
name="_apop_tax_sort_type[<?php echo esc_html( $tax_data->term_id ); ?>]"
name="_apop_tax_sort_type[<?php echo esc_attr( $tax_data->term_id ); ?>]"
value="1"<?php checked( $order_target, 1 ); ?>>ドラッグソート</label>
</li>
<li>
<label>
<input class="sort_menu" type="radio"
name="_apop_tax_sort_type[<?php echo esc_html( $tax_data->term_id ); ?>]"
name="_apop_tax_sort_type[<?php echo esc_attr( $tax_data->term_id ); ?>]"
value="2"<?php checked( $order_target, 2 ); ?>>標準+カスタムフィールドソート</label>
</li>
</ul>
<div class="sort_box">
<hr>
<p>並べ替えを登録するには「変更を保存」をクリックしてください</p>
<ul class="post-order-list drag_sort">
<?php echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
</ul>
</div>
<div class="sort_box">
<?php list( $list, $alert ) = APOP_UI::create_search_normal_list( 'tax', $tax_data->term_id ); ?>
<p><?php echo esc_html( $alert ); ?></p>
<hr>
<p>並べ替えを登録するには「変更を保存」をクリックしてください</p>
<div class="enable_box">
<h4>有効</h4>
<ul class="post-order-list search_normal_sort">
<?php echo $list; ?>
<?php APOP_UI::create_search_normal_list( 'tax', $tax_data->term_id ); ?>
</ul>
</div>
<div class="disable_box">
+39 -42
View File
@@ -1,47 +1,44 @@
<div class="post-setting-box">
<form action="" method="post">
<?php
wp_nonce_field( 'sh_options' );
$opt_per_page = get_option( '_apop_per_page' );
$default_per_page = get_option( 'posts_per_page' );
?>
<h2>設定</h2>
<table class="form-table apop-form_table">
<tr>
<th scope="row">全体設定</th>
<td>
<dl class="apop_setting_list">
<dt>1ページ表示件数</dt>
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'search' ); ?>
<ul>
<li>
<label>
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo esc_html($default_per_page); ?>
</label>
</li>
<li><label>
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
</li>
<li>
<label><input class="per_page_search" type="radio"
name="_apop_per_page[search]"
value="<?php echo esc_html($per_page_data['_checked']); ?>">表示数設定
<input class="per_page_search_input" type="text"
name="_apop_per_page[search]"
value="<?php echo esc_html($per_page_data['_per_page_num']); ?>" required>
</label>
</li>
</ul>
</dd>
</dl>
</td>
</tr>
<?php APOP_UI::disp_tax_setting( 'category', 'カテゴリー', '_apop_cat_order' ); ?>
<?php APOP_UI::disp_tax_setting( 'post_tag', 'タグ', '_apop_tag_order' ); ?>
<?php APOP_UI::disp_tax_setting( 'taxonomy', 'カスタム分類', '_apop_tax_order' ); ?>
</table>
<?php wp_nonce_field( 'sh_options' ); ?>
<h2>設定</h2>
<table class="form-table apop-form_table">
<tr>
<th scope="row">全体設定</th>
<td>
<dl class="apop_setting_list">
<dt>1ページ表示件数</dt>
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( get_option( '_apop_per_page' ), 'search' ); ?>
<ul>
<li>
<label>
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo esc_html( get_option( 'posts_per_page' ) ); ?>
件)</label>
</li>
<li><label>
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
</li>
<li>
<label><input class="per_page_search" type="radio"
name="_apop_per_page[search]"
value="" <?php echo esc_attr( $per_page_data['_checked'] ); ?>>表示数設定
<input class="per_page_search_input" type="text"
name="_apop_per_page[search]"
value="<?php echo esc_attr( $per_page_data['_per_page_num'] ); ?>"
required>
</label>
</li>
</ul>
</dd>
</dl>
</td>
</tr>
<?php APOP_UI::disp_tax_setting( 'category', 'カテゴリー', '_apop_cat_order' ); ?>
<?php APOP_UI::disp_tax_setting( 'post_tag', 'タグ', '_apop_tag_order' ); ?>
<?php APOP_UI::disp_tax_setting( 'taxonomy', 'カスタム分類', '_apop_tax_order' ); ?>
</table>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/>
</form>
</div>
+13 -17
View File
@@ -1,8 +1,4 @@
<?php if ( isset( $tax_data, $order_name, $order_tax ) ): ?>
<?php
$default_per_page = get_option( 'posts_per_page' );
$opt_per_page = get_option( '_apop_per_page' );
?>
<dl class="apop_setting_list">
<dt>対象</dt>
<dd>
@@ -11,48 +7,48 @@
<?php
$opt_cat = get_option( $order_name );
$check_slug = $opt_cat['target_cat'][ $tax_datum->term_id ] ?? '';
APOP_UI::is_disp_per_page( $disp, $check_slug );
?>
<li>
<div class="select_cat">
<label>
<input type="hidden"
name="<?php echo esc_html($order_name); ?>[target_cat][<?php echo esc_html($tax_datum->term_id); ?>]"
name="<?php echo esc_attr( $order_name ); ?>[target_cat][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
value="0">
<input class="select_cat_checkbox" type="checkbox"
name="<?php echo esc_html($order_name); ?>[target_cat][<?php echo esc_html($tax_datum->term_id); ?>]"
name="<?php echo esc_attr( $order_name ); ?>[target_cat][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
<?php checked( $check_slug, 1 ); ?>
value="1">
<?php echo esc_html($tax_datum->name); ?>
<?php echo esc_html( $tax_datum->name ); ?>
</label>
</div>
<?php $per_page_data = APOP_UI::create_tax_per_page( $opt_per_page, $order_tax, $tax_datum->term_id ); ?>
<?php $per_page_data = APOP_UI::create_tax_per_page( get_option( '_apop_per_page' ), $order_tax, $tax_datum->term_id ); ?>
<div class="select_per_page">
<ul>
<li>
<label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo esc_html($default_per_page); ?>
name="_apop_per_page[<?php echo esc_attr( $order_tax ); ?>][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo esc_html( get_option( 'posts_per_page' ) ); ?>
件)</label>
</li>
<li><label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
name="_apop_per_page[<?php echo esc_attr( $order_tax ); ?>][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
</li>
<li><label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
name="_apop_per_page[<?php echo esc_attr( $order_tax ); ?>][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
</li>
<li class="set_number_list">
<label><input class="per_page_cat set_number" type="radio"
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
value=""<?php echo esc_html($per_page_data['_checked']); ?>>表示数設定
name="_apop_per_page[<?php echo esc_attr( $order_tax ); ?>][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
value=""<?php echo esc_attr( $per_page_data['_checked'] ); ?>>表示数設定
<input class="per_page_cat_input" type="text"
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
value="<?php echo esc_html($per_page_data['_per_page_num']); ?>" required>
name="_apop_per_page[<?php echo esc_attr( $order_tax ); ?>][<?php echo esc_attr( $tax_datum->term_id ); ?>]"
value="<?php echo esc_attr( $per_page_data['_per_page_num'] ); ?>"
required>
</label>
</li>
</ul>
+2 -2
View File
@@ -9,8 +9,8 @@
<?php if ( ! empty( $item ) ): ?>
<li><label><?php echo esc_html( $item ); ?></label>
<input type="text"
name="<?php echo esc_html( APOP_CUSTOM_FIELD_PREFIX . $item ); ?>"
value="<?php echo esc_html( $this->get_custom_field_data( $item ) ); ?>"/>
name="<?php echo esc_attr( APOP_CUSTOM_FIELD_PREFIX . $item ); ?>"
value="<?php echo esc_attr( $this->get_custom_field_data( $item ) ); ?>"/>
</li>
<?php endif; ?>
<?php endforeach; ?>