diff --git a/class/mtee_canonical_setting.php b/class/mtee_canonical_setting.php
index bedf5dc..3e02b14 100644
--- a/class/mtee_canonical_setting.php
+++ b/class/mtee_canonical_setting.php
@@ -57,9 +57,9 @@ if (!class_exists('mtee_canonical_setting')) {
echo '
';
}
@@ -101,35 +101,47 @@ placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" />
}
public function add_tax_term_fields($tag) {
- $form = 'Canonical URL
##CONTENTS##
';
-
- echo $this->insert_term_meta_fields($tag, $form);
+ $canonical_url = $this->create_canonical_url($tag);
+ $placeholder = $this->create_placeholder($tag, $canonical_url);
+ echo 'Canonical URL
';
+ echo '';
+ echo '
';
}
public function edit_tax_term_fields($tag) {
- $form = '
- | Canonical URL |
- ##CONTENTS## |
+ $canonical_url = $this->create_canonical_url($tag);
+ $placeholder = $this->create_placeholder($tag, $canonical_url);
+ echo '
+ | Canonical URL |
+ ';
+ echo '';
+ echo ' |
';
-
- 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 = '';
- 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') {
diff --git a/class/mtee_meta_output_canonical.php b/class/mtee_meta_output_canonical.php
index a529fbf..d68851d 100644
--- a/class/mtee_meta_output_canonical.php
+++ b/class/mtee_meta_output_canonical.php
@@ -38,7 +38,7 @@ if (!class_exists('mtee_meta_output_canonical')) {
$type = 'posts';
}
- echo $this->get_canonical_data($id, $type);
+ echo '' . 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 '' . PHP_EOL;
- }
+ return $canonical;
}
public function set_top_page_canonical() {
diff --git a/class/mtee_meta_output_keydesc.php b/class/mtee_meta_output_keydesc.php
index de54c09..c67bc61 100644
--- a/class/mtee_meta_output_keydesc.php
+++ b/class/mtee_meta_output_keydesc.php
@@ -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 '';
+ }
+ if (isset($this->metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) {
+ echo '';
+ }
}
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], '');
+ $metas[MTEE_CONFIG::MTEE_NAME_KEYWORDS] = str_replace('##KEYWORDS##', $meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS], '');
}
if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) {
- $metas[] = str_replace('##DISCRIPTION##', $meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION], '');
+ $metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION] = str_replace('##DISCRIPTION##', $meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION], '');
}
return $metas;
}
diff --git a/class/mtee_meta_output_noindexnofollow.php b/class/mtee_meta_output_noindexnofollow.php
index 8f9ea5f..8f73c60 100644
--- a/class/mtee_meta_output_noindexnofollow.php
+++ b/class/mtee_meta_output_noindexnofollow.php
@@ -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 '';
+ echo '';
}
if ($status['noindex'] == '1' && $status['nofollow'] == '0') {
- return '';
+ echo '';
}
if ($status['noindex'] == '0' && $status['nofollow'] == '1') {
- return '';
+ echo '';
}
}
diff --git a/class/mtee_meta_output_ogp.php b/class/mtee_meta_output_ogp.php
index 8f83d84..7b5d0b1 100644
--- a/class/mtee_meta_output_ogp.php
+++ b/class/mtee_meta_output_ogp.php
@@ -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 = '' . PHP_EOL;
- $tags .= '' . PHP_EOL;
- $tags .= '' . PHP_EOL;
- $tags .= '' . PHP_EOL;
+ echo '' . PHP_EOL;
+ echo '' . PHP_EOL;
+ echo '' . PHP_EOL;
+ echo '' . PHP_EOL;
if (!empty($this->ogp_img)) {
- $tags .= '' . PHP_EOL;
+ echo '' . PHP_EOL;
}
- $tags .= '' . PHP_EOL;
+ echo '' . PHP_EOL;
// $tags .= '' . PHP_EOL;
// $tags .= '' . PHP_EOL;
- $tags .= '' . "\n";
- return $tags;
+ echo '' . PHP_EOL;
}
public function get_ogp_locale(): string {
diff --git a/class/mtee_noindexnofolow_setting.php b/class/mtee_noindexnofolow_setting.php
index 0ee3519..4573bf9 100644
--- a/class/mtee_noindexnofolow_setting.php
+++ b/class/mtee_noindexnofolow_setting.php
@@ -51,20 +51,18 @@ if (!class_exists('mtee_noindexnofolow_setting')) {
$nofollow_value = get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true);
echo '
';
+';
}
// カスタムフィールドの値を保存
@@ -95,42 +93,50 @@ if (!class_exists('mtee_noindexnofolow_setting')) {
}
public function add_tax_term_fields($tag) {
- $form = '##CONTENTS##
';
-
- echo $this->insert_term_meta_fields($tag, $form);
+ ?>
+
+ insert_term_meta_fields($tag);
+ ?>
+
+
- noindex / nofollow |
- ##CONTENTS## |
- ';
+ ?>
+
+ | noindex / nofollow |
- echo $this->insert_term_meta_fields($tag, $form);
+
+ insert_term_meta_fields($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 '
-
-
-
';
-
- return str_replace('##CONTENTS##', $add_meta, $form);
+
+
+
+';
}
diff --git a/class/mtee_ogp_post_setting.php b/class/mtee_ogp_post_setting.php
index 782e980..2ac0899 100644
--- a/class/mtee_ogp_post_setting.php
+++ b/class/mtee_ogp_post_setting.php
@@ -49,31 +49,31 @@ if (!class_exists('mtee_ogp_post_setting')) {
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()) . '"/>
';
}
diff --git a/class/mtee_ogp_tax_setting.php b/class/mtee_ogp_tax_setting.php
index 23d6718..08829fe 100644
--- a/class/mtee_ogp_tax_setting.php
+++ b/class/mtee_ogp_tax_setting.php
@@ -50,26 +50,26 @@ if (!class_exists('mtee_ogp_tax_setting')) {
echo '
OGP title
-
OGP description
-
';
@@ -82,23 +82,23 @@ var ogp_img_name = ' . "'" . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . '
OGP |
-
-
-
+
' . $this->set_ogp_thumb($tag->term_id) . '
|
diff --git a/class/mtee_post_setting.php b/class/mtee_post_setting.php
index 3a4454f..2a6ee1f 100644
--- a/class/mtee_post_setting.php
+++ b/class/mtee_post_setting.php
@@ -48,14 +48,14 @@ if (!class_exists('mtee_post_setting')) {
global $post;
echo '