From 1c1d97cedf065ad7c02e4c8ea6db150bda916717 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 17 Jun 2021 15:11:15 +0900 Subject: [PATCH] =?UTF-8?q?WP=20PLUGIN=20MTEE(Meta=20Tag=20etc=20Extend)?= =?UTF-8?q?=20=E5=AE=9A=E6=95=B0=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・グローバル定数からクラス定数に変更 --- class/mtee.php | 4 +-- class/mtee_canonical_setting.php | 18 +++++------ class/mtee_meta_output_canonical.php | 8 ++--- class/mtee_meta_output_keydesc.php | 24 +++++++-------- class/mtee_meta_output_noindexnofollow.php | 8 ++--- class/mtee_meta_output_ogp.php | 18 +++++------ class/mtee_noindexnofolow_setting.php | 36 +++++++++++----------- class/mtee_ogp_post_setting.php | 32 +++++++++---------- class/mtee_ogp_tax_setting.php | 36 +++++++++++----------- class/mtee_post_setting.php | 22 ++++++------- class/mtee_tax_setting.php | 22 ++++++------- config.php | 20 ------------ meta-tag-etc-extend.php | 29 +++++++++-------- mtee_config.php | 30 ++++++++++++++++++ template/index.php | 8 ++--- template/pages_meta.php | 4 +-- template/pages_ogp.php | 6 ++-- trait/mtee_meta_desc_trait.php | 12 ++++---- 18 files changed, 173 insertions(+), 164 deletions(-) delete mode 100644 config.php create mode 100644 mtee_config.php diff --git a/class/mtee.php b/class/mtee.php index f283527..0042231 100644 --- a/class/mtee.php +++ b/class/mtee.php @@ -34,9 +34,9 @@ if (!class_exists('MTEE')) { check_admin_referer('check_options'); $opt = $_POST['_mtee']; update_option('_mtee', $opt); - require_once MTEE_TEMPLATE_DIR . 'success.php'; + require_once MTEE_CONFIG::MTEE_TEMPLATE_DIR . 'success.php'; } - require_once MTEE_TEMPLATE_DIR . 'index.php'; + require_once MTEE_CONFIG::MTEE_TEMPLATE_DIR . 'index.php'; } public static function register_target(): array { diff --git a/class/mtee_canonical_setting.php b/class/mtee_canonical_setting.php index 09f0efe..4175f5c 100644 --- a/class/mtee_canonical_setting.php +++ b/class/mtee_canonical_setting.php @@ -55,8 +55,8 @@ if (!class_exists('mtee_canonical_setting')) { echo '
-
'; @@ -64,10 +64,10 @@ placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" /> // カスタムフィールドの値を保存 public function save_meta_fields($post_id) { - if (!empty($_POST[MTEE_CANONICAL_URL])) { //meta_keywordsが入力されている場合 - update_post_meta($post_id, MTEE_CANONICAL_URL, $_POST[MTEE_CANONICAL_URL]); //値を保存 + if (!empty($_POST[MTEE_CONFIG::MTEE_CANONICAL_URL])) { //meta_keywordsが入力されている場合 + update_post_meta($post_id, MTEE_CONFIG::MTEE_CANONICAL_URL, $_POST[MTEE_CONFIG::MTEE_CANONICAL_URL]); //値を保存 } else { //未入力の場合は値を削除 - delete_post_meta($post_id, MTEE_CANONICAL_URL); + delete_post_meta($post_id, MTEE_CONFIG::MTEE_CANONICAL_URL); } } @@ -121,12 +121,12 @@ placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" /> $canonical_url = ''; $placeholder = ''; if (isset($tag->term_id)) { - $canonical_url = get_term_meta($tag->term_id, MTEE_CANONICAL_URL, true); + $canonical_url = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_CANONICAL_URL, true); } 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); } @@ -143,8 +143,8 @@ placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" /> } public function save_terms($term_id) { - if (array_key_exists(MTEE_CANONICAL_URL, $_POST)) { - update_term_meta($term_id, MTEE_CANONICAL_URL, $_POST[MTEE_CANONICAL_URL]); + if (array_key_exists(MTEE_CONFIG::MTEE_CANONICAL_URL, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_CANONICAL_URL, $_POST[MTEE_CONFIG::MTEE_CANONICAL_URL]); } } diff --git a/class/mtee_meta_output_canonical.php b/class/mtee_meta_output_canonical.php index e5c7116..ef6fb58 100644 --- a/class/mtee_meta_output_canonical.php +++ b/class/mtee_meta_output_canonical.php @@ -85,7 +85,7 @@ if (!class_exists('mtee_meta_output_canonical')) { } public function set_post_canonical($id) { - $canonical = get_post_meta($id, MTEE_CANONICAL_URL, true); + $canonical = get_post_meta($id, MTEE_CONFIG::MTEE_CANONICAL_URL, true); if (empty($canonical)) { $canonical = get_permalink($id); global $page, $paged; @@ -97,7 +97,7 @@ if (!class_exists('mtee_meta_output_canonical')) { } public function set_category_canonical($id) { - $canonical = get_term_meta($id, MTEE_CANONICAL_URL, true); + $canonical = get_term_meta($id, MTEE_CONFIG::MTEE_CANONICAL_URL, true); if (empty($canonical)) { $canonical = get_category_link($id); } @@ -105,7 +105,7 @@ if (!class_exists('mtee_meta_output_canonical')) { } public function set_tag_canonical($id) { - $canonical = get_term_meta($id, MTEE_CANONICAL_URL, true); + $canonical = get_term_meta($id, MTEE_CONFIG::MTEE_CANONICAL_URL, true); if (empty($canonical)) { $canonical = get_tag_link($id); } @@ -113,7 +113,7 @@ if (!class_exists('mtee_meta_output_canonical')) { } public function set_tax_canonical($id) { - $canonical = get_term_meta($id, MTEE_CANONICAL_URL, true); + $canonical = get_term_meta($id, MTEE_CONFIG::MTEE_CANONICAL_URL, true); if (empty($canonical)) { $canonical = get_term_link((int)$id); } diff --git a/class/mtee_meta_output_keydesc.php b/class/mtee_meta_output_keydesc.php index 135ea5d..da9d976 100644 --- a/class/mtee_meta_output_keydesc.php +++ b/class/mtee_meta_output_keydesc.php @@ -6,7 +6,7 @@ if (!defined('ABSPATH')) { if (!class_exists('mtee_meta_output_keydesc')) { - include MTEE_TRAIT_DIR . 'mtee_meta_desc_trait.php'; + include MTEE_CONFIG::MTEE_TRAIT_DIR . 'mtee_meta_desc_trait.php'; class mtee_meta_output_keydesc { @@ -18,7 +18,7 @@ if (!class_exists('mtee_meta_output_keydesc')) { public function __construct() { $this->site_name = get_bloginfo('name'); - $this->description = $this->site_name . MTEE_META_DESC_PARTICLE; + $this->description = $this->site_name . MTEE_CONFIG::MTEE_META_DESC_PARTICLE; add_action('wp_head', array($this, 'post_output_add_metas')); } @@ -57,8 +57,8 @@ if (!class_exists('mtee_meta_output_keydesc')) { $type = 'custom_tax'; } $meta_data = array( - MTEE_NAME_KEYWORDS => str_replace('、', ',', $this->post_output_get_meta_keywords($type)), - MTEE_NAME_DESCRIPTION => $this->post_output_get_meta_desc($type), + 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); } @@ -72,9 +72,9 @@ if (!class_exists('mtee_meta_output_keydesc')) { $meta_key_words = get_option('_mtee')['custom_post'][$custom_post_name]['keywords']; } elseif ($type == 'custom_tax' || $type == 'category' || $type == 'post_tag') { $queried_object = get_queried_object(); - $meta_key_words = get_term_meta($queried_object->term_id, MTEE_NAME_KEYWORDS, true); + $meta_key_words = get_term_meta($queried_object->term_id, MTEE_CONFIG::MTEE_NAME_KEYWORDS, true); } else { - $meta_key_words = get_post_meta($post->ID, MTEE_NAME_KEYWORDS, true); + $meta_key_words = get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_KEYWORDS, true); } return $meta_key_words; } @@ -82,8 +82,8 @@ if (!class_exists('mtee_meta_output_keydesc')) { public function create_default_keywords_description(): array { $this->description .= $this->create_default_description(); $meta_data = array( - MTEE_NAME_KEYWORDS => implode(',', $this->create_default_keywords()), - MTEE_NAME_DESCRIPTION => $this->description, + MTEE_CONFIG::MTEE_NAME_KEYWORDS => implode(',', $this->create_default_keywords()), + MTEE_CONFIG::MTEE_NAME_DESCRIPTION => $this->description, ); return $this->create_meta_tags($meta_data); } @@ -206,11 +206,11 @@ if (!class_exists('mtee_meta_output_keydesc')) { public function create_meta_tags($meta_data): array { $metas = array(); - if (!empty($meta_data[MTEE_NAME_KEYWORDS])) { - $metas[] = str_replace('##KEYWORDS##', $meta_data[MTEE_NAME_KEYWORDS], ''); + if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS])) { + $metas[] = str_replace('##KEYWORDS##', $meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS], ''); } - if (!empty($meta_data[MTEE_NAME_DESCRIPTION])) { - $metas[] = str_replace('##DISCRIPTION##', $meta_data[MTEE_NAME_DESCRIPTION], ''); + if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) { + $metas[] = 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 71e955d..8f9ea5f 100644 --- a/class/mtee_meta_output_noindexnofollow.php +++ b/class/mtee_meta_output_noindexnofollow.php @@ -77,11 +77,11 @@ if (!class_exists('mtee_meta_output_noindexnofollow')) { $noindex = get_option('_mtee')['custom_post'][$custom_post_name]['noindex']; $nofollow = get_option('_mtee')['custom_post'][$custom_post_name]['nofollow']; } elseif ($type == 'posts') { - $noindex = get_post_meta($id, MTEE_NAME_NOINDEX, true); - $nofollow = get_post_meta($id, MTEE_NAME_NOFOLLOW, true); + $noindex = get_post_meta($id, MTEE_CONFIG::MTEE_NAME_NOINDEX, true); + $nofollow = get_post_meta($id, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true); } elseif ($type == 'tax') { - $noindex = get_term_meta($id, MTEE_NAME_NOINDEX, true); - $nofollow = get_term_meta($id, MTEE_NAME_NOFOLLOW, true); + $noindex = get_term_meta($id, MTEE_CONFIG::MTEE_NAME_NOINDEX, true); + $nofollow = get_term_meta($id, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true); } return array( diff --git a/class/mtee_meta_output_ogp.php b/class/mtee_meta_output_ogp.php index 2336765..5d66bd3 100644 --- a/class/mtee_meta_output_ogp.php +++ b/class/mtee_meta_output_ogp.php @@ -90,9 +90,9 @@ if (!class_exists('mtee_meta_output_ogp')) { $this->ogp_title = get_option('_mtee')['custom_post'][$custom_post_name]['ogp_title']; } elseif (is_category() || is_tag() || is_tax()) { $queried_object = get_queried_object(); - $this->ogp_title = get_term_meta($queried_object->term_id, MTEE_OGP_TITLE, true); + $this->ogp_title = get_term_meta($queried_object->term_id, MTEE_CONFIG::MTEE_OGP_TITLE, true); } elseif (is_page() || is_single()) { - $this->ogp_title = get_post_meta($post->ID, MTEE_OGP_TITLE, true); + $this->ogp_title = get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_TITLE, true); } if (empty($this->ogp_title)) { $this->create_default_title(); @@ -131,14 +131,14 @@ if (!class_exists('mtee_meta_output_ogp')) { $this->ogp_description = get_option('_mtee')['custom_post'][$custom_post_name]['ogp_description']; } elseif (is_category() || is_tag() || is_tax()) { $queried_object = get_queried_object(); - $this->ogp_description = get_term_meta($queried_object->term_id, MTEE_OGP_DESC, true); + $this->ogp_description = get_term_meta($queried_object->term_id, MTEE_CONFIG::MTEE_OGP_DESC, true); } elseif (is_page() || is_single()) { - $this->ogp_description = get_post_meta($post->ID, MTEE_OGP_DESC, true); + $this->ogp_description = get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_DESC, true); } } public function set_default_description() { - $this->ogp_description = $this->site_name . MTEE_META_DESC_PARTICLE; + $this->ogp_description = $this->site_name . MTEE_CONFIG::MTEE_META_DESC_PARTICLE; $type = ''; $ogp_desc = ''; @@ -224,22 +224,22 @@ if (!class_exists('mtee_meta_output_ogp')) { } public function set_post_ogp_img($id) { - $id = get_post_meta($id, MTEE_OGP_IMG, true); + $id = get_post_meta($id, MTEE_CONFIG::MTEE_OGP_IMG, true); $this->get_thumbnail($id); } public function set_category_ogp_img($id) { - $id = get_term_meta($id, MTEE_OGP_IMG, true); + $id = get_term_meta($id, MTEE_CONFIG::MTEE_OGP_IMG, true); $this->get_thumbnail($id); } public function set_tag_ogp_img($id) { - $id = get_term_meta($id, MTEE_OGP_IMG, true); + $id = get_term_meta($id, MTEE_CONFIG::MTEE_OGP_IMG, true); $this->get_thumbnail($id); } public function set_tax_ogp_img($id) { - $id = get_term_meta($id, MTEE_OGP_IMG, true); + $id = get_term_meta($id, MTEE_CONFIG::MTEE_OGP_IMG, true); $this->get_thumbnail($id); } diff --git a/class/mtee_noindexnofolow_setting.php b/class/mtee_noindexnofolow_setting.php index 80d398d..d0d696c 100644 --- a/class/mtee_noindexnofolow_setting.php +++ b/class/mtee_noindexnofolow_setting.php @@ -45,20 +45,20 @@ if (!class_exists('mtee_noindexnofolow_setting')) { // カスタムフィールドの入力エリア public function insert_meta_fields() { global $post; - $noindex_value = get_post_meta($post->ID, MTEE_NAME_NOINDEX, true); - $nofollow_value = get_post_meta($post->ID, MTEE_NAME_NOFOLLOW, true); + $noindex_value = get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_NOINDEX, true); + $nofollow_value = get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true); echo '
- - +
- - +
@@ -67,8 +67,8 @@ if (!class_exists('mtee_noindexnofolow_setting')) { // カスタムフィールドの値を保存 public function save_meta_fields($post_id) { - update_post_meta($post_id, MTEE_NAME_NOINDEX, $_POST[MTEE_NAME_NOINDEX] ?? ''); - update_post_meta($post_id, MTEE_NAME_NOFOLLOW, $_POST[MTEE_NAME_NOFOLLOW] ?? ''); + update_post_meta($post_id, MTEE_CONFIG::MTEE_NAME_NOINDEX, $_POST[MTEE_CONFIG::MTEE_NAME_NOINDEX] ?? ''); + update_post_meta($post_id, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, $_POST[MTEE_CONFIG::MTEE_NAME_NOFOLLOW] ?? ''); } //------------------------------------------------------------------------------------------- @@ -111,19 +111,19 @@ if (!class_exists('mtee_noindexnofolow_setting')) { $noindex_value = ''; $nofollow_value = ''; if (isset($tag->term_id)) { - $noindex_value = get_term_meta($tag->term_id, MTEE_NAME_NOINDEX, true); - $nofollow_value = get_term_meta($tag->term_id, MTEE_NAME_NOFOLLOW, true); + $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 = '
'; @@ -141,11 +141,11 @@ nofollow } public function save_terms($term_id) { - if (array_key_exists(MTEE_NAME_NOINDEX, $_POST)) { - update_term_meta($term_id, MTEE_NAME_NOINDEX, $_POST[MTEE_NAME_NOINDEX]); + if (array_key_exists(MTEE_CONFIG::MTEE_NAME_NOINDEX, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_NAME_NOINDEX, $_POST[MTEE_CONFIG::MTEE_NAME_NOINDEX]); } - if (array_key_exists(MTEE_NAME_NOFOLLOW, $_POST)) { - update_term_meta($term_id, MTEE_NAME_NOFOLLOW, $_POST[MTEE_NAME_NOFOLLOW]); + if (array_key_exists(MTEE_CONFIG::MTEE_NAME_NOFOLLOW, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, $_POST[MTEE_CONFIG::MTEE_NAME_NOFOLLOW]); } } diff --git a/class/mtee_ogp_post_setting.php b/class/mtee_ogp_post_setting.php index cc70936..1bd22f5 100644 --- a/class/mtee_ogp_post_setting.php +++ b/class/mtee_ogp_post_setting.php @@ -47,8 +47,8 @@ if (!class_exists('mtee_ogp_post_setting')) {
@@ -56,22 +56,22 @@ placeholder="' . $this->set_default_ogp_title() . '"/>
- +
' . $this->set_ogp_thumb($post->ID) . '
'; } @@ -84,7 +84,7 @@ var ogp_img_name = ' . "'" . MTEE_OGP_IMG . "'" . ' } public function set_ogp_thumb($id): string { - $ogp_thumb = get_post_meta($id, MTEE_OGP_IMG, true); + $ogp_thumb = get_post_meta($id, MTEE_CONFIG::MTEE_OGP_IMG, true); if (!empty($ogp_thumb)) { return ''; } @@ -93,20 +93,20 @@ var ogp_img_name = ' . "'" . MTEE_OGP_IMG . "'" . ' // カスタムフィールドの値を保存 public function save_meta_fields($post_id) { - if (!empty($_POST[MTEE_OGP_TITLE])) { //meta_keywordsが入力されている場合 - update_post_meta($post_id, MTEE_OGP_TITLE, $_POST[MTEE_OGP_TITLE]); //値を保存 + if (!empty($_POST[MTEE_CONFIG::MTEE_OGP_TITLE])) { //meta_keywordsが入力されている場合 + update_post_meta($post_id, MTEE_CONFIG::MTEE_OGP_TITLE, $_POST[MTEE_CONFIG::MTEE_OGP_TITLE]); //値を保存 } else { //未入力の場合は値を削除 - delete_post_meta($post_id, MTEE_OGP_TITLE); + delete_post_meta($post_id, MTEE_CONFIG::MTEE_OGP_TITLE); } - if (!empty($_POST[MTEE_OGP_DESC])) { - update_post_meta($post_id, MTEE_OGP_DESC, $_POST[MTEE_OGP_DESC]); + if (!empty($_POST[MTEE_CONFIG::MTEE_OGP_DESC])) { + update_post_meta($post_id, MTEE_CONFIG::MTEE_OGP_DESC, $_POST[MTEE_CONFIG::MTEE_OGP_DESC]); } else { - delete_post_meta($post_id, MTEE_OGP_DESC); + delete_post_meta($post_id, MTEE_CONFIG::MTEE_OGP_DESC); } - if (!empty($_POST[MTEE_OGP_IMG])) { - update_post_meta($post_id, MTEE_OGP_IMG, $_POST[MTEE_OGP_IMG]); + if (!empty($_POST[MTEE_CONFIG::MTEE_OGP_IMG])) { + update_post_meta($post_id, MTEE_CONFIG::MTEE_OGP_IMG, $_POST[MTEE_CONFIG::MTEE_OGP_IMG]); } else { - delete_post_meta($post_id, MTEE_OGP_IMG); + delete_post_meta($post_id, MTEE_CONFIG::MTEE_OGP_IMG); } } diff --git a/class/mtee_ogp_tax_setting.php b/class/mtee_ogp_tax_setting.php index c59cc33..e8ea9de 100644 --- a/class/mtee_ogp_tax_setting.php +++ b/class/mtee_ogp_tax_setting.php @@ -48,26 +48,26 @@ if (!class_exists('mtee_ogp_tax_setting')) { echo '
OGP title
-
OGP description
-
image
- +
'; @@ -80,23 +80,23 @@ var ogp_img_name = ' . "'" . MTEE_OGP_IMG . "'" . ' OGP - - - +
' . $this->set_ogp_thumb($tag->term_id) . '
@@ -109,8 +109,8 @@ var ogp_img_name = ' . "'" . MTEE_OGP_IMG . "'" . ' $title_placeholder = ''; $desc_placeholder = ''; if (isset($tag->term_id)) { - $title_value = get_term_meta($tag->term_id, MTEE_OGP_TITLE, true); - $desc_value = get_term_meta($tag->term_id, MTEE_OGP_DESC, true); + $title_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_OGP_TITLE, true); + $desc_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_OGP_DESC, true); $title_placeholder = $this->set_default_title($tag); $desc_placeholder = $this->set_default_description($title_placeholder); } @@ -131,7 +131,7 @@ var ogp_img_name = ' . "'" . MTEE_OGP_IMG . "'" . ' } public function set_ogp_thumb($id): string { - $ogp_thumb = get_post_meta($id, MTEE_OGP_IMG, true); + $ogp_thumb = get_post_meta($id, MTEE_CONFIG::MTEE_OGP_IMG, true); if (!empty($ogp_thumb)) { return ''; } @@ -139,16 +139,16 @@ var ogp_img_name = ' . "'" . MTEE_OGP_IMG . "'" . ' } function save_terms($term_id) { - if (array_key_exists(MTEE_OGP_TITLE, $_POST)) { - update_term_meta($term_id, MTEE_OGP_TITLE, $_POST[MTEE_OGP_TITLE]); + if (array_key_exists(MTEE_CONFIG::MTEE_OGP_TITLE, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_OGP_TITLE, $_POST[MTEE_CONFIG::MTEE_OGP_TITLE]); } - if (array_key_exists(MTEE_OGP_DESC, $_POST)) { - update_term_meta($term_id, MTEE_OGP_DESC, $_POST[MTEE_OGP_DESC]); + if (array_key_exists(MTEE_CONFIG::MTEE_OGP_DESC, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_OGP_DESC, $_POST[MTEE_CONFIG::MTEE_OGP_DESC]); } - if (!empty($_POST[MTEE_OGP_IMG])) { - update_post_meta($term_id, MTEE_OGP_IMG, $_POST[MTEE_OGP_IMG]); + if (!empty($_POST[MTEE_CONFIG::MTEE_OGP_IMG])) { + update_post_meta($term_id, MTEE_CONFIG::MTEE_OGP_IMG, $_POST[MTEE_CONFIG::MTEE_OGP_IMG]); } else { - delete_post_meta($term_id, MTEE_OGP_IMG); + delete_post_meta($term_id, MTEE_CONFIG::MTEE_OGP_IMG); } } diff --git a/class/mtee_post_setting.php b/class/mtee_post_setting.php index ca30761..1e4c3a0 100644 --- a/class/mtee_post_setting.php +++ b/class/mtee_post_setting.php @@ -46,13 +46,13 @@ if (!class_exists('mtee_post_setting')) { global $post; echo '
-
'; echo ' -
'; @@ -60,15 +60,15 @@ placeholder="' . $this->set_default_description() . '"/> // カスタムフィールドの値を保存 public function save_meta_fields($post_id) { - if (!empty($_POST[MTEE_NAME_KEYWORDS])) { //meta_keywordsが入力されている場合 - update_post_meta($post_id, MTEE_NAME_KEYWORDS, $_POST[MTEE_NAME_KEYWORDS]); //値を保存 + if (!empty($_POST[MTEE_CONFIG::MTEE_NAME_KEYWORDS])) { //meta_keywordsが入力されている場合 + update_post_meta($post_id, MTEE_CONFIG::MTEE_NAME_KEYWORDS, $_POST[MTEE_CONFIG::MTEE_NAME_KEYWORDS]); //値を保存 } else { //未入力の場合は値を削除 - delete_post_meta($post_id, MTEE_NAME_KEYWORDS); + delete_post_meta($post_id, MTEE_CONFIG::MTEE_NAME_KEYWORDS); } - if (!empty($_POST[MTEE_NAME_DESCRIPTION])) { - update_post_meta($post_id, MTEE_NAME_DESCRIPTION, $_POST[MTEE_NAME_DESCRIPTION]); + if (!empty($_POST[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) { + update_post_meta($post_id, MTEE_CONFIG::MTEE_NAME_DESCRIPTION, $_POST[MTEE_CONFIG::MTEE_NAME_DESCRIPTION]); } else { - delete_post_meta($post_id, MTEE_NAME_DESCRIPTION); + delete_post_meta($post_id, MTEE_CONFIG::MTEE_NAME_DESCRIPTION); } } @@ -91,7 +91,7 @@ placeholder="' . $this->set_default_description() . '"/> if (!empty($this->options['description_tmp']['page'])) { return $this->options['description_tmp']['page']; } - return '##site_name##の' . MTEE_META_DESC_BEFORE_BRACKETS . '##title##' . MTEE_META_DESC_AFTER_BRACKETS . MTEE_META_DESC_SINGLE_BASE; + return '##site_name##の' . MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS . '##title##' . MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS . MTEE_CONFIG::MTEE_META_DESC_SINGLE_BASE; } } diff --git a/class/mtee_tax_setting.php b/class/mtee_tax_setting.php index 778cdc2..274a778 100644 --- a/class/mtee_tax_setting.php +++ b/class/mtee_tax_setting.php @@ -43,14 +43,14 @@ if (!class_exists('mtee_tax_setting')) { echo '
meta keywords
-
meta description
- @@ -65,12 +65,12 @@ class="tax-meta-field" /> meta keywords
meta description - - @@ -85,8 +85,8 @@ class="tax-meta-field" /> $keyword_placeholder = ''; $desc_placeholder = ''; if (isset($tag->term_id)) { - $key_value = get_term_meta($tag->term_id, MTEE_NAME_KEYWORDS, true); - $desc_value = get_term_meta($tag->term_id, MTEE_NAME_DESCRIPTION, true); + $key_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_NAME_KEYWORDS, true); + $desc_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_NAME_DESCRIPTION, true); $keyword_placeholder = $this->set_default_keywords($tag); $desc_placeholder = $this->set_default_description($tag); } @@ -121,17 +121,17 @@ class="tax-meta-field" /> $description = $this->options['description_tmp']['tax']; } if (empty($description)) { - $description = '##site_name##の' . MTEE_META_DESC_BEFORE_BRACKETS . '##title##' . MTEE_META_DESC_AFTER_BRACKETS . MTEE_META_DESC_SINGLE_BASE; + $description = '##site_name##の' . MTEE_CONFIG::MTEE_META_DESC_BEFORE_BRACKETS . '##title##' . MTEE_CONFIG::MTEE_META_DESC_AFTER_BRACKETS . MTEE_CONFIG::MTEE_META_DESC_SINGLE_BASE; } return $description; } function save_terms($term_id) { - if (array_key_exists(MTEE_NAME_KEYWORDS, $_POST)) { - update_term_meta($term_id, MTEE_NAME_KEYWORDS, $_POST[MTEE_NAME_KEYWORDS]); + if (array_key_exists(MTEE_CONFIG::MTEE_NAME_KEYWORDS, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_NAME_KEYWORDS, $_POST[MTEE_CONFIG::MTEE_NAME_KEYWORDS]); } - if (array_key_exists(MTEE_NAME_DESCRIPTION, $_POST)) { - update_term_meta($term_id, MTEE_NAME_DESCRIPTION, $_POST[MTEE_NAME_DESCRIPTION]); + if (array_key_exists(MTEE_CONFIG::MTEE_NAME_DESCRIPTION, $_POST)) { + update_term_meta($term_id, MTEE_CONFIG::MTEE_NAME_DESCRIPTION, $_POST[MTEE_CONFIG::MTEE_NAME_DESCRIPTION]); } } } diff --git a/config.php b/config.php deleted file mode 100644 index 33a35e6..0000000 --- a/config.php +++ /dev/null @@ -1,20 +0,0 @@ -get_options(); // enabled my meta keywords, description if ($mtee->is_enable('enabled')) { - require_once MTEE_CLASS_DIR . 'mtee_tax_setting.php'; - require_once MTEE_CLASS_DIR . 'mtee_post_setting.php'; - require_once MTEE_CLASS_DIR . 'mtee_meta_output_keydesc.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_tax_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_post_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_meta_output_keydesc.php'; new mtee_tax_setting($options); new mtee_post_setting($options); new mtee_meta_output_keydesc(); @@ -46,18 +45,18 @@ if ($mtee->is_enable('enabled')) { // enabled my canonical. caution : default canonical delete if ($mtee->is_enable('canonical_setting')) { remove_action('wp_head', 'rel_canonical'); - require_once MTEE_CLASS_DIR . 'mtee_canonical_setting.php'; - require_once MTEE_CLASS_DIR . 'mtee_meta_output_canonical.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_canonical_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_meta_output_canonical.php'; new mtee_canonical_setting($options); new mtee_meta_output_canonical(); } // enabled my OGP tag if ($mtee->is_enable('ogp_setting')) { - include MTEE_TRAIT_DIR . 'mtee_meta_desc_trait.php'; - require_once MTEE_CLASS_DIR . 'mtee_ogp_tax_setting.php'; - require_once MTEE_CLASS_DIR . 'mtee_ogp_post_setting.php'; - require_once MTEE_CLASS_DIR . 'mtee_meta_output_ogp.php'; + include MTEE_CONFIG::MTEE_TRAIT_DIR . 'mtee_meta_desc_trait.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_ogp_tax_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_ogp_post_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_meta_output_ogp.php'; new mtee_ogp_tax_setting($options); new mtee_ogp_post_setting($options); new mtee_meta_output_ogp(); @@ -65,8 +64,8 @@ if ($mtee->is_enable('ogp_setting')) { //enabled my noindex, nofollow if ($mtee->is_enable('noindex_nofollow')) { - require_once MTEE_CLASS_DIR . 'mtee_noindexnofolow_setting.php'; - require_once MTEE_CLASS_DIR . 'mtee_meta_output_noindexnofollow.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_noindexnofolow_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_meta_output_noindexnofollow.php'; new mtee_noindexnofolow_setting($options); new mtee_meta_output_noindexnofollow(); } @@ -80,7 +79,7 @@ $disabled_checks = array( ); foreach ($disabled_checks as $disabled_check) { if ($mtee->is_disable($disabled_check)) { - require_once MTEE_CLASS_DIR . 'mtee_version_setting.php'; + require_once MTEE_CONFIG::MTEE_CLASS_DIR . 'mtee_version_setting.php'; new mtee_version_setting($options); break; } diff --git a/mtee_config.php b/mtee_config.php new file mode 100644 index 0000000..64b4cfc --- /dev/null +++ b/mtee_config.php @@ -0,0 +1,30 @@ +get_key_setting('rss_disabled');
カテゴリー
+ placeholder="##site_name##の##title##">
タグ
+ placeholder="##site_name##の##title##">
カスタム分類
+ placeholder="##site_name##の##title##">