Skip to content

Commit

Permalink
Merge pull request #1642 from semperfiwebdesign/development
Browse files Browse the repository at this point in the history
dev to master for 2.5
  • Loading branch information
michaeltorbert authored Mar 29, 2018
2 parents 410ad40 + a177f55 commit a16a687
Show file tree
Hide file tree
Showing 17 changed files with 3,237 additions and 2,599 deletions.
33 changes: 6 additions & 27 deletions admin/aioseop_module_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,37 +326,18 @@ function strrpos( $haystack, $needle, $offset = 0 ) {
}

/**
* convert xml string to php array - useful to get a serializable value
* Convert html string to php array - useful to get a serializable value.
*
* @param string $xmlstr
*
* @return array
*
* @author Adrien aka Gaarf & contributors
* @see http://gaarf.info/2009/08/13/xml-string-to-php-array/
*/
function html_string_to_array( $xmlstr ) {
if ( ! class_exists( 'DOMDocument' ) ) {
return array();
} else {
$doc = new DOMDocument();
$doc->loadHTML( $xmlstr );

return $this->domnode_to_array( $doc->documentElement );
}
}

/**
* @param $xmlstr
*
* @return array|string
*/
function xml_string_to_array( $xmlstr ) {
function html_string_to_array( $htmlstr ) {
if ( ! class_exists( 'DOMDocument' ) ) {
return array();
} else {
$doc = new DOMDocument();
$doc->loadXML( $xmlstr );
$doc->loadXML( $htmlstr );

return $this->domnode_to_array( $doc->documentElement );
}
Expand Down Expand Up @@ -444,9 +425,6 @@ function cf_field_replace( $matches ) {
$result = get_post_meta( $post->ID, $matches[1], true );
}
}
if ( empty( $result ) ) {
$result = $matches[0];
}
} else {
$result = $matches[0];
}
Expand Down Expand Up @@ -2256,8 +2234,9 @@ function get_option_html( $args ) {
$onload = '';
if ( ! empty( $options['count'] ) ) {
$n ++;
$attr .= " onKeyDown='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)' onKeyUp='if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n)'";
$onload = "if (typeof countChars == \"function\") countChars(document.{$this->form}.$name,document.{$this->form}.{$prefix}length$n);";
$classes = isset( $options['class'] ) ? $options['class'] : '';
$classes .= ' aioseop_count_chars';
$attr .= " class='{$classes}' data-length-field='{$prefix}length$n'";
}
if ( isset( $opts['id'] ) ) {
$attr .= " id=\"{$opts['id']}\" ";
Expand Down
27 changes: 17 additions & 10 deletions aioseop_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1211,10 +1211,11 @@ function custom_output_option( $buf, $args ) {
$title_format = str_replace( '%page_title%', $replace_title, $title_format );
}
if ( strpos( $title_format, '%current_date%' ) !== false ) {
$title_format = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $title_format );
$title_format = str_replace( '%current_date%', aioseop_formatted_date(), $title_format );
}
if ( strpos( $title_format, '%post_date%' ) !== false ) {
$title_format = str_replace( '%post_date%', get_the_date(), $title_format );

if ( strpos( $title_format, "%post_date%" ) !== false ){
$title_format = str_replace( '%post_date%', aioseop_formatted_date( get_the_time( 'U' ) ), $title_format );
}
if ( strpos( $title_format, '%post_year%' ) !== false ) {
$title_format = str_replace( '%post_year%', get_the_date( 'Y' ), $title_format );
Expand Down Expand Up @@ -2082,11 +2083,12 @@ function title_placeholder_helper( $title, $post, $type = 'post', $title_format
if ( strpos( $new_title, "%{$type}_author_lastname%" ) !== false ) {
$new_title = str_replace( "%{$type}_author_lastname%", $this->ucwords( $authordata->last_name ), $new_title );
}
if ( strpos( $new_title, '%current_date%' ) !== false ) {
$new_title = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $new_title );

if ( strpos( $new_title, "%current_date%" ) !== false ){
$new_title = str_replace( '%current_date%', aioseop_formatted_date(), $new_title );
}
if ( strpos( $new_title, '%post_date%' ) !== false ) {
$new_title = str_replace( '%post_date%', get_the_date(), $new_title );
if ( strpos( $new_title, "%post_date%" ) !== false ){
$new_title = str_replace( '%post_date%', aioseop_formatted_date( get_the_date( 'U' ) ), $new_title );
}
if ( strpos( $new_title, '%post_year%' ) !== false ) {
$new_title = str_replace( '%post_year%', get_the_date( 'Y' ), $new_title );
Expand Down Expand Up @@ -2659,7 +2661,11 @@ function aiosp_mrt_get_url( $query, $show_page = true ) {
return false;
}
$link = '';
$haspost = count( $query->posts ) > 0;
$haspost = false;
if ( ! empty( $query->posts ) ) {
$haspost = count( $query->posts ) > 0;
}

if ( get_query_var( 'm' ) ) {
$m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) );
switch ( $this->strlen( $m ) ) {
Expand Down Expand Up @@ -3793,8 +3799,9 @@ function wp_head() {
global $aioseop_update_checker, $wp_query, $aioseop_options, $posts;
static $aioseop_dup_counter = 0;
$aioseop_dup_counter ++;
if ( $aioseop_dup_counter > 1 ) {
echo "\n<!-- " . sprintf( __( 'Debug Warning: All in One SEO Pack meta data was included again from %1$s filter. Called %2$s times!', 'all-in-one-seo-pack' ), current_filter(), $aioseop_dup_counter ) . " -->\n";

if ( ! defined('AIOSEOP_UNIT_TESTING') && $aioseop_dup_counter > 1 ) {
echo "\n<!-- " . sprintf( __( 'Debug Warning: All in One SEO Pack meta data was included again from %s filter. Called %s times!', 'all-in-one-seo-pack' ), current_filter(), $aioseop_dup_counter ) . " -->\n";
if ( ! empty( $old_wp_query ) ) {
// Change the query back after we've finished.
$GLOBALS['wp_query'] = $old_wp_query;
Expand Down
Loading

0 comments on commit a16a687

Please sign in to comment.