From 301f38f04fd45f5d1ec60c20162c7c315cc05247 Mon Sep 17 00:00:00 2001 From: EkoJR Date: Fri, 12 Jan 2018 06:15:19 -0800 Subject: [PATCH 1/6] Hotfix aioseop_description filter --- aioseop_class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index d036e3dea..9221532c4 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -2472,6 +2472,12 @@ function get_main_description( $post = null ) { $description = $this->internationalize( $description ); } + $description = apply_filters( + 'aioseop_description', + $description, + empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) + ); + return $description; } @@ -2542,6 +2548,7 @@ function get_aioseop_description( $post = null ) { */ function get_post_description( $post ) { global $aioseop_options; + $aioseop_options['aiosp_dont_truncate_descriptions'] = false; $description = ''; if ( ! $this->show_page_description() ) { return ''; @@ -2560,12 +2567,8 @@ function get_post_description( $post ) { $content = do_shortcode( $content ); } $description = $this->trim_text_without_filters_full_length( $this->internationalize( $content ) ); + $aioseop_options['aiosp_dont_truncate_descriptions'] = true; } - $description = apply_filters( - 'aioseop_description', - $description, - empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) - ); } return $description; @@ -4938,7 +4941,7 @@ public function filter_description( $value, $truncate = false ) { // Internal whitespace trim. $value = preg_replace( '/\s\s+/u', ' ', $value ); // Truncate / crop - if ( ! empty( $truncate ) ) + if ( ! empty( $truncate ) && $truncate ) $value = $this->trim_excerpt_without_filters( $value ); // Encode to valid SEO html entities return $this->seo_entity_encode( $value ); From a34fa83999a7b29734651f88249ac922c162b75e Mon Sep 17 00:00:00 2001 From: EkoJR Date: Sat, 13 Jan 2018 07:14:48 -0800 Subject: [PATCH 2/6] Hotfix Desc update --- aioseop_class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 9221532c4..07d637fb0 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -2509,12 +2509,16 @@ function get_page_number() { } /** + * @since ? + * @since 2.4 #1395 Longer Meta Descriptions & don't trim manual Descriptions. + * * @param null $post * * @return mixed|string */ function get_aioseop_description( $post = null ) { global $aioseop_options; + $aioseop_options['aiosp_dont_truncate_descriptions'] = true; if ( null === $post ) { $post = $GLOBALS['post']; } @@ -2548,7 +2552,6 @@ function get_aioseop_description( $post = null ) { */ function get_post_description( $post ) { global $aioseop_options; - $aioseop_options['aiosp_dont_truncate_descriptions'] = false; $description = ''; if ( ! $this->show_page_description() ) { return ''; @@ -2567,7 +2570,7 @@ function get_post_description( $post ) { $content = do_shortcode( $content ); } $description = $this->trim_text_without_filters_full_length( $this->internationalize( $content ) ); - $aioseop_options['aiosp_dont_truncate_descriptions'] = true; + $aioseop_options['aiosp_dont_truncate_descriptions'] = false; } } From 3fc51b49446547bbaa7012c12065f31f94ca1b7b Mon Sep 17 00:00:00 2001 From: EkoJR Date: Mon, 15 Jan 2018 14:26:41 -0800 Subject: [PATCH 3/6] Fixed Never Shorten operations Regarding setting for Never Shorten Long Descriptions --- aioseop_class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 07d637fb0..ac522cc6b 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -2518,7 +2518,6 @@ function get_page_number() { */ function get_aioseop_description( $post = null ) { global $aioseop_options; - $aioseop_options['aiosp_dont_truncate_descriptions'] = true; if ( null === $post ) { $post = $GLOBALS['post']; } @@ -2570,7 +2569,13 @@ function get_post_description( $post ) { $content = do_shortcode( $content ); } $description = $this->trim_text_without_filters_full_length( $this->internationalize( $content ) ); - $aioseop_options['aiosp_dont_truncate_descriptions'] = false; + } + if ( isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) && false === $aioseop_options['aiosp_dont_truncate_descriptions'] ) { + $description = $this->substr( $description, 0, $this->maximum_description_length ); + $description = trim( $description ); + } elseif ( ! isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) || empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) { + $description = $this->substr( $description, 0, $this->maximum_description_length ); + $description = trim( $description ); } } From 40e670cbbcdff6614f8fddaa85cd6325d1b36567 Mon Sep 17 00:00:00 2001 From: EkoJR Date: Mon, 15 Jan 2018 15:54:35 -0800 Subject: [PATCH 4/6] Fixed trim on auto-gen --- aioseop_class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index ac522cc6b..5e6f6e631 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -2569,13 +2569,14 @@ function get_post_description( $post ) { $content = do_shortcode( $content ); } $description = $this->trim_text_without_filters_full_length( $this->internationalize( $content ) ); - } - if ( isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) && false === $aioseop_options['aiosp_dont_truncate_descriptions'] ) { - $description = $this->substr( $description, 0, $this->maximum_description_length ); - $description = trim( $description ); - } elseif ( ! isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) || empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) { - $description = $this->substr( $description, 0, $this->maximum_description_length ); - $description = trim( $description ); + + if ( isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) && false === $aioseop_options['aiosp_dont_truncate_descriptions'] ) { + $description = $this->substr( $description, 0, $this->maximum_description_length ); + $description = trim( $description ); + } elseif ( ! isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) || empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) { + $description = $this->substr( $description, 0, $this->maximum_description_length ); + $description = trim( $description ); + } } } From 2f04e739c68554da19f49bb31a96d4bcc53e0f64 Mon Sep 17 00:00:00 2001 From: EkoJR Date: Tue, 16 Jan 2018 10:21:32 -0800 Subject: [PATCH 5/6] Changed Description operation. --- aioseop_class.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 5e6f6e631..c4267b705 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -2436,6 +2436,7 @@ function get_archive_title_format() { /** * @since 2.3.14 #932 Adds filter "aioseop_description", removes extra filtering. * @since 2.4 #951 Trim/truncates occurs inside filter "aioseop_description". + * @since 2.4.4 #1395 Longer Meta Descriptions & don't trim manual Descriptions. * * @param null $post * @@ -2472,10 +2473,20 @@ function get_main_description( $post = null ) { $description = $this->internationalize( $description ); } + $truncate = false; + $aioseop_desc = ''; + if ( ! empty( $post->ID ) ) { + $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'] ) ) { + $truncate = true; + } + $description = apply_filters( 'aioseop_description', $description, - empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) + $truncate ); return $description; @@ -2569,14 +2580,6 @@ function get_post_description( $post ) { $content = do_shortcode( $content ); } $description = $this->trim_text_without_filters_full_length( $this->internationalize( $content ) ); - - if ( isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) && false === $aioseop_options['aiosp_dont_truncate_descriptions'] ) { - $description = $this->substr( $description, 0, $this->maximum_description_length ); - $description = trim( $description ); - } elseif ( ! isset( $aioseop_options['aiosp_dont_truncate_descriptions'] ) || empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ) ) { - $description = $this->substr( $description, 0, $this->maximum_description_length ); - $description = trim( $description ); - } } } From 8663ce1560244a7753aa3147688225fedd8c14cc Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Thu, 18 Jan 2018 13:21:44 -0500 Subject: [PATCH 6/6] fixing version documentation --- aioseop_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index c4267b705..82d9d71b6 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -2436,7 +2436,7 @@ function get_archive_title_format() { /** * @since 2.3.14 #932 Adds filter "aioseop_description", removes extra filtering. * @since 2.4 #951 Trim/truncates occurs inside filter "aioseop_description". - * @since 2.4.4 #1395 Longer Meta Descriptions & don't trim manual Descriptions. + * @since 2.4.4.1 #1395 Longer Meta Descriptions & don't trim manual Descriptions. * * @param null $post *