/** * Displays the title. Parses the variables. **/ public static function output_title($title, $forced_title = null) { if (is_feed()) { return null; } if (self::plugin_active()) { return $title; } $seo_templates_query = HeadwayOption::get('seo-templates', 'general', self::output_layouts_and_defaults()); $seo_templates = headway_get(HeadwaySEO::current_seo_layout(), $seo_templates_query, array()); if (HeadwayLayoutOption::get(false, 'title', 'seo', false)) { $title = HeadwayLayoutOption::get(false, 'title', 'seo', false); } elseif (headway_get('title', $seo_templates)) { $title = headway_get('title', $seo_templates); } /* If the template is %tagline% | %sitename% and there is no tagline, then remove the tagline and pipe character */ if ($title === '%tagline% | %sitename%' && get_bloginfo('description') == false) { $title = '%sitename%'; } /* Allow $forced_page_name to change %title%... Useful for plugins like BuddyPress */ if ($forced_title) { $title = str_ireplace('%title%', $forced_title, $title); } return HeadwaySEO::parse_seo_variables($title); }
break; } } else { ?> <h3 class="title" id="seo-templates-title">SEO Templates</h3> <div id="seo-templates"> <div id="seo-templates-hidden-inputs"> <?php /* SETUP THE TYPES OF SEO TEMPLATE INPUTS */ $seo_template_inputs = array('title', 'description', 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noodp', 'noydir'); /* GENERATE HIDDEN INPUTS */ $seo_options = HeadwayOption::get('seo-templates', 'general', array()); foreach (HeadwaySEO::output_layouts_and_defaults() as $page => $defaults) { foreach ($seo_template_inputs as $input) { $name_attr = 'name="headway-admin-input[seo-templates][' . $page . '][' . $input . ']"'; $default = isset($defaults[$input]) ? $defaults[$input] : null; $page_options = headway_get($page, $seo_options, array()); $value = headway_get($input, $page_options, $default); echo '<input type="hidden" id="seo-' . $page . '-' . $input . '"' . $name_attr . ' value="' . stripslashes(htmlspecialchars($value)) . '" />'; } } ?> </div> <div id="seo-templates-header"> <span>Select a Template:</span> <select> <option value="index">Blog Index</option>
Responsive Grid: <?php echo HeadwayResponsiveGrid::is_enabled() ? 'Enabled' . "\n" : 'Disabled' . "\n"; ?> Caching Allowed: <?php echo HeadwayCompiler::can_cache() ? 'Yes' . "\n" : 'No' . "\n"; ?> Caching Enabled: <?php echo HeadwayCompiler::caching_enabled() ? 'Yes' . "\n" : 'No' . "\n"; ?> Caching Plugin: <?php echo HeadwayCompiler::is_plugin_caching() ? HeadwayCompiler::is_plugin_caching() . "\n" : 'No caching plugin active' . "\n"; ?> SEO Plugin: <?php echo HeadwaySEO::plugin_active() ? HeadwaySEO::plugin_active() . "\n" : 'No SEO plugin active' . "\n"; ?> Operating System: <?php echo ucwords($browser['platform']) . "\n"; ?> Browser: <?php echo $browser['name'] . "\n"; ?> Browser Version: <?php echo $browser['version'] . "\n"; ?> Full User Agent: <?php echo $browser['userAgent'] . "\n";
function filter_nofollow_links_in_post($text) { global $post; if (!is_object($post) || empty($post->ID) || !HeadwaySEO::is_seo_checkbox_enabled('nofollow', $post->ID)) { return $text; } preg_match_all("/<a.*? href=\"(.*?)\".*?>(.*?)<\\/a>/i", $text, $links); $match_count = count($links[0]); for ($i = 0; $i < $match_count; $i++) { if (!preg_match("/rel=[\"\\']*nofollow[\"\\']*/", $links[0][$i])) { preg_match_all("/<a.*? href=\"(.*?)\"(.*?)>(.*?)<\\/a>/i", $links[0][$i], $link_text); $text = str_replace('>' . $link_text[3][0] . '</a>', ' rel="nofollow">' . $link_text[3][0] . '</a>', $text); } } return $text; }
protected function modify_arguments($post = false) { //Do not use this box if the page being edited is the front page since they can edit the setting in the configuration. if (get_option('page_on_front') == headway_get('post') && get_option('show_on_front') == 'page') { $this->info = '<strong>Configure the SEO settings for this page (Front Page) in the Headway Search Engine Optimization settings tab in <a href="' . admin_url('admin.php?page=headway-options#tab-seo-content') . '" target="_blank">Headway » Configuration</a>.</strong>'; $this->inputs = array(); return; } //Setup the defaults for the title and checkboxes $current_screen = get_current_screen(); $seo_templates_query = HeadwayOption::get('seo-templates', 'general', HeadwaySEO::output_layouts_and_defaults()); $seo_templates = headway_get('single-' . $current_screen->id, $seo_templates_query, array()); $title_template = str_replace(array('%sitename%', '%SITENAME%'), get_bloginfo('name'), headway_get('title', $seo_templates)); echo '<input type="hidden" id="title-seo-template" value="' . $title_template . '" />'; $this->inputs['noindex']['default'] = headway_get('noindex', $seo_templates); $this->inputs['nofollow']['default'] = headway_get('nofollow', $seo_templates); $this->inputs['noarchive']['default'] = headway_get('noarchive', $seo_templates); $this->inputs['nosnippet']['default'] = headway_get('nosnippet', $seo_templates); $this->inputs['noodp']['default'] = headway_get('noodp', $seo_templates); $this->inputs['noydir']['default'] = headway_get('noydir', $seo_templates); }