*/ if(!defined('ABSPATH')){ die('HACKING ATTEMPT!'); } function siteseo_metabox_form_html(&$metabox_data){ global $siteseo, $post, $pagenow, $typenow; $data_attr = []; $data_attr['data_tax'] = ''; $data_attr['termId'] = ''; if('post-new.php' == $pagenow || 'post.php' == $pagenow){ $data_attr['current_id'] = get_the_id(); $data_attr['origin'] = 'post'; $data_attr['title'] = get_the_title($data_attr['current_id']); } elseif('term.php' == $pagenow || 'edit-tags.php' == $pagenow){ global $tag; $data_attr['current_id'] = $tag->term_id; $data_attr['termId'] = $tag->term_id; $data_attr['origin'] = 'term'; $data_attr['data_tax'] = $tag->taxonomy; $data_attr['title'] = $tag->name; } $data_attr['isHomeId'] = get_option('page_on_front'); if($data_attr['isHomeId'] === '0'){ $data_attr['isHomeId'] = ''; } // Static Data $home_url = home_url(); $parsed_url = parse_url($home_url); $host_uri = $parsed_url['host']; $social_placeholder = SITESEO_ASSETS_DIR . '/img/social-placeholder.png'; $metabox_tag_drop_kses = [ 'button' => [ 'class' => true, 'type' => true, ], 'span' => [ 'class' => true, ], 'div' => [ 'class' => true, 'style' => true, ], 'input' => [ 'type' => true, 'class' => true, 'name' => true, 'spellcheck' => true, 'placeholder' => true, ], 'ul' => true, 'li' => [ 'class' => true, 'data-*' => true, 'tabindex' => true, ] ]; $siteseo_metabox_tabs = [ 'content-analysis' => __('Content Analysis', 'siteseo') ]; if($typenow != 'siteseo_404'){ $siteseo_metabox_tabs['title-settings'] = __('Title', 'siteseo'); $siteseo_metabox_tabs['social-settings'] = __('Social', 'siteseo'); $siteseo_metabox_tabs['advanced-settings'] = __('Advanced', 'siteseo'); } $siteseo_metabox_tabs['redirect'] = __('Redirects', 'siteseo'); echo '
'; } function siteseo_resolve_text($text){ global $pagenow; // The text does not have any variable. if(strpos($text, '%%') === FALSE){ return $text; } $post_id = get_the_id(); if('term.php' == $pagenow || 'edit-tags.php' == $pagenow){ global $tag; $post_id = $tag->term_id; $term_id = $tag->term_id; } $home_id = (int) get_option('page_on_front'); $contextPage = siteseo_get_service('ContextPage')->buildContextWithCurrentId($post_id); if(isset($post_id)){ $contextPage->setPostById($post_id); $contextPage->setIsSingle(true); $terms = get_the_terms($post_id, 'post_tag'); if(!empty($terms)){ $contextPage->setHasTag(true); } $categories = get_the_terms($post_id, 'category'); if(!empty($categories)){ $contextPage->setHasCategory(true); } } if($post_id === $home_id && null !== $home_id){ $contextPage->setIsHome(true); } if(isset($term_id) && $term_id !== null && $post_id === $term_id){ $contextPage->setIsCategory(true); $contextPage->setTermId($term_id); } $resolved_text = siteseo_get_service('TagsToString')->replace($text, $contextPage->getContext()); return $resolved_text; }