Skip to content

Commit

Permalink
Merge pull request #1026 from semperfiwebdesign/development
Browse files Browse the repository at this point in the history
Development to master for 2.3.15
  • Loading branch information
michaeltorbert authored Aug 3, 2017
2 parents cfdaf3a + 033c08d commit 152fcc1
Show file tree
Hide file tree
Showing 8 changed files with 260 additions and 356 deletions.
12 changes: 10 additions & 2 deletions admin/aioseop_module_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2220,8 +2220,10 @@ function get_option_html( $args ) {
$buf .= "<textarea name='$name' $attr>$value</textarea>";
break;
case 'image':
$buf .= '<input class="aioseop_upload_image_checker" type="hidden" name="'.$name.'_checker" value="0">'.
"<input class='aioseop_upload_image_button button-primary' type='button' value='Upload Image' style='float:left;' />" .
$buf .= '<input class="aioseop_upload_image_checker" type="hidden" name="' . $name . '_checker" value="0">' .
"<input class='aioseop_upload_image_button button-primary' type='button' value='";
$buf .= __( 'Upload Image', 'all-in-one-seo-pack' );
$buf .= "' style='float:left;' />" .
"<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
break;
case 'html':
Expand Down Expand Up @@ -2849,6 +2851,12 @@ function get_current_options( $opts = array(), $location = null, $defaults = nul
$get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
}
}

if ( is_home() && ! is_front_page() ) {
// If we're on the non-front page blog page, WP doesn't really know its post meta data so we need to get that manually for social meta.
$get_opts = get_post_meta( get_option( 'page_for_posts' ), '_' . $prefix . $location, true );
}

$defs = $this->default_options( $location, $defaults );
if ( empty( $get_opts ) ) {
$get_opts = $defs;
Expand Down
8 changes: 2 additions & 6 deletions admin/meta_import.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ function aiosp_seometa_settings_init() {
/**
* Intercept POST data from the form submission.
*
* Use the intercepted data to convert values in the postmeta table from one platform to another.
* Use the intercepted data to convert values in the postmeta table from one platform to another and display feedback to the user about compatible conversion
* elements and the conversion process.
*/
function aiosp_seometa_action() {

Expand Down Expand Up @@ -130,11 +131,6 @@ function aiosp_seometa_action() {

}

/**
* This function displays feedback to the user about compatible conversion
* elements and the conversion process via the admin_alert hook.
*/

/**
* The admin page output
*/
Expand Down
133 changes: 59 additions & 74 deletions aioseop_class.php

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions all_in_one_seo_pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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.3.14.2
Version: 2.3.15
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 @@ -31,14 +31,14 @@
* The original WordPress SEO plugin.
*
* @package All-in-One-SEO-Pack
* @version 2.3.14.2
* @version 2.3.15
*/

if ( ! defined( 'AIOSEOPPRO' ) ) {
define( 'AIOSEOPPRO', false );
}
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
define( 'AIOSEOP_VERSION', '2.3.14.2' );
define( 'AIOSEOP_VERSION', '2.3.15' );
}
global $aioseop_plugin_name;
$aioseop_plugin_name = 'All in One SEO Pack';
Expand Down
20 changes: 11 additions & 9 deletions inc/sitemap-xsl.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,17 @@
<a href="{$itemURL}">
<xsl:value-of select="sitemap:loc"/>
</a>
<xsl:variable name="thumbURL">
<xsl:value-of select="video:video/video:thumbnail_loc"/>
</xsl:variable>
<xsl:variable name="playURL">
<xsl:value-of select="video:video/video:player_loc"/>
</xsl:variable>
<xsl:if test="$thumbURL != ''">
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
</xsl:if>
<xsl:for-each select="video:video">
<xsl:variable name="thumbURL">
<xsl:value-of select="video:thumbnail_loc"/>
</xsl:variable>
<xsl:variable name="playURL">
<xsl:value-of select="video:player_loc"/>
</xsl:variable>
<xsl:if test="$thumbURL != ''">
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
</xsl:if>
</xsl:for-each>
</td>
<td>
<xsl:if test="string(number(sitemap:priority))!='NaN'">
Expand Down
123 changes: 44 additions & 79 deletions modules/aioseop_opengraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
/**
* Module constructor.
*
* @since 2.4.14 Added display filter.
* @since 2.4.14 Added display filter.
*/
function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'og_admin_enqueue_scripts' ) );
Expand Down Expand Up @@ -81,12 +81,6 @@ function __construct() {
);
parent::__construct();

$categories = Array(
'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
'website' => __( 'Website', 'all-in-one-seo-pack' ),
'article' => __( 'Article', 'all-in-one-seo-pack' ),
);

$this->help_text = Array(
"setmeta" => __( "Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.", 'all-in-one-seo-pack' ),
"key" => __( "Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma. You can look up your Facebook ID using this tool http://findmyfbid.com/", 'all-in-one-seo-pack' ),
Expand All @@ -97,15 +91,13 @@ function __construct() {
"hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ),
"description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ),
"homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ),
"hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ),
"generate_descriptions" => __( "This option will auto generate your Open Graph descriptions from your post content instead of your post excerpt. WooCommerce users should read the documentation regarding this setting.", 'all-in-one-seo-pack' ),
"defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.", 'all-in-one-seo-pack' ),
"fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ),
"dimg" => __( "This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.", 'all-in-one-seo-pack' ),
"dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ),
"dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ),
"meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.", 'all-in-one-seo-pack' ),
"categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ),
"image" => __( "This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.", 'all-in-one-seo-pack' ),
"customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.", 'all-in-one-seo-pack' ),
"imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
Expand Down Expand Up @@ -146,7 +138,6 @@ function __construct() {
'hometitle' => '#home-title-and-description',
'description' => '#home-title-and-description',
'homeimage' => '#home-image',
'hometag' => '#home-article-tags',
'defimg' => '#select-og-image-source',
'fallback' => '#use-default-if-no-image-found',
'dimg' => '#default-og-image',
Expand All @@ -158,7 +149,6 @@ function __construct() {
'social_name' => '#social-profile-links',
'key' => '#facebook-admin-id',
'appid' => '#facebook-app-id',
'categories' => '#facebook-object-type',
'gen_tags' => '#automatically-generate-article-tags',
'gen_keywords' => '#use-keywords-in-article-tags',
'gen_categories' => '#use-categories-in-article-tags',
Expand All @@ -167,7 +157,6 @@ function __construct() {
'facebook_author' => '#show-facebook-author-on-articles',
'types' => '#enable-facebook-meta-for',
'defcard' => '#default-twitter-card',
'setcard' => '#default-twitter-card',
'twitter_site' => '#twitter-site',
'twitter_creator' => '#show-twitter-author',
'twitter_domain' => '#twitter-domain',
Expand Down Expand Up @@ -211,15 +200,9 @@ function __construct() {

/**
* Hook called after wordpress has been loaded.
* @since 2.4.14
* @since 2.4.14
*/
public function init() {
// Prepare re-usable variables
$categories = array(
'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
'website' => __( 'Website', 'all-in-one-seo-pack' ),
'article' => __( 'Article', 'all-in-one-seo-pack' ),
);
$count_desc = __( ' characters. Open Graph allows up to a maximum of %s chars for the %s.', 'all-in-one-seo-pack' );
// Create default options
$this->default_options = array(
Expand Down Expand Up @@ -281,14 +264,6 @@ public function init() {
'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
'type' => 'image',
),
'hometag' => array(
'name' => __( 'Home Article Tags', 'all-in-one-seo-pack' ),
'type' => 'text',
'default' => '',
'condshow' => array(
'aiosp_opengraph_categories' => 'article'
),
),
'generate_descriptions' => array(
'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ),
'default' => 0,
Expand Down Expand Up @@ -330,12 +305,6 @@ public function init() {
'type' => 'text',
'default' => '',
),
'categories' => array(
'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
'type' => 'radio',
'default' => 'blog',
'initial_options' => $categories,
),
'image' => array(
'name' => __( 'Image', 'all-in-one-seo-pack' ),
'type' => 'radio',
Expand Down Expand Up @@ -541,15 +510,13 @@ public function init() {
'hometitle',
'description',
'homeimage',
'hometag',
'generate_descriptions',
'defimg',
'fallback',
'dimg',
'dimgwidth',
'dimgheight',
'meta_key',
'categories',
'defcard',
'profile_links',
'person_or_org',
Expand Down Expand Up @@ -595,7 +562,7 @@ public function init() {
'home' => Array(
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description',
'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage', 'hometag' ),
'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ),
),
'image' => Array(
'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
Expand All @@ -618,7 +585,6 @@ public function init() {
'gen_keywords',
'gen_categories',
'gen_post_tags',
'categories',
'facebook_publisher',
'facebook_author',
),
Expand Down Expand Up @@ -706,20 +672,6 @@ function force_fb_refresh_update( $post_ID, $post_after ) {

function settings_page_init() {
add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
$cat = $this->options["{$this->prefix}categories"];
if ( ! empty( $cat ) ) {
if ( $cat == 'blog' ) {
$show_on_front = get_option( 'show_on_front' );
if ( ( $show_on_front == 'page' ) && ( get_option( 'page_on_front' ) ) ) {
$this->output_error( '<p>' . __( "Static front page detected, suggested Facebook Object Type is 'website'.", 'all-in-one-seo-pack' ) . '</p>' );
}
} elseif ( $cat == 'website' ) {
$show_on_front = get_option( 'show_on_front' );
if ( ( $show_on_front == 'posts' ) ) {
$this->output_error( '<p>' . __( "Blog on front page detected, suggested Facebook Object Type is 'blog'.", 'all-in-one-seo-pack' ) . '</p>' );
}
}
}
}

function filter_options( $options, $location ) {
Expand Down Expand Up @@ -753,6 +705,7 @@ function filter_options( $options, $location ) {
*
* @since 2.3.11
* @since 2.4.14 Added filter for description and title placeholders.
* @since 2.3.15 do_shortcode on description.
*
* @see [plugin]\admin\aioseop_module_class.php > display_options()
*/
Expand Down Expand Up @@ -790,18 +743,19 @@ function filter_settings( $settings, $location, $current ) {

// Description options
if ( is_object( $post ) )
// Always show excerpt
$description = empty( $this->options['aiosp_opengraph_generate_descriptions'] )
? $aiosp->trim_excerpt_without_filters(
$aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ),
1000
)
: $aiosp->trim_excerpt_without_filters(
$aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ),
1000
);
// Always show excerpt
$description = empty( $this->options['aiosp_opengraph_generate_descriptions'] )
? $aiosp->trim_excerpt_without_filters(
$aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ),
1000
)
: $aiosp->trim_excerpt_without_filters(
$aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ),
1000
);

// Add filters
$description = do_shortcode( $description );
$description = apply_filters( 'aioseop_description', $description );
// Add placholders
$settings["{$prefix}title"]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title );
Expand Down Expand Up @@ -981,6 +935,7 @@ function add_attributes( $output ) { // avoid having duplicate meta tags
* @since 2.3.11.5 Support for multiple fb_admins.
* @since 2.3.13 Adds filter:aioseop_description on description.
* @since 2.4.14 Fixes for aioseop-pro #67.
* @since 2.3.15 Always do_shortcode on descriptions, removed for titles.
*
* @global object $post Current WP_Post object.
* @global object $aiosp All in one seo plugin object.
Expand Down Expand Up @@ -1056,9 +1011,6 @@ function add_meta() {
if ( empty( $description ) && $first_page ) {
$description = get_bloginfo( 'description' );
}
if ( $type == 'article' && ( ! empty( $this->options['aiosp_opengraph_hometag'] ) ) ) {
$tag = $this->options['aiosp_opengraph_hometag'];
}
if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
$social_links = $this->options['aiosp_opengraph_profile_links'];
if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
Expand Down Expand Up @@ -1194,6 +1146,21 @@ function add_meta() {
if ( empty( $type ) ) {
$type = 'website';
}
} else if ( is_home() && ! is_front_page() ) {
// This is the blog page but not the homepage.
global $aiosp;
$image = $metabox['aioseop_opengraph_settings_image'];
$video = $metabox['aioseop_opengraph_settings_video'];
$title = $metabox['aioseop_opengraph_settings_title'];
$description = $metabox['aioseop_opengraph_settings_desc'];

if ( empty( $description ) ) {
// If there's not social description, fall back to the SEO description.
$description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) );
}
if ( empty( $title ) ) {
$title = $aiosp->wp_title();
}
} else {
return;
}
Expand Down Expand Up @@ -1223,15 +1190,9 @@ function add_meta() {
}
}

if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
$title = do_shortcode( $title );
}

if ( ! empty( $description ) ) {
$description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) {
$description = do_shortcode( $description );
}
$description = do_shortcode( $description );
$description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
}

Expand Down Expand Up @@ -1486,13 +1447,17 @@ public function do_opengraph() {
}
}

/**
* Set up types.
*
* @since ?
* @since 2.3.15 Change to website for homepage and blog post index page, default to object.
*/
function type_setup() {
global $aiosp, $wp_query;
$this->type = '';
if ( $aiosp->is_static_front_page() ) {
if ( ! empty( $this->options ) && ! empty( $this->options['aiosp_opengraph_categories'] ) ) {
$this->type = $this->options['aiosp_opengraph_categories'];
}
$this->type = 'object'; // Default to type object if we don't have some other rule.

if ( is_home() || is_front_page() ) {
$this->type = 'website'; // Home page and blog page should be website.
} elseif ( is_singular() && $this->option_isset( 'types' ) ) {
$metabox = $this->get_current_options( Array(), 'settings' );
$current_post_type = get_post_type();
Expand All @@ -1506,7 +1471,7 @@ function type_setup() {

/**
* Inits hooks and others for admin init.
* action:admin_init.
* action:admin_init.
*
* @since 2.3.11
* @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox.
Expand Down Expand Up @@ -1700,7 +1665,7 @@ public function filter_default_options( $options, $location ) {
* Returns facebook debug script and link.
* @since 2.4.14
*
* @return string
* @return string
*/
private function get_facebook_debug() {
ob_start();
Expand Down
Loading

0 comments on commit 152fcc1

Please sign in to comment.