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
Conflicts:
	admin/pages/files.php
  • Loading branch information
jrfnl committed Jul 16, 2014
2 parents 152cc9c + 2d45481 commit f0242ad
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 27 deletions.
4 changes: 3 additions & 1 deletion admin/class-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,9 @@ public function enqueue() {
if ( $pagenow == 'edit.php' ) {
wp_enqueue_style( 'edit-page', plugins_url( 'css/edit-page' . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), WPSEO_VERSION );
} else {
wp_enqueue_media( array( 'post' => get_queried_object_id() ) ); // enqueue files needed for upload functionality
if ( 0 != get_queried_object_id() ) {
wp_enqueue_media( array( 'post' => get_queried_object_id() ) ); // enqueue files needed for upload functionality
}
wp_enqueue_style( 'metabox-tabs', plugins_url( 'css/metabox-tabs' . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), WPSEO_VERSION );
wp_enqueue_style( "metabox-$color", plugins_url( 'css/metabox-' . esc_attr( $color ) . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), WPSEO_VERSION );

Expand Down
5 changes: 3 additions & 2 deletions admin/pages/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@
echo '<div id="message" style="width:94%;" class="updated fade"><p>' . esc_html( $msg ) . '</p></div>';
}

$action_url = network_admin_url( 'admin.php?page=wpseo_files' ); // auto-falls back on admin_url for non-multisite

if ( ! file_exists( $robots_file ) ) {
if ( is_writable( get_home_path() ) ) {
$content = '<form action="' . admin_url( 'admin.php?page=wpseo_files' ) . '" method="post" id="robotstxtcreateform">';
$content = '<form action="' . esc_url( $action_url ) . '" method="post" id="robotstxtcreateform">';
$content .= wp_nonce_field( 'wpseo_create_robots', '_wpnonce', true, false );
$content .= '<p>' . __( 'You don\'t have a robots.txt file, create one here:', 'wordpress-seo' ) . '</p>';
$content .= '<input type="submit" class="button" name="create_robots" value="' . __( 'Create robots.txt file', 'wordpress-seo' ) . '">';
Expand All @@ -96,7 +97,7 @@
$content = '<p><em>' . __( 'If your robots.txt were writable, you could edit it from here.', 'wordpress-seo' ) . '</em></p>';
$content .= '<textarea class="large-text code" disabled="disabled" rows="15" name="robotsnew">' . $robots_txt_content . '</textarea><br/>';
} else {
$content = '<form action="' . admin_url( 'admin.php?page=wpseo_files' ) . '" method="post" id="robotstxtform">';
$content = '<form action="' . esc_url( $action_url ) . '" method="post" id="robotstxtform">';
$content .= wp_nonce_field( 'wpseo-robotstxt', '_wpnonce', true, false );
$content .= '<p>' . __( 'Edit the content of your robots.txt:', 'wordpress-seo' ) . '</p>';
$content .= '<textarea class="large-text code" rows="15" name="robotsnew">' . $robots_txt_content . '</textarea><br/>';
Expand Down
28 changes: 18 additions & 10 deletions frontend/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ function __construct() {
add_filter( 'loginout', array( $this, 'nofollow_link' ) );
add_filter( 'register', array( $this, 'nofollow_link' ) );

// Fix the WooThemes woo_title() output
add_filter( 'woo_title', array( $this, 'fix_woo_title' ), 10, 1 );

if ( $this->options['hide-rsdlink'] === true ) {
remove_action( 'wp_head', 'rsd_link' );
}
Expand Down Expand Up @@ -120,6 +123,19 @@ function __construct() {
}
}

/**
* Strip the extra blogname from the title
*
* @param $title
*
* @return mixed
*/
public function fix_woo_title( $title ) {
$title = substr( $title, 0, - ( strlen( get_bloginfo( 'name' ) ) ) );

return $title;
}

/**
* Determine whether the current page is the homepage and shows posts.
*
Expand Down Expand Up @@ -1508,11 +1524,7 @@ function rss_replace_vars( $content ) {
* @return string
*/
function embed_rssfooter( $content ) {
if ( is_feed() ) {
$content = $this->embed_rss( $content, 'full' );
}

return $content;
return $this->embed_rss( $content, 'full' );
}

/**
Expand All @@ -1523,11 +1535,7 @@ function embed_rssfooter( $content ) {
* @return string
*/
function embed_rssfooter_excerpt( $content ) {
if ( is_feed() ) {
$content = $this->embed_rss( $content, 'excerpt' );
}

return $content;
return $this->embed_rss( $content, 'excerpt' );
}

/**
Expand Down
8 changes: 4 additions & 4 deletions inc/class-sitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ function build_root_map() {
$wpdb->get_blog_prefix() . 'user_level'
)
);
$date = new DateTime( $date, new DateTimeZone( $this->get_timezone_string() ) );
$date = new DateTime( date( 'y-m-d H:i:s', $date ), new DateTimeZone( $this->get_timezone_string() ) );

// Retrieve the newest updated profile timestamp by an offset
} else {
Expand All @@ -546,7 +546,7 @@ function build_root_map() {
$this->max_entries * ( $i + 1 ) - 1
)
);
$date = new DateTime( $date, new DateTimeZone( $this->get_timezone_string() ) );
$date = new DateTime( date( 'y-m-d H:i:s', $date ), new DateTimeZone( $this->get_timezone_string() ) );
}

$this->sitemap .= '<sitemap>' . "\n";
Expand Down Expand Up @@ -1300,10 +1300,10 @@ function get_last_modified( $post_types ) {
unset( $results );
}

if ( count( $post_types ) === 1 ) {
if ( count( $post_types ) === 1 && isset( $this->post_type_dates[ $post_types[0] ] ) ) {
$result = $this->post_type_dates[ $post_types[0] ];
} else {
$result = 0;
$result = null;
foreach ( $post_types as $post_type ) {
if ( isset( $this->post_type_dates[ $post_type ] ) && strtotime( $this->post_type_dates[ $post_type ] ) > $result ) {
$result = $this->post_type_dates[ $post_type ];
Expand Down
4 changes: 4 additions & 0 deletions inc/class-wpseo-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ public function remove_default_filters() {
* @return array
*/
public function get_defaults() {
if ( method_exists( $this, 'translate_defaults' ) ) {
$this->translate_defaults();
}

if ( method_exists( $this, 'enrich_defaults' ) ) {
$this->enrich_defaults();
}
Expand Down
2 changes: 2 additions & 0 deletions inc/wpseo-non-ajax-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ function wpseo_translate_score( $val, $css_value = true ) {
/**
* Check whether file editing is allowed for the .htaccess and robots.txt files
*
* @internal current_user_can() checks internally whether a user is on wp-ms and adjusts accordingly.
*
* @return bool
*/
function wpseo_allow_system_file_edit() {
Expand Down
2 changes: 1 addition & 1 deletion js/wp-seo-metabox.min.js

Large diffs are not rendered by default.

33 changes: 28 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
Tags: seo, SEO, google, meta, meta description, search engine optimization, xml sitemap, xml sitemaps, google sitemap, sitemap, sitemaps, robots meta, rss, rss footer, yahoo, bing, news sitemaps, XML News Sitemaps, WordPress SEO, WordPress SEO by Yoast, yoast, multisite, canonical, nofollow, noindex, keywords, meta keywords, description, webmaster tools, google webmaster tools, seo pack
Requires at least: 3.5
Tested up to: 3.9.1
Stable tag: 1.5.3.3
Stable tag: 1.5.4.1

Improve your WordPress SEO: Write better content and have a fully optimized WordPress site using the WordPress SEO plugin by Yoast.

Expand Down Expand Up @@ -109,7 +109,15 @@ You'll find the [FAQ on Yoast.com](https://yoast.com/wordpress/plugins/seo/faq/)

== Changelog ==

= Trunk / 1.5.4 =
= 1.5.4.1 =
Release Date: July 15th, 2014

* Bugfixes:
* Properly minified the metabox JS file, fixing snippet preview, props [Jrf](http://profiles.wordpress.org/jrf).
* Format unix timestamp to string in sitemap, fixes possible fatal error in XML sitemap.

= 1.5.4 =
Release Date: July 15th, 2014

* Bugfixes
* Refactored the variable replacement function for better and faster results and more stability. This should fix most if not all problems users where having with variables not being replaced in the title, meta description, snippet preview etc - props [Jrf](http://profiles.wordpress.org/jrf).
Expand All @@ -128,22 +136,37 @@ You'll find the [FAQ on Yoast.com](https://yoast.com/wordpress/plugins/seo/faq/)
- restoring site to default settings from multisite settings page was not working.
- initializing new blogs with settings from a chosen default blog was not working (might still not be completely stable for WP multisite with WPSEO in must-use plugins directory, stable in all other cases).
- wrong option debug information shown on multisite settings page

* Fixed: an issue with sitemap transient caching for plugins not using paginated sitemaps (like news seo).
* Check if get_queried_object_id is not 0 before enqueueing wp_enqueue_media.
* Set rssafter to empty string on test_embed_rss() test.
* Fixed: Bing URL - props [GodThor](https://github.com/GodThor).
* Prevent from loading if WP is installing - props [Jrf](http://profiles.wordpress.org/jrf).
* Fixed: Incorrect timezone in the root sitemap.
* Fixed: Multiselect fields are now properly saved in wpseo meta boxes.
* Force canonical links to be absolute, relative is NOT an option.
* Fixed: Breadcrumb on search pages.
* Added CDATA in sitemap image captions and titles.
* Various sitemap fixes and improvements - props [Rarst] (https://github.com/Rarst).

* Enhancements
* Heavily reduce query load for XML sitemaps by caching XML sitemaps in transients.
* New `wpseo_register_extra_replacements` action hook which lets plugin/theme builders add new `%%...%%` replacement variables - including relevant help texts -. See [function documentation](https://github.com/Yoast/wordpress-seo/blob/master/inc/wpseo-functions.php) for an example of how to use this new functionality.
* If the final string - after replacement - would contain two separators with nothing between them, this extra separator will be removed.
* All remaining not replaced replacement vars are now stripped from the strings (without breaking the snippet preview).
* New filter `wpseo_replacements_filter_sep` which can be used to change the seperator character passed by the theme.
* When using the 'Reset default settings' button on a blog in a network while another blog has been chosen to be used as a basis for the settings for all new blogs, the reset will respect that setting and reset the blog to the settings from the chosen blog.
* For small networks ( < 100 sites ), the network page user interface has been improved, by offering drop-down lists of the blogs for blog selection fields. For larger networks, the interface remains the same.
* Added an action to allow adding content to the Post Type tab on the meta admin page.
* Removing the extra blog name added to the title by woo_title().
* More optimization improvements to snippet preview.
* Add filter to allow other plugins to interact with our metaboxes outside of the standard pages - props [Jrf](http://profiles.wordpress.org/jrf).
* Replace variables through an AJAX call, which makes them work in the post editor too and allows for more variables to be replaced in the title.
* Added priority filters for XML sitemaps.

* Other enhancements
* Security improvement: As the .htaccess / robots.txt files are site-wide files, on a multi-site WP installation they will no longer be available for editing to individual site owners. For super-admins, the 'SEO -> Edit Files' admin page will now be accessible through the Network Admin.
* We've added server specific info to our tracking class. Most notably, we're tracking whether a number of PHP extensions are enabled for our users now.



= 1.5.3.3 =
Release Date: June 2nd, 2014

Expand Down
5 changes: 3 additions & 2 deletions tests/test-class-wpseo-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,20 +805,21 @@ public function test_embed_rssfooter_excerpt() {
* @covers WPSEO_Frontend::embed_rss
*/
public function test_embed_rss() {
$input = 'Some content';
$input = 'Some other content';

// go to home (non-feed)
$this->go_to_home();

// test if input was unchanged
$expected = $input;
$this->assertEquals( $expected, self::$class_instance->embed_rss( $input, 'full' ) );
$this->assertEquals( $expected, self::$class_instance->embed_rss( $input ) );

// go to feed
$this->go_to( get_bloginfo( 'rss2_url' ) );

// test if input was changed
self::$class_instance->options['rssbefore'] = 'Some RSS before text';
self::$class_instance->options['rssafter'] = '';
$expected = wpautop( self::$class_instance->options['rssbefore'] ) . $input;
$this->assertEquals( $expected, self::$class_instance->embed_rss( $input, 'full' ) );
}
Expand Down
4 changes: 3 additions & 1 deletion wp-seo-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @internal Nobody should be able to overrule the real version number as this can cause serious issues
* with the options, so no if ( ! defined() )
*/
define( 'WPSEO_VERSION', '1.5.3.3' );
define( 'WPSEO_VERSION', '1.5.4.1' );

if ( ! defined( 'WPSEO_PATH' ) ) {
define( 'WPSEO_PATH', plugin_dir_path( WPSEO_FILE ) );
Expand Down Expand Up @@ -165,13 +165,15 @@ function wpseo_network_activate_deactivate( $activate = true ) {
function _wpseo_activate() {
require_once( WPSEO_PATH . 'inc/wpseo-functions.php' );

wpseo_load_textdomain(); // Make sure we have our translations available for the defaults
WPSEO_Options::get_instance();
if ( ! is_multisite() ) {
WPSEO_Options::initialize();
}
else {
WPSEO_Options::maybe_set_multisite_defaults( true );
}
WPSEO_Options::ensure_options_exist();

flush_rewrite_rules();

Expand Down
2 changes: 1 addition & 1 deletion wp-seo.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: WordPress SEO
Version: 1.5.3.3
Version: 1.5.4.1
Plugin URI: https://yoast.com/wordpress/plugins/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin
Description: The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.
Author: Joost de Valk
Expand Down

0 comments on commit f0242ad

Please sign in to comment.