/** * @param array $opts * @param null $location * @param null $defaults * @param null $post * * @return array */ function get_current_options($opts = array(), $location = null, $defaults = null, $post = null) { if ('aiosp' === $location && 'metabox' == $this->locations[$location]['type']) { if (null === $post) { global $post; } $post_id = $post; if (is_object($post_id)) { $post_id = $post_id->ID; } $get_opts = $this->default_options($location); $optlist = array('keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel'); if (!!empty($this->options['aiosp_can']) && !empty($this->options['aiosp_customize_canonical_links'])) { unset($optlist['custom_link']); } foreach ($optlist as $f) { $meta = ''; $field = "aiosp_{$f}"; if (AIOSEOPPRO) { if (isset($_GET['taxonomy']) && isset($_GET['tag_ID']) || is_category() || is_tag() || is_tax()) { if (is_admin() && isset($_GET['tag_ID'])) { $meta = get_term_meta($_GET['tag_ID'], '_aioseop_' . $f, true); } else { $queried_object = get_queried_object(); if (!empty($queried_object) && !empty($queried_object->term_id)) { $meta = get_term_meta($queried_object->term_id, '_aioseop_' . $f, true); } } } else { $meta = get_post_meta($post_id, '_aioseop_' . $f, true); } if ('title' === $f || 'description' === $f) { $get_opts[$field] = htmlspecialchars($meta); } else { $get_opts[$field] = htmlspecialchars(stripslashes($meta)); } } else { $field = "aiosp_{$f}"; $meta = get_post_meta($post_id, '_aioseop_' . $f, true); if ('title' === $f || 'description' === $f) { $get_opts[$field] = htmlspecialchars($meta); } else { $get_opts[$field] = htmlspecialchars(stripslashes($meta)); } } } $opts = wp_parse_args($opts, $get_opts); return $opts; } else { $options = parent::get_current_options($opts, $location, $defaults); return $options; } }
function get_current_options($opts = array(), $location = null, $defaults = null, $post = null) { if ($location === 'aiosp' && $this->locations[$location]['type'] == 'metabox') { if ($post == null) { global $post; } $post_id = $post; if (is_object($post_id)) { $post_id = $post_id->ID; } $get_opts = $this->default_options($location); foreach (array('keywords', 'description', 'title', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel') as $f) { $field = "aiosp_{$f}"; $get_opts[$field] = htmlspecialchars(stripslashes(get_post_meta($post_id, '_aioseop_' . $f, true))); } $opts = wp_parse_args($opts, $get_opts); return $opts; } else { $options = parent::get_current_options($opts, $location, $defaults); return $options; } }
function get_current_options($opts = array(), $location = null, $defaults = null, $post = null) { if ($location === 'aiosp' && $this->locations[$location]['type'] == 'metabox') { if ($post == null) { global $post; } $post_id = $post; if (is_object($post_id)) { $post_id = $post_id->ID; } $get_opts = $this->default_options($location); foreach (array('keywords', 'description', 'title', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel') as $f) { $field = "aiosp_{$f}"; if (isset($_GET['taxonomy']) && isset($_GET['tag_ID']) || is_category() || is_tag() || is_tax()) { if (is_admin() && isset($_GET['tag_ID'])) { $meta = get_term_meta($_GET['tag_ID'], '_aioseop_' . $f, true); } else { $queried_object = get_queried_object(); if (!empty($queried_object) && !empty($queried_object->term_id)) { $meta = get_term_meta($queried_object->term_id, '_aioseop_' . $f, true); } } } else { $meta = get_post_meta($post_id, '_aioseop_' . $f, true); } $get_opts[$field] = htmlspecialchars(stripslashes($meta)); } $opts = wp_parse_args($opts, $get_opts); return $opts; } else { $options = parent::get_current_options($opts, $location, $defaults); return $options; } }