WP_PLUGIN パスワード保護ページのテキスト変更
・サニタイズとエスケープ ・完了メッセージの閉じるボタン追加
This commit is contained in:
+13
-10
@@ -30,13 +30,14 @@ class CNV_Protection_Text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function show_text_option_page() {
|
public function show_text_option_page() {
|
||||||
//$_POST['_cnv_protect_options'])があったら保存
|
$update_option = filter_input( INPUT_POST, '_cnv_protect_options', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
|
||||||
if ( isset( $_POST['_cnv_protect_options'] ) ) {
|
if ( ! empty( $update_option ) ) {
|
||||||
check_admin_referer( 'cnv_options' );
|
check_admin_referer( 'cnv_options' );
|
||||||
$opt = $_POST['_cnv_protect_options'];
|
update_option( '_cnv_protect_options', $update_option );
|
||||||
update_option( '_cnv_protect_options', $opt );
|
|
||||||
?>
|
?>
|
||||||
<div class="updated fade"><p><strong>設定を保存しました</strong></p></div><?php
|
<div id="settings_updated" class="updated notice is-dismissible">
|
||||||
|
<p><strong>設定を保存しました</strong></p>
|
||||||
|
</div><?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
@@ -76,19 +77,21 @@ class CNV_Protection_Text {
|
|||||||
<th scope="row">メッセージ</th>
|
<th scope="row">メッセージ</th>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="_cnv_protect_options[text]" rows="4"
|
<textarea name="_cnv_protect_options[text]" rows="4"
|
||||||
cols="60"><?php echo $show_text; ?></textarea>
|
cols="60"><?php echo esc_html( $show_text ); ?></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row">ボタンラベル</th>
|
<th scope="row">ボタンラベル</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="_cnv_protect_options[label]" value="<?php echo $show_label; ?>">
|
<input type="text" name="_cnv_protect_options[label]"
|
||||||
|
value="<?php echo esc_html( $show_label ); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row">ボタン名</th>
|
<th scope="row">ボタン名</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="_cnv_protect_options[btn]" value="<?php echo $show_btn; ?>">
|
<input type="text" name="_cnv_protect_options[btn]"
|
||||||
|
value="<?php echo esc_html( $show_btn ); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -127,8 +130,8 @@ class CNV_Protection_Text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return '<form action="' . home_url() . '/wp-login.php?action=postpass" class="post-password-form" method="post">
|
return '<form action="' . home_url() . '/wp-login.php?action=postpass" class="post-password-form" method="post">
|
||||||
<p>' . nl2br( $alert_text ) . '</p>
|
<p>' . nl2br( esc_html( $alert_text ) ) . '</p>
|
||||||
<p><label for="pwbox">' . $btn_label . '<input name="post_password" id="pwbox" type="password" size="20"></label> <input type="submit" name="Submit" value="' . $btn_text . '"></p></form>';
|
<p><label for="pwbox">' . esc_html( $btn_label ) . '<input name="post_password" id="pwbox" type="password" size="20"></label> <input type="submit" name="Submit" value="' . esc_html( $btn_text ) . '"></p></form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user