/** * Compare the WordPress version to the input one. * * @since 2.2.9 * * @deprecated * @since 2.7.0 * * @param string $version The 3 point version compare * @param string $compare The PHP comparison operator. * @return bool true if Version passes comparison. */ function tsf_wp_version($version = '4.3.0', $compare = '>=') { $theseoframework = the_seo_framework(); if (isset($theseoframework)) { $theseoframework->_deprecated_function(__FUNCTION__, '2.7.0', 'The_SEO_Framework_Detect::wp_version()'); return $theseoframework->wp_version($version, $compare); } return null; }
/** * Upgrade The SEO Framework to the latest version. * * Does an iteration of upgrades in order of upgrade appearance. * Each called function will upgrade the version by its iteration. * * Only works on WordPress 4.4 and later to ensure and force maximum compatibility. * * @since 2.7.0 * @global int $wp_db_version * * @thanks StudioPress for some code. */ function the_seo_framework_do_upgrade() { if (get_option('the_seo_framework_upgraded_db_version') >= THE_SEO_FRAMEWORK_DB_VERSION) { return; } if (!the_seo_framework()->wp_version('4.4', '>=')) { return; } global $wp_db_version; //* If the WordPress Database hasn't been upgraded yet, make the user upgrade first. if ((int) get_option('db_version') !== $wp_db_version) { wp_safe_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(wp_unslash($_SERVER['REQUEST_URI'])))); exit; } if (get_option('the_seo_framework_upgraded_db_version') < '2701') { the_seo_framework_do_upgrade_2701(); } do_action('the_seo_framework_upgraded'); }
/** * Add and Flush rewrite rules on plugin activation. * * @since 2.6.6 * @access private * @global object $wp_rewrite */ function the_seo_framework_flush_rewrite_rules_activation() { global $wp_rewrite; $the_seo_framework = the_seo_framework(); $the_seo_framework->rewrite_rule_sitemap(true); $wp_rewrite->init(); $wp_rewrite->flush_rules(true); }
/** * Returns the parent slug name of The SEO Framework plugin. * * @since 2.7.0 * * @return bool|string False on failure, the slug on success. */ function the_seo_framework_options_page_slug() { $theseoframework = the_seo_framework(); if (isset($theseoframework)) { return $theseoframework->seo_settings_page_slug; } return false; }
/** * Replaces the title tag. * * @since 1.0.0 * * @param string $title_tag the Title tag with the title * @param string $content The content containing the $title_tag * @return string the content with replaced title tag. */ public function replace_title_tag($title_tag, $content) { $new_title = '<title>' . the_seo_framework()->title_from_cache('', '', '', true) . '</title>' . $this->indicator(); $count = 1; //* Replace the title tag within the header. $content = str_replace($title_tag, $new_title, $content, $count); //* Can't be escaped, as content is unknown. echo $content; }
/** * Wraps query status booleans in human-readable code. * * @since 2.6.6 * @global bool $multipage * @global int $numpages * * @return string Wrapped Query State debug output. */ protected function get_debug_query_output() { //* Start timer. $this->timer(true); //* Don't register duplicated output invoked in this method. $this->add_debug_output = false; global $multipage, $numpages; $tsf = the_seo_framework(); //* Only get true/false values. $is_404 = $tsf->is_404(); $is_admin = $tsf->is_admin(); $is_attachment = $tsf->is_attachment(); $is_archive = $tsf->is_archive(); $is_term_edit = $tsf->is_term_edit(); $is_post_edit = $tsf->is_post_edit(); $is_wp_lists_edit = $tsf->is_wp_lists_edit(); $is_wp_lists_edit = $tsf->is_wp_lists_edit(); $is_author = $tsf->is_author(); $is_blog_page = $tsf->is_blog_page(); $is_category = $tsf->is_category(); $is_date = $tsf->is_date(); $is_day = $tsf->is_day(); $is_feed = $tsf->is_feed(); $is_front_page = $tsf->is_front_page(); $is_home = $tsf->is_home(); $is_month = $tsf->is_month(); $is_page = $tsf->is_page(); $page = $tsf->page(); $paged = $tsf->paged(); $is_preview = $tsf->is_preview(); $is_search = $tsf->is_search(); $is_single = $tsf->is_single(); $is_singular = $tsf->is_singular(); $is_static_frontpage = $tsf->is_static_frontpage(); $is_tag = $tsf->is_tag(); $is_tax = $tsf->is_tax(); $is_ultimate_member_user_page = $tsf->is_ultimate_member_user_page(); $is_wc_shop = $tsf->is_wc_shop(); $is_wc_product = $tsf->is_wc_product(); $is_year = $tsf->is_year(); $is_seo_settings_page = $tsf->is_seo_settings_page(true); //* Get all above vars, split them in two (true and false) and sort them by key names. $vars = get_defined_vars(); $current = array_filter($vars); $not_current = array_diff_key($vars, $current); ksort($current); ksort($not_current); $timer = '<div style="display:inline-block;width:100%;padding:20px;border-bottom:1px solid #666;">Generated in: ' . number_format($this->timer(), 5) . ' seconds</div>'; $output = ''; foreach ($current as $name => $value) { $type = '(' . gettype($value) . ')'; if (is_bool($value)) { $value = $value ? 'true' : 'false'; } else { $value = esc_attr(var_export($value, true)); } $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>'; $out = esc_html($name) . ' => ' . $value; $output .= $this->the_seo_framework_debug_hidden ? $out . PHP_EOL : '<span style="background:#dadada">' . $out . '</span>' . PHP_EOL; } foreach ($not_current as $name => $value) { $type = '(' . gettype($value) . ')'; if (is_bool($value)) { $value = $value ? 'true' : 'false'; } else { $value = esc_attr(var_export($value, true)); } $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>'; $out = esc_html($name) . ' => ' . $value; $output .= $out . PHP_EOL; } $title = $tsf->is_admin() ? 'Current WordPress Screen + Expected WordPress Query' : 'Current WordPress Query'; $title = '<div style="display:inline-block;width:100%;padding:20px;margin:0 auto;border-bottom:1px solid #666;"><h2 style="color:#222;font-size:22px;padding:0;margin:0">' . $title . '</h2></div>'; $output = $this->the_seo_framework_debug_hidden ? $output : str_replace(PHP_EOL, '<br>' . PHP_EOL, $output); $output = '<div style="display:inline-block;width:100%;padding:20px;font-family:Consolas,Monaco,monospace;font-size:14px;">' . $output . '</div>'; $output = '<div style="display:block;width:100%;background:#fafafa;color:#333;border-bottom:1px solid #666">' . $title . $timer . $output . '</div>'; $this->add_debug_output = true; return $output; }
/** * Handles unapproachable invoked methods. * * @param string $name * @param array $arguments * @return void */ public final function __call($name, $arguments) { $debug_instance = Debug::get_instance(); the_seo_framework()->_inaccessible_p_or_m('the_seo_framework()->' . esc_html($name) . '()'); return; }