Version Description
Download this release
Release Info
Developer | hallsofmontezuma |
Plugin | All in One SEO Pack |
Version | 3.3.4 |
Comparing to | |
See all releases |
Code changes from version 3.3.3 to 3.3.4
- aioseop_class.php +7 -18
- all_in_one_seo_pack.php +3 -3
- js/admin/aioseop-admin-functions.js +118 -0
- js/admin/aioseop-count-chars-old.min.js +0 -1
- js/admin/aioseop-count-chars.js +18 -42
- js/admin/aioseop-count-chars.min.js +0 -1
- js/admin/aioseop-preview-snippet.js +30 -42
- js/admin/aioseop-preview-snippet.min.js +0 -1
- modules/aioseop_opengraph.php +8 -7
- readme.txt +1 -1
aioseop_class.php
CHANGED
@@ -565,11 +565,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
565 |
'rhs' => '',
|
566 |
),
|
567 |
'aiosp_ga_advanced_options' => 'on',
|
568 |
-
'aiosp_gtm_container_id' => array(
|
569 |
-
'lhs' => 'aiosp_gtm_container_id',
|
570 |
-
'op' => '==',
|
571 |
-
'rhs' => '',
|
572 |
-
),
|
573 |
),
|
574 |
),
|
575 |
'ga_link_attribution' => array(
|
@@ -596,11 +591,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
596 |
'rhs' => '',
|
597 |
),
|
598 |
'aiosp_ga_advanced_options' => 'on',
|
599 |
-
'aiosp_gtm_container_id' => array(
|
600 |
-
'lhs' => 'aiosp_gtm_container_id',
|
601 |
-
'op' => '==',
|
602 |
-
'rhs' => '',
|
603 |
-
),
|
604 |
),
|
605 |
),
|
606 |
'schema_markup' => array(
|
@@ -3666,12 +3656,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3666 |
public function admin_enqueue_scripts( $hook_suffix ) {
|
3667 |
global $current_screen;
|
3668 |
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 |
|
3676 |
add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
|
3677 |
add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
|
@@ -3696,13 +3680,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3696 |
$extra_title_length = strlen( preg_replace( '/<span.*\/span>/', '', $title_format ) );
|
3697 |
|
3698 |
$snippet_preview_data = array(
|
3699 |
-
'isGutenberg' => $is_gutenberg,
|
3700 |
'autogenerateDescriptions' => $aioseop_options['aiosp_generate_descriptions'],
|
3701 |
'skipExcerpt' => $aioseop_options['aiosp_skip_excerpt'],
|
3702 |
);
|
3703 |
|
3704 |
$count_chars_data['extraTitleLength'] = $extra_title_length;
|
3705 |
-
$count_chars_data['isGutenberg'] = $is_gutenberg;
|
3706 |
$count_chars_data['autogenerateDescriptions'] = $aioseop_options['aiosp_generate_descriptions'];
|
3707 |
|
3708 |
wp_enqueue_script(
|
@@ -3724,6 +3706,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3724 |
$count_chars_data['pluginDirName'] = AIOSEOP_PLUGIN_DIRNAME;
|
3725 |
$count_chars_data['currentPage'] = $hook_suffix;
|
3726 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3727 |
wp_enqueue_script(
|
3728 |
'aioseop-count-chars',
|
3729 |
AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-count-chars.js',
|
565 |
'rhs' => '',
|
566 |
),
|
567 |
'aiosp_ga_advanced_options' => 'on',
|
|
|
|
|
|
|
|
|
|
|
568 |
),
|
569 |
),
|
570 |
'ga_link_attribution' => array(
|
591 |
'rhs' => '',
|
592 |
),
|
593 |
'aiosp_ga_advanced_options' => 'on',
|
|
|
|
|
|
|
|
|
|
|
594 |
),
|
595 |
),
|
596 |
'schema_markup' => array(
|
3656 |
public function admin_enqueue_scripts( $hook_suffix ) {
|
3657 |
global $current_screen;
|
3658 |
global $aioseop_options;
|
|
|
|
|
|
|
|
|
|
|
|
|
3659 |
|
3660 |
add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
|
3661 |
add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
|
3680 |
$extra_title_length = strlen( preg_replace( '/<span.*\/span>/', '', $title_format ) );
|
3681 |
|
3682 |
$snippet_preview_data = array(
|
|
|
3683 |
'autogenerateDescriptions' => $aioseop_options['aiosp_generate_descriptions'],
|
3684 |
'skipExcerpt' => $aioseop_options['aiosp_skip_excerpt'],
|
3685 |
);
|
3686 |
|
3687 |
$count_chars_data['extraTitleLength'] = $extra_title_length;
|
|
|
3688 |
$count_chars_data['autogenerateDescriptions'] = $aioseop_options['aiosp_generate_descriptions'];
|
3689 |
|
3690 |
wp_enqueue_script(
|
3706 |
$count_chars_data['pluginDirName'] = AIOSEOP_PLUGIN_DIRNAME;
|
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 |
+
);
|
3715 |
+
|
3716 |
wp_enqueue_script(
|
3717 |
'aioseop-count-chars',
|
3718 |
AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-count-chars.js',
|
all_in_one_seo_pack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
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.
|
7 |
Author: Michael Torbert
|
8 |
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
9 |
Text Domain: all-in-one-seo-pack
|
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
31 |
* The original WordPress SEO plugin.
|
32 |
*
|
33 |
* @package All-in-One-SEO-Pack
|
34 |
-
* @version 3.3.
|
35 |
*/
|
36 |
|
37 |
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
@@ -45,7 +45,7 @@ if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
|
|
45 |
}
|
46 |
}
|
47 |
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
48 |
-
define( 'AIOSEOP_VERSION', '3.3.
|
49 |
}
|
50 |
|
51 |
/*
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
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.4
|
7 |
Author: Michael Torbert
|
8 |
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
9 |
Text Domain: all-in-one-seo-pack
|
31 |
* The original WordPress SEO plugin.
|
32 |
*
|
33 |
* @package All-in-One-SEO-Pack
|
34 |
+
* @version 3.3.4
|
35 |
*/
|
36 |
|
37 |
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
45 |
}
|
46 |
}
|
47 |
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
48 |
+
define( 'AIOSEOP_VERSION', '3.3.4' );
|
49 |
}
|
50 |
|
51 |
/*
|
js/admin/aioseop-admin-functions.js
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Contains shared functions that are limited to the admin panel.
|
3 |
+
*
|
4 |
+
* @since 3.3.4
|
5 |
+
*
|
6 |
+
* @package all-in-one-seo-pack
|
7 |
+
*/
|
8 |
+
|
9 |
+
(function () { 'use strict'; }());
|
10 |
+
|
11 |
+
var aioseopEditorUndefined = false;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Checks whether the Gutenberg Editor is active.
|
15 |
+
*
|
16 |
+
* @since 3.3.4
|
17 |
+
*
|
18 |
+
* @return bool Whether or not the Gutenberg Editor is active.
|
19 |
+
*/
|
20 |
+
function aioseopIsGutenbergEditor() {
|
21 |
+
return document.body.classList.contains('block-editor-page');
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Determines whether the visual tab is active in the Classic Editor.
|
26 |
+
*
|
27 |
+
* @since 3.3.4
|
28 |
+
*
|
29 |
+
* @return bool Whether or not the visual tab is active.
|
30 |
+
*/
|
31 |
+
function aioseopIsVisualTab() {
|
32 |
+
if (jQuery('#wp-content-wrap').hasClass('tmce-active')) {
|
33 |
+
return true;
|
34 |
+
}
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Sets the event listeners for the Classic Editor based on which tab is active.
|
40 |
+
*
|
41 |
+
* @since 3.3.4
|
42 |
+
*
|
43 |
+
* @param string functionName The name of the function that has to be called when the event is triggered.
|
44 |
+
*/
|
45 |
+
function aioseopSetClassicEditorEventListener(functionName) {
|
46 |
+
if (aioseopIsVisualTab()) {
|
47 |
+
setTimeout(function () {
|
48 |
+
tinymce.editors[0].on('KeyUp', function () {
|
49 |
+
functionName();
|
50 |
+
});
|
51 |
+
}, 500);
|
52 |
+
} else {
|
53 |
+
setTimeout(function () {
|
54 |
+
jQuery('.wp-editor-area').on('change', function () {
|
55 |
+
functionName();
|
56 |
+
});
|
57 |
+
}, 500);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Sets the event listener for the editor tab switch.
|
63 |
+
*
|
64 |
+
* @since 3.3.4
|
65 |
+
*
|
66 |
+
* @param string functionName The name of the function that needs to be called when the event is triggered.
|
67 |
+
*/
|
68 |
+
function aioseopSetClassicEditorTabSwitchEventListener(functionName) {
|
69 |
+
jQuery('.wp-switch-editor').each(function () {
|
70 |
+
jQuery(this).on('click', function () {
|
71 |
+
setTimeout(function () {
|
72 |
+
aioseopSetClassicEditorEventListener(functionName);
|
73 |
+
});
|
74 |
+
});
|
75 |
+
});
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Gets the content of the active Classic Editor tab.
|
80 |
+
*
|
81 |
+
* @since 3.3.4
|
82 |
+
*
|
83 |
+
* @return string The content of the active editor tab.
|
84 |
+
*/
|
85 |
+
function aioseopGetClassicEditorContent() {
|
86 |
+
if (aioseopIsVisualTab()) {
|
87 |
+
//tinymce.activeEditor.getContent();
|
88 |
+
return jQuery('#content_ifr').contents().find('body')[0].innerHTML;
|
89 |
+
}
|
90 |
+
return jQuery('.wp-editor-area').val();
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Sets the event listener for the Gutenberg Editor.
|
95 |
+
*
|
96 |
+
* @since 3.3.0
|
97 |
+
* @since 3.4.0 Moved to its own function.
|
98 |
+
*
|
99 |
+
* @param functionName The name of the function that needs to be called when the event is triggered.
|
100 |
+
*/
|
101 |
+
function aioseopSetGutenbergEditorEventListener(functionName) {
|
102 |
+
if ('undefined' === typeof (window._wpLoadBlockEditor)) {
|
103 |
+
aioseopEditorUndefined = true;
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
window._wpLoadBlockEditor.then(function () {
|
107 |
+
setTimeout(function () {
|
108 |
+
// https://developer.wordpress.org/block-editor/packages/packages-data/
|
109 |
+
wp.data.subscribe(function () {
|
110 |
+
clearTimeout(aioseopGutenbergEventTimeout);
|
111 |
+
// This is needed because the code otherwise is triggered dozens of times.
|
112 |
+
var aioseopGutenbergEventTimeout = setTimeout(function () {
|
113 |
+
functionName();
|
114 |
+
}, 200);
|
115 |
+
});
|
116 |
+
});
|
117 |
+
});
|
118 |
+
}
|
js/admin/aioseop-count-chars-old.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var aiosp_title_extra=parseInt(aioseop_count_chars.aiosp_title_extra,10);function aioseopInitCounting(){jQuery(".aioseop_count_chars").on("keyup keydown",function(){aioseopCountChars(jQuery(this).eq(0),jQuery(this).parent().find('[name="'+jQuery(this).attr("data-length-field")+'"]').eq(0))}),jQuery(".aioseop_count_chars").each(function(){aioseopCountChars(jQuery(this).eq(0),jQuery(this).parent().find('[name="'+jQuery(this).attr("data-length-field")+'"]').eq(0))})}function aioseopCountChars(e,t){var a,o=0;"aiosp_title"===e.attr("name")&&void 0!==aiosp_title_extra&&(o=aiosp_title_extra),t.val(e.val().length+o),a=void 0!==e.attr("size")?e.attr("size"):e.attr("rows")*e.attr("cols"),(a=parseInt(a,10))<10||(t.val()>a?t.removeClass().addClass("aioseop_count_ugly"):"aiosp_title"===e.attr("name")||"aiosp_home_title"===e.attr("name")?t.val()>a-6?t.removeClass().addClass("aioseop_count_bad"):t.removeClass().addClass("aioseop_count_good"):t.val()>a-10?t.removeClass().addClass("aioseop_count_bad"):t.removeClass().addClass("aioseop_count_good"))}jQuery(document).ready(function(){aioseopInitCounting()}),jQuery(document).ready(function(){jQuery("#aiosp_title_wrapper").bind("input",function(){jQuery("#aiosp_snippet_title").text(jQuery("#aiosp_title_wrapper input").val().replace(/<(?:.|\n)*?>/gm,""))}),jQuery("#aiosp_description_wrapper").bind("input",function(){jQuery("#aioseop_snippet_description").text(jQuery("#aiosp_description_wrapper textarea").val().replace(/<(?:.|\n)*?>/gm,""))})});
|
|
js/admin/aioseop-count-chars.js
CHANGED
@@ -10,28 +10,26 @@ jQuery(function($){ // eslint-disable-line max-statements
|
|
10 |
|
11 |
"use strict";
|
12 |
|
13 |
-
let isGutenberg;
|
14 |
-
let autogenerateDescriptions;
|
15 |
-
let extraTitleLength;
|
16 |
-
let pluginDirName;
|
17 |
-
let currentPage;
|
18 |
let inputField;
|
19 |
let counterField;
|
20 |
let fieldSize;
|
21 |
-
let
|
|
|
|
|
|
|
|
|
22 |
|
23 |
if ('undefined' !== typeof aioseopCharacterCounter) {
|
24 |
-
isGutenberg = aioseopCharacterCounter.isGutenberg;
|
25 |
-
autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;
|
26 |
extraTitleLength = +aioseopCharacterCounter.extraTitleLength;
|
27 |
pluginDirName = aioseopCharacterCounter.pluginDirName;
|
28 |
currentPage = aioseopCharacterCounter.currentPage;
|
|
|
29 |
}
|
30 |
else if ('undefined' !== typeof aioseopOGCharacterCounter) {
|
31 |
-
isGutenberg = aioseopOGCharacterCounter.isGutenberg;
|
32 |
pluginDirName = aioseopOGCharacterCounter.pluginDirName;
|
33 |
currentPage = aioseopOGCharacterCounter.currentPage;
|
34 |
}
|
|
|
35 |
aioseopAddEventListeners();
|
36 |
// Fire once on page load.
|
37 |
aioseopCountChars();
|
@@ -44,27 +42,28 @@ jQuery(function($){ // eslint-disable-line max-statements
|
|
44 |
* @return void
|
45 |
*/
|
46 |
function aioseopAddEventListeners() {
|
47 |
-
|
|
|
48 |
|
49 |
if (!aioseopIsEditPage()) {
|
50 |
return;
|
51 |
}
|
52 |
|
53 |
-
if (
|
54 |
-
|
55 |
} else {
|
56 |
-
|
57 |
}
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
-
* Adds the
|
62 |
*
|
63 |
* @since 3.3.0
|
64 |
*
|
65 |
* @return void
|
66 |
*/
|
67 |
-
function
|
68 |
$('.aioseop_count_chars').on('keyup', function () {
|
69 |
aioseopCountChars();
|
70 |
});
|
@@ -74,42 +73,19 @@ jQuery(function($){ // eslint-disable-line max-statements
|
|
74 |
* Adds the event listeners for the Classic Editor.
|
75 |
*
|
76 |
* @since 3.3.0
|
|
|
77 |
*
|
78 |
* @return void
|
79 |
*/
|
80 |
-
function
|
81 |
-
|
82 |
-
|
83 |
-
aioseopCountChars();
|
84 |
-
});
|
85 |
-
}, 1000);
|
86 |
|
87 |
$('#title, #excerpt').on('keyup', function () {
|
88 |
aioseopCountChars();
|
89 |
});
|
90 |
}
|
91 |
|
92 |
-
/**
|
93 |
-
* Adds the event listener for the Gutenberg Editor.
|
94 |
-
*
|
95 |
-
* @since 3.3.0
|
96 |
-
*
|
97 |
-
* @return void
|
98 |
-
*/
|
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 |
-
});
|
111 |
-
}
|
112 |
-
|
113 |
/**
|
114 |
* Get the character count for all fields on the Edit page.
|
115 |
*
|
10 |
|
11 |
"use strict";
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
let inputField;
|
14 |
let counterField;
|
15 |
let fieldSize;
|
16 |
+
let extraTitleLength;
|
17 |
+
let pluginDirName;
|
18 |
+
let currentPage;
|
19 |
+
let autogenerateDescriptions;
|
20 |
+
let isGutenbergEditor = aioseopIsGutenbergEditor();
|
21 |
|
22 |
if ('undefined' !== typeof aioseopCharacterCounter) {
|
|
|
|
|
23 |
extraTitleLength = +aioseopCharacterCounter.extraTitleLength;
|
24 |
pluginDirName = aioseopCharacterCounter.pluginDirName;
|
25 |
currentPage = aioseopCharacterCounter.currentPage;
|
26 |
+
autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;
|
27 |
}
|
28 |
else if ('undefined' !== typeof aioseopOGCharacterCounter) {
|
|
|
29 |
pluginDirName = aioseopOGCharacterCounter.pluginDirName;
|
30 |
currentPage = aioseopOGCharacterCounter.currentPage;
|
31 |
}
|
32 |
+
|
33 |
aioseopAddEventListeners();
|
34 |
// Fire once on page load.
|
35 |
aioseopCountChars();
|
42 |
* @return void
|
43 |
*/
|
44 |
function aioseopAddEventListeners() {
|
45 |
+
|
46 |
+
aioseopSetInputEventListeners();
|
47 |
|
48 |
if (!aioseopIsEditPage()) {
|
49 |
return;
|
50 |
}
|
51 |
|
52 |
+
if (!isGutenbergEditor) {
|
53 |
+
aioseopSetClassicEditorListeners();
|
54 |
} else {
|
55 |
+
aioseopSetGutenbergEditorEventListener(aioseopCountChars);
|
56 |
}
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
+
* Adds the event listener to the input field of the character counter.
|
61 |
*
|
62 |
* @since 3.3.0
|
63 |
*
|
64 |
* @return void
|
65 |
*/
|
66 |
+
function aioseopSetInputEventListeners() {
|
67 |
$('.aioseop_count_chars').on('keyup', function () {
|
68 |
aioseopCountChars();
|
69 |
});
|
73 |
* Adds the event listeners for the Classic Editor.
|
74 |
*
|
75 |
* @since 3.3.0
|
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);
|
|
|
|
|
|
|
83 |
|
84 |
$('#title, #excerpt').on('keyup', function () {
|
85 |
aioseopCountChars();
|
86 |
});
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
/**
|
90 |
* Get the character count for all fields on the Edit page.
|
91 |
*
|
js/admin/aioseop-count-chars.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var pluginDirName,currentPage;if("undefined"!=typeof aioseopCharacterCounter){var aioseopCharacterCounterIsGutenberg=aioseopCharacterCounter.isGutenberg,aioseopCharacterCounterAutogenerateDescriptions=aioseopCharacterCounter.autogenerateDescriptions,extraTitleLength=+aioseopCharacterCounter.extraTitleLength;currentPage=aioseopCharacterCounter.currentPage,pluginDirName=aioseopCharacterCounter.pluginDirName}else"undefined"!=typeof aioseopOGCharacterCounter&&(pluginDirName=aioseopOGCharacterCounter.pluginDirName,currentPage=aioseopOGCharacterCounter.currentPage);$(function(){"use strict";var a,t,o,e=0;function n(){var e;switch(currentPage){case"toplevel_page_all-in-one-seo-packp/aioseop_class":case"aiosp_opengraph_description":e=[p,l];break;default:e=[p,l,c,u]}for(var a=0;a<e.length;a++)e[a](),r()}function r(){var e=0;o=void 0!==a.attr("size")?+a.attr("size"):+a.attr("rows")*+a.attr("cols"),"aiosp_title"===a.attr("name")&&void 0!==extraTitleLength&&(e=extraTitleLength),0!=+a.length&&(t.val(+a.val().length+e),function(){if(!g()||"on"!==aioseopCharacterCounterAutogenerateDescriptions&&"aiosp_description"===a.attr("name")||"on"!==aioseopCharacterCounterAutogenerateDescriptions&&"aioseop_opengraph_settings_desc"===a.attr("name")||0!=+a.val().length)return;switch(a.attr("name")){case"aiosp_title":case"aioseop_opengraph_settings_title":t.val(+$("#aiosp_snippet_title").parent()[0].innerText.length);break;default:var e=$("[name=aiosp_description]")[0].placeholder;t.val(+e.length)," ..."===e.slice(e.length-4)&&t.val(e.length-4)}}()),i()}function i(){if(+t.val()>+o)t.removeClass().addClass("aioseop_count_chars_past_treshold");else switch(a.attr("name")){case"aiosp_title":case"aiosp_home_title":s(6);break;case"aioseop_opengraph_settings_title":case"aiosp_opengraph_hometitle":s(40);break;case"aioseop_opengraph_settings_desc":case"aiosp_opengraph_description":s(145);break;default:s(10)}}function s(e){+t.val()>+o-+e?t.removeClass().addClass("aioseop_count_chars_near_treshold"):t.removeClass().addClass("aioseop_count_chars_below_treshold")}function p(){var e;switch(currentPage){case"toplevel_page_"+pluginDirName+"/aioseop_class":e="aiosp_home_title";break;case"all-in-one-seo_page_aiosp_opengraph":e="aiosp_opengraph_hometitle";break;default:e="aiosp_title"}_(e)}function c(){_("aioseop_opengraph_settings_title")}function u(){var e;switch(currentPage){case"toplevel_page_"+pluginDirName+"/aioseop_class":e="aiosp_home_description";break;case"all-in-one-seo_page_aiosp_opengraph":e="aiosp_opengraph_description";break;default:e="aiosp_description"}_(e)}function l(){_("aioseop_opengraph_settings_desc")}function _(e){a=$('[name="'+e+'"]'),t=a.parent().find('[name="'+a.attr("data-length-field")+'"]')}function g(){return"post.php"===currentPage||"post-new.php"===currentPage||"term.php"===currentPage}!function(){if($(".aioseop_count_chars").on("keyup",function(){n()}),!g())return;"false"===aioseopCharacterCounterIsGutenberg?(setTimeout(function(){tinymce.editors[0].on("KeyUp",function(){n()})},1e3),$("#title, #excerpt").on("keyup",function(){n()})):window._wpLoadBlockEditor.then(function(){setTimeout(function(){wp.data.subscribe(function(){clearTimeout(e),e=setTimeout(function(){n()},200)})})})}(),n()});
|
|
js/admin/aioseop-preview-snippet.js
CHANGED
@@ -17,47 +17,32 @@ jQuery(function($){
|
|
17 |
let aioseopTitle = $('input[name="aiosp_title"]');
|
18 |
let aioseopDescription = $('textarea[name="aiosp_description"]');
|
19 |
let timeout = 0;
|
20 |
-
let isGutenberg = aioseop_preview_snippet.isGutenberg;
|
21 |
let autogenerateDescriptions = aioseop_preview_snippet.autogenerateDescriptions;
|
22 |
let skipExcerpt = aioseop_preview_snippet.skipExcerpt;
|
|
|
23 |
|
24 |
-
|
25 |
|
26 |
/**
|
27 |
-
*
|
28 |
-
*
|
29 |
-
* Updates the preview snippet and input field placeholders in the meta box when a change happens.
|
30 |
*
|
31 |
* @since 3.3.0
|
|
|
32 |
*/
|
33 |
-
function
|
34 |
let inputFields = [aioseopTitle, aioseopDescription];
|
35 |
|
36 |
-
if (
|
37 |
docTitle = $('#title');
|
38 |
let postExcerpt = $('#excerpt');
|
39 |
|
40 |
inputFields.push(docTitle, postExcerpt);
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
aioseopUpdatePreviewSnippet();
|
45 |
-
});
|
46 |
-
}, 1000);
|
47 |
}
|
48 |
else {
|
49 |
-
|
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 |
-
});
|
61 |
}
|
62 |
|
63 |
inputFields.forEach(addEvent);
|
@@ -67,34 +52,38 @@ jQuery(function($){
|
|
67 |
});
|
68 |
}
|
69 |
|
70 |
-
//Run once on page load.
|
71 |
timeout = setTimeout(function () {
|
72 |
aioseopUpdatePreviewSnippet();
|
73 |
}, 1000);
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
-
*
|
78 |
*
|
79 |
* @uses wp.data.select().getEditedPostAttribute()
|
80 |
* @link https://developer.wordpress.org/block-editor/data/data-core-editor/#getEditedPostAttribute
|
81 |
*
|
82 |
-
* @since 3.3
|
83 |
*/
|
84 |
function aioseopUpdatePreviewSnippet() {
|
85 |
let postTitle = '';
|
86 |
let postContent = '';
|
87 |
let postExcerpt = '';
|
88 |
|
89 |
-
if (
|
|
|
|
|
|
|
|
|
90 |
postTitle = aioseopStripMarkup($.trim($('#title').val()));
|
91 |
-
postContent =
|
92 |
-
postExcerpt =
|
93 |
}
|
94 |
else {
|
95 |
postTitle = aioseopStripMarkup($.trim($('#post-title-0').val()));
|
96 |
-
postContent =
|
97 |
-
postExcerpt =
|
98 |
}
|
99 |
|
100 |
let metaboxTitle = aioseopStripMarkup($.trim($('input[name="aiosp_title').val()));
|
@@ -127,15 +116,18 @@ jQuery(function($){
|
|
127 |
}
|
128 |
|
129 |
/**
|
130 |
-
*
|
131 |
-
*
|
132 |
-
* Shortens the description to max. 160 characters without truncation.
|
133 |
*
|
134 |
* @since 3.3.0
|
|
|
135 |
*
|
136 |
-
* @param string
|
|
|
137 |
*/
|
138 |
-
function
|
|
|
|
|
|
|
139 |
description = aioseopStripMarkup(description);
|
140 |
if (160 < description.length) {
|
141 |
let excessLength = description.length - 160;
|
@@ -147,8 +139,6 @@ jQuery(function($){
|
|
147 |
}
|
148 |
|
149 |
/**
|
150 |
-
* The aioseopStripMarkup() function.
|
151 |
-
*
|
152 |
* Strips all editor markup from a string.
|
153 |
*
|
154 |
* @since 3.3.0
|
@@ -160,13 +150,11 @@ jQuery(function($){
|
|
160 |
// Remove all HTML tags.
|
161 |
content = content.replace(/(<[^ >][^>]*>)?/gm, '');
|
162 |
// Remove all line breaks.
|
163 |
-
content = content.replace(
|
164 |
return aioseopDecodeHtmlEntities(content.trim());
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
-
* The aioseopDecodeHtmlEntities() function.
|
169 |
-
*
|
170 |
* Decodes HTML entities to characters.
|
171 |
*
|
172 |
* @since 3.3.0
|
17 |
let aioseopTitle = $('input[name="aiosp_title"]');
|
18 |
let aioseopDescription = $('textarea[name="aiosp_description"]');
|
19 |
let timeout = 0;
|
|
|
20 |
let autogenerateDescriptions = aioseop_preview_snippet.autogenerateDescriptions;
|
21 |
let skipExcerpt = aioseop_preview_snippet.skipExcerpt;
|
22 |
+
let isGutenbergEditor = aioseopIsGutenbergEditor();
|
23 |
|
24 |
+
aioseopInitPreviewSnippet();
|
25 |
|
26 |
/**
|
27 |
+
* Defines the relevant fields and adds the relevant event listeners based on which editor is active.
|
|
|
|
|
28 |
*
|
29 |
* @since 3.3.0
|
30 |
+
* @since 3.3.4 Add support for text tab in Classic Editor.
|
31 |
*/
|
32 |
+
function aioseopInitPreviewSnippet() {
|
33 |
let inputFields = [aioseopTitle, aioseopDescription];
|
34 |
|
35 |
+
if (!isGutenbergEditor) {
|
36 |
docTitle = $('#title');
|
37 |
let postExcerpt = $('#excerpt');
|
38 |
|
39 |
inputFields.push(docTitle, postExcerpt);
|
40 |
|
41 |
+
aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet);
|
42 |
+
aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet);
|
|
|
|
|
|
|
43 |
}
|
44 |
else {
|
45 |
+
aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
inputFields.forEach(addEvent);
|
52 |
});
|
53 |
}
|
54 |
|
55 |
+
// Run once on page load.
|
56 |
timeout = setTimeout(function () {
|
57 |
aioseopUpdatePreviewSnippet();
|
58 |
}, 1000);
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
+
* Updates the preview snippet and input field placeholders in the meta box when a change happens.
|
63 |
*
|
64 |
* @uses wp.data.select().getEditedPostAttribute()
|
65 |
* @link https://developer.wordpress.org/block-editor/data/data-core-editor/#getEditedPostAttribute
|
66 |
*
|
67 |
+
* @since 3.3.0
|
68 |
*/
|
69 |
function aioseopUpdatePreviewSnippet() {
|
70 |
let postTitle = '';
|
71 |
let postContent = '';
|
72 |
let postExcerpt = '';
|
73 |
|
74 |
+
if (aioseopEditorUndefined) {
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
|
78 |
+
if (!isGutenbergEditor) {
|
79 |
postTitle = aioseopStripMarkup($.trim($('#title').val()));
|
80 |
+
postContent = aioseopGetDescription(aioseopGetClassicEditorContent());
|
81 |
+
postExcerpt = aioseopGetDescription($.trim($('#excerpt').val()));
|
82 |
}
|
83 |
else {
|
84 |
postTitle = aioseopStripMarkup($.trim($('#post-title-0').val()));
|
85 |
+
postContent = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));
|
86 |
+
postExcerpt = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));
|
87 |
}
|
88 |
|
89 |
let metaboxTitle = aioseopStripMarkup($.trim($('input[name="aiosp_title').val()));
|
116 |
}
|
117 |
|
118 |
/**
|
119 |
+
* Shortens the description to 160 characters without truncation.
|
|
|
|
|
120 |
*
|
121 |
* @since 3.3.0
|
122 |
+
* @since 3.3.4 Shorten post content to improve performance.
|
123 |
*
|
124 |
+
* @param string postContent
|
125 |
+
* @return string description
|
126 |
*/
|
127 |
+
function aioseopGetDescription(postContent) {
|
128 |
+
// Shorten content first to avoid performance drops.
|
129 |
+
let description = postContent.substring(0, 5000);
|
130 |
+
|
131 |
description = aioseopStripMarkup(description);
|
132 |
if (160 < description.length) {
|
133 |
let excessLength = description.length - 160;
|
139 |
}
|
140 |
|
141 |
/**
|
|
|
|
|
142 |
* Strips all editor markup from a string.
|
143 |
*
|
144 |
* @since 3.3.0
|
150 |
// Remove all HTML tags.
|
151 |
content = content.replace(/(<[^ >][^>]*>)?/gm, '');
|
152 |
// Remove all line breaks.
|
153 |
+
content = content.replace(/[\r\n]+/gm, ' ');
|
154 |
return aioseopDecodeHtmlEntities(content.trim());
|
155 |
}
|
156 |
|
157 |
/**
|
|
|
|
|
158 |
* Decodes HTML entities to characters.
|
159 |
*
|
160 |
* @since 3.3.0
|
js/admin/aioseop-preview-snippet.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var docTitle="",snippetTitle="",snippetDescription="",aioseopTitle="",aioseopDescription="",aioseopPreviewTimeout=0,aioseopPreviewIsGutenberg=aioseop_preview_snippet.isGutenberg,aioseopPreviewAutogenerateDescriptions=aioseop_preview_snippet.autogenerateDescriptions,skipExcerpt=aioseop_preview_snippet.skipExcerpt;function aioseopUpdateMetabox(){var e=[aioseopTitle,aioseopDescription];if("false"===aioseopPreviewIsGutenberg){docTitle=$("#title");var i=$("#excerpt");e.push(docTitle,i),setTimeout(function(){tinymce.editors[0].on("KeyUp",function(){aioseopUpdatePreviewSnippet()})},1e3)}else window._wpLoadBlockEditor.then(function(){setTimeout(function(){wp.data.subscribe(function(){clearTimeout(aioseopPreviewTimeout),aioseopPreviewTimeout=setTimeout(function(){aioseopUpdatePreviewSnippet()},200)})})});e.forEach(function(e){e.on("input",function(){aioseopUpdatePreviewSnippet()})}),aioseopPreviewTimeout=setTimeout(function(){aioseopUpdatePreviewSnippet()},1e3)}function aioseopUpdatePreviewSnippet(){var e="",i="",t="";t="false"===aioseopPreviewIsGutenberg?(e=aioseopStripMarkup($.trim($("#title").val())),i=aioseopShortenDescription($("#content_ifr").contents().find("body")[0].innerHTML),aioseopShortenDescription($.trim($("#excerpt").val()))):(e=aioseopStripMarkup($.trim($("#post-title-0").val())),i=aioseopShortenDescription(wp.data.select("core/editor").getEditedPostAttribute("content")),aioseopShortenDescription(wp.data.select("core/editor").getEditedPostAttribute("excerpt")));var o=aioseopStripMarkup($.trim($('input[name="aiosp_title').val())),p=aioseopStripMarkup($.trim($('textarea[name="aiosp_description"]').val()));snippetTitle.text(e),aioseopTitle.attr("placeholder",e),""!==o&&snippetTitle.text(o),"on"===aioseopPreviewAutogenerateDescriptions?(snippetDescription.text(i),aioseopDescription.attr("placeholder",i),"on"!==skipExcerpt&""!==t&&(snippetDescription.text(t),aioseopDescription.attr("placeholder",t))):(snippetDescription.text(""),aioseopDescription.attr("placeholder","")),""!==p&&(snippetDescription.text(p),aioseopDescription.attr("placeholder",p))}function aioseopShortenDescription(e){if(160<(e=aioseopStripMarkup(e)).length){var i=e.length-160,t=new XRegExp("[^\\pZ\\pP]*.{"+i+"}$");e=XRegExp.replace(e,t,""),e+=" ..."}return e}function aioseopStripMarkup(e){return aioseopDecodeHtmlEntities((e=(e=e.replace(/(<[^ >][^>]*>)?/gm,"")).replace(/\s\s+/g," ")).trim())}function aioseopDecodeHtmlEntities(e){var i=document.createElement("textarea");return i.innerHTML=e,i.value}$(function(){"use strict";snippetTitle=$("#aiosp_snippet_title"),snippetDescription=$("#aioseop_snippet_description"),aioseopTitle=$('input[name="aiosp_title"]'),aioseopDescription=$('textarea[name="aiosp_description"]'),aioseopUpdateMetabox()});
|
|
modules/aioseop_opengraph.php
CHANGED
@@ -1884,12 +1884,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
1884 |
* @param string $hook_suffix
|
1885 |
*/
|
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 |
|
1894 |
switch ( $hook_suffix ) {
|
1895 |
case 'term.php':
|
@@ -1918,8 +1912,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
1918 |
AIOSEOP_VERSION
|
1919 |
);
|
1920 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1921 |
$count_chars_data = array(
|
1922 |
-
'isGutenberg' => $is_gutenberg,
|
1923 |
'pluginDirName' => AIOSEOP_PLUGIN_DIRNAME,
|
1924 |
'currentPage' => $hook_suffix,
|
1925 |
);
|
1884 |
* @param string $hook_suffix
|
1885 |
*/
|
1886 |
public function admin_enqueue_scripts( $hook_suffix ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1887 |
|
1888 |
switch ( $hook_suffix ) {
|
1889 |
case 'term.php':
|
1912 |
AIOSEOP_VERSION
|
1913 |
);
|
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 |
+
|
1923 |
$count_chars_data = array(
|
|
|
1924 |
'pluginDirName' => AIOSEOP_PLUGIN_DIRNAME,
|
1925 |
'currentPage' => $hook_suffix,
|
1926 |
);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: hallsofmontezuma, semperplugins, wpsmort, arnaudbroes
|
|
3 |
Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 3.3.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.2.4
|
9 |
|
3 |
Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 3.3.4
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.2.4
|
9 |
|