/** * Prepares the organization or person markup */ private function prepare_organization_person_markup() { $this->fetch_social_profiles(); $this->data = array('@context' => 'http://schema.org', '@type' => '', 'url' => YMBESEO_Frontend::get_instance()->canonical(false, true), 'sameAs' => $this->profiles); }
/** * Returns the Twitter title for any page * * @return string */ private function fallback_title() { return YMBESEO_Frontend::get_instance()->title(''); }
/** * Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here. */ function YMBESEO_admin_bar_menu() { // If the current user can't write posts, this is all of no use, so let's not output an admin menu. if (!current_user_can('edit_posts')) { return; } global $wp_admin_bar, $post; $focuskw = ''; $score = ''; $seo_url = get_admin_url(null, 'admin.php?page=YMBESEO_dashboard'); if ((is_singular() || is_admin() && in_array($GLOBALS['pagenow'], array('post.php', 'post-new.php'), true)) && isset($post) && is_object($post) && apply_filters('YMBESEO_use_page_analysis', true) === true) { $focuskw = YMBESEO_Meta::get_value('focuskw', $post->ID); $perc_score = YMBESEO_Meta::get_value('linkdex', $post->ID); $calc_score = YMBESEO_Utils::calc($perc_score, '/', 10, true); $txtscore = YMBESEO_Utils::translate_score($calc_score); $title = YMBESEO_Utils::translate_score($calc_score, false); $score = '<div title="' . esc_attr($title) . '" class="' . esc_attr('wpseo-score-icon ' . $txtscore . ' ' . $perc_score) . '"></div>'; $seo_url = get_edit_post_link($post->ID); if ($txtscore !== 'na') { $seo_url .= '#YMBESEO_linkdex'; } } $wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => __('SEO', 'ymbeseo') . $score, 'href' => $seo_url)); $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __('Keyword Research', 'ymbeseo'), '#')); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __('AdWords External', 'ymbeseo'), 'href' => 'http://adwords.google.com/keywordplanner', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __('Google Insights', 'ymbeseo'), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode($focuskw) . '&cmpt=q', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __('SEO Book', 'ymbeseo'), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank'))); if (!is_admin()) { $url = YMBESEO_Frontend::get_instance()->canonical(false); if (is_string($url)) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __('Analyze this page', 'ymbeseo'), '#')); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __('Check Inlinks (OSE)', 'ymbeseo'), 'href' => '//moz.com/researchtools/ose/links?site=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __('Check Keyword Density', 'ymbeseo'), 'href' => '//www.zippy.co.uk/keyworddensity/index.php?url=' . urlencode($url) . '&keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __('Check Google Cache', 'ymbeseo'), 'href' => '//webcache.googleusercontent.com/search?strip=1&q=cache:' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __('Check Headers', 'ymbeseo'), 'href' => '//quixapp.com/headers/?r=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-richsnippets', 'title' => __('Check Rich Snippets', 'ymbeseo'), 'href' => '//www.google.com/webmasters/tools/richsnippets?q=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-facebookdebug', 'title' => __('Facebook Debugger', 'ymbeseo'), 'href' => '//developers.facebook.com/tools/debug/og/object?q=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pinterestvalidator', 'title' => __('Pinterest Rich Pins Validator', 'ymbeseo'), 'href' => '//developers.pinterest.com/rich_pins/validator/?link=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-htmlvalidation', 'title' => __('HTML Validator', 'ymbeseo'), 'href' => '//validator.w3.org/check?uri=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cssvalidation', 'title' => __('CSS Validator', 'ymbeseo'), 'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pagespeed', 'title' => __('Google Page Speed Test', 'ymbeseo'), 'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-modernie', 'title' => __('Modern IE Site Scan', 'ymbeseo'), 'href' => '//www.modern.ie/en-us/report#' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-google-mobile-friendly', 'title' => __('Mobile-Friendly Test', 'ymbeseo'), 'href' => 'https://www.google.com/webmasters/tools/mobile-friendly/?url=' . urlencode($url), 'meta' => array('target' => '_blank'))); } } $admin_menu = current_user_can('manage_options'); if (!$admin_menu && is_multisite()) { $options = get_site_option('YMBESEO_ms'); $admin_menu = $options['access'] === 'superadmin' && is_super_admin(); } // @todo: add links to bulk title and bulk description edit pages. if ($admin_menu) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __('SEO Settings', 'ymbeseo'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-general', 'title' => __('General', 'ymbeseo'), 'href' => admin_url('admin.php?page=YMBESEO_dashboard'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __('Titles & Metas', 'ymbeseo'), 'href' => admin_url('admin.php?page=YMBESEO_titles'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __('Social', 'ymbeseo'), 'href' => admin_url('admin.php?page=YMBESEO_social'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __('XML Sitemaps', 'ymbeseo'), 'href' => admin_url('admin.php?page=YMBESEO_xml'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-YMBESEO_advanced', 'title' => __('Advanced', 'ymbeseo'), 'href' => admin_url('admin.php?page=YMBESEO_advanced'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-licenses', 'title' => __('Extensions', 'ymbeseo'), 'href' => admin_url('admin.php?page=YMBESEO_licenses'))); } }
/** * Wraps frontend class. */ function initialize_YMBESEO_front() { YMBESEO_Frontend::get_instance(); }
/** * Output the OpenGraph description, specific OG description first, if not, grab the meta description. * * @param bool $echo Whether to echo or return the description. * * @return string $ogdesc */ public function description($echo = true) { $ogdesc = ''; $frontend = YMBESEO_Frontend::get_instance(); if (is_front_page()) { if (isset($this->options['og_frontpage_desc']) && $this->options['og_frontpage_desc'] !== '') { $ogdesc = YMBESEO_replace_vars($this->options['og_frontpage_desc'], null); } else { $ogdesc = $frontend->metadesc(false); } } $is_posts_page = $frontend->is_posts_page(); if (is_singular() || $is_posts_page) { $post_id = $is_posts_page ? get_option('page_for_posts') : get_the_ID(); $post = get_post($post_id); $ogdesc = YMBESEO_Meta::get_value('opengraph-description', $post_id); // Replace Yoast SEO Variables. $ogdesc = YMBESEO_replace_vars($ogdesc, $post); // Use metadesc if $ogdesc is empty. if ($ogdesc === '') { $ogdesc = $frontend->metadesc(false); } // Tag og:description is still blank so grab it from get_the_excerpt(). if (!is_string($ogdesc) || is_string($ogdesc) && $ogdesc === '') { $ogdesc = str_replace('[…]', '…', strip_tags(get_the_excerpt())); } } if (is_category() || is_tag() || is_tax()) { $ogdesc = $frontend->metadesc(false); if ('' == $ogdesc) { $ogdesc = trim(strip_tags(term_description())); } if ('' == $ogdesc) { $term = $GLOBALS['wp_query']->get_queried_object(); $ogdesc = YMBESEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'desc'); } } // Strip shortcodes if any. $ogdesc = strip_shortcodes($ogdesc); /** * Filter: 'YMBESEO_opengraph_desc' - Allow changing the OpenGraph description * * @api string $ogdesc The description string. */ $ogdesc = trim(apply_filters('YMBESEO_opengraph_desc', $ogdesc)); if (is_string($ogdesc) && $ogdesc !== '') { if ($echo !== false) { $this->og_tag('og:description', $ogdesc); } } return $ogdesc; }