Skip to content

Commit

Permalink
Merge pull request #1565 from semperfiwebdesign/development
Browse files Browse the repository at this point in the history
Development to master for 2.4.5
  • Loading branch information
michaeltorbert authored Feb 13, 2018
2 parents 31aba3f + 6d0ccd4 commit f74d0cf
Show file tree
Hide file tree
Showing 14 changed files with 409 additions and 97 deletions.
26 changes: 17 additions & 9 deletions admin/aioseop_module_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2190,15 +2190,16 @@ function get_option_html( $args ) {
return apply_filters( "{$prefix}output_option", '', $args );
}
if ( in_array( $options['type'], array(
'multiselect',
'select',
'multicheckbox',
'radio',
'checkbox',
'textarea',
'text',
'submit',
'hidden',
'multiselect',
'select',
'multicheckbox',
'radio',
'checkbox',
'textarea',
'text',
'submit',
'hidden',
'date',
) ) && is_string( $value )
) {
$value = esc_attr( $value );
Expand All @@ -2213,6 +2214,9 @@ function get_option_html( $args ) {
if ( isset( $opts['id'] ) ) {
$attr .= " id=\"{$opts['id']}\" ";
}
if ( isset( $options['required'] ) && true === $options['required'] ) {
$attr .= ' required';
}
switch ( $options['type'] ) {
case 'multiselect':
$attr .= ' MULTIPLE';
Expand Down Expand Up @@ -2249,6 +2253,10 @@ function get_option_html( $args ) {
case 'esc_html':
$buf .= "<pre>" . esc_html( $value ) . "</pre>\n";
break;
case 'date':
// firefox and IE < 11 do not have support for HTML5 date, so we will fall back to the datepicker.
wp_enqueue_script( 'jquery-ui-datepicker' );
// fall through.
default:
$buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
}
Expand Down
6 changes: 3 additions & 3 deletions aioseop_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ function get_page_snippet_info() {
$url = apply_filters( 'aioseop_canonical_url', $url );
}
if ( ! $url ) {
$url = get_permalink();
$url = aioseop_get_permalink();
}

$title = $this->apply_cf_fields( $title );
Expand Down Expand Up @@ -2675,7 +2675,7 @@ function aiosp_mrt_get_url( $query, $show_page = true ) {
return false;
}
} elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) {
$link = get_permalink( $pageid );
$link = aioseop_get_permalink( $pageid );
} elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
if ( function_exists( 'icl_get_home_url' ) ) {
$link = icl_get_home_url();
Expand All @@ -2684,7 +2684,7 @@ function aiosp_mrt_get_url( $query, $show_page = true ) {
}
} elseif ( ( $query->is_single || $query->is_page ) && $haspost ) {
$post = $query->posts[0];
$link = get_permalink( $post->ID );
$link = aioseop_get_permalink( $post->ID );
} elseif ( $query->is_author && $haspost ) {
$author = get_userdata( get_query_var( 'author' ) );
if ( false === $author ) {
Expand Down
2 changes: 1 addition & 1 deletion 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.4.4.1
Version: 2.4.5
Author: Michael Torbert
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Text Domain: all-in-one-seo-pack
Expand Down
77 changes: 52 additions & 25 deletions inc/aioseop_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@
* @version 2.3.13
*/

if ( ! function_exists( 'aioseop_get_permalink' ) ) {
/**
* Support UTF8 URLs.
*
* @param int|object|null $post_id The post.
*/
function aioseop_get_permalink( $post_id = null ) {
if ( is_null( $post_id ) ) {
global $post;
$post_id = $post;
}

return urldecode( get_permalink( $post_id ) );
}
}

if ( ! function_exists( 'aioseop_load_modules' ) ) {
/**
* Load the module manager.
Expand Down Expand Up @@ -406,39 +422,50 @@ function aioseop_ajax_update_oembed() {
if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {

function aioseop_ajax_save_url() {
$valid = true;
aioseop_ajax_init();
$options = Array();
parse_str( $_POST['options'], $options );
foreach ( $options as $k => $v ) {
// all values are mandatory while adding to the sitemap.
// this should work in the same way for news and video sitemaps too, but tackling only regular sitemaps for now.
if ( 'sitemap_addl_pages' === $_POST['settings'] && empty( $v ) ) {
$valid = false;
break;
}
$_POST[ $k ] = $v;
}
$_POST['action'] = 'aiosp_update_module';
global $aiosp, $aioseop_modules;
aioseop_load_modules();
$aiosp->admin_menu();
if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'video_sitemap_addl_pages' ) ) {
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Video_Sitemap' );
} elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'news_sitemap_addl_pages' ) ) {
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_News_Sitemap' );
if ( $valid ) {
$_POST['action'] = 'aiosp_update_module';
global $aiosp, $aioseop_modules;
aioseop_load_modules();
$aiosp->admin_menu();
if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'video_sitemap_addl_pages' ) ) {
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Video_Sitemap' );
} elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'news_sitemap_addl_pages' ) ) {
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_News_Sitemap' );
} else {
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
}
$_POST['location'] = null;
$_POST['Submit'] = 'ajax';
$module->add_page_hooks();
$prefix = $module->get_prefix();
$_POST = $module->get_current_options( $_POST, null );
$module->handle_settings_updates( null );
$options = $module->get_current_options( Array(), null );
$output = $module->display_custom_options( '', Array(
'name' => $prefix . 'addl_pages',
'type' => 'custom',
'save' => true,
'value' => $options[ $prefix . 'addl_pages' ],
'attr' => '',
) );
$output = str_replace( "'", "\'", $output );
$output = str_replace( "\n", '\n', $output );
} else {
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
$output = __( 'All values are mandatory.', 'all-in-one-seo-pack' );
}
$_POST['location'] = null;
$_POST['Submit'] = 'ajax';
$module->add_page_hooks();
$prefix = $module->get_prefix();
$_POST = $module->get_current_options( $_POST, null );
$module->handle_settings_updates( null );
$options = $module->get_current_options( Array(), null );
$output = $module->display_custom_options( '', Array(
'name' => $prefix . 'addl_pages',
'type' => 'custom',
'save' => true,
'value' => $options[ $prefix . 'addl_pages' ],
'attr' => '',
) );
$output = str_replace( "'", "\'", $output );
$output = str_replace( "\n", '\n', $output );
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
}
}
Expand Down
14 changes: 14 additions & 0 deletions js/modules/aioseop_module.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,17 @@ jQuery( document ).ready(function() {
return false;
});
});


jQuery(document).ready( function() {
// TODO: consider moving EVERYTHING that needs ready() to this function
initAll(jQuery);
});

function initAll($){
if($('.aiseop-date').eq(0).prop('type').toLowerCase() === 'text'){
$('.aiseop-date').datepicker({
dateFormat: "yy-mm-dd"
});
}
}
8 changes: 4 additions & 4 deletions modules/aioseop_opengraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ function force_fb_refresh_transition( $new_status, $old_status, $post ) {

// Only ping Facebook if Social SEO is enabled on this post type.
if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
$post_url = get_permalink( $post->ID );
$post_url = aioseop_get_permalink( $post->ID );
$endpoint = sprintf( 'https://graph.facebook.com/?%s', http_build_query( array(
'id' => $post_url,
'scrape' => true,
Expand All @@ -652,19 +652,19 @@ function force_fb_refresh_transition( $new_status, $old_status, $post ) {
/**
* Forces FaceBook OpenGraph refresh on update.
*
* @param $post_ID
* @param $post_id
* @param $post_after
*
* @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
* @since 2.3.11
*/
function force_fb_refresh_update( $post_ID, $post_after ) {
function force_fb_refresh_update( $post_id, $post_after ) {

$current_post_type = get_post_type();

// Only ping Facebook if Social SEO is enabled on this post type.
if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) {
$post_url = get_permalink( $post_ID );
$post_url = aioseop_get_permalink( $post_id );
$endpoint = sprintf( 'https://graph.facebook.com/?%s', http_build_query( array(
'id' => $post_url,
'scrape' => true,
Expand Down
Loading

0 comments on commit f74d0cf

Please sign in to comment.