Changeset 2215789
- Timestamp:
- 12/20/2019 03:24:14 PM (6 years ago)
- Location:
- all-in-one-seo-pack
- Files:
-
- 2 added
- 6 deleted
- 12 edited
- 1 copied
-
tags/3.3.4 (copied) (copied from all-in-one-seo-pack/trunk)
-
tags/3.3.4/aioseop_class.php (modified) (6 diffs)
-
tags/3.3.4/all_in_one_seo_pack.php (modified) (3 diffs)
-
tags/3.3.4/js/admin/aioseop-admin-functions.js (added)
-
tags/3.3.4/js/admin/aioseop-count-chars-old.min.js (deleted)
-
tags/3.3.4/js/admin/aioseop-count-chars.js (modified) (5 diffs)
-
tags/3.3.4/js/admin/aioseop-count-chars.min.js (deleted)
-
tags/3.3.4/js/admin/aioseop-preview-snippet.js (modified) (8 diffs)
-
tags/3.3.4/js/admin/aioseop-preview-snippet.min.js (deleted)
-
tags/3.3.4/modules/aioseop_opengraph.php (modified) (2 diffs)
-
tags/3.3.4/readme.txt (modified) (1 diff)
-
trunk/aioseop_class.php (modified) (6 diffs)
-
trunk/all_in_one_seo_pack.php (modified) (3 diffs)
-
trunk/js/admin/aioseop-admin-functions.js (added)
-
trunk/js/admin/aioseop-count-chars-old.min.js (deleted)
-
trunk/js/admin/aioseop-count-chars.js (modified) (5 diffs)
-
trunk/js/admin/aioseop-count-chars.min.js (deleted)
-
trunk/js/admin/aioseop-preview-snippet.js (modified) (8 diffs)
-
trunk/js/admin/aioseop-preview-snippet.min.js (deleted)
-
trunk/modules/aioseop_opengraph.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
all-in-one-seo-pack/tags/3.3.4/aioseop_class.php
r2190206 r2215789 566 566 ), 567 567 'aiosp_ga_advanced_options' => 'on', 568 'aiosp_gtm_container_id' => array(569 'lhs' => 'aiosp_gtm_container_id',570 'op' => '==',571 'rhs' => '',572 ),573 568 ), 574 569 ), … … 597 592 ), 598 593 'aiosp_ga_advanced_options' => 'on', 599 'aiosp_gtm_container_id' => array(600 'lhs' => 'aiosp_gtm_container_id',601 'op' => '==',602 'rhs' => '',603 ),604 594 ), 605 595 ), … … 3667 3657 global $current_screen; 3668 3658 global $aioseop_options; 3669 $current_screen = get_current_screen();3670 $is_gutenberg = 'false';3671 3672 if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {3673 $is_gutenberg = 'true';3674 }3675 3659 3676 3660 add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 ); … … 3697 3681 3698 3682 $snippet_preview_data = array( 3699 'isGutenberg' => $is_gutenberg,3700 3683 'autogenerateDescriptions' => $aioseop_options['aiosp_generate_descriptions'], 3701 3684 'skipExcerpt' => $aioseop_options['aiosp_skip_excerpt'], … … 3703 3686 3704 3687 $count_chars_data['extraTitleLength'] = $extra_title_length; 3705 $count_chars_data['isGutenberg'] = $is_gutenberg;3706 3688 $count_chars_data['autogenerateDescriptions'] = $aioseop_options['aiosp_generate_descriptions']; 3707 3689 … … 3724 3706 $count_chars_data['pluginDirName'] = AIOSEOP_PLUGIN_DIRNAME; 3725 3707 $count_chars_data['currentPage'] = $hook_suffix; 3708 3709 wp_enqueue_script( 3710 'aioseop-admin-functions', 3711 AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js', 3712 array(), 3713 AIOSEOP_VERSION 3714 ); 3726 3715 3727 3716 wp_enqueue_script( -
all-in-one-seo-pack/tags/3.3.4/all_in_one_seo_pack.php
r2195818 r2215789 4 4 Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ 5 5 Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007. 6 Version: 3.3. 36 Version: 3.3.4 7 7 Author: Michael Torbert 8 8 Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ … … 32 32 * 33 33 * @package All-in-One-SEO-Pack 34 * @version 3.3. 334 * @version 3.3.4 35 35 */ 36 36 … … 46 46 } 47 47 if ( ! defined( 'AIOSEOP_VERSION' ) ) { 48 define( 'AIOSEOP_VERSION', '3.3. 3' );48 define( 'AIOSEOP_VERSION', '3.3.4' ); 49 49 } 50 50 -
all-in-one-seo-pack/tags/3.3.4/js/admin/aioseop-count-chars.js
r2195818 r2215789 11 11 "use strict"; 12 12 13 let isGutenberg; 14 let autogenerateDescriptions; 13 let inputField; 14 let counterField; 15 let fieldSize; 15 16 let extraTitleLength; 16 17 let pluginDirName; 17 18 let currentPage; 18 let inputField; 19 let counterField; 20 let fieldSize; 21 let timeout = 0; 19 let autogenerateDescriptions; 20 let isGutenbergEditor = aioseopIsGutenbergEditor(); 22 21 23 22 if ('undefined' !== typeof aioseopCharacterCounter) { 24 isGutenberg = aioseopCharacterCounter.isGutenberg;25 autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;26 23 extraTitleLength = +aioseopCharacterCounter.extraTitleLength; 27 24 pluginDirName = aioseopCharacterCounter.pluginDirName; 28 25 currentPage = aioseopCharacterCounter.currentPage; 26 autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions; 29 27 } 30 28 else if ('undefined' !== typeof aioseopOGCharacterCounter) { 31 isGutenberg = aioseopOGCharacterCounter.isGutenberg;32 29 pluginDirName = aioseopOGCharacterCounter.pluginDirName; 33 30 currentPage = aioseopOGCharacterCounter.currentPage; 34 31 } 32 35 33 aioseopAddEventListeners(); 36 34 // Fire once on page load. … … 45 43 */ 46 44 function aioseopAddEventListeners() { 47 aioseopAddGeneralListener(); 45 46 aioseopSetInputEventListeners(); 48 47 49 48 if (!aioseopIsEditPage()) { … … 51 50 } 52 51 53 if ( 'false' === isGutenberg) {54 aioseop AddClassicEditorListener();52 if (!isGutenbergEditor) { 53 aioseopSetClassicEditorListeners(); 55 54 } else { 56 aioseop AddGutenbergEditorListener();57 } 58 } 59 60 /** 61 * Adds the general/shared events listeners.55 aioseopSetGutenbergEditorEventListener(aioseopCountChars); 56 } 57 } 58 59 /** 60 * Adds the event listener to the input field of the character counter. 62 61 * 63 62 * @since 3.3.0 … … 65 64 * @return void 66 65 */ 67 function aioseop AddGeneralListener() {66 function aioseopSetInputEventListeners() { 68 67 $('.aioseop_count_chars').on('keyup', function () { 69 68 aioseopCountChars(); … … 75 74 * 76 75 * @since 3.3.0 77 * 78 * @return void 79 */ 80 function aioseopAddClassicEditorListener() { 81 setTimeout(function () { 82 tinymce.editors[0].on('KeyUp', function () { 83 aioseopCountChars(); 84 }); 85 }, 1000); 76 * @since 3.3.4 Add support for text tab of Classic Editor. 77 * 78 * @return void 79 */ 80 function aioseopSetClassicEditorListeners() { 81 82 aioseopSetClassicEditorEventListener(aioseopCountChars); 86 83 87 84 $('#title, #excerpt').on('keyup', function () { 88 85 aioseopCountChars(); 89 });90 }91 92 /**93 * Adds the event listener for the Gutenberg Editor.94 *95 * @since 3.3.096 *97 * @return void98 */99 function aioseopAddGutenbergEditorListener() {100 window._wpLoadBlockEditor.then(function () {101 setTimeout(function () {102 // https://developer.wordpress.org/block-editor/packages/packages-data/103 wp.data.subscribe(function () {104 clearTimeout(timeout);105 timeout = setTimeout(function () {106 aioseopCountChars();107 }, 200);108 });109 });110 86 }); 111 87 } -
all-in-one-seo-pack/tags/3.3.4/js/admin/aioseop-preview-snippet.js
r2192264 r2215789 18 18 let aioseopDescription = $('textarea[name="aiosp_description"]'); 19 19 let timeout = 0; 20 let isGutenberg = aioseop_preview_snippet.isGutenberg;21 20 let autogenerateDescriptions = aioseop_preview_snippet.autogenerateDescriptions; 22 21 let skipExcerpt = aioseop_preview_snippet.skipExcerpt; 22 let isGutenbergEditor = aioseopIsGutenbergEditor(); 23 23 24 aioseop UpdateMetabox();24 aioseopInitPreviewSnippet(); 25 25 26 26 /** 27 * The aioseopUpdateMetabox() function. 28 * 29 * Updates the preview snippet and input field placeholders in the meta box when a change happens. 27 * Defines the relevant fields and adds the relevant event listeners based on which editor is active. 30 28 * 31 29 * @since 3.3.0 30 * @since 3.3.4 Add support for text tab in Classic Editor. 32 31 */ 33 function aioseop UpdateMetabox() {32 function aioseopInitPreviewSnippet() { 34 33 let inputFields = [aioseopTitle, aioseopDescription]; 35 34 36 if ( 'false' === isGutenberg) {35 if (!isGutenbergEditor) { 37 36 docTitle = $('#title'); 38 37 let postExcerpt = $('#excerpt'); … … 40 39 inputFields.push(docTitle, postExcerpt); 41 40 42 setTimeout(function () { 43 tinymce.editors[0].on('KeyUp', function () { 44 aioseopUpdatePreviewSnippet(); 45 }); 46 }, 1000); 41 aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet); 42 aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet); 47 43 } 48 44 else { 49 window._wpLoadBlockEditor.then(function () { 50 setTimeout(function () { 51 // https://developer.wordpress.org/block-editor/packages/packages-data/ 52 wp.data.subscribe(function () { 53 clearTimeout(timeout); 54 // This is needed because the code otherwise is triggered dozens of times. 55 timeout = setTimeout(function () { 56 aioseopUpdatePreviewSnippet(); 57 }, 200); 58 }); 59 }); 60 }); 45 aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet); 61 46 } 62 47 … … 68 53 } 69 54 70 // Run once on page load.55 // Run once on page load. 71 56 timeout = setTimeout(function () { 72 57 aioseopUpdatePreviewSnippet(); … … 75 60 76 61 /** 77 * AIOSEOP Update Preview Snippet62 * Updates the preview snippet and input field placeholders in the meta box when a change happens. 78 63 * 79 64 * @uses wp.data.select().getEditedPostAttribute() 80 65 * @link https://developer.wordpress.org/block-editor/data/data-core-editor/#getEditedPostAttribute 81 66 * 82 * @since 3.3 67 * @since 3.3.0 83 68 */ 84 69 function aioseopUpdatePreviewSnippet() { … … 87 72 let postExcerpt = ''; 88 73 89 if ('false' === isGutenberg) { 74 if (aioseopEditorUndefined) { 75 return; 76 } 77 78 if (!isGutenbergEditor) { 90 79 postTitle = aioseopStripMarkup($.trim($('#title').val())); 91 postContent = aioseop ShortenDescription($('#content_ifr').contents().find('body')[0].innerHTML);92 postExcerpt = aioseop ShortenDescription($.trim($('#excerpt').val()));80 postContent = aioseopGetDescription(aioseopGetClassicEditorContent()); 81 postExcerpt = aioseopGetDescription($.trim($('#excerpt').val())); 93 82 } 94 83 else { 95 84 postTitle = aioseopStripMarkup($.trim($('#post-title-0').val())); 96 postContent = aioseop ShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));97 postExcerpt = aioseop ShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));85 postContent = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('content')); 86 postExcerpt = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt')); 98 87 } 99 88 … … 128 117 129 118 /** 130 * The aioseopShortenDescription() function. 131 * 132 * Shortens the description to max. 160 characters without truncation. 119 * Shortens the description to 160 characters without truncation. 133 120 * 134 121 * @since 3.3.0 122 * @since 3.3.4 Shorten post content to improve performance. 135 123 * 136 * @param string description 124 * @param string postContent 125 * @return string description 137 126 */ 138 function aioseopShortenDescription(description) { 127 function aioseopGetDescription(postContent) { 128 // Shorten content first to avoid performance drops. 129 let description = postContent.substring(0, 5000); 130 139 131 description = aioseopStripMarkup(description); 140 132 if (160 < description.length) { … … 148 140 149 141 /** 150 * The aioseopStripMarkup() function.151 *152 142 * Strips all editor markup from a string. 153 143 * … … 161 151 content = content.replace(/(<[^ >][^>]*>)?/gm, ''); 162 152 // Remove all line breaks. 163 content = content.replace(/ \s\s+/g, ' ');153 content = content.replace(/[\r\n]+/gm, ' '); 164 154 return aioseopDecodeHtmlEntities(content.trim()); 165 155 } 166 156 167 157 /** 168 * The aioseopDecodeHtmlEntities() function.169 *170 158 * Decodes HTML entities to characters. 171 159 * -
all-in-one-seo-pack/tags/3.3.4/modules/aioseop_opengraph.php
r2195818 r2215789 1885 1885 */ 1886 1886 public function admin_enqueue_scripts( $hook_suffix ) { 1887 global $current_screen;1888 1889 $is_gutenberg = 'false';1890 if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {1891 $is_gutenberg = 'true';1892 }1893 1887 1894 1888 switch ( $hook_suffix ) { … … 1919 1913 ); 1920 1914 1915 1916 wp_enqueue_script( 1917 'aioseop-admin-functions', 1918 AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js', 1919 array(), 1920 AIOSEOP_VERSION 1921 ); 1922 1921 1923 $count_chars_data = array( 1922 'isGutenberg' => $is_gutenberg,1923 1924 'pluginDirName' => AIOSEOP_PLUGIN_DIRNAME, 1924 1925 'currentPage' => $hook_suffix, -
all-in-one-seo-pack/tags/3.3.4/readme.txt
r2195818 r2215789 4 4 Requires at least: 4.9 5 5 Tested up to: 5.3 6 Stable tag: 3.3. 36 Stable tag: 3.3.4 7 7 License: GPLv2 or later 8 8 Requires PHP: 5.2.4 -
all-in-one-seo-pack/trunk/aioseop_class.php
r2190206 r2215789 566 566 ), 567 567 'aiosp_ga_advanced_options' => 'on', 568 'aiosp_gtm_container_id' => array(569 'lhs' => 'aiosp_gtm_container_id',570 'op' => '==',571 'rhs' => '',572 ),573 568 ), 574 569 ), … … 597 592 ), 598 593 'aiosp_ga_advanced_options' => 'on', 599 'aiosp_gtm_container_id' => array(600 'lhs' => 'aiosp_gtm_container_id',601 'op' => '==',602 'rhs' => '',603 ),604 594 ), 605 595 ), … … 3667 3657 global $current_screen; 3668 3658 global $aioseop_options; 3669 $current_screen = get_current_screen();3670 $is_gutenberg = 'false';3671 3672 if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {3673 $is_gutenberg = 'true';3674 }3675 3659 3676 3660 add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 ); … … 3697 3681 3698 3682 $snippet_preview_data = array( 3699 'isGutenberg' => $is_gutenberg,3700 3683 'autogenerateDescriptions' => $aioseop_options['aiosp_generate_descriptions'], 3701 3684 'skipExcerpt' => $aioseop_options['aiosp_skip_excerpt'], … … 3703 3686 3704 3687 $count_chars_data['extraTitleLength'] = $extra_title_length; 3705 $count_chars_data['isGutenberg'] = $is_gutenberg;3706 3688 $count_chars_data['autogenerateDescriptions'] = $aioseop_options['aiosp_generate_descriptions']; 3707 3689 … … 3724 3706 $count_chars_data['pluginDirName'] = AIOSEOP_PLUGIN_DIRNAME; 3725 3707 $count_chars_data['currentPage'] = $hook_suffix; 3708 3709 wp_enqueue_script( 3710 'aioseop-admin-functions', 3711 AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js', 3712 array(), 3713 AIOSEOP_VERSION 3714 ); 3726 3715 3727 3716 wp_enqueue_script( -
all-in-one-seo-pack/trunk/all_in_one_seo_pack.php
r2195818 r2215789 4 4 Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ 5 5 Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007. 6 Version: 3.3. 36 Version: 3.3.4 7 7 Author: Michael Torbert 8 8 Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ … … 32 32 * 33 33 * @package All-in-One-SEO-Pack 34 * @version 3.3. 334 * @version 3.3.4 35 35 */ 36 36 … … 46 46 } 47 47 if ( ! defined( 'AIOSEOP_VERSION' ) ) { 48 define( 'AIOSEOP_VERSION', '3.3. 3' );48 define( 'AIOSEOP_VERSION', '3.3.4' ); 49 49 } 50 50 -
all-in-one-seo-pack/trunk/js/admin/aioseop-count-chars.js
r2195818 r2215789 11 11 "use strict"; 12 12 13 let isGutenberg; 14 let autogenerateDescriptions; 13 let inputField; 14 let counterField; 15 let fieldSize; 15 16 let extraTitleLength; 16 17 let pluginDirName; 17 18 let currentPage; 18 let inputField; 19 let counterField; 20 let fieldSize; 21 let timeout = 0; 19 let autogenerateDescriptions; 20 let isGutenbergEditor = aioseopIsGutenbergEditor(); 22 21 23 22 if ('undefined' !== typeof aioseopCharacterCounter) { 24 isGutenberg = aioseopCharacterCounter.isGutenberg;25 autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;26 23 extraTitleLength = +aioseopCharacterCounter.extraTitleLength; 27 24 pluginDirName = aioseopCharacterCounter.pluginDirName; 28 25 currentPage = aioseopCharacterCounter.currentPage; 26 autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions; 29 27 } 30 28 else if ('undefined' !== typeof aioseopOGCharacterCounter) { 31 isGutenberg = aioseopOGCharacterCounter.isGutenberg;32 29 pluginDirName = aioseopOGCharacterCounter.pluginDirName; 33 30 currentPage = aioseopOGCharacterCounter.currentPage; 34 31 } 32 35 33 aioseopAddEventListeners(); 36 34 // Fire once on page load. … … 45 43 */ 46 44 function aioseopAddEventListeners() { 47 aioseopAddGeneralListener(); 45 46 aioseopSetInputEventListeners(); 48 47 49 48 if (!aioseopIsEditPage()) { … … 51 50 } 52 51 53 if ( 'false' === isGutenberg) {54 aioseop AddClassicEditorListener();52 if (!isGutenbergEditor) { 53 aioseopSetClassicEditorListeners(); 55 54 } else { 56 aioseop AddGutenbergEditorListener();57 } 58 } 59 60 /** 61 * Adds the general/shared events listeners.55 aioseopSetGutenbergEditorEventListener(aioseopCountChars); 56 } 57 } 58 59 /** 60 * Adds the event listener to the input field of the character counter. 62 61 * 63 62 * @since 3.3.0 … … 65 64 * @return void 66 65 */ 67 function aioseop AddGeneralListener() {66 function aioseopSetInputEventListeners() { 68 67 $('.aioseop_count_chars').on('keyup', function () { 69 68 aioseopCountChars(); … … 75 74 * 76 75 * @since 3.3.0 77 * 78 * @return void 79 */ 80 function aioseopAddClassicEditorListener() { 81 setTimeout(function () { 82 tinymce.editors[0].on('KeyUp', function () { 83 aioseopCountChars(); 84 }); 85 }, 1000); 76 * @since 3.3.4 Add support for text tab of Classic Editor. 77 * 78 * @return void 79 */ 80 function aioseopSetClassicEditorListeners() { 81 82 aioseopSetClassicEditorEventListener(aioseopCountChars); 86 83 87 84 $('#title, #excerpt').on('keyup', function () { 88 85 aioseopCountChars(); 89 });90 }91 92 /**93 * Adds the event listener for the Gutenberg Editor.94 *95 * @since 3.3.096 *97 * @return void98 */99 function aioseopAddGutenbergEditorListener() {100 window._wpLoadBlockEditor.then(function () {101 setTimeout(function () {102 // https://developer.wordpress.org/block-editor/packages/packages-data/103 wp.data.subscribe(function () {104 clearTimeout(timeout);105 timeout = setTimeout(function () {106 aioseopCountChars();107 }, 200);108 });109 });110 86 }); 111 87 } -
all-in-one-seo-pack/trunk/js/admin/aioseop-preview-snippet.js
r2192264 r2215789 18 18 let aioseopDescription = $('textarea[name="aiosp_description"]'); 19 19 let timeout = 0; 20 let isGutenberg = aioseop_preview_snippet.isGutenberg;21 20 let autogenerateDescriptions = aioseop_preview_snippet.autogenerateDescriptions; 22 21 let skipExcerpt = aioseop_preview_snippet.skipExcerpt; 22 let isGutenbergEditor = aioseopIsGutenbergEditor(); 23 23 24 aioseop UpdateMetabox();24 aioseopInitPreviewSnippet(); 25 25 26 26 /** 27 * The aioseopUpdateMetabox() function. 28 * 29 * Updates the preview snippet and input field placeholders in the meta box when a change happens. 27 * Defines the relevant fields and adds the relevant event listeners based on which editor is active. 30 28 * 31 29 * @since 3.3.0 30 * @since 3.3.4 Add support for text tab in Classic Editor. 32 31 */ 33 function aioseop UpdateMetabox() {32 function aioseopInitPreviewSnippet() { 34 33 let inputFields = [aioseopTitle, aioseopDescription]; 35 34 36 if ( 'false' === isGutenberg) {35 if (!isGutenbergEditor) { 37 36 docTitle = $('#title'); 38 37 let postExcerpt = $('#excerpt'); … … 40 39 inputFields.push(docTitle, postExcerpt); 41 40 42 setTimeout(function () { 43 tinymce.editors[0].on('KeyUp', function () { 44 aioseopUpdatePreviewSnippet(); 45 }); 46 }, 1000); 41 aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet); 42 aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet); 47 43 } 48 44 else { 49 window._wpLoadBlockEditor.then(function () { 50 setTimeout(function () { 51 // https://developer.wordpress.org/block-editor/packages/packages-data/ 52 wp.data.subscribe(function () { 53 clearTimeout(timeout); 54 // This is needed because the code otherwise is triggered dozens of times. 55 timeout = setTimeout(function () { 56 aioseopUpdatePreviewSnippet(); 57 }, 200); 58 }); 59 }); 60 }); 45 aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet); 61 46 } 62 47 … … 68 53 } 69 54 70 // Run once on page load.55 // Run once on page load. 71 56 timeout = setTimeout(function () { 72 57 aioseopUpdatePreviewSnippet(); … … 75 60 76 61 /** 77 * AIOSEOP Update Preview Snippet62 * Updates the preview snippet and input field placeholders in the meta box when a change happens. 78 63 * 79 64 * @uses wp.data.select().getEditedPostAttribute() 80 65 * @link https://developer.wordpress.org/block-editor/data/data-core-editor/#getEditedPostAttribute 81 66 * 82 * @since 3.3 67 * @since 3.3.0 83 68 */ 84 69 function aioseopUpdatePreviewSnippet() { … … 87 72 let postExcerpt = ''; 88 73 89 if ('false' === isGutenberg) { 74 if (aioseopEditorUndefined) { 75 return; 76 } 77 78 if (!isGutenbergEditor) { 90 79 postTitle = aioseopStripMarkup($.trim($('#title').val())); 91 postContent = aioseop ShortenDescription($('#content_ifr').contents().find('body')[0].innerHTML);92 postExcerpt = aioseop ShortenDescription($.trim($('#excerpt').val()));80 postContent = aioseopGetDescription(aioseopGetClassicEditorContent()); 81 postExcerpt = aioseopGetDescription($.trim($('#excerpt').val())); 93 82 } 94 83 else { 95 84 postTitle = aioseopStripMarkup($.trim($('#post-title-0').val())); 96 postContent = aioseop ShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));97 postExcerpt = aioseop ShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));85 postContent = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('content')); 86 postExcerpt = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt')); 98 87 } 99 88 … … 128 117 129 118 /** 130 * The aioseopShortenDescription() function. 131 * 132 * Shortens the description to max. 160 characters without truncation. 119 * Shortens the description to 160 characters without truncation. 133 120 * 134 121 * @since 3.3.0 122 * @since 3.3.4 Shorten post content to improve performance. 135 123 * 136 * @param string description 124 * @param string postContent 125 * @return string description 137 126 */ 138 function aioseopShortenDescription(description) { 127 function aioseopGetDescription(postContent) { 128 // Shorten content first to avoid performance drops. 129 let description = postContent.substring(0, 5000); 130 139 131 description = aioseopStripMarkup(description); 140 132 if (160 < description.length) { … … 148 140 149 141 /** 150 * The aioseopStripMarkup() function.151 *152 142 * Strips all editor markup from a string. 153 143 * … … 161 151 content = content.replace(/(<[^ >][^>]*>)?/gm, ''); 162 152 // Remove all line breaks. 163 content = content.replace(/ \s\s+/g, ' ');153 content = content.replace(/[\r\n]+/gm, ' '); 164 154 return aioseopDecodeHtmlEntities(content.trim()); 165 155 } 166 156 167 157 /** 168 * The aioseopDecodeHtmlEntities() function.169 *170 158 * Decodes HTML entities to characters. 171 159 * -
all-in-one-seo-pack/trunk/modules/aioseop_opengraph.php
r2195818 r2215789 1885 1885 */ 1886 1886 public function admin_enqueue_scripts( $hook_suffix ) { 1887 global $current_screen;1888 1889 $is_gutenberg = 'false';1890 if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {1891 $is_gutenberg = 'true';1892 }1893 1887 1894 1888 switch ( $hook_suffix ) { … … 1919 1913 ); 1920 1914 1915 1916 wp_enqueue_script( 1917 'aioseop-admin-functions', 1918 AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js', 1919 array(), 1920 AIOSEOP_VERSION 1921 ); 1922 1921 1923 $count_chars_data = array( 1922 'isGutenberg' => $is_gutenberg,1923 1924 'pluginDirName' => AIOSEOP_PLUGIN_DIRNAME, 1924 1925 'currentPage' => $hook_suffix, -
all-in-one-seo-pack/trunk/readme.txt
r2195818 r2215789 4 4 Requires at least: 4.9 5 5 Tested up to: 5.3 6 Stable tag: 3.3. 36 Stable tag: 3.3.4 7 7 License: GPLv2 or later 8 8 Requires PHP: 5.2.4
Note: See TracChangeset
for help on using the changeset viewer.