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 ' @@ -56,22 +56,22 @@ placeholder="' . $this->set_default_ogp_title() . '"/>