Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/Yoast/wordpress-seo into PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Jul 3, 2014
2 parents 6c9a84d + 3f2d079 commit d4030c8
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 105 deletions.
14 changes: 14 additions & 0 deletions admin/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ function wpseo_get_suggest() {

add_action( 'wp_ajax_wpseo_get_suggest', 'wpseo_get_suggest' );

/**
* Used in the editor to replace vars for the snippet preview
*/
function wpseo_ajax_replace_vars() {
check_ajax_referer( 'wpseo-replace-vars' );

$args = get_post( $_POST['post_id'] );
$omit = array( 'excerpt', 'excerpt_only', 'title' );
echo wpseo_replace_vars( $_POST['string'], $args, $omit );
die;
}

add_action( 'wp_ajax_wpseo_replace_vars', 'wpseo_ajax_replace_vars' );

/**
* Save an individual SEO title from the Bulk Editor.
*/
Expand Down
18 changes: 11 additions & 7 deletions admin/class-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function translate_meta_boxes() {

self::$meta_fields['general']['metadesc']['title'] = __( 'Meta Description', 'wordpress-seo' );
self::$meta_fields['general']['metadesc']['description'] = sprintf( __( 'The <code>meta</code> description will be limited to %s chars%s, %s chars left.', 'wordpress-seo' ), self::$meta_length, self::$meta_length_reason, '<span id="yoast_wpseo_metadesc-length"></span>' ) . ' <div id="yoast_wpseo_metadesc_notice"></div>';
self::$meta_fields['general']['metadesc']['help'] = __( 'If the meta description is empty, the snippet preview above shows what is generated based on this sites meta description template.', 'wordpress-seo' );
self::$meta_fields['general']['metadesc']['help'] = sprintf( __( 'The meta description is often shown as the black text under the title in a search result. For this to work it has to contain the keyword that was searched for.<br/><br/>Read %sthis post%s for more info.', 'wordpress-seo' ), '<a href="https://yoast.com/snippet-preview/#utm_source=wordpress-seo-metabox&amp;utm_medium=inline-help&amp;utm_campaign=focus-keyword">', '</a>' );

self::$meta_fields['general']['metakeywords']['title'] = __( 'Meta Keywords', 'wordpress-seo' );
self::$meta_fields['general']['metakeywords']['description'] = __( 'If you type something above it will override your %smeta keywords template%s.', 'wordpress-seo' );
Expand Down Expand Up @@ -342,11 +342,11 @@ public function localize_script() {
if ( $title_template == '' ) {
$title_template = '%%title%% - %%sitename%%';
}
$title_template = wpseo_replace_vars( $title_template, $post, array( '%%title%%' ) );
$title_template = wpseo_replace_vars( $title_template, $post, array( '%%title%%', '%%sitename%%', '%%sitedesc%%', '%%sep%%' ) );

$metadesc_template = '';
if ( isset( $options['metadesc-' . $post->post_type] ) && $options['metadesc-' . $post->post_type] !== '' ) {
$metadesc_template = wpseo_replace_vars( $options['metadesc-' . $post->post_type], $post, array( '%%excerpt%%', '%%excerpt_only%%' ) );
$metadesc_template = wpseo_replace_vars( $options['metadesc-' . $post->post_type], $post, array( '%%excerpt%%', '%%excerpt_only%%', '%%sitename%%', '%%sitedesc%%', '%%sep%%' ) );
}

$sample_permalink = get_sample_permalink( $post->ID );
Expand All @@ -366,7 +366,11 @@ public function localize_script() {
'wpseo_title_template' => $title_template,
'wpseo_metadesc_template' => $metadesc_template,
'wpseo_permalink_template' => $sample_permalink,
'sitename' => get_bloginfo( 'name' ),
'sitedesc' => get_bloginfo( 'description' ),
'sep' => wpseo_replace_vars( '%%sep%%', array() ),
'wpseo_keyword_suggest_nonce' => wp_create_nonce( 'wpseo-get-suggest' ),
'wpseo_replace_vars_nonce' => wp_create_nonce( 'wpseo-replace-vars' ),
);
}

Expand Down Expand Up @@ -599,7 +603,7 @@ function get_post_date( $post ) {
$date = date_i18n( 'j M Y' );
}

return $date;
return (string) $date;
}

/**
Expand Down Expand Up @@ -640,7 +644,7 @@ function snippet() {

$content .= '<span class="url">' . str_replace( 'http://', '', get_bloginfo( 'url' ) ) . '/' . esc_html( $slug ) . '/</span>';

$content .= '<p class="desc">' . $datestr . '<span class="content">' . esc_html( $desc ) . '</span></p>';
$content .= '<p class="desc">' . $datestr . '<span class="autogen"></span><span class="content">' . esc_html( $desc ) . '</span></p>';

$content .= '</div>';

Expand Down Expand Up @@ -819,10 +823,10 @@ function column_content( $column_name, $post_id ) {
echo '<div title="' . esc_attr( $title ) . '" class="wpseo-score-icon ' . esc_attr( $score_label ) . '"></div>';
}
if ( $column_name === 'wpseo-title' ) {
echo esc_html( apply_filters( 'wpseo_title', $this->page_title( $post_id ) ) );
echo esc_html( apply_filters( 'wpseo_title', wpseo_replace_vars( $this->page_title( $post_id ), get_post( $post_id, ARRAY_A ) ) ) );
}
if ( $column_name === 'wpseo-metadesc' ) {
echo esc_html( apply_filters( 'wpseo_metadesc', self::get_value( 'metadesc', $post_id ) ) );
echo esc_html( apply_filters( 'wpseo_metadesc', wpseo_replace_vars( self::get_value( 'metadesc', $post_id ), get_post( $post_id, ARRAY_A ) ) ) );
}
if ( $column_name === 'wpseo-focuskw' ) {
$focuskw = self::get_value( 'focuskw', $post_id );
Expand Down
23 changes: 14 additions & 9 deletions css/metabox-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ ul.wpseo-metabox-tabs li {
word-wrap: break-word;
font-size: small;
}
#wpseosnippet .desc .autogen {
color: #777;
}
#wpseosnippet .date {
color: #808080;
}
Expand Down Expand Up @@ -160,15 +163,17 @@ ul.wpseo-metabox-tabs li {
text-decoration: underline;
}

.wpseo_yahoo_kw {
display: block;
float: left;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background-color: #ddd;
margin: 3px 8px 3px 0;
padding: 3px;
#focuskwresults ul {
margin: 0;
}

#focuskwresults p, #focuskwresults li {
font-size: 13px;
}

#focuskwresults li {
list-style-type: disc;
margin: 0 0 0 20px;
}

.wpseo_hidden {
Expand Down
2 changes: 1 addition & 1 deletion inc/wpseo-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function wpseo_ping_search_engines( $sitemapurl = null ) {

// Always ping Google and Bing, optionally ping Ask and Yahoo!
wp_remote_get( 'http://www.google.com/webmasters/tools/ping?sitemap=' . $sitemapurl );
wp_remote_get( 'http://www.bing.com/webmaster/ping.aspx?sitemap=' . $sitemapurl );
wp_remote_get( 'http://www.bing.com/ping?sitemap=' . $sitemapurl );

if ( $options['xml_ping_yahoo'] === true ) {
wp_remote_get( 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=3usdTDLV34HbjQpIBuzMM1UkECFl5KDN7fogidABihmHBfqaebDuZk1vpLDR64I-&url=' . $sitemapurl );
Expand Down
Loading

0 comments on commit d4030c8

Please sign in to comment.