Skip to content

Commit

Permalink
Merge pull request #1706 from semperfiwebdesign/development
Browse files Browse the repository at this point in the history
Development to master for 2.6
  • Loading branch information
michaeltorbert authored May 24, 2018
2 parents 066662f + 91ca2ef commit 131d246
Show file tree
Hide file tree
Showing 10 changed files with 1,884 additions and 1,822 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ matrix:
- php: 5.2
dist: precise
- env: WP_VERSION=latest
- env: WP_VERSION=4.0
- env: WP_VERSION=4.5
- env: WP_MULTISITE=1
allow_failures:
- env: WP_MULTISITE=1
Expand Down
17 changes: 11 additions & 6 deletions admin/aioseop_module_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2127,9 +2127,11 @@ function save_post_data( $post_id ) {
* @return string
*/
function do_multi_input( $args ) {
// @codingStandardsIgnoreStart
extract( $args );
// @codingStandardsIgnoreEnd
$options = $args['options'];
$value = $args['value'];
$name = $args['name'];
$attr = $args['attr'];

$buf1 = '';
$type = $options['type'];

Expand Down Expand Up @@ -2206,9 +2208,12 @@ function do_multi_input( $args ) {
*/
function get_option_html( $args ) {
static $n = 0;
// @codingStandardsIgnoreStart
extract( $args );
// @codingStandardsIgnoreEnd

$options = $args['options'];
$value = $args['value'];
$name = $args['name'];
$attr = $args['attr'];
$prefix = isset( $args['prefix'] ) ? $args['prefix'] : '';

if ( $options['type'] == 'custom' ) {
return apply_filters( "{$prefix}output_option", '', $args );
Expand Down
2 changes: 1 addition & 1 deletion admin/display/general-metaboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class="btn"></p>
if ( AIOSEOPPRO ) {
echo 'https://semperplugins.com/documentation/all-in-one-seo-pack-pro-changelog/';
} else {
echo 'https://semperfiwebdesign.com/blog/all-in-one-seo-pack/all-in-one-seo-pack-release-history/';
echo 'https://semperfiwebdesign.com/all-in-one-seo-pack-release-history/';
}
?>
"><?php _e( 'View the Changelog', 'all-in-one-seo-pack' ); ?></a></p>
Expand Down
77 changes: 52 additions & 25 deletions aioseop_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,8 @@ function __construct() {
'condshow' => array( 'aiosp_disable' => 'on' ),
),
),
'display' => null,
// #1067: if SEO is disabled and an empty array is passed below, it will be overriden. So let's pass a post type that cannot possibly exist.
'display' => 'on' === $aioseop_options['aiosp_enablecpost'] ? $aioseop_options['aiosp_cpostactive'] : array( '___null___' ),
),
);

Expand Down Expand Up @@ -1176,13 +1177,23 @@ function custom_output_option( $buf, $args ) {
$args['options']['nowrap'] = false;
$args['options']['save'] = false;
$info = $this->get_page_snippet_info();
// @codingStandardsIgnoreStart
extract( $info );
// @codingStandardsIgnoreEnd
} else {
return '';
}

$args['options']['type'] = 'html';
$args['options']['nowrap'] = false;
$args['options']['save'] = false;
$info = $this->get_page_snippet_info();
$title = $info['title'];
$description = $info['description'];
$keywords = $info['keywords'];
$url = $info['url'];
$title_format = $info['title_format'];
$category = $info['category'];
$w = $info['w'];
$p = $info['p'];

if ( $this->strlen( $title ) > 70 ) {
$title = $this->trim_excerpt_without_filters(
$this->html_entity_decode( $title ),
Expand Down Expand Up @@ -2482,7 +2493,7 @@ function get_main_description( $post = null ) {
$aioseop_desc = get_post_meta( $post->ID, '_aioseop_description', true );
}

if ( empty( $aioseop_desc ) && 'on' === $aioseop_options['aiosp_generate_descriptions'] && empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
if ( empty( $aioseop_desc ) && isset( $aioseop_options['aiosp_generate_descriptions'] ) && 'on' === $aioseop_options['aiosp_generate_descriptions'] && empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) {
$truncate = true;
}

Expand Down Expand Up @@ -3375,12 +3386,15 @@ function filter_settings( $settings, $location, $current ) {

global $post;
$info = $this->get_page_snippet_info();
// @codingStandardsIgnoreStart
extract( $info );
// @codingStandardsIgnoreEnd
$settings[ "{$prefix}title" ]['placeholder'] = $this->html_entity_decode( $title );
$settings[ "{$prefix}description" ]['placeholder'] = $this->html_entity_decode( $description );
$settings[ "{$prefix}keywords" ]['placeholder'] = $keywords;


$title = $info['title'];
$description = $info['description'];
$keywords = $info['keywords'];

$settings["{$prefix}title"]['placeholder'] = $this->html_entity_decode( $title );
$settings["{$prefix}description"]['placeholder'] = $this->html_entity_decode( $description );
$settings["{$prefix}keywords"]['placeholder'] = $keywords;
}

if ( ! AIOSEOPPRO ) {
Expand Down Expand Up @@ -3625,12 +3639,11 @@ function replace_title( $content, $title ) {
function add_hooks() {
global $aioseop_options, $aioseop_update_checker;

// MOVED TO MAIN PLUGIN FILE IN ORDER TO FIRE SOONS
// $role = get_role( 'administrator' );
// if ( is_object( $role ) ) {
// $role->add_cap( 'aiosp_manage_seo' );
// }
aioseop_update_settings_check();
if ( is_admin() ) {
// this checks if the settiongs options exist and if they dont, it sets the defaults.
// let's do this only in backend.
aioseop_update_settings_check();
}
add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
if ( is_user_logged_in() && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 1000 );
Expand Down Expand Up @@ -3967,7 +3980,7 @@ function wp_head() {
$show_page = false;
}

if ( $aioseop_options['aiosp_can'] ) {
if ( isset( $aioseop_options['aiosp_can'] ) && $aioseop_options['aiosp_can'] ) {
$url = '';
if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) && ! is_home() ) {
$url = $opts['aiosp_custom_link'];
Expand Down Expand Up @@ -4121,6 +4134,12 @@ function get_robots_meta() {
$aiosp_noindex = $aiosp_nofollow = '';
$noindex = 'index';
$nofollow = 'follow';

if ( ! empty( $opts ) ) {
$aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
$aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
}

if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
&& ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
|| ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
Expand All @@ -4129,17 +4148,23 @@ function get_robots_meta() {
|| ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
) {
$noindex = 'noindex';

// #322: duplicating this code so that we don't step on some other entities' toes.
if ( ( 'on' === $aiosp_nofollow ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
( ( '' === $aiosp_nofollow ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
) {
$nofollow = 'nofollow';
}
// #322: duplicating this code so that we don't step on some other entities' toes.
} elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
$post_type = get_post_type();
if ( ! empty( $opts ) ) {
$aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
$aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
}
if ( $aiosp_noindex || $aiosp_nofollow || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
|| ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
) {
if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )

if ( ( 'on' === $aiosp_noindex ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
( ( '' === $aiosp_noindex ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )

) {
$noindex = 'noindex';
}
Expand Down Expand Up @@ -4812,7 +4837,9 @@ function admin_menu() {
$this->locations['aiosp']['display'] = array();
}
}
} else {
} elseif ( empty( $this->locations['aiosp']['display'] ) ) {
// #1067: if SEO was disabled, it was always displaying for post and page. Because we are now sending an invalid post type '___null___' when SEO is disabled,
// this else will be unreachable. Still keeping it in case there is an undiscovered path that needs this condition.
$this->locations['aiosp']['display'] = array( 'post', 'page' );
}

Expand Down
6 changes: 3 additions & 3 deletions all_in_one_seo_pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: All In One SEO Pack
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
Version: 2.4.6
Version: 2.6
Author: Michael Torbert
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Text Domain: all-in-one-seo-pack
Expand Down Expand Up @@ -32,14 +32,14 @@
* The original WordPress SEO plugin.
*
* @package All-in-One-SEO-Pack
* @version 2.4.6
* @version 2.6
*/

if ( ! defined( 'AIOSEOPPRO' ) ) {
define( 'AIOSEOPPRO', false );
}
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
define( 'AIOSEOP_VERSION', '2.4.6' );
define( 'AIOSEOP_VERSION', '2.6' );
}
global $aioseop_plugin_name;
$aioseop_plugin_name = 'All in One SEO Pack';
Expand Down
10 changes: 5 additions & 5 deletions inc/aioseop_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ function aioseop_get_options() {
/**
* Check if settings need to be updated / migrated from old version.
*
* @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class?
* @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class? This is called every single time a page is loaded both on the front-end or backend.
*/
function aioseop_update_settings_check() {
global $aioseop_options;
if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) {
aioseop_mrt_mkarry();
aioseop_initialize_options();
}
// WPML has now attached to filters, read settings again so they can be translated.
aioseop_get_options();
Expand All @@ -85,13 +85,13 @@ function aioseop_update_settings_check() {
}
}

if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
if ( ! function_exists( 'aioseop_initialize_options' ) ) {
/**
* Initialize settings to defaults.
* Initialize settings to defaults. Changed name from the abstruse 'aioseop_mrt_mkarry' to 'aioseop_initialize_options'.
*
* @TODO Should also move.
*/
function aioseop_mrt_mkarry() {
function aioseop_initialize_options() {
global $aiosp;
global $aioseop_options;
$naioseop_options = $aiosp->default_options();
Expand Down
21 changes: 21 additions & 0 deletions modules/aioseop_feature_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,51 @@ class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
* @param $mod Module.
*/
function __construct( $mod ) {
/* translators: the Feature Manager allows users to (de)activate other modules of the plugin. */
$this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
$this->prefix = 'aiosp_feature_manager_'; // Option prefix.
$this->file = __FILE__; // The current file.
parent::__construct();
$this->module_info = array(
'sitemap' => array(
/* translators: the XML Sitemaps module allows users to generate a sitemap in .xml format for their website and
submit it to search engines such as Google, Bing and Yahoo. */
'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
),
'opengraph' => array(
/* translators: the Social Meta module allows users to add Open Graph (OG:) meta tags to their site's post/pages
to control the appearance of them when shared on social media networks like Facebook and Twitter. */
'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
/* translators: Social Meta refers to Open Graph (OG:) meta tags, which can be used to control the appearance
of a site's posts/pages when shared on social media networks like Facebook and Twitter. */
'description' => __( 'Add Social Meta data to your site to deliver closer integration between your website/blog and social media.', 'all-in-one-seo-pack' ),
),
'robots' => array(
/* translators: the Robots.txt module allows users to provide instructions to web robots, e.g. search engine crawlers. */
'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ),
),
'file_editor' => array(
/* translators: the File Editor module allows users to edit the robots.txt file or .htaccess file on their site. */
'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ),
),
'importer_exporter' => array(
/* translators: the Importer & Exporter module allows users to import/export their All in One SEO Pack
settings for backup purposes or when migrating their site. */
'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ),
),
'bad_robots' => array(
/* translators: the Bad Bot Blocker module allows users to block requests from user agents that are known to misbehave. */
'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
/* translators: 'bots' refers to user agents/web robots that misbehave. */
'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ),
),
'performance' => array(
/* translators: the Performance module allows users to set certain performance related settings and
check the status of their WordPress installation. */
'name' => __( 'Performance', 'all-in-one-seo-pack' ),
'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
'default' => 'on',
Expand All @@ -59,11 +74,15 @@ function __construct( $mod ) {
if ( AIOSEOPPRO ) {

$this->module_info['coming_soon'] = array(
/* translators: this refers to a feature that will be launched in the near future. */
'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
/* translators: the Image SEO module allows users to optimize their images for search engines. */
'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
'save' => false,
);
$this->module_info['video_sitemap'] = array(
/*translators: the Video Sitemap module allows users to generate a sitemap with video content in .xml format
for their website and submit it to search engines such as Google, Bing and Yahoo. */
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
);
Expand All @@ -72,6 +91,7 @@ function __construct( $mod ) {

$this->module_info['coming_soon'] = array(
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
/* translators: this refers to a module that is exclusively available in All in One SEO Pack Pro. */
'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
'save' => false,
);
Expand Down Expand Up @@ -145,6 +165,7 @@ function menu_order() {
function filter_submit( $submit ) {
$submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
$submit['Submit']['class'] .= ' hidden';
/* translators: this button deactivates all active modules of the plugin. */
$submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';

return $submit;
Expand Down
Loading

0 comments on commit 131d246

Please sign in to comment.