WP PLUGIN MTEE(Meta Tag etc Extend) 表示のエスケープ

・echo時データのエスケープ処理修正(esc_attrに変更)
・メソッド内でecho+エスケープするよう修正
This commit is contained in:
2021-06-19 12:09:00 +09:00
parent 937d33817a
commit dcf7e015a7
15 changed files with 188 additions and 180 deletions
+29 -17
View File
@@ -57,9 +57,9 @@ if (!class_exists('mtee_canonical_setting')) {
echo '<div class="meta_key_desc_box">
<label class="block_bold">Canonical URL</label>
<div>
<input class="width_100" type="text" name="' . MTEE_CONFIG::MTEE_CANONICAL_URL . '"
value="' . get_post_meta($post->ID, MTEE_CONFIG::MTEE_CANONICAL_URL, true) . '"
placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" />
<input class="width_100" type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_CANONICAL_URL) . '"
value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_CANONICAL_URL, true)) . '"
placeholder="' . esc_attr($this->set_default_post_canonical_url($post->ID)) . '" />
</div>
</div>';
}
@@ -101,35 +101,47 @@ placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" />
}
public function add_tax_term_fields($tag) {
$form = '<div class="form-field">Canonical URL<br>##CONTENTS##</div>';
echo $this->insert_term_meta_fields($tag, $form);
$canonical_url = $this->create_canonical_url($tag);
$placeholder = $this->create_placeholder($tag, $canonical_url);
echo '<div class="form-field">Canonical URL<br>';
echo '<input type="text"
name="' . esc_attr(MTEE_CONFIG::MTEE_CANONICAL_URL) . '"
value="' . esc_attr($canonical_url) . '"
placeholder="' . esc_attr($placeholder) . '" />';
echo '</div>';
}
public function edit_tax_term_fields($tag) {
$form = '<tr class="form-field">
<th scope="row">Canonical URL</th>
<td>##CONTENTS##</td>
$canonical_url = $this->create_canonical_url($tag);
$placeholder = $this->create_placeholder($tag, $canonical_url);
echo '<tr class="form-field">
<th scope="row">Canonical URL</th>
<td>';
echo '<input type="text"
name="' . esc_attr(MTEE_CONFIG::MTEE_CANONICAL_URL) . '"
value="' . esc_attr($canonical_url) . '"
placeholder="' . esc_attr($placeholder) . '" />';
echo '</td>
</tr>';
echo $this->insert_term_meta_fields($tag, $form);
}
public function insert_term_meta_fields($tag, $form) {
private function create_canonical_url($tag) {
$canonical_url = '';
$placeholder = '';
if (isset($tag->term_id)) {
$canonical_url = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_CANONICAL_URL, true);
}
return $canonical_url;
}
private function create_placeholder($tag, $canonical_url) {
$placeholder = '';
if (isset($tag->term_id) && empty($canonical_url)) {
$placeholder = $this->set_default_tax_canonical_url($tag->term_id, $tag->taxonomy);
}
$add_meta = '<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_CANONICAL_URL) . '" value="' . esc_html($canonical_url) . '"
placeholder="' . esc_html($placeholder) . '" />';
return str_replace('##CONTENTS##', $add_meta, $form);
return $placeholder;
}
public function set_default_tax_canonical_url($id, $taxonomy) {
private function set_default_tax_canonical_url($id, $taxonomy) {
if ($taxonomy == 'category') {
$placeholder = get_category_link($id);
} elseif ($taxonomy == 'post_tag') {
+2 -5
View File
@@ -38,7 +38,7 @@ if (!class_exists('mtee_meta_output_canonical')) {
$type = 'posts';
}
echo $this->get_canonical_data($id, $type);
echo '<link rel="canonical" href="' . esc_html($this->get_canonical_data($id, $type)) . '">' . PHP_EOL;
}
@@ -61,10 +61,7 @@ if (!class_exists('mtee_meta_output_canonical')) {
} elseif ($type == 'tax') {
$canonical = $this->set_tax_canonical($id);
}
if ($canonical) {
return '<link rel="canonical" href="' . esc_html($canonical) . '">' . PHP_EOL;
}
return $canonical;
}
public function set_top_page_canonical() {
+18 -15
View File
@@ -24,7 +24,12 @@ if (!class_exists('mtee_meta_output_keydesc')) {
public function post_output_add_metas() {
$this->create_post_output_add_metas();
echo implode(PHP_EOL, $this->metas) . PHP_EOL;
if (isset($this->metas[MTEE_CONFIG::MTEE_NAME_KEYWORDS])) {
echo '<meta name="keywords" content="' . esc_attr($this->metas[MTEE_CONFIG::MTEE_NAME_KEYWORDS]) . '" />';
}
if (isset($this->metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) {
echo '<meta name="description" content="' . esc_attr($this->metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION]) . '" />';
}
}
public function create_post_output_add_metas() {
@@ -42,25 +47,24 @@ if (!class_exists('mtee_meta_output_keydesc')) {
$type = 'post_tag';
}
if (isset($type)) {
$this->metas = $this->post_output_view_metas($type);
$this->post_output_view_metas($type);
}
if (count($this->metas) == 0) {
$this->metas = $this->create_default_keywords_description();
$this->create_default_keywords_description();
}
}
public function post_output_view_metas($type): array {
public function post_output_view_metas($type) {
$targets = get_option('_mtee');
if (isset($targets['custom_posts']) && array_key_exists($type, $targets['custom_posts'])) {
$type = 'custom_post';
} elseif (isset($targets['taxonomies']) && array_key_exists($type, $targets['taxonomies'])) {
$type = 'custom_tax';
}
$meta_data = array(
MTEE_CONFIG::MTEE_NAME_KEYWORDS => esc_html(str_replace('、', ',', $this->post_output_get_meta_keywords($type))),
MTEE_CONFIG::MTEE_NAME_DESCRIPTION => esc_html($this->post_output_get_meta_desc($type)),
$this->metas = array(
MTEE_CONFIG::MTEE_NAME_KEYWORDS => str_replace('、', ',', $this->post_output_get_meta_keywords($type)),
MTEE_CONFIG::MTEE_NAME_DESCRIPTION => $this->post_output_get_meta_desc($type),
);
return $this->create_meta_tags($meta_data);
}
public function post_output_get_meta_keywords($type) {
@@ -79,13 +83,12 @@ if (!class_exists('mtee_meta_output_keydesc')) {
return $meta_key_words;
}
public function create_default_keywords_description(): array {
public function create_default_keywords_description() {
$this->description .= $this->create_default_description();
$meta_data = array(
MTEE_CONFIG::MTEE_NAME_KEYWORDS => esc_html(implode(',', $this->create_default_keywords())),
MTEE_CONFIG::MTEE_NAME_DESCRIPTION => esc_html($this->description),
$this->metas = array(
MTEE_CONFIG::MTEE_NAME_KEYWORDS => implode(',', $this->create_default_keywords()),
MTEE_CONFIG::MTEE_NAME_DESCRIPTION => $this->description,
);
return $this->create_meta_tags($meta_data);
}
public function create_default_keywords(): array {
@@ -207,10 +210,10 @@ if (!class_exists('mtee_meta_output_keydesc')) {
public function create_meta_tags($meta_data): array {
$metas = array();
if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS])) {
$metas[] = str_replace('##KEYWORDS##', $meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS], '<meta name="keywords" content="##KEYWORDS##" />');
$metas[MTEE_CONFIG::MTEE_NAME_KEYWORDS] = str_replace('##KEYWORDS##', $meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS], '<meta name="keywords" content="##KEYWORDS##" />');
}
if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) {
$metas[] = str_replace('##DISCRIPTION##', $meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION], '<meta name="description" content="##DISCRIPTION##" />');
$metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION] = str_replace('##DISCRIPTION##', $meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION], '<meta name="description" content="##DISCRIPTION##" />');
}
return $metas;
}
+4 -4
View File
@@ -41,7 +41,7 @@ if (!class_exists('mtee_meta_output_noindexnofollow')) {
$type = 'posts';
}
echo $this->get_noindex_nofollow_data($id, $type);
$this->get_noindex_nofollow_data($id, $type);
}
@@ -56,13 +56,13 @@ if (!class_exists('mtee_meta_output_noindexnofollow')) {
return;
}
if ($status['noindex'] == '1' && $status['nofollow'] == '1') {
return '<meta name="robots" content="noindex,nofollow" />';
echo '<meta name="robots" content="noindex,nofollow" />';
}
if ($status['noindex'] == '1' && $status['nofollow'] == '0') {
return '<meta name="robots" content="noindex,follow" />';
echo '<meta name="robots" content="noindex,follow" />';
}
if ($status['noindex'] == '0' && $status['nofollow'] == '1') {
return '<meta name="robots" content="index,nofollow" />';
echo '<meta name="robots" content="index,nofollow" />';
}
}
+8 -9
View File
@@ -44,23 +44,22 @@ if (!class_exists('mtee_meta_output_ogp')) {
$this->create_ogp_description();
$this->create_ogp_image();
$this->create_ogp_url();
echo $this->set_ogp_tag();
$this->set_ogp_tag();
}
public function set_ogp_tag() {
$tags = '<meta property="og:title" content="' . esc_html($this->ogp_title) . '" />' . PHP_EOL;
$tags .= '<meta property="og:description" content="' . esc_html($this->ogp_description) . '" />' . PHP_EOL;
$tags .= '<meta property="og:type" content="' . esc_html($this->ogp_type) . '" />' . PHP_EOL;
$tags .= '<meta property="og:url" content="' . esc_html($this->ogp_url) . '" />' . PHP_EOL;
echo '<meta property="og:title" content="' . esc_attr($this->ogp_title) . '" />' . PHP_EOL;
echo '<meta property="og:description" content="' . esc_attr($this->ogp_description) . '" />' . PHP_EOL;
echo '<meta property="og:type" content="' . esc_attr($this->ogp_type) . '" />' . PHP_EOL;
echo '<meta property="og:url" content="' . esc_attr($this->ogp_url) . '" />' . PHP_EOL;
if (!empty($this->ogp_img)) {
$tags .= '<meta property="og:image" content="' . esc_html($this->ogp_img) . '" />' . PHP_EOL;
echo '<meta property="og:image" content="' . esc_attr($this->ogp_img) . '" />' . PHP_EOL;
}
$tags .= '<meta property="og:site_name" content="' . esc_html($this->site_name) . '" />' . PHP_EOL;
echo '<meta property="og:site_name" content="' . esc_attr($this->site_name) . '" />' . PHP_EOL;
// $tags .= '<meta name="twitter:card" content="summary_large_image" />' . PHP_EOL;
// $tags .= '<meta name="twitter:site" content="ツイッターのアカウント名" />' . PHP_EOL;
$tags .= '<meta property="og:locale" content="' . esc_html($this->get_ogp_locale()) . '" />' . "\n";
return $tags;
echo '<meta property="og:locale" content="' . esc_attr($this->get_ogp_locale()) . '" />' . PHP_EOL;
}
public function get_ogp_locale(): string {
+42 -36
View File
@@ -51,20 +51,18 @@ if (!class_exists('mtee_noindexnofolow_setting')) {
$nofollow_value = get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true);
echo '
<div class="meta_noindex_nofollow_box">
<div>
<label style="font-weight: bold;">noindex</label>
<input type="hidden" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_NOINDEX) . '" value="0" />
<input type="checkbox" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_NOINDEX) . '" value="1"';
checked(esc_html($noindex_value), 1);
echo ' /></div>
<div>
<label style="font-weight: bold;">nofollow</label>
<input type="hidden" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_NOFOLLOW) . '" value="0" />
<input type="checkbox" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_NOFOLLOW) . '" value="1"';
checked(esc_html($nofollow_value), 1);
echo '. />
<div>
<label style="font-weight: bold;">noindex</label>
<input type="hidden" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOINDEX) . '" value="0" />
<input type="checkbox" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOINDEX) . '" value="1" />
</div>
<div>
<label style="font-weight: bold;">nofollow</label>
<input type="hidden" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOFOLLOW) . '" value="0" />
<input type="checkbox" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOFOLLOW) . '" value="1"' . checked(esc_attr($nofollow_value), 1) . ' />
</div>
</div>
</div>';
';
}
// カスタムフィールドの値を保存
@@ -95,42 +93,50 @@ if (!class_exists('mtee_noindexnofolow_setting')) {
}
public function add_tax_term_fields($tag) {
$form = '<div class="meta_noindex_nofollow_outer">##CONTENTS##</div>';
echo $this->insert_term_meta_fields($tag, $form);
?>
<div class="meta_noindex_nofollow_outer">
<?php
$this->insert_term_meta_fields($tag);
?>
</div>
<?php
}
public function edit_tax_term_fields($tag) {
$form = '<tr class="form-field">
<th scope="row">noindex / nofollow</th>
<td>##CONTENTS##</td>
</tr>';
?>
<tr class="form-field">
<th scope="row">noindex / nofollow</th>
echo $this->insert_term_meta_fields($tag, $form);
<td>
<?php
$this->insert_term_meta_fields($tag);
?>
</td>
</tr>
<?php
}
private function insert_term_meta_fields($tag, $form) {
private function insert_term_meta_fields($tag) {
$noindex_value = '';
$nofollow_value = '';
if (isset($tag->term_id)) {
$noindex_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_NAME_NOINDEX, true);
$nofollow_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true);
}
$add_meta = '
echo '
<div class="meta_noindex_nofollow_box">
<label>
<input type="hidden" name="' . MTEE_CONFIG::MTEE_NAME_NOINDEX . '" value="0" />
<input type="checkbox" name="' . MTEE_CONFIG::MTEE_NAME_NOINDEX . '" value="1" ' . self::create_checked(1, $noindex_value) . ' />
noindex
</label>
<label>
<input type="hidden" name="' . MTEE_CONFIG::MTEE_NAME_NOFOLLOW . '" value="0" />
<input type="checkbox" name="' . MTEE_CONFIG::MTEE_NAME_NOFOLLOW . '" value="1" ' . self::create_checked(1, $nofollow_value) . ' />
nofollow
</label>
</div>';
return str_replace('##CONTENTS##', $add_meta, $form);
<label>
<input type="hidden" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOINDEX) . '" value="0" />
<input type="checkbox" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOINDEX) . '" value="1" ' . esc_attr(self::create_checked(1, $noindex_value)) . ' />
noindex
</label>
<label>
<input type="hidden" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOFOLLOW) . '" value="0" />
<input type="checkbox" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_NOFOLLOW) . '" value="1" ' . esc_attr(self::create_checked(1, $nofollow_value)) . ' />
nofollow
</label>
</div>
';
}
+8 -8
View File
@@ -49,31 +49,31 @@ if (!class_exists('mtee_ogp_post_setting')) {
<label style="font-weight: bold; display: block">title</label>
<div>
<input style="width:100%" type="text"
name="' . esc_html(MTEE_CONFIG::MTEE_OGP_TITLE) . '"
value="' . esc_html(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_TITLE, true)) . '"
placeholder="' . esc_html($this->set_default_ogp_title()) . '"/>
name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_TITLE) . '"
value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_TITLE, true)) . '"
placeholder="' . esc_attr($this->set_default_ogp_title()) . '"/>
</div>
</div>
<div class="meta_key_desc_box">
<label style="font-weight: bold; display: block">description</label>
<div>
<input style="width:100%" type="text"
name="' . esc_html(MTEE_CONFIG::MTEE_OGP_DESC) . '"
value="' . esc_html(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_DESC, true)) . '"
placeholder="' . esc_html($this->set_default_ogp_desc()) . '"/>
name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_DESC) . '"
value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_DESC, true)) . '"
placeholder="' . esc_attr($this->set_default_ogp_desc()) . '"/>
</div>
</div>
<div class="meta_key_desc_box">
<label style="font-weight: bold; display: block">image</label>
<div>
<input class="' . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . '" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . '" type="hidden" value="' . esc_html(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_IMG, true)) . '" />
<input class="' . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . '" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . '" type="hidden" value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_IMG, true)) . '" />
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択" />
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア" />
<div class="ogp_media">' . $this->set_ogp_thumb($post->ID) . '</div>
</div>
</div>
<script>
var ogp_img_name = ' . "'" . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
var ogp_img_name = ' . "'" . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
</script>';
}
+14 -14
View File
@@ -50,26 +50,26 @@ if (!class_exists('mtee_ogp_tax_setting')) {
echo '
<div class="form-field">
OGP title<br>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_TITLE) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_TITLE) . '"
value=""
placeholder="' . esc_html($input_values['title_pl']) . '"
placeholder="' . esc_attr($input_values['title_pl']) . '"
class="tax-meta-field" />
</div>
<div class="form-field">
OGP description<br>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_DESC) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_DESC) . '"
value=""
placeholder="' . esc_html($input_values['desc_pl']) . '"
placeholder="' . esc_attr($input_values['desc_pl']) . '"
class="tax-meta-field" />
</div>
<div class="form-field">
image<br>
<input class="' . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . '" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . '" type="hidden" value="" />
<input class="' . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . '" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . '" type="hidden" value="" />
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択" />
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア" />
<div class="ogp_media"></div>
<script>
var ogp_img_name = ' . "'" . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
var ogp_img_name = ' . "'" . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
</script>
</div>
';
@@ -82,23 +82,23 @@ var ogp_img_name = ' . "'" . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
<th scope="row">OGP</th>
<td>
<label class="mtee-label">title:</label>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_TITLE) . '"
value="' . esc_html($input_values['title']) . '"
placeholder="' . esc_html($input_values['title_pl']) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_TITLE) . '"
value="' . esc_attr($input_values['title']) . '"
placeholder="' . esc_attr($input_values['title_pl']) . '"
class="tax-meta-field" />
<label class="mtee-label">description:</label>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_DESC) . '"
value="' . esc_html($input_values['desc']) . '"
placeholder="' . esc_html($input_values['desc_pl']) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_DESC) . '"
value="' . esc_attr($input_values['desc']) . '"
placeholder="' . esc_attr($input_values['desc_pl']) . '"
class="tax-meta-field" />
<label class="mtee-label">image:</label>
<input class="' . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . '" name="' . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . '" type="hidden" value="' . esc_html(get_post_meta($tag->term_id, MTEE_CONFIG::MTEE_OGP_IMG, true)) . '" />
<input class="' . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . '" name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . '" type="hidden" value="' . esc_attr(get_post_meta($tag->term_id, MTEE_CONFIG::MTEE_OGP_IMG, true)) . '" />
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択" />
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア" />
<div class="ogp_media">' . $this->set_ogp_thumb($tag->term_id) . '</div>
<script>
var ogp_img_name = ' . "'" . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
var ogp_img_name = ' . "'" . esc_attr(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
</script>
</td>
</tr>
+6 -6
View File
@@ -48,14 +48,14 @@ if (!class_exists('mtee_post_setting')) {
global $post;
echo '<div class="meta_key_desc_box">
<label style="font-weight: bold; display: block">meta keywords</label>
<div><input style="width:100%" type="text" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_KEYWORDS) . '"
value="' . esc_html(get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_KEYWORDS, true)) . '"
placeholder="' . esc_html($this->set_default_keywords()) . '"/>
<div><input style="width:100%" type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_KEYWORDS) . '"
value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_KEYWORDS, true)) . '"
placeholder="' . esc_attr($this->set_default_keywords()) . '"/>
</div>';
echo '<label style="font-weight: bold; display: block">meta description</label>
<div><input style="width:100%" type="text" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_DESCRIPTION) . '"
value="' . esc_html(get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_DESCRIPTION, true)) . '"
placeholder="' . esc_html($this->set_default_description()) . '"/>
<div><input style="width:100%" type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_DESCRIPTION) . '"
value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_DESCRIPTION, true)) . '"
placeholder="' . esc_attr($this->set_default_description()) . '"/>
</div>
</div>';
}
+12 -12
View File
@@ -45,16 +45,16 @@ if (!class_exists('mtee_tax_setting')) {
echo '
<div class="form-field">
meta keywords<br>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_KEYWORDS) . '"
value="' . esc_html($input_values['keywords']) . '"
placeholder="' . esc_html($input_values['keyword_pl']) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_KEYWORDS) . '"
value="' . esc_attr($input_values['keywords']) . '"
placeholder="' . esc_attr($input_values['keyword_pl']) . '"
class="tax-meta-field" />
</div>
<div class="form-field">
meta description<br>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_DESCRIPTION) . '"
value="' . esc_html($input_values['desc']) . '"
placeholder="' . esc_html($input_values['desc_pl']) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_DESCRIPTION) . '"
value="' . esc_attr($input_values['desc']) . '"
placeholder="' . esc_attr($input_values['desc_pl']) . '"
class="tax-meta-field" />
</div>
';
@@ -67,14 +67,14 @@ class="tax-meta-field" />
<th scope="row">meta keywords<br>meta description</th>
<td>
<label class="mtee-label">meta keywords:</label>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_KEYWORDS) . '"
value="' . esc_html($input_values['keywords']) . '"
placeholder="' . esc_html($input_values['keyword_pl']) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_KEYWORDS) . '"
value="' . esc_attr($input_values['keywords']) . '"
placeholder="' . esc_attr($input_values['keyword_pl']) . '"
class="tax-meta-field" />
<label class="mtee-label">meta description:</label>
<input type="text" name="' . esc_html(MTEE_CONFIG::MTEE_NAME_DESCRIPTION) . '"
value="' . esc_html($input_values['desc']) . '"
placeholder="' . esc_html($input_values['desc_pl']) . '"
<input type="text" name="' . esc_attr(MTEE_CONFIG::MTEE_NAME_DESCRIPTION) . '"
value="' . esc_attr($input_values['desc']) . '"
placeholder="' . esc_attr($input_values['desc_pl']) . '"
class="tax-meta-field" />
</td>
</tr>
+17 -26
View File
@@ -1,15 +1,6 @@
<?php
$register_targets = MTEE::register_target();
$opt = get_option('_mtee');
//$mtee_set_nav = $_POST['mtee_set_nav'] ?? 'nav_metas';
//$enabled = $this->get_key_setting('enabled');
//$noindex_nofollow = $this->get_key_setting('noindex_nofollow');
//$ogp_setting = $this->get_key_setting('ogp_setting');
//$canonical_setting = $this->get_key_setting('canonical_setting');
//$wp_ver_disabled = $this->get_key_setting('wp_ver_disabled');
//$asset_ver_disabled = $this->get_key_setting('asset_ver_disabled');
//$emoji_disabled = $this->get_key_setting('emoji_disabled');
//$rss_disabled = $this->get_key_setting('rss_disabled');
?>
<div class="wrap">
<h2>meta keyword, description / バージョン情報 設定</h2>
@@ -25,7 +16,7 @@ $opt = get_option('_mtee');
<form action="" method="post">
<?php wp_nonce_field('check_options'); ?>
<input type="hidden" id="mtee_set_nav" name="mtee_set_nav"
value="<?php echo esc_html($_POST['mtee_set_nav'] ?? 'nav_metas'); ?>">
value="<?php echo esc_attr($_POST['mtee_set_nav'] ?? 'nav_metas'); ?>">
<div class="mtee_tab_box">
<div class="mtee-form-box">
<h2>メタキーワード・ディスクリプション</h2>
@@ -40,33 +31,33 @@ $opt = get_option('_mtee');
<p>個別設定していない投稿やカテゴリー等は、このテンプレートを適用します。</p>
<dl class="mtee_description_tmp_list">
<dt>投稿</dt>
<dd>
<dd>base[$param][$type]
<input class="mtee_keywords_tmp" type="text" name="_mtee[keywords_tmp][post]"
value="<?php echo $this->set_escape_str($opt, 'keywords_tmp', 'post'); ?>"
value="<?php echo esc_attr($opt['keywords_tmp']['post']); ?>"
placeholder="##title##,##category##,##tag##,##custom_tax##,##description##,##site_name##"
</dd>
<dt>ページ</dt>
<dd>
<input class="mtee_keywords_tmp" type="text" name="_mtee[keywords_tmp][page]"
value="<?php echo $this->set_escape_str($opt, 'keywords_tmp', 'page'); ?>"
value="<?php echo esc_attr($opt['keywords_tmp']['page']); ?>"
placeholder="##title##,##description##,##site_name##"
</dd>
<dt>カテゴリー</dt>
<dd>
<input class="mtee_keywords_tmp" type="text" name="_mtee[keywords_tmp][category]"
value="<?php echo $this->set_escape_str($opt, 'keywords_tmp', 'category'); ?>"
value="<?php echo esc_attr($opt['keywords_tmp']['category']); ?>"
placeholder="##title##,##description##,##site_name##">
</dd>
<dt>タグ</dt>
<dd>
<input class="mtee_keywords_tmp" type="text" name="_mtee[keywords_tmp][tag]"
value="<?php echo $this->set_escape_str($opt, 'keywords_tmp', 'tag'); ?>"
value="<?php echo esc_attr($opt['keywords_tmp']['tag']); ?>"
placeholder="##title##,##description##,##site_name##">
</dd>
<dt>カスタム分類</dt>
<dd>
<input class="mtee_keywords_tmp" type="text" name="_mtee[keywords_tmp][tax]"
value="<?php echo $this->set_escape_str($opt, 'keywords_tmp', 'tax'); ?>"
value="<?php echo esc_attr($opt['keywords_tmp']['tax']); ?>"
placeholder="##title##,##description##,##site_name##">
</dd>
</dl>
@@ -94,31 +85,31 @@ $opt = get_option('_mtee');
<dt>ページ/投稿</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][page]"
value="<?php echo $this->set_escape_str($opt, 'description_tmp', 'page'); ?>"
placeholder="##site_name##の<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_SINGLE_BASE); ?>"
value="<?php echo esc_attr($opt['description_tmp']['page']); ?>"
placeholder="##site_name##の<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_SINGLE_BASE); ?>"
</dd>
<dt>カテゴリー</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][category]"
value="<?php echo $this->set_escape_str($opt, 'description_tmp', 'category'); ?>"
placeholder="##site_name##の<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
value="<?php echo esc_attr($opt['description_tmp']['category']); ?>"
placeholder="##site_name##の<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
</dd>
<dt>タグ</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][tag]"
value="<?php echo $this->set_escape_str($opt, 'description_tmp', 'tag'); ?>"
placeholder="##site_name##の<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
value="<?php echo esc_attr($opt['description_tmp']['tag']); ?>"
placeholder="##site_name##の<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
</dd>
<dt>カスタム分類</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][tax]"
value="<?php echo $this->set_escape_str($opt, 'description_tmp', 'tax'); ?>"
placeholder="##site_name##の<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_html(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
value="<?php echo esc_attr($opt['description_tmp']['tax']); ?>"
placeholder="##site_name##の<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS); ?>##title##<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS); ?><?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
</dd>
</dl>
<ul>
<li>##site_name##:サイト名(<?php echo get_bloginfo('name'); ?></li>
<li>##site_description##:サイトの説明(<?php echo get_bloginfo('description'); ?></li>
<li>##site_name##:サイト名(<?php bloginfo('name'); ?></li>
<li>##site_description##:サイトの説明(<?php bloginfo('description'); ?></li>
<li>##title##:投稿、ページ、カテゴリー等のタイトル</li>
</ul>
</div>
+6 -6
View File
@@ -5,8 +5,8 @@
<th>Canonical URL</th>
<td><input class="top_page_description" type="text"
name="_mtee[top_page][canonical]"
value="<?php echo esc_html($opt['top_page']['canonical'] ?? ''); ?>"
placeholder="<?php echo get_bloginfo('url'); ?>">
value="<?php echo esc_attr($opt['top_page']['canonical'] ?? ''); ?>"
placeholder="<?php bloginfo('url'); ?>">
</td>
</tr>
</table>
@@ -17,16 +17,16 @@
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3 class="mtee_page_archive_title">
<?php echo get_post_type_object($custom_post)->label; ?>
<?php echo esc_html(get_post_type_object($custom_post)->label); ?>
<?php echo esc_html($custom_post); ?>
</h3>
<table class="form-table">
<tr valign="top">
<th>Canonical URL</th>
<td><input class="top_page_description" type="text"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][canonical]"
value="<?php echo esc_html($opt['custom_post'][$custom_post]['canonical'] ?? ''); ?>"
placeholder="<?php echo get_post_type_archive_link($custom_post); ?>">
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][canonical]"
value="<?php echo esc_attr($opt['custom_post'][$custom_post]['canonical'] ?? ''); ?>"
placeholder="<?php echo esc_attr(get_post_type_archive_link($custom_post)); ?>">
</td>
</tr>
</table>
+6 -6
View File
@@ -24,15 +24,15 @@
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3 class="mtee_page_archive_title">
<?php echo get_post_type_object($custom_post)->label; ?>
<?php echo esc_html(get_post_type_object($custom_post)->label); ?>
<?php echo esc_html($custom_post); ?>
</h3>
<table class="form-table">
<tr valign="top">
<th>meta keywords</th>
<td><input class="top_page_keywords" type="text"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][keywords]"
value="<?php echo esc_html($opt['custom_post'][$custom_post]['keywords'] ?? ''); ?>"
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][keywords]"
value="<?php echo esc_attr($opt['custom_post'][$custom_post]['keywords'] ?? ''); ?>"
placeholder="キーワード1,キーワード2,キーワード3">
<br>キーワードはカンマ(,)区切りで入力してください
</td>
@@ -40,9 +40,9 @@
<tr valign="top">
<th>meta description</th>
<td><input class="top_page_description" type="text"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][description]"
value="<?php echo esc_html($opt['custom_post'][$custom_post]['description'] ?? ''); ?>"
placeholder="<?php echo get_bloginfo('name'); ?>の[カスタム投稿ラベル]<?php echo MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE; ?>">
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][description]"
value="<?php echo esc_attr($opt['custom_post'][$custom_post]['description'] ?? ''); ?>"
placeholder="<?php bloginfo('name'); ?>の[カスタム投稿ラベル]<?php echo esc_attr(MTEE_CONFIG::MTEE_META_DESC_ARCHIVE_BASE); ?>">
</td>
</tr>
</table>
+3 -3
View File
@@ -38,7 +38,7 @@ $nofollow = $opt['top_page']['nofollow'] ?? '0';
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3 class="mtee_page_archive_title">
<?php echo get_post_type_object($custom_post)->label; ?>
<?php echo esc_html(get_post_type_object($custom_post)->label); ?>
<?php echo esc_html($custom_post); ?>
</h3>
<table class="form-table">
@@ -48,10 +48,10 @@ $nofollow = $opt['top_page']['nofollow'] ?? '0';
<div class="meta_noindex_nofollow_box">
<label>
<input type="hidden"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][noindex]"
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][noindex]"
value="0"/>
<input type="checkbox"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][noindex]" <?php checked($noindex, 1); ?>
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][noindex]" <?php checked($noindex, 1); ?>
value="1"/>
noindex
</label>
+13 -13
View File
@@ -4,21 +4,21 @@
<tr valign="top">
<th>OGP title</th>
<td><input class="top_page_keywords" type="text" name="_mtee[top_page][ogp_title]"
value="<?php echo esc_html($opt['top_page']['ogp_title'] ?? ''); ?>">
value="<?php echo esc_attr($opt['top_page']['ogp_title'] ?? ''); ?>">
</td>
</tr>
<tr valign="top">
<th>OGP description</th>
<td><input class="top_page_description" type="text" name="_mtee[top_page][ogp_description]"
value="<?php echo esc_html($opt['top_page']['ogp_description'] ?? ''); ?>">
value="<?php echo esc_attr($opt['top_page']['ogp_description'] ?? ''); ?>">
</td>
</tr>
<tr valign="top">
<th>OGP Image</th>
<td>
<input class="<?php echo esc_html(MTEE_CONFIG::MTEE_OGP_IMG); ?>" name="_mtee[top_page][ogp_img]"
<input class="<?php echo esc_attr(MTEE_CONFIG::MTEE_OGP_IMG); ?>" name="_mtee[top_page][ogp_img]"
type="hidden"
value="<?php echo esc_html($opt['top_page']['ogp_img'] ?? ''); ?>"/>
value="<?php echo esc_attr($opt['top_page']['ogp_img'] ?? ''); ?>"/>
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択"/>
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア"/>
<div class="ogp_media"><?php echo $this->get_ogp_img('top_page'); ?></div>
@@ -32,31 +32,31 @@
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3 class="mtee_page_archive_title">
<?php echo get_post_type_object($custom_post)->label; ?>
<?php echo esc_html(get_post_type_object($custom_post)->label); ?>
<?php echo esc_html($custom_post); ?>
</h3>
<table class="form-table">
<tr valign="top">
<th>OGP title</th>
<td><input class="top_page_keywords" type="text"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][ogp_title]"
value="<?php echo esc_html($opt['custom_post'][$custom_post]['ogp_title'] ?? ''); ?>">
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][ogp_title]"
value="<?php echo esc_attr($opt['custom_post'][$custom_post]['ogp_title'] ?? ''); ?>">
</td>
</tr>
<tr valign="top">
<th>OGP description</th>
<td><input class="top_page_description" type="text"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][ogp_description]"
value="<?php echo esc_html($opt['custom_post'][$custom_post]['ogp_description'] ?? ''); ?>">
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][ogp_description]"
value="<?php echo esc_attr($opt['custom_post'][$custom_post]['ogp_description'] ?? ''); ?>">
</td>
</tr>
<tr valign="top">
<th>OGP Image</th>
<td>
<input class="<?php echo esc_html(MTEE_CONFIG::MTEE_OGP_IMG); ?>"
name="_mtee[custom_post][<?php echo esc_html($custom_post); ?>][ogp_img]"
<input class="<?php echo esc_attr(MTEE_CONFIG::MTEE_OGP_IMG); ?>"
name="_mtee[custom_post][<?php echo esc_attr($custom_post); ?>][ogp_img]"
type="hidden"
value="<?php echo esc_html($opt['custom_post'][$custom_post]['ogp_img'] ?? ''); ?>"/>
value="<?php echo esc_attr($opt['custom_post'][$custom_post]['ogp_img'] ?? ''); ?>"/>
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択"/>
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア"/>
<div class="ogp_media"><?php echo $this->get_ogp_img('custom_post', $custom_post); ?></div>
@@ -67,6 +67,6 @@
<?php endforeach; ?>
<?php endif; ?>
<script>
var ogp_img_name = "<?php echo esc_html(MTEE_CONFIG::MTEE_OGP_IMG); ?>"
var ogp_img_name = "<?php echo esc_attr(MTEE_CONFIG::MTEE_OGP_IMG); ?>"
</script>