Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.4.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Mathias committed Jul 9, 2013
2 parents 10d9b63 + b1679bd commit 1f11ce2
Show file tree
Hide file tree
Showing 20 changed files with 384 additions and 138 deletions.
25 changes: 15 additions & 10 deletions admin/class-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -1506,17 +1506,21 @@ function score_images_alt_text( $job, &$results, $imgs ) {
function get_images_alt_text( $post, $imgs ) {
preg_match_all( '/<img[^>]+>/im', $post->post_content, $matches );
$imgs['alts'] = array();
foreach ( $matches[0] as $img ) {
if ( preg_match( '/alt=("|\')(.*?)\1/', $img, $alt ) )
$imgs['alts'][] = $this->strtolower_utf8( $alt[2] );
if( is_array( $matches ) && count( $matches ) > 0 ) {
foreach ( $matches[0] as $img ) {
if ( preg_match( '`alt=("|\')(.*?)\1`', $img, $alt ) && isset( $alt[2] ) )
$imgs['alts'][] = $this->strtolower_utf8( $alt[2] );
}
}
if ( preg_match_all( '/\[gallery/', $post->post_content, $matches ) ) {
$attachments = get_children( array( 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'fields' => 'ids' ) );
foreach ( $attachments as $att_id ) {
$alt = get_post_meta( $att_id, '_wp_attachment_image_alt', true );
if ( $alt && !empty( $alt ) )
$imgs['alts'][] = $alt;
$imgs['count']++;
if( is_array( $attachments ) && count( $attachments ) > 0 ) {
foreach ( $attachments as $att_id ) {
$alt = get_post_meta( $att_id, '_wp_attachment_image_alt', true );
if ( $alt && !empty( $alt ) )
$imgs['alts'][] = $alt;
$imgs['count']++;
}
}
}
return $imgs;
Expand Down Expand Up @@ -1663,6 +1667,7 @@ function score_body( $job, &$results, $body, $firstp, $statistics ) {
$this->save_score_result( $results, 9, sprintf( $scoreBodyGoodLength, $wordCount ), 'body_length', $wordCount );

$body = $this->strtolower_utf8( $body );
$job["keyword"] = $this->strtolower_utf8( $job["keyword"] );

$keywordWordCount = str_word_count( $job["keyword"] );
if ( $keywordWordCount > 10 ) {
Expand All @@ -1687,7 +1692,7 @@ function score_body( $job, &$results, $body, $firstp, $statistics ) {
$firstp = $this->strtolower_utf8( $firstp );

// First Paragraph Test
if ( !preg_match('/\b'.$job["keyword"].'\b/', $firstp) && !preg_match('/\b'.$job["keyword_folded"].'\b/', $firstp) ) {
if ( !preg_match('`\b'.$job['keyword'].'\b`', $firstp) && !preg_match('`\b'.$job['keyword_folded'].'\b`', $firstp) ) {
$this->save_score_result( $results, 3, $scoreFirstParagraphLow, 'keyword_first_paragraph' );
} else {
$this->save_score_result( $results, 9, $scoreFirstParagraphHigh, 'keyword_first_paragraph' );
Expand Down Expand Up @@ -1785,4 +1790,4 @@ function get_first_paragraph( $post ) {
}
}

$wpseo_metabox = new WPSEO_Metabox();
$wpseo_metabox = new WPSEO_Metabox();
8 changes: 6 additions & 2 deletions admin/class-pointers.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,12 @@ function intro_tour() {
'position' => array( 'edge' => 'top', 'align' => $align ),
'pointerWidth' => 400
);
$button2 = $adminpages[$page]['button2'];
$function = $adminpages[$page]['function'];
if( isset( $adminpages[$page]['button2'] ) ) {
$button2 = $adminpages[$page]['button2'];
}
if( isset( $adminpages[$page]['function'] ) ) {
$function = $adminpages[$page]['function'];
}
}
}

Expand Down
27 changes: 16 additions & 11 deletions admin/pages/metas.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class="icon32"><br/></div>
<h2 id="wpseo-title"><?php _e( "Yoast WordPress SEO: Titles &amp; Metas", 'wordpress-seo' ); ?></h2>

<div id="wpseo_content_top" class="postbox-container">
<div class="metabox-holder">
<div class="metabox-holder" style="max-width: 650px; float: left;">
<div class="meta-box-sortables">

<h2 class="nav-tab-wrapper" id="wpseo-tabs">
Expand All @@ -43,6 +43,7 @@ class="icon32"><br/></div>
<a class="nav-tab" id="template_help-tab" href="#top#template_help"><?php _e( 'Help', 'wordpress-seo' );?></a>
</h2>

<div class="tabwrapper>">
<div id="general" class="wpseotab">
<?php
echo '<form action="' . admin_url( 'options.php' ) . '" method="post" id="wpseo-conf">';
Expand Down Expand Up @@ -88,12 +89,13 @@ class="icon32"><br/></div>
echo '<p>' . sprintf( __( 'You can determine the title and description for the blog page by %sediting the blog page itself &raquo;%s', 'wordpress-seo' ), '<a href="' . get_edit_post_link( get_option( 'page_for_posts' ) ) . '">', '</a>' ) . '</p>';
}

echo '<h2>' . __( 'Author metadata', 'wordpress-seo' ) . '</h2>';
echo '<label class="select" for="">' . __( 'Author highlighting', 'wordpress-seo' ) . ':</label>';
wp_dropdown_users( array( 'show_option_none' => __( "Don't show", 'wordpress-seo' ), 'name' => 'wpseo_titles[plus-author]', 'class' => 'select', 'selected' => isset( $options[ 'plus-author' ] ) ? $options[ 'plus-author' ] : '' ) );
echo '<p class="desc label">' . __( 'Choose the user that should be used for the <code>rel="author"</code> on the blog homepage. Make sure the user has filled out his/her Google+ profile link on their profile page.', 'wordpress-seo' ) . '</p>';
echo $wpseo_admin_pages->textinput( 'plus-publisher', __( 'Google Publisher Page', 'wordpress-seo' ) );
echo '<p class="desc label">' . __( 'If you have a Google+ page for your business, add that URL here and link it on your Google+ page\'s about page.', 'wordpress-seo' ) . '</p>';
// TODO: Please remove...Depreciated: moved over to the social tab
// echo '<h2>' . __( 'Author metadata', 'wordpress-seo' ) . '</h2>';
// echo '<label class="select" for="">' . __( 'Author highlighting', 'wordpress-seo' ) . ':</label>';
// wp_dropdown_users( array( 'show_option_none' => __( "Don't show", 'wordpress-seo' ), 'name' => 'wpseo_titles[plus-author]', 'class' => 'select', 'selected' => isset( $options[ 'plus-author' ] ) ? $options[ 'plus-author' ] : '' ) );
// echo '<p class="desc label">' . __( 'Choose the user that should be used for the <code>rel="author"</code> on the blog homepage. Make sure the user has filled out his/her Google+ profile link on their profile page.', 'wordpress-seo' ) . '</p>';
// echo $wpseo_admin_pages->textinput( 'plus-publisher-old', __( 'Google Publisher Page', 'wordpress-seo' ) );
// echo '<p class="desc label">' . __( 'If you have a Google+ page for your business, add that URL here and link it on your Google+ page\'s about page.', 'wordpress-seo' ) . '</p>';
?>
</div>
<div id="post_types" class="wpseotab">
Expand Down Expand Up @@ -302,6 +304,10 @@ class="icon32"><br/></div>
<th>%%focuskw%%</th>
<td>' . __( 'Replaced with the posts focus keyword', 'wordpress-seo' ) . '</td>
</tr>
<tr>
<th>%%term404%%</th>
<td>' . __( 'Replaced with the slug which caused the 404', 'wordpress-seo' ) . '</td>
</tr>
<tr>
<th>%%cf_&lt;custom-field-name&gt;%%</th>
<td>' . __( 'Replaced with a posts custom field value', 'wordpress-seo' ) . '</td>
Expand All @@ -322,7 +328,6 @@ class="icon32"><br/></div>

echo '<h2>' . __( 'Variables', 'wordpress-seo' ) . '</h2>';
echo $content;
?>
</div>
<?php
$wpseo_admin_pages->admin_footer();
echo '</div>';
$wpseo_admin_pages->admin_footer();
echo '</div>';
71 changes: 50 additions & 21 deletions admin/pages/social.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,55 @@
if ( $error )
settings_errors();

echo '<h2>' . __( 'Facebook Open Graph', 'wordpress-seo' ) . '</h2>';
echo $wpseo_admin_pages->checkbox( 'opengraph', '<label for="opengraph">' . __( 'Add Open Graph meta data', 'wordpress-seo' ) . '</label>' );
echo'<p class="desc">' . __( 'Add Open Graph meta data to your site\'s <code>&lt;head&gt;</code> section. You can specify some of the ID\'s that are sometimes needed below:', 'wordpress-seo' ) . '</p>';
echo $fbconnect;
echo $wpseo_admin_pages->textinput( 'facebook_site', __( 'Facebook Page URL', 'wordpress-seo' ) );
echo '<h4>' . __( 'Frontpage settings', 'wordpress-seo' ) . '</h4>';
echo $wpseo_admin_pages->textinput( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) );
echo $wpseo_admin_pages->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) );
echo '<p class="desc label">' . __( 'These are the image and description used in the Open Graph meta tags on the frontpage of your site.', 'wordpress-seo' ) . '</p>';
echo '<h4>' . __( 'Default settings', 'wordpress-seo' ) . '</h4>';
echo $wpseo_admin_pages->textinput( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) );
echo '<p class="desc label">' . __( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ) . '</p>';

do_action('wpseo_admin_opengraph_section');

echo '<h2>' . __( 'Twitter', 'wordpress-seo' ) . '</h2>';
echo $wpseo_admin_pages->checkbox( 'twitter', '<label for="twitter">' . __( 'Add Twitter card meta data', 'wordpress-seo' ) . '</label>' );
echo'<p class="desc">' . __( 'Add Twitter card meta data to your site\'s <code>&lt;head&gt;</code> section.', 'wordpress-seo' ) . '</p>';
echo $wpseo_admin_pages->textinput( 'twitter_site', __( 'Site Twitter Username', 'wordpress-seo' ) );

do_action('wpseo_admin_twitter_section');
?>

<h2 class="nav-tab-wrapper" id="wpseo-tabs">
<a class="nav-tab nav-tab-active" id="facebook-tab" href="#top#facebook"><?php _e( 'Facebook', 'wordpress-seo' );?></a>
<a class="nav-tab" id="twitter-tab" href="#top#twitter"><?php _e( 'Twitter', 'wordpress-seo' );?></a>
<a class="nav-tab" id="google-tab" href="#top#google"><?php _e( 'Google+', 'wordpress-seo' );?></a>
</h2>

<div id="facebook" class="wpseotab">
<?php
echo '<p>';
echo $wpseo_admin_pages->checkbox( 'opengraph', '<label for="opengraph">' . __( 'Add Open Graph meta data', 'wordpress-seo' ) . '</label>' );
echo '</p>';
echo'<p class="desc">' . __( 'Add Open Graph meta data to your site\'s <code>&lt;head&gt;</code> section. You can specify some of the ID\'s that are sometimes needed below:', 'wordpress-seo' ) . '</p>';
echo $fbconnect;
echo $wpseo_admin_pages->textinput( 'facebook_site', __( 'Facebook Page URL', 'wordpress-seo' ) );
echo '<h4>' . __( 'Frontpage settings', 'wordpress-seo' ) . '</h4>';
echo $wpseo_admin_pages->textinput( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) );
echo $wpseo_admin_pages->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) );
echo '<p class="desc label">' . __( 'These are the image and description used in the Open Graph meta tags on the frontpage of your site.', 'wordpress-seo' ) . '</p>';
echo '<h4>' . __( 'Default settings', 'wordpress-seo' ) . '</h4>';
echo $wpseo_admin_pages->textinput( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) );
echo '<p class="desc label">' . __( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ) . '</p>';
do_action('wpseo_admin_opengraph_section');
?>
</div>

<div id="twitter" class="wpseotab">
<?php
echo '<p>';
echo $wpseo_admin_pages->checkbox( 'twitter', '<label for="twitter">' . __( 'Add Twitter card meta data', 'wordpress-seo' ) . '</label>' );
echo '</p>';
echo'<p class="desc">' . __( 'Add Twitter card meta data to your site\'s <code>&lt;head&gt;</code> section.', 'wordpress-seo' ) . '</p>';
echo $wpseo_admin_pages->textinput( 'twitter_site', __( 'Site Twitter Username', 'wordpress-seo' ) );
do_action('wpseo_admin_twitter_section');
?>
</div>

<div id="google" class="wpseotab">
<?php
// echo '<h2>' . __( 'Author metadata', 'wordpress-seo' ) . '</h2>';
echo '<label class="select" for="">' . __( 'Author for homepage', 'wordpress-seo' ) . ':</label>';
wp_dropdown_users( array( 'show_option_none' => __( "Don't show", 'wordpress-seo' ), 'name' => 'wpseo_social[plus-author]', 'class' => 'select', 'selected' => isset( $options[ 'plus-author' ] ) ? $options[ 'plus-author' ] : '' ) );
echo '<p class="desc label">' . __( 'Choose the user that should be used for the <code>rel="author"</code> on the blog homepage. Make sure the user has filled out his/her Google+ profile link on their profile page.', 'wordpress-seo' ) . '</p>';
echo $wpseo_admin_pages->textinput( 'plus-publisher', __( 'Google Publisher Page', 'wordpress-seo' ) );
echo '<p class="desc label">' . __( 'If you have a Google+ page for your business, add that URL here and link it on your Google+ page\'s about page.', 'wordpress-seo' ) . '</p>';
do_action('wpseo_admin_googleplus_section');
?>
</div>

<?php
$wpseo_admin_pages->admin_footer();
23 changes: 12 additions & 11 deletions admin/pages/xml-sitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @package Admin
*/

if ( !defined('WPSEO_VERSION') ) {
header('HTTP/1.0 403 Forbidden');
if ( !defined( 'WPSEO_VERSION' ) ) {
header( 'HTTP/1.0 403 Forbidden' );
die;
}

Expand All @@ -14,38 +14,39 @@

$options = get_option( 'wpseo_xml' );

$base = $GLOBALS[ 'wp_rewrite' ]->using_index_permalinks() ? 'index.php/' : '';
$base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : '';

$content = $wpseo_admin_pages->checkbox( 'enablexmlsitemap', __( 'Check this box to enable XML sitemap functionality.', 'wordpress-seo' ), false );
$content .= '<div id="sitemapinfo">';
if ( isset($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false ) {
if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'nginx' ) !== false ) {
$content .= '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px">';
$content .= '<p>'.__('As you\'re on NGINX, you\'ll need the following rewrites:','wordpress-seo').'</p>';
$content .= '<p>' . __( 'As you\'re on NGINX, you\'ll need the following rewrites:', 'wordpress-seo' ) . '</p>';
$content .= '<pre>rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;</pre>';
$content .= '</div>';
}

if ( isset( $options[ 'enablexmlsitemap' ] ) && $options[ 'enablexmlsitemap' ] )
if ( isset( $options['enablexmlsitemap'] ) && $options['enablexmlsitemap'] )
$content .= '<p>' . sprintf( __( 'You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo' ), '<a target="_blank" class="button-secondary" href="' . home_url( $base . 'sitemap_index.xml' ) . '">', '</a>' ) . '<br/><br/>' . __( 'You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo' ) . '</p>';
else
$content .= '<p>' . __( 'Save your settings to activate XML Sitemaps.', 'wordpress-seo' ) . '</p>';

$content .= '<h2>' . __( 'User sitemap', 'wordpress-seo' ) . '</h2>';
$content .= $wpseo_admin_pages->checkbox( 'disable_author_sitemap', __( "Disable author/user sitemap", 'wordpress-seo' ), false );
$content .= '<br/>';
$content .= '<strong>' . __( 'General settings', 'wordpress-seo' ) . '</strong><br/>';
$content .= '<h2>' . __( 'General settings', 'wordpress-seo' ) . '</h2>';
$content .= '<p>' . __( 'After content publication, the plugin automatically pings Google and Bing, do you need it to ping other search engines too? If so, check the box:', 'wordpress-seo' ) . '</p>';
$content .= $wpseo_admin_pages->checkbox( 'xml_ping_yahoo', __( "Ping Yahoo!", 'wordpress-seo' ), false );
$content .= $wpseo_admin_pages->checkbox( 'xml_ping_ask', __( "Ping Ask.com", 'wordpress-seo' ), false );
$content .= '<br/><strong>' . __( 'Exclude post types', 'wordpress-seo' ) . '</strong><br/>';
$content .= '<h2>' . __( 'Exclude post types', 'wordpress-seo' ) . '</h2>';
$content .= '<p>' . __( 'Please check the appropriate box below if there\'s a post type that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo' ) . '</p>';

$post_types = apply_filters( 'wpseo_sitemaps_supported_post_types', get_post_types( array( 'public' => true ), 'objects' ) );
foreach ( $post_types as $pt ) {
$content .= $wpseo_admin_pages->checkbox( 'post_types-' . $pt->name . '-not_in_sitemap', $pt->labels->name . ' (<code>' . $pt->name . '</code>)' );
}

$content .= '<br/>';
$content .= '<strong>' . __( 'Exclude taxonomies', 'wordpress-seo' ) . '</strong><br/>';
$content .= '<h2>' . __( 'Exclude taxonomies', 'wordpress-seo' ) . '</h2>';
$content .= '<p>' . __( 'Please check the appropriate box below if there\'s a taxonomy that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo' ) . '</p>';

$taxonomies = apply_filters( 'wpseo_sitemaps_supported_taxonomies', get_taxonomies( array( 'public' => true ), 'objects' ) );
Expand All @@ -55,7 +56,7 @@
}

$content .= '<br/>';
$content .= '<strong>' . __( 'Entries per page', 'wordpress-seo' ) . '</strong><br/>';
$content .= '<h2>' . __( 'Entries per page', 'wordpress-seo' ) . '</h2>';
$content .= '<p>' . __( 'Please enter the maximum number of entries per sitemap page (defaults to 1000, you might want to lower this to prevent memory issues on some installs):', 'wordpress-seo' ) . '</p>';
$content .= $wpseo_admin_pages->textinput( 'entries-per-page', __( 'Max entries per sitemap page', 'wordpress-seo' ) );

Expand Down
Loading

0 comments on commit 1f11ce2

Please sign in to comment.