Skip to content

Commit

Permalink
Merge pull request #426 from wp-media/branch-3.0
Browse files Browse the repository at this point in the history
2.10
  • Loading branch information
GeekPress authored Jun 7, 2017
2 parents 9d57943 + ce6947e commit 8cc8fe1
Show file tree
Hide file tree
Showing 175 changed files with 40,559 additions and 23,172 deletions.
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# PHPUnit files
.travis.yml export-ignore
bin export-ignore
tests/bootstrap.php export-ignore
tests/test-sample.php export-ignore
tests/inc export-ignore
phpunit.xml export-ignore
tests export-ignore
README.md export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpcs.xml export-ignore
.tx export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules/
getpomakemo.sh
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[wp-rocket.rocket]
file_filter = languages/rocket-<lang>.po
source_file = languages/rocket.pot
source_lang = en
type = PO
5 changes: 4 additions & 1 deletion contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ This file contains a list of people who have made large contributions to WP Rock
Developers:
Jonathan Buttigieg <jonathan@wp-rocket.me>
Julio Potier <julio@wp-rocket.me>
Remy Perona <remy@wp-rocket.me>
Remy Perona <remy@wp-rocket.me>

UX:
Caspar Hübinger <caspar@wp-rocket.me>
2 changes: 1 addition & 1 deletion inc/3rd-party/3rd-party.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
defined( 'ABSPATH' ) or die( 'Cheatin&#8217; uh?' );

require( WP_ROCKET_3RD_PARTY_PATH . 'hosting/wpengine.php' );
require( WP_ROCKET_3RD_PARTY_PATH . 'hosting/flywheel.php' );
Expand Down
63 changes: 38 additions & 25 deletions inc/3rd-party/age-verify.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,58 @@
<?php
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
defined( 'ABSPATH' ) or die( 'Cheatin&#8217; uh?' );

/**
* Conflict with Age Verify: don't cache pages until to have the age-verified cookie
* Conflict with Age Verify: don't cache pages until the age-verified cookie is set
*
* @since 2.7
*/
if ( class_exists( 'Age_Verify' ) && defined( 'Age_Verify::SLUG' ) ) :

add_filter( 'rocket_htaccess_mod_rewrite', '__return_false' );
add_filter( 'rocket_cache_mandatory_cookies', '__rocket_add_cache_mandatory_cookie_for_age_verify' );

add_filter( 'rocket_htaccess_mod_rewrite', '__return_false' );
add_filter( 'rocket_cache_mandatory_cookies', 'rocket_add_cache_mandatory_cookie_for_age_verify' );
endif;

// Add age-verified to the list of mandatory cookies
function __rocket_add_cache_mandatory_cookie_for_age_verify( $cookies ) {
/**
* Add age-verified to the list of mandatory cookies
*
* @since 2.7
*
* @param Array $cookies Array of mandatory cookies.
* @return Array Updated array of mandatory cookies
*/
function rocket_add_cache_mandatory_cookie_for_age_verify( $cookies ) {
$cookies[] = 'age-verified';
return $cookies;
}

// Add age-verified cookie when we activate the plugin
add_action( 'activate_age-verify/age-verify.php' , '__rocket_activate_age_verify', 11 );
function __rocket_activate_age_verify() {
/**
* Add age-verified cookie when we activate the plugin
*
* @since 2.7
*/
function rocket_activate_age_verify() {
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false' );
add_filter( 'rocket_cache_mandatory_cookies', '__rocket_add_cache_mandatory_cookie_for_age_verify' );
// Update the WP Rocket rules on the .htaccess file
add_filter( 'rocket_cache_mandatory_cookies', 'rocket_add_cache_mandatory_cookie_for_age_verify' );

// Update the WP Rocket rules on the .htaccess file.
flush_rocket_htaccess();
// Regenerate the config file

// Regenerate the config file.
rocket_generate_config_file();
}
add_action( 'activate_age-verify/age-verify.php' , 'rocket_activate_age_verify', 11 );

/**
* Remove age-verified cookie when we deactivate the plugin
*
* @since 2.7
*/
function rocket_deactivate_age_verify() {
remove_filter( 'rocket_cache_mandatory_cookies', 'rocket_add_cache_mandatory_cookie_for_age_verify' );

// Remove age-verified cookie when we deactivate the plugin
add_action( 'deactivate_age-verify/age-verify.php' , '__rocket_deactivate_age_verify', 11 );
function __rocket_deactivate_age_verify() {
remove_filter( 'rocket_cache_mandatory_cookies', '__rocket_add_cache_mandatory_cookie_for_age_verify' );

// Update the WP Rocket rules on the .htaccess file
// Update the WP Rocket rules on the .htaccess file.
flush_rocket_htaccess();
// Regenerate the config file

// Regenerate the config file.
rocket_generate_config_file();
}
}
add_action( 'deactivate_age-verify/age-verify.php' , 'rocket_deactivate_age_verify', 11 );
118 changes: 78 additions & 40 deletions inc/3rd-party/all-in-one-seo-pack.php
Original file line number Diff line number Diff line change
@@ -1,54 +1,92 @@
<?php
defined( 'ABSPATH' ) or die( 'Cheatin&#8217; uh?' );

if ( defined( 'AIOSEOP_VERSION' ) ) :
$all_in_one_seo_xml_options = get_option( 'aioseop_options' );
$all_in_one_seo_xml_options = get_option( 'aioseop_options' );
/**
* Improvement with All in One SEO Pack: auto-detect the XML sitemaps for the preload option
*
* @since 2.8
* @author Remy Perona
*/
if ( isset( $all_in_one_seo_xml_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) && 'on' === $all_in_one_seo_xml_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) {
add_filter( 'rocket_first_install_options', '__rocket_add_all_in_one_seo_sitemap_option' );
function __rocket_add_all_in_one_seo_sitemap_option( $options ) {
$options['all_in_one_seo_xml_sitemap'] = 0;
if ( isset( $all_in_one_seo_xml_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) && 'on' === $all_in_one_seo_xml_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) {
/**
* Add All in One SEO Sitemap option to WP Rocket options
*
* @since 2.8
* @author Remy Perona
*
* @param Array $options Array of WP Rocket options.
* @return Array Updated array of WP Rocket options
*/
function rocket_add_all_in_one_seo_sitemap_option( $options ) {
$options['all_in_one_seo_xml_sitemap'] = 0;

return $options;
}
return $options;
}
add_filter( 'rocket_first_install_options', 'rocket_add_all_in_one_seo_sitemap_option' );

add_filter( 'rocket_inputs_sanitize', '__rocket_all_in_one_seo_sitemap_option_sanitize' );
function __rocket_all_in_one_seo_sitemap_option_sanitize( $inputs ) {
$inputs['all_in_one_seo_xml_sitemap'] = ! empty( $inputs['all_in_one_seo_xml_sitemap'] ) ? 1 : 0;
/**
* Sanitize the AIO SEO option value
*
* @since 2.8
* @author Remy Perona
*
* @param Array $inputs Array of inputs values.
* @return Array Updated array of inputs $values
*/
function rocket_all_in_one_seo_sitemap_option_sanitize( $inputs ) {
$inputs['all_in_one_seo_xml_sitemap'] = ! empty( $inputs['all_in_one_seo_xml_sitemap'] ) ? 1 : 0;

return $inputs;
}
return $inputs;
}
add_filter( 'rocket_inputs_sanitize', 'rocket_all_in_one_seo_sitemap_option_sanitize' );

add_filter( 'rocket_sitemap_preload_list', '__rocket_add_all_in_one_seo_sitemap' );
function __rocket_add_all_in_one_seo_sitemap( $sitemaps ) {
if ( get_rocket_option( 'all_in_one_seo_xml_sitemap', false ) ) {
$all_in_one_seo_xml = get_option( 'aioseop_options' );
$sitemaps[] = trailingslashit( home_url() ) . $all_in_one_seo_xml['modules']['aiosp_sitemap_options']['aiosp_sitemap_filename'] . '.xml';
}
/**
* Add All in One SEO Sitemap to the preload list
*
* @since 2.8
* @author Remy Perona
*
* @param Array $sitemaps Array of sitemaps to preload.
* @return Array Updated array of sitemaps to preload
*/
function rocket_add_all_in_one_seo_sitemap( $sitemaps ) {
if ( get_rocket_option( 'all_in_one_seo_xml_sitemap', false ) ) {
$all_in_one_seo_xml = get_option( 'aioseop_options' );
$sitemaps[] = trailingslashit( home_url() ) . $all_in_one_seo_xml['modules']['aiosp_sitemap_options']['aiosp_sitemap_filename'] . '.xml';
}

return $sitemaps;
}
return $sitemaps;
}
add_filter( 'rocket_sitemap_preload_list', 'rocket_add_all_in_one_seo_sitemap' );

add_filter( 'rocket_sitemap_preload_options', '__rocket_sitemap_preload_all_in_one_seo_option' );
function __rocket_sitemap_preload_all_in_one_seo_option( $options ) {
$options[] = array(
'parent' => 'sitemap_preload',
'type' => 'checkbox',
'label' => __('All in One SEO XML sitemap', 'rocket' ),
'label_for' => 'all_in_one_seo_xml_sitemap',
'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'All in One SEO Pack' ),
'default' => 0,
);
$options[] = array(
'parent' => 'sitemap_preload',
'type' => 'helper_description',
'name' => 'all_in_one_seo_xml_sitemap_desc',
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'All in One SEO Pack' )
);
return $options;
}
}
endif;
/**
* Add All in One SEO Sitemap sub-option on WP Rocket settings page
*
* @since 2.8
* @author Remy Perona
*
* @param Array $options Array of WP Rocket options.
* @return Array Updated array of WP Rocket options
*/
function rocket_sitemap_preload_all_in_one_seo_option( $options ) {
$options[] = array(
'parent' => 'sitemap_preload',
'type' => 'checkbox',
'label' => __( 'All in One SEO XML sitemap', 'rocket' ),
'label_for' => 'all_in_one_seo_xml_sitemap',
'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'All in One SEO Pack' ),
'default' => 0,
);
$options[] = array(
'parent' => 'sitemap_preload',
'type' => 'helper_description',
'name' => 'all_in_one_seo_xml_sitemap_desc',
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'All in One SEO Pack' ),
);
return $options;
}
add_filter( 'rocket_sitemap_preload_options', 'rocket_sitemap_preload_all_in_one_seo_option' );
}
endif;
Loading

0 comments on commit 8cc8fe1

Please sign in to comment.