The SEO Framework - Version 4.0.5

Version Description

In WordPress, we found various query endpoints that can be malformed to create broken pages. Backlinks to these pages can harm your site's ranking. In this update, we added advanced query protection, which you can enable via the robots meta settings.

The "Connected Social Pages" input fields will now disappear when you empty them. They have never proven to work, and Google has deprecated them. We also removed the transient caching for JSON-LD scripts, as it wasn't helping anyone.

On the other hand, we added a new feed indexing option, Discord sharing options (oEmbed, theme color), and the aforementioned advanced query protection option. Support for EDD and Polylang has been expanded, and we reintroduced the hyphen option for titles (which is the new default).

In this update, we bring a few other quality-of-life changes, as well. We added a dozen new filters, touched up the interface, streamlined the query handler, and fixed known corner-case issues and bugs.

Download this release

Release Info

Developer Cybr
Plugin Icon 128x128 The SEO Framework
Version 4.0.5
Comparing to
See all releases

Code changes from version 4.0.4 to 4.0.5

Files changed (100) hide show
  1. autodescription.php +4 -4
  2. bootstrap/activation.php +1 -1
  3. bootstrap/deactivation.php +1 -1
  4. bootstrap/define.php +1 -1
  5. bootstrap/envtest.php +4 -3
  6. bootstrap/load.php +5 -5
  7. bootstrap/upgrade.php +36 -8
  8. inc/classes/admin-init.class.php +7 -5
  9. inc/classes/admin-pages.class.php +22 -15
  10. inc/classes/bridges/listedit.class.php +66 -20
  11. inc/classes/bridges/listtable.class.php +18 -1
  12. inc/classes/bridges/ping.class.php +1 -1
  13. inc/classes/bridges/postsettings.class.php +27 -2
  14. inc/classes/bridges/scripts.class.php +7 -4
  15. inc/classes/bridges/seobar.class.php +3 -18
  16. inc/classes/bridges/seosettings.class.php +13 -2
  17. inc/classes/bridges/sitemap.class.php +1 -1
  18. inc/classes/bridges/termsettings.class.php +1 -1
  19. inc/classes/builders/images.class.php +25 -4
  20. inc/classes/builders/scripts.class.php +3 -2
  21. inc/classes/builders/seobar-page.class.php +36 -4
  22. inc/classes/builders/seobar-term.class.php +41 -9
  23. inc/classes/builders/seobar.class.php +1 -1
  24. inc/classes/builders/sitemap-base.class.php +3 -3
  25. inc/classes/builders/sitemap.class.php +1 -1
  26. inc/classes/cache.class.php +4 -69
  27. inc/classes/core.class.php +24 -20
  28. inc/classes/debug.class.php +53 -67
  29. inc/classes/deprecated.class.php +11 -11
  30. inc/classes/detect.class.php +186 -9
  31. inc/classes/feed.class.php +2 -2
  32. inc/classes/generate-description.class.php +13 -9
  33. inc/classes/generate-image.class.php +27 -2
  34. inc/classes/generate-ldjson.class.php +19 -33
  35. inc/classes/generate-title.class.php +30 -12
  36. inc/classes/generate-url.class.php +3 -2
  37. inc/classes/generate.class.php +72 -57
  38. inc/classes/init.class.php +187 -116
  39. inc/classes/interpreters/seobar.class.php +1 -1
  40. inc/classes/load.class.php +4 -1
  41. inc/classes/post-data.class.php +20 -5
  42. inc/classes/profile.class.php +1 -1
  43. inc/classes/query.class.php +146 -34
  44. inc/classes/render.class.php +55 -6
  45. inc/classes/sanitize.class.php +93 -23
  46. inc/classes/silencer.class.php +35 -1
  47. inc/classes/site-options.class.php +19 -8
  48. inc/classes/term-data.class.php +36 -22
  49. inc/classes/user-data.class.php +6 -3
  50. inc/compat/php-mbstring.php +2 -0
  51. inc/compat/plugin-edd.php +56 -0
  52. inc/compat/plugin-polylang.php +42 -0
  53. inc/compat/plugin-woocommerce.php +82 -3
  54. inc/compat/plugin-wpforo.php +29 -15
  55. inc/compat/theme-genesis.php +1 -1
  56. inc/functions/api.php +5 -4
  57. inc/functions/deprecated.php +3 -2
  58. inc/functions/upgrade-suggestion.php +1 -1
  59. inc/index.php +7 -0
  60. inc/traits/core/overload.trait.php +1 -1
  61. inc/views/admin/metaboxes/feed-metabox.php +4 -0
  62. inc/views/admin/metaboxes/general-metabox.php +10 -17
  63. inc/views/admin/metaboxes/homepage-metabox.php +1 -1
  64. inc/views/admin/metaboxes/robots-metabox.php +18 -12
  65. inc/views/admin/metaboxes/schema-metabox.php +56 -25
  66. inc/views/admin/metaboxes/sitemaps-metabox.php +2 -2
  67. inc/views/admin/metaboxes/social-metabox.php +51 -4
  68. inc/views/admin/metaboxes/title-metabox.php +1 -1
  69. inc/views/admin/metaboxes/webmaster-metabox.php +73 -59
  70. inc/views/debug/output.php +2 -2
  71. inc/views/edit/seo-settings-singular.php +3 -3
  72. inc/views/edit/seo-settings-tt.php +1 -1
  73. inc/views/list/bulk-post.php +28 -0
  74. inc/views/list/quick-post.php +28 -0
  75. inc/views/list/quick-term.php +28 -0
  76. inc/views/templates/settings/index.php +6 -0
  77. inc/views/templates/settings/settings.php +19 -0
  78. language/autodescription.pot +592 -505
  79. lib/css/post.css +50 -25
  80. lib/css/post.min.css +1 -1
  81. lib/css/settings.css +32 -0
  82. lib/css/settings.min.css +1 -1
  83. lib/js/ays.js +1 -1
  84. lib/js/c.js +3 -6
  85. lib/js/c.min.js +1 -1
  86. lib/js/description.js +1 -1
  87. lib/js/gbc.js +1 -1
  88. lib/js/le.js +30 -26
  89. lib/js/le.min.js +1 -1
  90. lib/js/post.js +1 -1
  91. lib/js/pt-gb.js +1 -1
  92. lib/js/pt.js +1 -1
  93. lib/js/settings.js +83 -13
  94. lib/js/settings.min.js +1 -1
  95. lib/js/social.js +1 -1
  96. lib/js/term.js +1 -1
  97. lib/js/title.js +1 -1
  98. lib/js/tsf.js +5 -5
  99. lib/js/tt.js +1 -1
  100. readme.txt +18 -11
autodescription.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://theseoframework.com/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
6
- * Version: 4.0.4
7
* Author: The SEO Framework Team
8
* Author URI: https://theseoframework.com/
9
* License: GPLv3
@@ -17,7 +17,7 @@ defined( 'ABSPATH' ) or die;
17
18
/**
19
* The SEO Framework plugin
20
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
21
*
22
* This program is free software: you can redistribute it and/or modify
23
* it under the terms of the GNU General Public License version 3 as published
@@ -64,7 +64,7 @@ defined( 'ABSPATH' ) or die;
64
*
65
* @since 2.3.5
66
*/
67
- define( 'THE_SEO_FRAMEWORK_VERSION', '4.0.4' );
68
69
/**
70
* The plugin Database version.
@@ -73,7 +73,7 @@ define( 'THE_SEO_FRAMEWORK_VERSION', '4.0.4' );
73
*
74
* @since 2.7.0
75
*/
76
- define( 'THE_SEO_FRAMEWORK_DB_VERSION', '4000' );
77
78
/**
79
* The plugin file, absolute unix path.
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://theseoframework.com/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
6
+ * Version: 4.0.5
7
* Author: The SEO Framework Team
8
* Author URI: https://theseoframework.com/
9
* License: GPLv3
17
18
/**
19
* The SEO Framework plugin
20
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
21
*
22
* This program is free software: you can redistribute it and/or modify
23
* it under the terms of the GNU General Public License version 3 as published
64
*
65
* @since 2.3.5
66
*/
67
+ define( 'THE_SEO_FRAMEWORK_VERSION', '4.0.5' );
68
69
/**
70
* The plugin Database version.
73
*
74
* @since 2.7.0
75
*/
76
+ define( 'THE_SEO_FRAMEWORK_DB_VERSION', '4051' );
77
78
/**
79
* The plugin file, absolute unix path.
bootstrap/activation.php CHANGED
@@ -9,7 +9,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
9
10
/**
11
* The SEO Framework plugin
12
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
9
10
/**
11
* The SEO Framework plugin
12
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
bootstrap/deactivation.php CHANGED
@@ -9,7 +9,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
9
10
/**
11
* The SEO Framework plugin
12
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
9
10
/**
11
* The SEO Framework plugin
12
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
bootstrap/define.php CHANGED
@@ -9,7 +9,7 @@ defined( 'THE_SEO_FRAMEWORK_DB_VERSION' ) or die;
9
10
/**
11
* The SEO Framework plugin
12
- * Copyright (C) 2018 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
9
10
/**
11
* The SEO Framework plugin
12
+ * Copyright (C) 2018 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
bootstrap/envtest.php CHANGED
@@ -12,7 +12,7 @@ defined( 'THE_SEO_FRAMEWORK_DB_VERSION' ) or die;
12
13
/**
14
* The SEO Framework plugin
15
- * Copyright (C) 2018 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
16
*
17
* This program is free software: you can redistribute it and/or modify
18
* it under the terms of the GNU General Public License version 3 as published
@@ -41,6 +41,7 @@ the_seo_framework_pre_boot_test();
41
* Tests plugin upgrade.
42
*
43
* @since 3.1.0
44
* @access private
45
* @link http://php.net/eol.php
46
* @link https://codex.wordpress.org/WordPress_Versions
@@ -60,7 +61,7 @@ function the_seo_framework_pre_boot_test() {
60
61
$nw = get_network();
62
if ( $nw instanceof WP_Network ) {
63
- if ( get_blog_option( $nw->site_id, 'the_seo_framework_tested_upgrade_version' ) ) {
64
update_option( 'the_seo_framework_tested_upgrade_version', THE_SEO_FRAMEWORK_DB_VERSION );
65
return;
66
}
@@ -109,7 +110,7 @@ function the_seo_framework_pre_boot_test() {
109
switch ( $test ) :
110
case 1:
111
//* PHP requirements not met, always count up to encourage best standards.
112
- $requirement = 'PHP 5.5.0 or later';
113
$issue = 'PHP version';
114
$version = PHP_VERSION;
115
$subtitle = 'Server Requirements';
12
13
/**
14
* The SEO Framework plugin
15
+ * Copyright (C) 2018 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
16
*
17
* This program is free software: you can redistribute it and/or modify
18
* it under the terms of the GNU General Public License version 3 as published
41
* Tests plugin upgrade.
42
*
43
* @since 3.1.0
44
+ * @since 4.0.5 No longer assumes the main blog (WP Multisite) has been tested, although that's very likely when updated via the interface.
45
* @access private
46
* @link http://php.net/eol.php
47
* @link https://codex.wordpress.org/WordPress_Versions
61
62
$nw = get_network();
63
if ( $nw instanceof WP_Network ) {
64
+ if ( get_blog_option( $nw->site_id, 'the_seo_framework_tested_upgrade_version' ) >= THE_SEO_FRAMEWORK_DB_VERSION ) {
65
update_option( 'the_seo_framework_tested_upgrade_version', THE_SEO_FRAMEWORK_DB_VERSION );
66
return;
67
}
110
switch ( $test ) :
111
case 1:
112
//* PHP requirements not met, always count up to encourage best standards.
113
+ $requirement = 'PHP 5.6.0 or later';
114
$issue = 'PHP version';
115
$version = PHP_VERSION;
116
$subtitle = 'Server Requirements';
bootstrap/load.php CHANGED
@@ -9,7 +9,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
9
10
/**
11
* The SEO Framework plugin
12
- * Copyright (C) 2018 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
@@ -78,10 +78,10 @@ function _init_tsf() {
78
/**
79
* @package The_SEO_Framework
80
*/
81
- if ( \The_SEO_Framework\_can_load() ) {
82
if ( \is_admin() ) {
83
//! TODO: admin-only loader?
84
- $tsf = new \The_SEO_Framework\Load();
85
$tsf->loaded = true;
86
87
$tsf->_load_early_compat_files();
@@ -92,7 +92,7 @@ function _init_tsf() {
92
*/
93
\do_action( 'the_seo_framework_admin_loaded' );
94
} else {
95
- $tsf = new \The_SEO_Framework\Load();
96
$tsf->loaded = true;
97
98
$tsf->_load_early_compat_files();
@@ -104,7 +104,7 @@ function _init_tsf() {
104
*/
105
\do_action( 'the_seo_framework_loaded' );
106
} else {
107
- $tsf = new \The_SEO_Framework\Silencer();
108
$tsf->loaded = false;
109
}
110
9
10
/**
11
* The SEO Framework plugin
12
+ * Copyright (C) 2018 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
78
/**
79
* @package The_SEO_Framework
80
*/
81
+ if ( _can_load() ) {
82
if ( \is_admin() ) {
83
//! TODO: admin-only loader?
84
+ $tsf = new Load();
85
$tsf->loaded = true;
86
87
$tsf->_load_early_compat_files();
92
*/
93
\do_action( 'the_seo_framework_admin_loaded' );
94
} else {
95
+ $tsf = new Load();
96
$tsf->loaded = true;
97
98
$tsf->_load_early_compat_files();
104
*/
105
\do_action( 'the_seo_framework_loaded' );
106
} else {
107
+ $tsf = new Silencer();
108
$tsf->loaded = false;
109
}
110
bootstrap/upgrade.php CHANGED
@@ -9,7 +9,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
9
10
/**
11
* The SEO Framework plugin
12
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
@@ -107,15 +107,15 @@ function _do_upgrade() {
107
108
// Check if upgrade is locked. Otherwise, lock it.
109
if ( \get_transient( 'tsf_upgrade_lock' ) ) return;
110
- \set_transient( 'tsf_upgrade_lock', true, 300 );
111
112
// Register this AFTER the transient is set. Otherwise, it may clear the transient in another thread.
113
register_shutdown_function( __NAMESPACE__ . '\\_release_upgrade_lock' );
114
115
\wp_raise_memory_limit( 'tsf_upgrade' );
116
-
117
- // phpcs:ignore, WordPress.PHP.NoSilencedErrors -- Feature may be disabled.
118
- @set_time_limit( 300 );
119
120
/**
121
* Clear the cache to prevent an update_option() from saving a stale database version to the cache.
@@ -177,6 +177,11 @@ function _do_upgrade() {
177
$version = '3300';
178
}
179
180
/**
181
* @since 2.7.0
182
*/
@@ -258,7 +263,7 @@ function _do_upgrade_notice() {
258
);
259
} else {
260
$tsf->do_dismissible_notice(
261
- \esc_html__( 'Thank you for installing The SEO Framework! Your website is now optimized for SEO, automatically. We hope you enjoy our free plugin. Good luck with your site!', 'autodescription' ),
262
'updated',
263
false,
264
false
@@ -539,6 +544,7 @@ function _do_upgrade_3103() {
539
* refactored the whole API.
540
*
541
* @since 4.0.0
542
*/
543
function _do_upgrade_3300() {
544
@@ -554,9 +560,9 @@ function _do_upgrade_3300() {
554
555
$defaults = _upgrade_default_site_options();
556
557
- // Convert 'dash' title option to 'ndash', silently. Nothing really changes for the user.
558
if ( 'dash' === $tsf->get_option( 'title_separator', false ) )
559
- $tsf->update_option( 'title_separator', 'ndash' );
560
561
// Add default cron pinging option.
562
if ( isset( $defaults['ping_use_cron'] ) ) {
@@ -586,3 +592,25 @@ function _do_upgrade_3300() {
586
587
\update_option( 'the_seo_framework_upgraded_db_version', '3300' );
588
}
9
10
/**
11
* The SEO Framework plugin
12
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
13
*
14
* This program is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License version 3 as published
107
108
// Check if upgrade is locked. Otherwise, lock it.
109
if ( \get_transient( 'tsf_upgrade_lock' ) ) return;
110
+
111
+ $timeout = 5 * MINUTE_IN_SECONDS;
112
+ \set_transient( 'tsf_upgrade_lock', true, $timeout );
113
114
// Register this AFTER the transient is set. Otherwise, it may clear the transient in another thread.
115
register_shutdown_function( __NAMESPACE__ . '\\_release_upgrade_lock' );
116
117
\wp_raise_memory_limit( 'tsf_upgrade' );
118
+ set_time_limit( $timeout );
119
120
/**
121
* Clear the cache to prevent an update_option() from saving a stale database version to the cache.
177
$version = '3300';
178
}
179
180
+ if ( $version < '4051' ) {
181
+ _do_upgrade_4051();
182
+ $version = '4051';
183
+ }
184
+
185
/**
186
* @since 2.7.0
187
*/
263
);
264
} else {
265
$tsf->do_dismissible_notice(
266
+ \esc_html__( 'Thank you for installing The SEO Framework! Your website is now optimized for search and social sharing, automatically. We hope you enjoy our free plugin. Good luck with your site!', 'autodescription' ),
267
'updated',
268
false,
269
false
544
* refactored the whole API.
545
*
546
* @since 4.0.0
547
+ * @since 4.0.5 The upgrader now updates "dash" to "hyphen".
548
*/
549
function _do_upgrade_3300() {
550
560
561
$defaults = _upgrade_default_site_options();
562
563
+ // Convert 'dash' title option to 'hyphen', silently. Nothing really changes for the user.
564
if ( 'dash' === $tsf->get_option( 'title_separator', false ) )
565
+ $tsf->update_option( 'title_separator', 'hyphen' );
566
567
// Add default cron pinging option.
568
if ( isset( $defaults['ping_use_cron'] ) ) {
592
593
\update_option( 'the_seo_framework_upgraded_db_version', '3300' );
594
}
595
+
596
+ /**
597
+ * Registers the advanced_query_protection option. 0 for existing sites. 1 for new sites.
598
+ * Registers the `index_the_feed` and `baidu_verification` options for existing sites. New sites will have it registered already.
599
+ *
600
+ * @since 4.0.5
601
+ */
602
+ function _do_upgrade_4051() {
603
+
604
+ $tsf = \the_seo_framework();
605
+
606
+ if ( \get_option( 'the_seo_framework_initial_db_version' ) < '4051' ) {
607
+ $tsf->update_option( 'advanced_query_protection', 0 );
608
+ $tsf->update_option( 'index_the_feed', 0 );
609
+ $tsf->update_option( 'baidu_verification', '' );
610
+ $tsf->update_option( 'oembed_scripts', 1 );
611
+ $tsf->update_option( 'oembed_remove_author', 0 );
612
+ $tsf->update_option( 'theme_color', '' );
613
+ }
614
+
615
+ \update_option( 'the_seo_framework_upgraded_db_version', '4051' );
616
+ }
inc/classes/admin-init.class.php CHANGED
@@ -10,7 +10,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
10
11
/**
12
* The SEO Framework plugin
13
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
@@ -107,7 +107,7 @@ class Admin_Init extends Init {
107
if ( $this->is_archive_admin() ) {
108
$prepare_edit_screen = $this->is_taxonomy_supported();
109
} elseif ( $this->is_singular_admin() ) {
110
- $prepare_edit_screen = $this->is_post_type_supported();
111
} else {
112
$prepare_edit_screen = false;
113
}
@@ -199,7 +199,7 @@ class Admin_Init extends Init {
199
'ml_IN' => 100 / 160, // Malayalam (മലയാളം)
200
'ja' => 70 / 160, // Japanese (日本語)
201
'ko_KR' => 82 / 160, // Korean (한국어)
202
- 'ta_IN' => 120 / 160, // Talim (தமிழ்)
203
'zh_TW' => 70 / 160, // Taiwanese Mandarin (Traditional Chinese) (繁體中文)
204
'zh_HK' => 70 / 160, // Hong Kong (Chinese version) (香港中文版)
205
'zh_CN' => 70 / 160, // Mandarin (Simplified Chinese) (简体中文)
@@ -473,6 +473,7 @@ class Admin_Init extends Init {
473
if ( isset( $_POST['val'] ) ) {
474
$value = (int) $_POST['val'];
475
} else {
476
$value = $this->get_user_option( 0, 'counter_type', 3 ) + 1;
477
}
478
$value = \absint( $value );
@@ -505,7 +506,7 @@ class Admin_Init extends Init {
505
// phpcs:disable, WordPress.Security.NonceVerification -- _check_tsf_ajax_referer() does this.
506
$this->_check_tsf_ajax_referer( 'edit_posts' );
507
508
- // CLear output buffer.
509
$this->clean_response_header();
510
511
$post_id = \absint( $_POST['post_id'] );
@@ -600,6 +601,8 @@ class Admin_Init extends Init {
600
'data' => $data,
601
'processed' => $get,
602
] );
603
}
604
605
/**
@@ -620,7 +623,6 @@ class Admin_Init extends Init {
620
*/
621
public function _wp_ajax_crop_image() {
622
623
- // This checks the nonce, re:to all 'WordPress.Security.NonceVerification' below
624
// phpcs:disable, WordPress.Security.NonceVerification -- _check_tsf_ajax_referer does this.
625
$this->_check_tsf_ajax_referer( 'upload_files' );
626
10
11
/**
12
* The SEO Framework plugin
13
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
107
if ( $this->is_archive_admin() ) {
108
$prepare_edit_screen = $this->is_taxonomy_supported();
109
} elseif ( $this->is_singular_admin() ) {
110
+ $prepare_edit_screen = $this->is_post_type_supported( $this->get_admin_post_type() );
111
} else {
112
$prepare_edit_screen = false;
113
}
199
'ml_IN' => 100 / 160, // Malayalam (മലയാളം)
200
'ja' => 70 / 160, // Japanese (日本語)
201
'ko_KR' => 82 / 160, // Korean (한국어)
202
+ 'ta_IN' => 120 / 160, // Tamil (தமிழ்)
203
'zh_TW' => 70 / 160, // Taiwanese Mandarin (Traditional Chinese) (繁體中文)
204
'zh_HK' => 70 / 160, // Hong Kong (Chinese version) (香港中文版)
205
'zh_CN' => 70 / 160, // Mandarin (Simplified Chinese) (简体中文)
473
if ( isset( $_POST['val'] ) ) {
474
$value = (int) $_POST['val'];
475
} else {
476
+ // TODO use get_default_user_data() value instead.
477
$value = $this->get_user_option( 0, 'counter_type', 3 ) + 1;
478
}
479
$value = \absint( $value );
506
// phpcs:disable, WordPress.Security.NonceVerification -- _check_tsf_ajax_referer() does this.
507
$this->_check_tsf_ajax_referer( 'edit_posts' );
508
509
+ // Clear output buffer.
510
$this->clean_response_header();
511
512
$post_id = \absint( $_POST['post_id'] );
601
'data' => $data,
602
'processed' => $get,
603
] );
604
+
605
+ // phpcs:enable, WordPress.Security.NonceVerification
606
}
607
608
/**
623
*/
624
public function _wp_ajax_crop_image() {
625
626
// phpcs:disable, WordPress.Security.NonceVerification -- _check_tsf_ajax_referer does this.
627
$this->_check_tsf_ajax_referer( 'upload_files' );
628
inc/classes/admin-pages.class.php CHANGED
@@ -10,7 +10,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
10
11
/**
12
* The SEO Framework plugin
13
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
@@ -181,13 +181,12 @@ class Admin_Pages extends Profile {
181
* Outputs notices on SEO setting changes.
182
*
183
* @since 4.0.0
184
* @access private
185
*/
186
- public static function _do_settings_page_notices() {
187
188
- $tsf = \the_seo_framework();
189
-
190
- $notice = $tsf->get_static_cache( 'settings_notice' );
191
192
if ( ! $notice ) return;
193
@@ -216,9 +215,9 @@ class Admin_Pages extends Profile {
216
break;
217
}
218
219
- $tsf->update_static_cache( 'settings_notice', '' );
220
221
- $message and $tsf->do_dismissible_notice( $message, $type ?: 'updated' );
222
}
223
224
/**
@@ -270,8 +269,8 @@ class Admin_Pages extends Profile {
270
* Outputs in-post flex navigational wrapper and its content.
271
*
272
* @since 2.9.0
273
- * @since 3.0.0: Converted to view.
274
- * @since 4.0.0: Deprecated third parameter, silently.
275
*
276
* @param string $id The nav-tab ID
277
* @param array $tabs The tab content {
@@ -659,9 +658,11 @@ class Admin_Pages extends Profile {
659
* Returns a chechbox wrapper.
660
*
661
* @since 3.1.0
662
*
663
* @param array $args : {
664
* string $id The option name, used as field ID.
665
* string $index The option index, used when the option is an array.
666
* string $label The checkbox label description, placed inline of the checkbox.
667
* string $description The checkbox additional description, placed underneat.
@@ -677,6 +678,7 @@ class Admin_Pages extends Profile {
677
$args = array_merge(
678
[
679
'id' => '',
680
'index' => '',
681
'label' => '',
682
'description' => '',
@@ -706,17 +708,22 @@ class Admin_Pages extends Profile {
706
$value = isset( $value[ $index ] ) ? $value[ $index ] : '';
707
}
708
709
- $cb_class = '';
710
if ( $args['disabled'] ) {
711
- $cb_class = 'tsf-disabled';
712
} elseif ( ! $args['index'] ) {
713
// Can't fetch conditionals in index.
714
- $cb_class = $this->get_is_conditional_checked( $args['id'], false );
715
} else {
716
if ( $args['default'] ) {
717
- $cb_class = 'tsf-default-selected';
718
} elseif ( $args['warned'] ) {
719
- $cb_class = 'tsf-warning-selected';
720
}
721
}
722
@@ -730,7 +737,7 @@ class Admin_Pages extends Profile {
730
vsprintf(
731
'<input type=checkbox class="%s" name="%s" id="%s" value="1" %s %s /> %s',
732
[
733
- $cb_class,
734
$field_name,
735
$field_id,
736
\checked( $value, true, false ),
10
11
/**
12
* The SEO Framework plugin
13
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
181
* Outputs notices on SEO setting changes.
182
*
183
* @since 4.0.0
184
+ * @since 4.0.5 This is no longer a static function.
185
* @access private
186
*/
187
+ public function _do_settings_page_notices() {
188
189
+ $notice = $this->get_static_cache( 'settings_notice' );
190
191
if ( ! $notice ) return;
192
215
break;
216
}
217
218
+ $this->update_static_cache( 'settings_notice', '' );
219
220
+ $message and $this->do_dismissible_notice( $message, $type ?: 'updated' );
221
}
222
223
/**
269
* Outputs in-post flex navigational wrapper and its content.
270
*
271
* @since 2.9.0
272
+ * @since 3.0.0 Converted to view.
273
+ * @since 4.0.0 Deprecated third parameter, silently.
274
*
275
* @param string $id The nav-tab ID
276
* @param array $tabs The tab content {
658
* Returns a chechbox wrapper.
659
*
660
* @since 3.1.0
661
+ * @since 4.0.5 You can now supply an extra class for the checkbox.
662
*
663
* @param array $args : {
664
* string $id The option name, used as field ID.
665
+ * string $class The checkbox class.
666
* string $index The option index, used when the option is an array.
667
* string $label The checkbox label description, placed inline of the checkbox.
668
* string $description The checkbox additional description, placed underneat.
678
$args = array_merge(
679
[
680
'id' => '',
681
+ 'class' => '',
682
'index' => '',
683
'label' => '',
684
'description' => '',
708
$value = isset( $value[ $index ] ) ? $value[ $index ] : '';
709
}
710
711
+ $cb_classes = [];
712
+
713
+ if ( $args['class'] ) {
714
+ $cb_classes[] = $args['class'];
715
+ }
716
+
717
if ( $args['disabled'] ) {
718
+ $cb_classes[] = 'tsf-disabled';
719
} elseif ( ! $args['index'] ) {
720
// Can't fetch conditionals in index.
721
+ $cb_classes[] = $this->get_is_conditional_checked( $args['id'], false );
722
} else {
723
if ( $args['default'] ) {
724
+ $cb_classes[] = 'tsf-default-selected';
725
} elseif ( $args['warned'] ) {
726
+ $cb_classes[] = 'tsf-warning-selected';
727
}
728
}
729
737
vsprintf(
738
'<input type=checkbox class="%s" name="%s" id="%s" value="1" %s %s /> %s',
739
[
740
+ esc_attr( implode( ' ', $cb_classes ) ),
741
$field_name,
742
$field_id,
743
\checked( $value, true, false ),
inc/classes/bridges/listedit.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -123,7 +123,7 @@ final class ListEdit extends ListTable {
123
if ( $taxonomy ) {
124
// Not yet.
125
} else {
126
- \the_seo_framework()->get_view( 'list/bulk-post' );
127
}
128
}
129
@@ -142,9 +142,9 @@ final class ListEdit extends ListTable {
142
if ( $this->column_name !== $column_name ) return;
143
144
if ( $taxonomy ) {
145
- \the_seo_framework()->get_view( 'list/quick-term' );
146
} else {
147
- \the_seo_framework()->get_view( 'list/quick-post' );
148
}
149
}
150
@@ -180,28 +180,50 @@ final class ListEdit extends ListTable {
180
'value' => $meta['_genesis_canonical_uri'],
181
],
182
'noindex' => [
183
- 'default' => empty( $r_defaults['noindex'] ) ? 'index' : 'noindex',
184
- 'value' => $meta['_genesis_noindex'],
185
],
186
'nofollow' => [
187
- 'default' => empty( $r_defaults['nofollow'] ) ? 'follow' : 'nofollow',
188
- 'value' => $meta['_genesis_nofollow'],
189
],
190
'noarchive' => [
191
- 'default' => empty( $r_defaults['noarchive'] ) ? 'archive' : 'noarchive',
192
- 'value' => $meta['_genesis_noarchive'],
193
],
194
'redirect' => [
195
'value' => $meta['redirect'],
196
],
197
];
198
199
printf(
200
'<span class=hidden id=%s data-le="%s"></span>',
201
sprintf( 'tsfLeData[%s]', (int) $post_id ),
202
// phpcs:ignore, WordPress.Security.EscapeOutput -- esc_attr is too aggressive.
203
htmlspecialchars( json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_FORCE_OBJECT ), ENT_QUOTES, 'UTF-8' )
204
);
205
}
206
207
/**
@@ -226,11 +248,13 @@ final class ListEdit extends ListTable {
226
227
$tsf = \the_seo_framework();
228
229
$r_defaults = $tsf->robots_meta(
230
- [
231
- 'id' => $term_id,
232
- 'taxonomy' => $this->taxonomy,
233
- ],
234
\The_SEO_Framework\ROBOTS_IGNORE_SETTINGS | \The_SEO_Framework\ROBOTS_IGNORE_PROTECTION
235
);
236
@@ -242,28 +266,50 @@ final class ListEdit extends ListTable {
242
'value' => $meta['canonical'],
243
],
244
'noindex' => [
245
- 'default' => empty( $r_defaults['noindex'] ) ? 'index' : 'noindex',
246
- 'value' => $meta['noindex'],
247
],
248
'nofollow' => [
249
- 'default' => empty( $r_defaults['nofollow'] ) ? 'follow' : 'nofollow',
250
- 'value' => $meta['nofollow'],
251
],
252
'noarchive' => [
253
- 'default' => empty( $r_defaults['noarchive'] ) ? 'archive' : 'noarchive',
254
- 'value' => $meta['noarchive'],
255
],
256
'redirect' => [
257
'value' => $meta['redirect'],
258
],
259
];
260
261
$container = sprintf(
262
'<span class=hidden id=%s data-le="%s"></span>',
263
sprintf( 'tsfLeData[%s]', (int) $term_id ),
264
htmlspecialchars( json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_FORCE_OBJECT ), ENT_QUOTES, 'UTF-8' )
265
);
266
267
return $string . $container;
268
}
269
}
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
123
if ( $taxonomy ) {
124
// Not yet.
125
} else {
126
+ \the_seo_framework()->get_view( 'list/bulk-post', get_defined_vars() );
127
}
128
}
129
142
if ( $this->column_name !== $column_name ) return;
143
144
if ( $taxonomy ) {
145
+ \the_seo_framework()->get_view( 'list/quick-term', get_defined_vars() );
146
} else {
147
+ \the_seo_framework()->get_view( 'list/quick-post', get_defined_vars() );
148
}
149
}
150
180
'value' => $meta['_genesis_canonical_uri'],
181
],
182
'noindex' => [
183
+ 'value' => $meta['_genesis_noindex'],
184
+ 'isSelect' => true,
185
+ 'default' => empty( $r_defaults['noindex'] ) ? 'index' : 'noindex',
186
],
187
'nofollow' => [
188
+ 'value' => $meta['_genesis_nofollow'],
189
+ 'isSelect' => true,
190
+ 'default' => empty( $r_defaults['nofollow'] ) ? 'follow' : 'nofollow',
191
],
192
'noarchive' => [
193
+ 'value' => $meta['_genesis_noarchive'],
194
+ 'isSelect' => true,
195
+ 'default' => empty( $r_defaults['noarchive'] ) ? 'archive' : 'noarchive',
196
],
197
'redirect' => [
198
'value' => $meta['redirect'],
199
],
200
];
201
202
+ /**
203
+ * Tip: Prefix the indexes with your (plugin) name to prevent collisions.
204
+ * The index corresponds to field with the ID `autodescription-quick[%s]`, where %s is the index.
205
+ *
206
+ * @since 4.0.5
207
+ * @param array $data The current data : {
208
+ * string Index => @param array : {
209
+ * @param mixed $value The current value.
210
+ * @param bool $isSelect Optional. Whether the field is a select field.
211
+ * @param string $default Optional. Only works when $isSelect is true. The default value to be set in select index 0.
212
+ * }
213
+ * }
214
+ * @param array $query The query data. Contains 'id' and 'taxonomy'.
215
+ */
216
+ $data = \apply_filters_ref_array( 'the_seo_framework_list_table_data', [ $data, $query ] );
217
+
218
printf(
219
'<span class=hidden id=%s data-le="%s"></span>',
220
sprintf( 'tsfLeData[%s]', (int) $post_id ),
221
// phpcs:ignore, WordPress.Security.EscapeOutput -- esc_attr is too aggressive.
222
htmlspecialchars( json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_FORCE_OBJECT ), ENT_QUOTES, 'UTF-8' )
223
);
224
+
225
+ if ( $this->doing_ajax )
226
+ echo $this->get_ajax_dispatch_updated_event(); // phpcs:ignore, WordPress.Security.EscapeOutput
227
}
228
229
/**
248
249
$tsf = \the_seo_framework();
250
251
+ $query = [
252
+ 'id' => $term_id,
253
+ 'taxonomy' => $this->taxonomy,
254
+ ];
255
+
256
$r_defaults = $tsf->robots_meta(
257
+ $query,
258
\The_SEO_Framework\ROBOTS_IGNORE_SETTINGS | \The_SEO_Framework\ROBOTS_IGNORE_PROTECTION
259
);
260
266
'value' => $meta['canonical'],
267
],
268
'noindex' => [
269
+ 'value' => $meta['noindex'],
270
+ 'isSelect' => true,
271
+ 'default' => empty( $r_defaults['noindex'] ) ? 'index' : 'noindex',
272
],
273
'nofollow' => [
274
+ 'value' => $meta['nofollow'],
275
+ 'isSelect' => true,
276
+ 'default' => empty( $r_defaults['nofollow'] ) ? 'follow' : 'nofollow',
277
],
278
'noarchive' => [
279
+ 'value' => $meta['noarchive'],
280
+ 'isSelect' => true,
281
+ 'default' => empty( $r_defaults['noarchive'] ) ? 'archive' : 'noarchive',
282
],
283
'redirect' => [
284
'value' => $meta['redirect'],
285
],
286
];
287
288
+ /**
289
+ * Tip: Prefix the indexes with your (plugin) name to prevent collisions.
290
+ * The index corresponds to field with the ID `autodescription-quick[%s]`, where %s is the index.
291
+ *
292
+ * @since 4.0.5
293
+ * @param array $data The current data : {
294
+ * string Index => @param array : {
295
+ * @param mixed $value The current value.
296
+ * @param bool $isSelect Optional. Whether the field is a select field.
297
+ * @param string $default Optional. Only works when $isSelect is true. The default value to be set in select index 0.
298
+ * }
299
+ * }
300
+ * @param array $query The query data. Contains 'id' and 'taxonomy'.
301
+ */
302
+ $data = \apply_filters_ref_array( 'the_seo_framework_list_table_data', [ $data, $query ] );
303
+
304
$container = sprintf(
305
'<span class=hidden id=%s data-le="%s"></span>',
306
sprintf( 'tsfLeData[%s]', (int) $term_id ),
307
htmlspecialchars( json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_FORCE_OBJECT ), ENT_QUOTES, 'UTF-8' )
308
);
309
310
+ if ( $this->doing_ajax )
311
+ $container .= $this->get_ajax_dispatch_updated_event();
312
+
313
return $string . $container;
314
}
315
}
inc/classes/bridges/listtable.class.php CHANGED
@@ -7,7 +7,7 @@ namespace The_SEO_Framework\Bridges;
7
8
/**
9
* The SEO Framework plugin
10
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
11
*
12
* This program is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License version 3 as published
@@ -246,6 +246,23 @@ abstract class ListTable {
246
// phpcs:enable, WordPress.Security.NonceVerification
247
}
248
249
/**
250
* Add column on edit(-tags).php
251
*
7
8
/**
9
* The SEO Framework plugin
10
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
11
*
12
* This program is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License version 3 as published
246
// phpcs:enable, WordPress.Security.NonceVerification
247
}
248
249
+ /**
250
+ * Returns a JS script that triggers list updates.
251
+ * This is a necessity as WordPress doesn't trigger actions on update.
252
+ *
253
+ * TODO bind to WordPress' function instead? Didn't we already do that?!
254
+ * See: `tsfLe._hijackListeners()`; Although, that doesn't cover "adding" new items.
255
+ *
256
+ * @since 4.0.5
257
+ * @NOTE: Do not bind to `tsfLeDispatchUpdate`, it's a private action.
258
+ * Bind to `tsfLeUpdated` instead, which is debounced and should only run once.
259
+ *
260
+ * @return string The triggering script.
261
+ */
262
+ protected function get_ajax_dispatch_updated_event() {
263
+ return "<script>'use strict';(()=>document.dispatchEvent(new Event('tsfLeDispatchUpdate')))();</script>";
264
+ }
265
+
266
/**
267
* Add column on edit(-tags).php
268
*
inc/classes/bridges/ping.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
inc/classes/bridges/postsettings.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -42,6 +42,8 @@ final class PostSettings {
42
* Registers the meta box for the Post edit screens.
43
*
44
* @since 4.0.0
45
*
46
* @param string $post_type The current Post Type.
47
*/
@@ -84,7 +86,12 @@ final class PostSettings {
84
$title = sprintf( \esc_html__( '%s SEO Settings', 'autodescription' ), $label );
85
}
86
87
- \add_meta_box( 'tsf-inpost-box', $title, __CLASS__ . '::_meta_box', $post_type, $context, $priority, [] );
88
}
89
90
/**
@@ -136,6 +143,24 @@ final class PostSettings {
136
\do_action( 'the_seo_framework_pro_page_inpost_box' );
137
}
138
139
/**
140
* Outputs nonce fields for the post settings.
141
* Redundant, but added for sanity.
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
42
* Registers the meta box for the Post edit screens.
43
*
44
* @since 4.0.0
45
+ * @since 4.0.5 Now registers custom postbox classes.
46
+ * @access private
47
*
48
* @param string $post_type The current Post Type.
49
*/
86
$title = sprintf( \esc_html__( '%s SEO Settings', 'autodescription' ), $label );
87
}
88
89
+ $box_id = 'tsf-inpost-box';
90
+ // Implies `\get_current_screen()->id`. Is always 'post'.
91
+ $screen_id = 'post';
92
+
93
+ \add_meta_box( $box_id, $title, __CLASS__ . '::_meta_box', $post_type, $context, $priority, [] );
94
+ \add_filter( "postbox_classes_{$screen_id}_{$box_id}", __CLASS__ . '::_add_postbox_class' );
95
}
96
97
/**
143
\do_action( 'the_seo_framework_pro_page_inpost_box' );
144
}
145
146
+ /**
147
+ * Adds a Gutenberg/Block-editor box class.
148
+ *
149
+ * @since 4.0.5
150
+ * @access private
151
+ *
152
+ * @param array $classes The registered postbox classes.
153
+ * @return array
154
+ */
155
+ public static function _add_postbox_class( $classes = [] ) {
156
+
157
+ if ( \the_seo_framework()->is_gutenberg_page() ) {
158
+ $classes[] = 'tsf-is-block-editor';
159
+ }
160
+
161
+ return $classes;
162
+ }
163
+
164
/**
165
* Outputs nonce fields for the post settings.
166
* Redundant, but added for sanity.
inc/classes/bridges/scripts.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -404,7 +404,7 @@ final class Scripts {
404
[
405
'id' => 'tsf-settings',
406
'type' => 'js',
407
- 'deps' => [ 'jquery', 'tsf-ays', 'tsf-title', 'tsf-description', 'tsf', 'tsf-tt', 'wp-color-picker' ],
408
'autoload' => true,
409
'name' => 'settings',
410
'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
@@ -425,6 +425,9 @@ final class Scripts {
425
],
426
],
427
],
428
],
429
[
430
'id' => 'tsf-settings',
@@ -923,13 +926,13 @@ final class Scripts {
923
'id' => 'tsf-pt-gb',
924
'name' => 'pt-gb',
925
];
926
- $deps = [ 'jquery', 'tsf', 'tsf-post', 'wp-hooks', 'wp-element', 'wp-components', 'wp-url', 'wp-api-fetch', 'lodash', 'react' ];
927
} else {
928
$vars = [
929
'id' => 'tsf-pt',
930
'name' => 'pt',
931
];
932
- $deps = [ 'jquery', 'tsf', 'tsf-post', 'tsf-tt' ];
933
}
934
935
return [
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
404
[
405
'id' => 'tsf-settings',
406
'type' => 'js',
407
+ 'deps' => [ 'jquery', 'tsf-ays', 'tsf-title', 'tsf-description', 'tsf', 'tsf-tt', 'wp-color-picker', 'wp-util' ],
408
'autoload' => true,
409
'name' => 'settings',
410
'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
425
],
426
],
427
],
428
+ 'tmpl' => [
429
+ 'file' => $tsf->get_view_location( 'templates/settings/settings' ),
430
+ ],
431
],
432
[
433
'id' => 'tsf-settings',
926
'id' => 'tsf-pt-gb',
927
'name' => 'pt-gb',
928
];
929
+ $deps = [ 'jquery', 'tsf', 'tsf-post', 'wp-hooks', 'wp-element', 'wp-components', 'wp-url', 'wp-api-fetch', 'lodash', 'react', 'wp-util' ];
930
} else {
931
$vars = [
932
'id' => 'tsf-pt',
933
'name' => 'pt',
934
];
935
+ $deps = [ 'jquery', 'tsf', 'tsf-post', 'tsf-tt', 'wp-util' ];
936
}
937
938
return [
inc/classes/bridges/seobar.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -124,7 +124,7 @@ final class SeoBar extends ListTable {
124
] );
125
126
if ( $this->doing_ajax )
127
- echo $this->get_seo_bar_ajax_script(); // phpcs:ignore, WordPress.Security.EscapeOutput
128
}
129
130
/**
@@ -148,26 +148,11 @@ final class SeoBar extends ListTable {
148
if ( $this->column_name !== $column_name ) return $string;
149
150
if ( $this->doing_ajax )
151
- $string .= $this->get_seo_bar_ajax_script();
152
153
return \The_SEO_Framework\Interpreters\SeoBar::generate_bar( [
154
'id' => $term_id,
155
'taxonomy' => $this->taxonomy,
156
] ) . $string;
157
}
158
-
159
- /**
160
- * Outputs a JS script that triggers SEO Bar updates.
161
- * This is a necessity as WordPress doesn't trigger actions on update.
162
- *
163
- * TODO bind to WordPress' function instead? Didn't we already do that?!
164
- * See: `tsfLe._hijackListeners()`; Although, that doesn't cover "adding" new items.
165
- *
166
- * @since 4.0.0
167
- *
168
- * @return string The triggering script.
169
- */
170
- private function get_seo_bar_ajax_script() {
171
- return "<script>'use strict';(()=>document.dispatchEvent(new Event('tsfLeUpdated')))();</script>";
172
- }
173
}
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
124
] );
125
126
if ( $this->doing_ajax )
127
+ echo $this->get_ajax_dispatch_updated_event(); // phpcs:ignore, WordPress.Security.EscapeOutput
128
}
129
130
/**
148
if ( $this->column_name !== $column_name ) return $string;
149
150
if ( $this->doing_ajax )
151
+ $string .= $this->get_ajax_dispatch_updated_event();
152
153
return \The_SEO_Framework\Interpreters\SeoBar::generate_bar( [
154
'id' => $term_id,
155
'taxonomy' => $this->taxonomy,
156
] ) . $string;
157
}
158
}
inc/classes/bridges/seosettings.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -51,7 +51,7 @@ final class SeoSettings {
51
* Set any to false if you wish the meta box to be removed.
52
*
53
* @since 2.2.4
54
- * @since 2.8.0: Added `the_seo_framework_general_metabox` filter.
55
*/
56
$general = (bool) \apply_filters( 'the_seo_framework_general_metabox', true );
57
$title = (bool) \apply_filters( 'the_seo_framework_title_metabox', true );
@@ -571,6 +571,17 @@ final class SeoSettings {
571
\the_seo_framework()->get_view( 'admin/metaboxes/social-metabox', [], 'twitter' );
572
}
573
574
/**
575
* Social Metabox PostDates Tab output.
576
*
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
51
* Set any to false if you wish the meta box to be removed.
52
*
53
* @since 2.2.4
54
+ * @since 2.8.0 Added `the_seo_framework_general_metabox` filter.
55
*/
56
$general = (bool) \apply_filters( 'the_seo_framework_general_metabox', true );
57
$title = (bool) \apply_filters( 'the_seo_framework_title_metabox', true );
571
\the_seo_framework()->get_view( 'admin/metaboxes/social-metabox', [], 'twitter' );
572
}
573
574
+ /**
575
+ * Social Metabox oEmbed Tab output.
576
+ *
577
+ * @since 4.0.5
578
+ * @access private
579
+ * @see static::social_metabox() Callback for Social Settings box.
580
+ */
581
+ public static function _social_metabox_oembed_tab() {
582
+ \the_seo_framework()->get_view( 'admin/metaboxes/social-metabox', [], 'oembed' );
583
+ }
584
+
585
/**
586
* Social Metabox PostDates Tab output.
587
*
inc/classes/bridges/sitemap.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
inc/classes/bridges/termsettings.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Bridges;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
inc/classes/builders/images.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -107,9 +107,11 @@ final class Images {
107
* Generates image URLs and IDs from the content.
108
*
109
* @since 4.0.0
110
* @generator
111
- * TODO consider matching these images with wp-content/uploads items via database calls, which is heavy...
112
- * Combine query, instead of using WP API? Only do that for the first image, instead?
113
*
114
* @param array|null $args The query arguments. Accepts 'id' and 'taxonomy'.
115
* Leave null to autodetermine query.
@@ -139,6 +141,15 @@ final class Images {
139
140
// strlen( '<img src=a>' ) === 11; yes, that's a valid self-closing tag with a relative source.
141
if ( strlen( $content ) > 10 && false !== stripos( $content, '<img' ) ) {
142
preg_match_all(
143
'/<img[^>]+src=(\"|\')?([^\"\'>\s]+)\1?.*?>/mi',
144
$content,
@@ -148,12 +159,22 @@ final class Images {
148
}
149
150
if ( $matches ) {
151
foreach ( $matches as $match ) {
152
// Assume every URL to be correct? Yes. WordPress assumes that too.
153
yield [
154
- 'url' => $match[2] ?: '',
155
'id' => 0,
156
];
157
}
158
} else {
159
yield [
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
107
* Generates image URLs and IDs from the content.
108
*
109
* @since 4.0.0
110
+ * @since 4.0.5 1. Now strips tags before looking for images.
111
+ * 2. Now only yields at most 5 images.
112
* @generator
113
+ * @TODO consider matching these images with wp-content/uploads items via database calls, which is heavy...
114
+ * Combine query, instead of using WP API? Only do that for the first image, instead?
115
*
116
* @param array|null $args The query arguments. Accepts 'id' and 'taxonomy'.
117
* Leave null to autodetermine query.
141
142
// strlen( '<img src=a>' ) === 11; yes, that's a valid self-closing tag with a relative source.
143
if ( strlen( $content ) > 10 && false !== stripos( $content, '<img' ) ) {
144
+ $content = $tsf->strip_tags_cs(
145
+ $content,
146
+ [
147
+ 'space' => [],
148
+ 'clear' =>
149
+ [ 'address', 'aside', 'blockquote', 'dd', 'dl', 'dt', 'fieldset', 'figcaption', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'li', 'nav', 'ol', 'pre', 'table', 'tfoot', 'ul', 'bdo', 'br', 'button', 'canvas', 'code', 'hr', 'iframe', 'input', 'label', 'link', 'noscript', 'meta', 'option', 'samp', 'script', 'select', 'style', 'svg', 'textarea', 'var', 'video' ],
150
+ 'strip' => false,
151
+ ]
152
+ );
153
preg_match_all(
154
'/<img[^>]+src=(\"|\')?([^\"\'>\s]+)\1?.*?>/mi',
155
$content,
159
}
160
161
if ( $matches ) {
162
+ $i = 0;
163
foreach ( $matches as $match ) {
164
// Assume every URL to be correct? Yes. WordPress assumes that too.
165
+ $the_match = $match[2] ?: '';
166
+
167
+ // false-esque matches, like '0', are so uncommon it's not worth dealing with them.
168
+ if ( ! $the_match )
169
+ continue;
170
+
171
yield [
172
+ 'url' => $the_match,
173
'id' => 0,
174
];
175
+
176
+ // Get no more than 5 images.
177
+ if ( ++$i > 4 ) break;
178
}
179
} else {
180
yield [
inc/classes/builders/scripts.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2018 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -151,11 +151,12 @@ final class Scripts {
151
* Prints the TSF no-js transform script, using ES2015 (ECMA-262).
152
*
153
* @since 4.0.0
154
* @access private
155
* @internal
156
*/
157
public function _print_tsfjs_script() {
158
- echo "<script>(()=>{document.body.classList.replace('tsf-no-js','tsf-js');const a=0;})()</script>";
159
}
160
161
/**
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2018 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
151
* Prints the TSF no-js transform script, using ES2015 (ECMA-262).
152
*
153
* @since 4.0.0
154
+ * @since 4.0.5 Put the const assignment on front, so it's prone to fail earlier.
155
* @access private
156
* @internal
157
*/
158
public function _print_tsfjs_script() {
159
+ echo "<script>(()=>{const a=0;document.body.classList.replace('tsf-no-js','tsf-js')})()</script>";
160
}
161
162
/**
inc/classes/builders/seobar-page.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -51,6 +51,7 @@ final class SeoBar_Page extends SeoBar {
51
* @abstract
52
*/
53
protected function prime_cache() {
54
static::get_cache( 'general/i18n/inputguidelines' )
55
or static::set_cache(
56
'general/i18n/inputguidelines',
@@ -75,6 +76,7 @@ final class SeoBar_Page extends SeoBar {
75
],
76
]
77
);
78
}
79
80
/**
@@ -124,6 +126,7 @@ final class SeoBar_Page extends SeoBar {
124
* Runs title tests.
125
*
126
* @since 4.0.0
127
*
128
* @return array $item : {
129
* string $symbol : The displayed symbol that identifies your bar.
@@ -148,7 +151,11 @@ final class SeoBar_Page extends SeoBar {
148
],
149
'assess' => [
150
'empty' => \__( 'No title could be fetched.', 'autodescription' ),
151
- 'untitled' => \__( 'No title could be fetched, "Untitled" is used instead.', 'autodescription' ), // TODO use [params][untitled]?
152
'protected' => \__( 'A page protection state is added which increases the length.', 'autodescription' ),
153
'branding' => [
154
'not' => \__( "It's not branded. Search engines may ignore your title.", 'autodescription' ),
@@ -156,11 +163,13 @@ final class SeoBar_Page extends SeoBar {
156
'automatic' => \__( "It's automatically branded.", 'autodescription' ),
157
],
158
'duplicated' => \__( 'The blog name is found multiple times.', 'autodescription' ),
159
],
160
'reason' => [
161
'incomplete' => \__( 'Incomplete.', 'autodescription' ),
162
'duplicated' => \__( 'The branding is duplicated.', 'autodescription' ),
163
'notbranded' => \__( 'Not branded.', 'autodescription' ),
164
],
165
'defaults' => [
166
'generated' => [
@@ -204,6 +213,15 @@ final class SeoBar_Page extends SeoBar {
204
$item['assess']['homepage'] = \__( 'The title inputted at the Edit Page screen is used.', 'autodescription' );
205
}
206
}
207
} else {
208
$item = $cache['defaults']['generated'];
209
@@ -262,6 +280,7 @@ final class SeoBar_Page extends SeoBar {
262
}
263
}
264
265
$brand_count =
266
strlen( $cache['params']['blogname_quoted'] )
267
? preg_match_all(
@@ -270,6 +289,7 @@ final class SeoBar_Page extends SeoBar {
270
$matches
271
)
272
: 0;
273
274
if ( ! $brand_count ) {
275
// Override branding state.
@@ -326,9 +346,10 @@ final class SeoBar_Page extends SeoBar {
326
}
327
328
/**
329
- * Runs title tests.
330
*
331
* @since 4.0.0
332
* @see test_title() for return value.
333
*
334
* @return array $item
@@ -355,11 +376,13 @@ final class SeoBar_Page extends SeoBar {
355
'excerpt' => \__( "It's built using the excerpt field.", 'autodescription' ),
356
/* translators: %s = list of duplicated words */
357
'dupes' => \__( 'Found duplicated words: %s', 'autodescription' ),
358
],
359
'reason' => [
360
'empty' => \__( 'Empty.', 'autodescription' ),
361
'founddupe' => \__( 'Found duplicated words.', 'autodescription' ),
362
'foundmanydupe' => \__( 'Found too many duplicated words.', 'autodescription' ),
363
],
364
'defaults' => [
365
'generated' => [
@@ -412,6 +435,15 @@ final class SeoBar_Page extends SeoBar {
412
$item['assess']['homepage'] = \__( 'The description inputted at the Edit Page screen is used.', 'autodescription' );
413
}
414
}
415
} elseif ( ! static::$tsf->is_auto_description_enabled( $desc_args ) ) {
416
$item = $cache['defaults']['emptynoauto'];
417
@@ -521,7 +553,7 @@ final class SeoBar_Page extends SeoBar {
521
}
522
523
/**
524
- * Runs description tests.
525
*
526
* @since 4.0.0
527
* @see test_title() for return value.
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
51
* @abstract
52
*/
53
protected function prime_cache() {
54
+ // phpcs:disable, PEAR.Functions.FunctionCallSignature.Indent -- False negative.
55
static::get_cache( 'general/i18n/inputguidelines' )
56
or static::set_cache(
57
'general/i18n/inputguidelines',
76
],
77
]
78
);
79
+ // phpcs:enable, PEAR.Functions.FunctionCallSignature.Indent -- False negative.
80
}
81
82
/**
126
* Runs title tests.
127
*
128
* @since 4.0.0
129
+ * @since 4.0.5 Added syntax test.
130
*
131
* @return array $item : {
132
* string $symbol : The displayed symbol that identifies your bar.
151
],
152
'assess' => [
153
'empty' => \__( 'No title could be fetched.', 'autodescription' ),
154
+ 'untitled' => sprintf(
155
+ /* translators: %s = "Untitled" */
156
+ \__( 'No title could be fetched, "%s" is used instead.', 'autodescription' ),
157
+ static::$tsf->get_static_untitled_title()
158
+ ),
159
'protected' => \__( 'A page protection state is added which increases the length.', 'autodescription' ),
160
'branding' => [
161
'not' => \__( "It's not branded. Search engines may ignore your title.", 'autodescription' ),
163
'automatic' => \__( "It's automatically branded.", 'autodescription' ),
164
],
165
'duplicated' => \__( 'The blog name is found multiple times.', 'autodescription' ),
166
+ 'syntax' => \__( "Markup syntax was found that isn't transformed. Consider replacing it with static input.", 'autodescription' ),
167
],
168
'reason' => [
169
'incomplete' => \__( 'Incomplete.', 'autodescription' ),
170
'duplicated' => \__( 'The branding is duplicated.', 'autodescription' ),
171
'notbranded' => \__( 'Not branded.', 'autodescription' ),
172
+ 'syntax' => \__( 'Found markup syntax.', 'autodescription' ),
173
],
174
'defaults' => [
175
'generated' => [
213
$item['assess']['homepage'] = \__( 'The title inputted at the Edit Page screen is used.', 'autodescription' );
214
}
215
}
216
+
217
+ if ( static::$tsf->has_yoast_syntax( $title_part ) ) {
218
+ $item['status'] = \The_SEO_Framework\Interpreters\SeoBar::STATE_BAD;
219
+ $item['reason'] = $cache['reason']['syntax'];
220
+ $item['assess']['syntax'] = $cache['assess']['syntax'];
221
+
222
+ // Further assessments must be made later. Halt assertion here to prevent confusion.
223
+ return $item;
224
+ }
225
} else {
226
$item = $cache['defaults']['generated'];
227
280
}
281
}
282
283
+ // phpcs:disable, PEAR.Functions.FunctionCallSignature.Indent
284
$brand_count =
285
strlen( $cache['params']['blogname_quoted'] )
286
? preg_match_all(
289
$matches
290
)
291
: 0;
292
+ // phpcs:enable, PEAR.Functions.FunctionCallSignature.Indent
293
294
if ( ! $brand_count ) {
295
// Override branding state.
346
}
347
348
/**
349
+ * Runs description tests.
350
*
351
* @since 4.0.0
352
+ * @since 4.0.5 Added syntax test.
353
* @see test_title() for return value.
354
*
355
* @return array $item
376
'excerpt' => \__( "It's built using the excerpt field.", 'autodescription' ),
377
/* translators: %s = list of duplicated words */
378
'dupes' => \__( 'Found duplicated words: %s', 'autodescription' ),
379
+ 'syntax' => \__( "Markup syntax was found that isn't transformed. Consider replacing it with static input.", 'autodescription' ),
380
],
381
'reason' => [
382
'empty' => \__( 'Empty.', 'autodescription' ),
383
'founddupe' => \__( 'Found duplicated words.', 'autodescription' ),
384
'foundmanydupe' => \__( 'Found too many duplicated words.', 'autodescription' ),
385
+ 'syntax' => \__( 'Found markup syntax.', 'autodescription' ),
386
],
387
'defaults' => [
388
'generated' => [
435
$item['assess']['homepage'] = \__( 'The description inputted at the Edit Page screen is used.', 'autodescription' );
436
}
437
}
438
+
439
+ if ( static::$tsf->has_yoast_syntax( $desc ) ) {
440
+ $item['status'] = \The_SEO_Framework\Interpreters\SeoBar::STATE_BAD;
441
+ $item['reason'] = $cache['reason']['syntax'];
442
+ $item['assess']['syntax'] = $cache['assess']['syntax'];
443
+
444
+ // Further assessments must be made later. Halt assertion here to prevent confusion.
445
+ return $item;
446
+ }
447
} elseif ( ! static::$tsf->is_auto_description_enabled( $desc_args ) ) {
448
$item = $cache['defaults']['emptynoauto'];
449
553
}
554
555
/**
556
+ * Runs indexing tests.
557
*
558
* @since 4.0.0
559
* @see test_title() for return value.
inc/classes/builders/seobar-term.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -51,6 +51,7 @@ final class SeoBar_Term extends SeoBar {
51
* @abstract
52
*/
53
protected function prime_cache() {
54
static::get_cache( 'general/i18n/inputguidelines' )
55
or static::set_cache(
56
'general/i18n/inputguidelines',
@@ -85,6 +86,7 @@ final class SeoBar_Term extends SeoBar {
85
],
86
]
87
);
88
}
89
90
/**
@@ -137,6 +139,9 @@ final class SeoBar_Term extends SeoBar {
137
* Runs title tests.
138
*
139
* @since 4.0.0
140
*
141
* @return array $item : {
142
* string $symbol : The displayed symbol that identifies your bar.
@@ -155,14 +160,17 @@ final class SeoBar_Term extends SeoBar {
155
'params' => [
156
'untitled' => static::$tsf->get_static_untitled_title(),
157
'blogname_quoted' => preg_quote( static::$tsf->get_blogname(), '/' ),
158
- 'prefixed' => static::$tsf->use_generated_archive_prefix(),
159
/* translators: 1 = An assessment, 2 = Disclaimer, e.g. "take it with a grain of salt" */
160
'disclaim' => \__( '%1$s (%2$s)', 'autodescription' ),
161
'estimated' => \__( 'Estimated from the number of characters found. The pixel counter asserts the true length.', 'autodescription' ),
162
],
163
'assess' => [
164
'empty' => \__( 'No title could be fetched.', 'autodescription' ),
165
- 'untitled' => \__( 'No title could be fetched, "Untitled" is used instead.', 'autodescription' ), // TODO use [params][untitled]?
166
'prefixed' => \__( 'A term label prefix is automatically added which increases the length.', 'autodescription' ),
167
'branding' => [
168
'not' => \__( "It's not branded. Search engines may ignore your title.", 'autodescription' ),
@@ -170,11 +178,13 @@ final class SeoBar_Term extends SeoBar {
170
'automatic' => \__( "It's automatically branded.", 'autodescription' ),
171
],
172
'duplicated' => \__( 'The blog name is found multiple times.', 'autodescription' ),
173
],
174
'reason' => [
175
'incomplete' => \__( 'Incomplete.', 'autodescription' ),
176
'duplicated' => \__( 'The branding is duplicated.', 'autodescription' ),
177
'notbranded' => \__( 'Not branded.', 'autodescription' ),
178
],
179
'defaults' => [
180
'generated' => [
@@ -210,11 +220,19 @@ final class SeoBar_Term extends SeoBar {
210
211
if ( strlen( $title_part ) ) {
212
$item = $cache['defaults']['custom'];
213
} else {
214
$item = $cache['defaults']['generated'];
215
216
- // Move this to defaults cache? It'll make the code unreadable, though...
217
- if ( $cache['params']['prefixed'] ) {
218
$item['assess']['prefixed'] = $cache['assess']['prefixed'];
219
}
220
@@ -253,6 +271,7 @@ final class SeoBar_Term extends SeoBar {
253
$item['assess']['branding'] = $cache['assess']['branding']['manual'];
254
}
255
256
$brand_count =
257
strlen( $cache['params']['blogname_quoted'] )
258
? preg_match_all(
@@ -261,6 +280,7 @@ final class SeoBar_Term extends SeoBar {
261
$matches
262
)
263
: 0;
264
265
if ( ! $brand_count ) {
266
// Override branding state.
@@ -317,9 +337,10 @@ final class SeoBar_Term extends SeoBar {
317
}
318
319
/**
320
- * Runs title tests.
321
*
322
* @since 4.0.0
323
* @see test_title() for return value.
324
*
325
* @return array $item
@@ -340,14 +361,16 @@ final class SeoBar_Term extends SeoBar {
340
'dupe_short' => (int) \apply_filters( 'the_seo_framework_bother_me_desc_length', 3 ),
341
],
342
'assess' => [
343
- 'empty' => \__( 'No description could be generated.', 'autodescription' ),
344
/* translators: %s = list of duplicated words */
345
- 'dupes' => \__( 'Found duplicated words: %s', 'autodescription' ),
346
],
347
'reason' => [
348
'empty' => \__( 'Empty.', 'autodescription' ),
349
'founddupe' => \__( 'Found duplicated words.', 'autodescription' ),
350
'foundmanydupe' => \__( 'Found too many duplicated words.', 'autodescription' ),
351
],
352
'defaults' => [
353
'generated' => [
@@ -392,6 +415,15 @@ final class SeoBar_Term extends SeoBar {
392
393
if ( strlen( $desc ) ) {
394
$item = $cache['defaults']['custom'];
395
} elseif ( ! static::$tsf->is_auto_description_enabled( $desc_args ) ) {
396
$item = $cache['defaults']['emptynoauto'];
397
@@ -491,7 +523,7 @@ final class SeoBar_Term extends SeoBar {
491
}
492
493
/**
494
- * Runs description tests.
495
*
496
* @since 4.0.0
497
* @see test_title() for return value.
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
51
* @abstract
52
*/
53
protected function prime_cache() {
54
+ // phpcs:disable, PEAR.Functions.FunctionCallSignature.Indent -- False negative.
55
static::get_cache( 'general/i18n/inputguidelines' )
56
or static::set_cache(
57
'general/i18n/inputguidelines',
86
],
87
]
88
);
89
+ // phpcs:enable, PEAR.Functions.FunctionCallSignature.Indent
90
}
91
92
/**
139
* Runs title tests.
140
*
141
* @since 4.0.0
142
+ * @since 4.0.5 1. Removed `['params']['prefixed'] from cache.
143
+ * 2. Now tests for term title prefix per state.
144
+ * 3. Added syntax test.
145
*
146
* @return array $item : {
147
* string $symbol : The displayed symbol that identifies your bar.
160
'params' => [
161
'untitled' => static::$tsf->get_static_untitled_title(),
162
'blogname_quoted' => preg_quote( static::$tsf->get_blogname(), '/' ),
163
/* translators: 1 = An assessment, 2 = Disclaimer, e.g. "take it with a grain of salt" */
164
'disclaim' => \__( '%1$s (%2$s)', 'autodescription' ),
165
'estimated' => \__( 'Estimated from the number of characters found. The pixel counter asserts the true length.', 'autodescription' ),
166
],
167
'assess' => [
168
'empty' => \__( 'No title could be fetched.', 'autodescription' ),
169
+ 'untitled' => sprintf(
170
+ /* translators: %s = "Untitled" */
171
+ \__( 'No title could be fetched, "%s" is used instead.', 'autodescription' ),
172
+ static::$tsf->get_static_untitled_title()
173
+ ),
174
'prefixed' => \__( 'A term label prefix is automatically added which increases the length.', 'autodescription' ),
175
'branding' => [
176
'not' => \__( "It's not branded. Search engines may ignore your title.", 'autodescription' ),
178
'automatic' => \__( "It's automatically branded.", 'autodescription' ),
179
],
180
'duplicated' => \__( 'The blog name is found multiple times.', 'autodescription' ),
181
+ 'syntax' => \__( "Markup syntax was found that isn't transformed. Consider replacing it with static input.", 'autodescription' ),
182
],
183
'reason' => [
184
'incomplete' => \__( 'Incomplete.', 'autodescription' ),
185
'duplicated' => \__( 'The branding is duplicated.', 'autodescription' ),
186
'notbranded' => \__( 'Not branded.', 'autodescription' ),
187
+ 'syntax' => \__( 'Found markup syntax.', 'autodescription' ),
188
],
189
'defaults' => [
190
'generated' => [
220
221
if ( strlen( $title_part ) ) {
222
$item = $cache['defaults']['custom'];
223
+
224
+ if ( static::$tsf->has_yoast_syntax( $title_part, false ) ) {
225
+ $item['status'] = \The_SEO_Framework\Interpreters\SeoBar::STATE_BAD;
226
+ $item['reason'] = $cache['reason']['syntax'];
227
+ $item['assess']['syntax'] = $cache['assess']['syntax'];
228
+
229
+ // Further assessments must be made later. Halt assertion here to prevent confusion.
230
+ return $item;
231
+ }
232
} else {
233
$item = $cache['defaults']['generated'];
234
235
+ if ( static::$tsf->use_generated_archive_prefix( $this->query_cache['term'] ) ) {
236
$item['assess']['prefixed'] = $cache['assess']['prefixed'];
237
}
238
271
$item['assess']['branding'] = $cache['assess']['branding']['manual'];
272
}
273
274
+ // phpcs:disable, PEAR.Functions.FunctionCallSignature.Indent
275
$brand_count =
276
strlen( $cache['params']['blogname_quoted'] )
277
? preg_match_all(
280
$matches
281
)
282
: 0;
283
+ // phpcs:enable, PEAR.Functions.FunctionCallSignature.Indent
284
285
if ( ! $brand_count ) {
286
// Override branding state.
337
}
338
339
/**
340
+ * Runs description tests.
341
*
342
* @since 4.0.0
343
+ * @since 4.0.5 Added syntax test.
344
* @see test_title() for return value.
345
*
346
* @return array $item
361
'dupe_short' => (int) \apply_filters( 'the_seo_framework_bother_me_desc_length', 3 ),
362
],
363
'assess' => [
364
+ 'empty' => \__( 'No description could be generated.', 'autodescription' ),
365
/* translators: %s = list of duplicated words */
366
+ 'dupes' => \__( 'Found duplicated words: %s', 'autodescription' ),
367
+ 'syntax' => \__( "Markup syntax was found that isn't transformed. Consider replacing it with static input.", 'autodescription' ),
368
],
369
'reason' => [
370
'empty' => \__( 'Empty.', 'autodescription' ),
371
'founddupe' => \__( 'Found duplicated words.', 'autodescription' ),
372
'foundmanydupe' => \__( 'Found too many duplicated words.', 'autodescription' ),
373
+ 'syntax' => \__( 'Found markup syntax.', 'autodescription' ),
374
],
375
'defaults' => [
376
'generated' => [
415
416
if ( strlen( $desc ) ) {
417
$item = $cache['defaults']['custom'];
418
+
419
+ if ( static::$tsf->has_yoast_syntax( $desc ) ) {
420
+ $item['status'] = \The_SEO_Framework\Interpreters\SeoBar::STATE_BAD;
421
+ $item['reason'] = $cache['reason']['syntax'];
422
+ $item['assess']['syntax'] = $cache['assess']['syntax'];
423
+
424
+ // Further assessments must be made later. Halt assertion here to prevent confusion.
425
+ return $item;
426
+ }
427
} elseif ( ! static::$tsf->is_auto_description_enabled( $desc_args ) ) {
428
$item = $cache['defaults']['emptynoauto'];
429
523
}
524
525
/**
526
+ * Runs indexing tests.
527
*
528
* @since 4.0.0
529
* @see test_title() for return value.
inc/classes/builders/seobar.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
inc/classes/builders/sitemap-base.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
@@ -418,8 +418,8 @@ class Sitemap_Base extends Sitemap {
418
* Retrieves additional URLs and builds items from them.
419
*
420
* @since 4.0.0
421
- * @since 4.0.1: 1. Converted to generator and iterator. Therefore, renamed function.
422
- * 2. Now actually does something.
423
* @generator
424
* @iterator
425
*
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
418
* Retrieves additional URLs and builds items from them.
419
*
420
* @since 4.0.0
421
+ * @since 4.0.1 : 1. Converted to generator and iterator. Therefore, renamed function.
422
+ * 2. Now actually does something.
423
* @generator
424
* @iterator
425
*
inc/classes/builders/sitemap.class.php CHANGED
@@ -8,7 +8,7 @@ namespace The_SEO_Framework\Builders;
8
9
/**
10
* The SEO Framework plugin
11
- * Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
8
9
/**
10
* The SEO Framework plugin
11
+ * Copyright (C) 2019 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License version 3 as published
inc/classes/cache.class.php CHANGED
@@ -10,7 +10,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
10
11
/**
12
* The SEO Framework plugin
13
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
@@ -200,6 +200,7 @@ class Cache extends Site_Options {
200
* @since 2.8.0
201
* @since 2.9.3 $type = 'front' now also returns true.
202
* @since 3.1.0 Added action.
203
*
204
* @param string $type The type
205
* @param int $id The post, page or TT ID. Defaults to $this->get_the_real_ID().
@@ -217,7 +218,6 @@ class Cache extends Site_Options {
217
$front_id = $this->get_the_front_page_ID();
218
219
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $front_id, '', 'frontpage' ) );
220
- $this->delete_ld_json_transient( $front_id, '', 'frontpage' );
221
$success = true;
222
break;
223
@@ -238,7 +238,6 @@ class Cache extends Site_Options {
238
}
239
240
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, '', $post_type ) );
241
- $this->delete_ld_json_transient( $id, '', $post_type );
242
$success = true;
243
}
244
break;
@@ -246,13 +245,11 @@ class Cache extends Site_Options {
246
//* Careful, this can only run on archive pages. For now.
247
case 'term':
248
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, $args['term'], 'term' ) );
249
- $this->delete_ld_json_transient( $id, $args['term'], 'term' );
250
$success = true;
251
break;
252
253
case 'author':
254
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, 'author', 'author' ) );
255
- $this->delete_ld_json_transient( $id, 'author', 'author' );
256
$success = true;
257
break;
258
@@ -412,7 +409,7 @@ class Cache extends Site_Options {
412
*
413
* @param string $key The Object cache key.
414
* @param string $group The Object cache group.
415
- * @return mixed wp_cache_delete if object caching is allowed. False otherwise.
416
*/
417
public function object_cache_delete( $key, $group = 'the_seo_framework' ) {
418
@@ -448,35 +445,6 @@ class Cache extends Site_Options {
448
return $this->get_option( 'cache_sitemap' ) ? $this->add_cache_key_suffix( 'tsf_sitemap_' . $sitemap_revision ) : '';
449
}
450
451
- /**
452
- * Returns ld_json transients for page ID.
453
- *
454
- * @since 3.1.0
455
- * @since 3.1.1 : The first parameter is now optional.
456
- *
457
- * @param int|string|bool $id The Taxonomy or Post ID. If false it will generate for the blog page.
458
- * @param string $taxonomy The taxonomy name.
459
- * @param string|null $type The post type.
460
- * @return string The ld_json cache key.
461
- */
462
- public function get_ld_json_transient_name( $id = 0, $taxonomy = '', $type = null ) {
463
-
464
- if ( ! $this->get_option( 'cache_meta_schema' ) )
465
- return '';
466
-
467
- $cache_key = $this->generate_cache_key( $id, $taxonomy, $type );
468
-
469
- $revision = '7';
470
-
471
- /**
472
- * Change key based on options.
473
- */
474
- $options = $this->enable_ld_json_breadcrumbs() ? '1' : '0';
475
- $options .= $this->enable_ld_json_searchbox() ? '1' : '0';
476
-
477
- return 'tsf_' . $revision . '_' . $options . '_ldjs_' . $cache_key;
478
- }
479
-
480
/**
481
* Generate transient key based on query vars or input variables.
482
*
@@ -577,7 +545,7 @@ class Cache extends Site_Options {
577
578
//* Temporarily disable caches to prevent database spam.
579
$this->the_seo_framework_use_transients = false;
580
- $this->use_object_cache = false;
581
582
$the_id = 'unix_' . $unix;
583
}
@@ -679,34 +647,24 @@ class Cache extends Site_Options {
679
switch ( $type ) :
680
case 'author':
681
return $this->add_cache_key_suffix( 'author_' . $page_id );
682
- break;
683
case 'frontpage':
684
return $this->add_cache_key_suffix( $this->generate_front_page_cache_key() );
685
- break;
686
case 'page':
687
return $this->add_cache_key_suffix( 'page_' . $page_id );
688
- break;
689
case 'post':
690
return $this->add_cache_key_suffix( 'post_' . $page_id );
691
- break;
692
case 'attachment':
693
return $this->add_cache_key_suffix( 'attach_' . $page_id );
694
- break;
695
case 'singular':
696
return $this->add_cache_key_suffix( 'singular_' . $page_id );
697
- break;
698
case 'term':
699
return $this->add_cache_key_suffix( $this->generate_taxonomical_cache_key( $page_id, $taxonomy ) );
700
- break;
701
case 'ping':
702
return $this->add_cache_key_suffix( 'tsf_throttle_ping' );
703
default:
704
$this->_doing_it_wrong( __METHOD__, 'Third parameter must be a known type.', '2.6.5' );
705
return $this->add_cache_key_suffix( \esc_sql( $type . '_' . $page_id . '_' . $taxonomy ) );
706
- break;
707
endswitch;
708
-
709
- return false;
710
}
711
712
/**
@@ -896,29 +854,6 @@ class Cache extends Site_Options {
896
return $run = true;
897
}
898
899
- /**
900
- * Deletes transient for the LD+Json scripts on requests.
901
- *
902
- * @since 2.4.2
903
- * @since 2.8.0 Now listens to option 'cache_meta_schema' before deleting transient.
904
- * @since 2.9.1 Now no longer sets object property $this->ld_json_transient.
905
- * @since 2.9.4 Removed cache.
906
- *
907
- * @param mixed $page_id The page ID or identifier.
908
- * @param string $taxonomy The tt name.
909
- * @param string|null $type The post type.
910
- * @return bool true
911
- */
912
- public function delete_ld_json_transient( $page_id, $taxonomy = '', $type = null ) {
913
-
914
- if ( $this->get_option( 'cache_meta_schema' ) ) {
915
- $transient = $this->get_ld_json_transient_name( $page_id, $taxonomy, $type );
916
- $transient and \delete_transient( $transient );
917
- }
918
-
919
- return true;
920
- }
921
-
922
/**
923
* Builds and returns the excluded post IDs transient.
924
* The transients are autoloaded, as no expiration is set.
10
11
/**
12
* The SEO Framework plugin
13
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
200
* @since 2.8.0
201
* @since 2.9.3 $type = 'front' now also returns true.
202
* @since 3.1.0 Added action.
203
+ * @since 4.0.5 Removed all JSON-LD transient clear calls.
204
*
205
* @param string $type The type
206
* @param int $id The post, page or TT ID. Defaults to $this->get_the_real_ID().
218
$front_id = $this->get_the_front_page_ID();
219
220
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $front_id, '', 'frontpage' ) );
221
$success = true;
222
break;
223
238
}
239
240
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, '', $post_type ) );
241
$success = true;
242
}
243
break;
245
//* Careful, this can only run on archive pages. For now.
246
case 'term':
247
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, $args['term'], 'term' ) );
248
$success = true;
249
break;
250
251
case 'author':
252
$this->object_cache_delete( $this->get_meta_output_cache_key_by_type( $id, 'author', 'author' ) );
253
$success = true;
254
break;
255
409
*
410
* @param string $key The Object cache key.
411
* @param string $group The Object cache group.
412
+ * @return mixed `wp_cache_delete()` if object caching is allowed. False otherwise.
413
*/
414
public function object_cache_delete( $key, $group = 'the_seo_framework' ) {
415
445
return $this->get_option( 'cache_sitemap' ) ? $this->add_cache_key_suffix( 'tsf_sitemap_' . $sitemap_revision ) : '';
446
}
447
448
/**
449
* Generate transient key based on query vars or input variables.
450
*
545
546
//* Temporarily disable caches to prevent database spam.
547
$this->the_seo_framework_use_transients = false;
548
+ $this->use_object_cache = false;
549
550
$the_id = 'unix_' . $unix;
551
}
647
switch ( $type ) :
648
case 'author':
649
return $this->add_cache_key_suffix( 'author_' . $page_id );
650
case 'frontpage':
651
return $this->add_cache_key_suffix( $this->generate_front_page_cache_key() );
652
case 'page':
653
return $this->add_cache_key_suffix( 'page_' . $page_id );
654
case 'post':
655
return $this->add_cache_key_suffix( 'post_' . $page_id );
656
case 'attachment':
657
return $this->add_cache_key_suffix( 'attach_' . $page_id );
658
case 'singular':
659
return $this->add_cache_key_suffix( 'singular_' . $page_id );
660
case 'term':
661
return $this->add_cache_key_suffix( $this->generate_taxonomical_cache_key( $page_id, $taxonomy ) );
662
case 'ping':
663
return $this->add_cache_key_suffix( 'tsf_throttle_ping' );
664
default:
665
$this->_doing_it_wrong( __METHOD__, 'Third parameter must be a known type.', '2.6.5' );
666
return $this->add_cache_key_suffix( \esc_sql( $type . '_' . $page_id . '_' . $taxonomy ) );
667
endswitch;
668
}
669
670
/**
854
return $run = true;
855
}
856
857
/**
858
* Builds and returns the excluded post IDs transient.
859
* The transients are autoloaded, as no expiration is set.
inc/classes/core.class.php CHANGED
@@ -10,7 +10,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
10
11
/**
12
* The SEO Framework plugin
13
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
@@ -213,15 +213,17 @@ class Core {
213
*/
214
public function _add_plugin_action_links( $links = [] ) {
215
216
- if ( $this->load_options )
217
$tsf_links['settings'] = sprintf(
218
'<a href="%s">%s</a>',
219
\esc_url( \admin_url( 'admin.php?page=' . $this->seo_settings_page_slug ) ),
220
\esc_html__( 'Settings', 'autodescription' )
221
);
222
223
$tsf_links['about'] = sprintf(
224
- '<a href="https://theseoframework.com/about-us/" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
225
\esc_html_x( 'About', 'About us', 'autodescription' )
226
);
227
$tsf_links['tsfem'] = sprintf(
@@ -256,25 +258,32 @@ class Core {
256
return array_merge(
257
$plugin_meta,
258
[
259
- 'docs' => vsprintf(
260
'<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
261
[
262
'https://tsf.fyi/docs',
263
\esc_html__( 'View documentation', 'autodescription' ),
264
]
265
),
266
- 'API' => vsprintf(
267
'<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
268
[
269
'https://tsf.fyi/docs/api',
270
\esc_html__( 'View API docs', 'autodescription' ),
271
]
272
),
273
- 'EM' => vsprintf(
274
'<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
275
[
276
'https://tsf.fyi/extension-manager',
277
- $_get_em ? \esc_html_x( 'Get the Extension Manager', 'Extension Manager is a product name; do not translate it.', 'autodescription' ) : 'Extension Manager',
278
]
279
),
280
]
@@ -345,6 +354,7 @@ class Core {
345
* Checks if blog is public through WordPress core settings.
346
*
347
* @since 2.6.0
348
* @staticvar bool $cache
349
*
350
* @return bool True is blog is public.
@@ -353,13 +363,7 @@ class Core {
353
354
static $cache = null;
355
356
- if ( isset( $cache ) )
357
- return $cache;
358
-
359
- if ( '1' === \get_option( 'blog_public' ) )
360
- return $cache = true;
361
-
362
- return $cache = false;
363
}
364
365
/**
@@ -497,20 +501,19 @@ class Core {
497
498
static $old_tz = null;
499
500
- // phpcs:ignore, WordPress.WP.TimezoneChange
501
$old_tz = $old_tz ?: date_default_timezone_get() ?: 'UTC';
502
503
if ( $reset ) {
504
$_revert_tz = $old_tz;
505
$old_tz = null;
506
- // phpcs:ignore, WordPress.WP.TimezoneChange
507
return date_default_timezone_set( $_revert_tz );
508
}
509
510
if ( empty( $tzstring ) )
511
$tzstring = $this->get_timezone_string( true ) ?: $old_tz;
512
513
- // phpcs:ignore, WordPress.WP.TimezoneChange
514
return date_default_timezone_set( $tzstring );
515
}
516
@@ -674,7 +677,7 @@ class Core {
674
* @since 2.8.0
675
* @since 2.9.0 Now adds a little more relative softness based on rel_lum.
676
* @since 2.9.2 (Typo): Renamed from 'get_relatitve_fontcolor' to 'get_relative_fontcolor'.
677
- * @since 3.0.4 : Now uses WCAG's relative luminance formula
678
* @link https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast
679
* @link https://www.w3.org/WAI/GL/wiki/Relative_luminance
680
*
@@ -740,6 +743,7 @@ class Core {
740
* Returns sitemap color scheme.
741
*
742
* @since 2.8.0
743
*
744
* @param bool $get_defaults Whether to get the default colors.
745
* @return array The sitemap colors.
@@ -748,8 +752,8 @@ class Core {
748
749
if ( $get_defaults ) {
750
$colors = [
751
- 'main' => '#333',
752
- 'accent' => '#00cd98',
753
];
754
} else {
755
$main = $this->s_color_hex( $this->get_option( 'sitemap_color_main' ) );
10
11
/**
12
* The SEO Framework plugin
13
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
14
*
15
* This program is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License version 3 as published
213
*/
214
public function _add_plugin_action_links( $links = [] ) {
215
216
+ if ( $this->load_options ) {
217
$tsf_links['settings'] = sprintf(
218
'<a href="%s">%s</a>',
219
\esc_url( \admin_url( 'admin.php?page=' . $this->seo_settings_page_slug ) ),
220
\esc_html__( 'Settings', 'autodescription' )
221
);
222
+ }
223
224
$tsf_links['about'] = sprintf(
225
+ '<a href="%s" rel="noreferrer noopener" target="_blank">%s</a>',
226
+ 'https://theseoframework.com/about-us/',
227
\esc_html_x( 'About', 'About us', 'autodescription' )
228
);
229
$tsf_links['tsfem'] = sprintf(
258
return array_merge(
259
$plugin_meta,
260
[
261
+ 'support' => vsprintf(
262
+ '<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
263
+ [
264
+ 'https://tsf.fyi/support',
265
+ \esc_html__( 'Get support', 'autodescription' ),
266
+ ]
267
+ ),
268
+ 'docs' => vsprintf(
269
'<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
270
[
271
'https://tsf.fyi/docs',
272
\esc_html__( 'View documentation', 'autodescription' ),
273
]
274
),
275
+ 'API' => vsprintf(
276
'<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
277
[
278
'https://tsf.fyi/docs/api',
279
\esc_html__( 'View API docs', 'autodescription' ),
280
]
281
),
282
+ 'EM' => vsprintf(
283
'<a href="%s" rel="noreferrer noopener nofollow" target="_blank">%s</a>',
284
[
285
'https://tsf.fyi/extension-manager',
286
+ $_get_em ? \esc_html_x( 'Get Extension Manager', 'Extension Manager is a product name; do not translate it.', 'autodescription' ) : 'Extension Manager',
287
]
288
),
289
]
354
* Checks if blog is public through WordPress core settings.
355
*
356
* @since 2.6.0
357
+ * @since 4.0.5 Can now test for non-sanitized 'blog_public' option states.
358
* @staticvar bool $cache
359
*
360
* @return bool True is blog is public.
363
364
static $cache = null;
365
366
+ return isset( $cache ) ? $cache : $cache = (bool) \get_option( 'blog_public' );
367
}
368
369
/**
501
502
static $old_tz = null;
503
504
$old_tz = $old_tz ?: date_default_timezone_get() ?: 'UTC';
505
506
if ( $reset ) {
507
$_revert_tz = $old_tz;
508
$old_tz = null;
509
+ // phpcs:ignore, WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
510
return date_default_timezone_set( $_revert_tz );
511
}
512
513
if ( empty( $tzstring ) )
514
$tzstring = $this->get_timezone_string( true ) ?: $old_tz;
515
516
+ // phpcs:ignore, WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
517
return date_default_timezone_set( $tzstring );
518
}
519
677
* @since 2.8.0
678
* @since 2.9.0 Now adds a little more relative softness based on rel_lum.
679
* @since 2.9.2 (Typo): Renamed from 'get_relatitve_fontcolor' to 'get_relative_fontcolor'.
680
+ * @since 3.0.4 Now uses WCAG's relative luminance formula
681
* @link https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast
682
* @link https://www.w3.org/WAI/GL/wiki/Relative_luminance
683
*
743
* Returns sitemap color scheme.
744
*
745
* @since 2.8.0
746
+ * @since 4.0.5 Changed default colors to be more in line with WordPress.
747
*
748
* @param bool $get_defaults Whether to get the default colors.
749
* @return array The sitemap colors.
752
753
if ( $get_defaults ) {
754
$colors = [
755
+ 'main' => '#222222',
756
+ 'accent' => '#00a0d2',
757
];
758
} else {
759
$main = $this->s_color_hex( $this->get_option( 'sitemap_color_main' ) );
inc/classes/debug.class.php CHANGED
@@ -12,7 +12,7 @@ defined( 'THE_SEO_FRAMEWORK_PRESENT' ) or die;
12
13
/**
14
* The SEO Framework plugin
15
- * Copyright (C) 2015 - 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
16
*
17
* This program is free software: you can redistribute it and/or modify
18
* it under the terms of the GNU General Public License version 3 as published
@@ -493,6 +493,7 @@ final class Debug {
493
* This won't consider hiding the output.
494
*
495
* @since 2.6.5
496
*
497
* @return string Wrapped SEO meta tags output.
498
*/
@@ -509,34 +510,7 @@ final class Debug {
509
//* Start timer.
510
$this->timer( true );
511
512
- $output = $tsf->robots()
513
- . $tsf->the_description()
514
- . $tsf->og_image()
515
- . $tsf->og_locale()
516
- . $tsf->og_type()
517
- . $tsf->og_title()
518
- . $tsf->og_description()
519
- . $tsf->og_url()
520
- . $tsf->og_sitename()
521
- . $tsf->facebook_publisher()
522
- . $tsf->facebook_author()
523
- . $tsf->facebook_app_id()
524
- . $tsf->article_published_time()
525
- . $tsf->article_modified_time()
526
- . $tsf->twitter_card()
527
- . $tsf->twitter_site()
528
- . $tsf->twitter_creator()
529
- . $tsf->twitter_title()
530
- . $tsf->twitter_description()
531
- . $tsf->twitter_image()
532
- . $tsf->shortlink()
533
- . $tsf->canonical()
534
- . $tsf->paged_urls()
535
- . $tsf->ld_json()
536
- . $tsf->google_site_output()
537
- . $tsf->bing_site_output()
538
- . $tsf->yandex_site_output()
539
- . $tsf->pint_site_output();
540
541
$timer = '<div style="display:inline-block;width:100%;padding:20px;border-bottom:1px solid #ccc;">Generated in: ' . number_format( $this->timer(), 5 ) . ' seconds</div>';
542
@@ -620,45 +594,57 @@ final class Debug {
620
621
$tsf = \the_seo_framework();
622
623
//* Only get true/false values.
624
- $page_id = $tsf->get_the_real_ID();
625
- $is_404 = $tsf->is_404();
626
- $is_admin = $tsf->is_admin();
627
- $is_attachment = $tsf->is_attachment();
628
- $is_archive = $tsf->is_archive();
629
- $is_term_edit = $tsf->is_term_edit();
630
- $is_post_edit = $tsf->is_post_edit();
631
- $is_wp_lists_edit = $tsf->is_wp_lists_edit();
632
- $is_author = $tsf->is_author();
633
- $is_blog_page = $tsf->is_blog_page();
634
- $is_category = $tsf->is_category();
635
- $is_date = $tsf->is_date();
636
- $is_year = $tsf->is_year();
637
- $is_month = $tsf->is_month();
638
- $is_day = $tsf->is_day();
639
- $is_feed = $tsf->is_feed();
640
- $is_real_front_page = $tsf->is_real_front_page();
641
- $is_front_page_by_id = $tsf->is_front_page_by_id( $tsf->get_the_real_ID() );
642
- $is_home = $tsf->is_home();
643
- $is_page = $tsf->is_page();
644
- $page = $tsf->page();
645
- $paged = $tsf->paged();
646
- $is_preview = $tsf->is_preview();
647
- $is_customize_preview = $tsf->is_customize_preview();
648
- $is_search = $tsf->is_search();
649
- $is_single = $tsf->is_single();
650
- $is_singular = $tsf->is_singular();
651
- $is_static_frontpage = $tsf->is_static_frontpage();
652
- $is_tag = $tsf->is_tag();
653
- $is_tax = $tsf->is_tax();
654
- $is_wc_shop = $tsf->is_wc_shop();
655
- $is_wc_product = $tsf->is_wc_product();
656
- $is_seo_settings_page = $tsf->is_seo_settings_page( true );
657
- $numpages = $tsf->numpages();
658
- $is_multipage = $tsf->is_multipage();
659
- $is_singular_archive = $tsf->is_singular_archive();
660
- $is_term_meta_capable = $tsf->is_term_meta_capable();
661
- $is_post_type_archive = \is_post_type_archive();
662
663
//* Don't debug the class object.
664
unset( $tsf );
12
13
/**
14
* The SEO Framework plugin
15
+ * Copyright (C) 2015 - 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
16
*
17
* This program is free software: you can redistribute it and/or modify
18
* it under the terms of the GNU General Public License version 3 as published
493
* This won't consider hiding the output.
494
*
495
* @since 2.6.5
496
+ * @since 4.0.5 Now obtains the real rendered HTML output, instead of estimated.
497
*
498
* @return string Wrapped SEO meta tags output.
499
*/
510
//* Start timer.
511
$this->timer( true );
512
513
+ $output = $tsf->get_html_output();
514
515
$timer = '<div style="display:inline-block;width:100%;padding:20px;border-bottom:1px solid #ccc;">Generated in: ' . number_format( $this->timer(), 5 ) . ' seconds</div>';
516
594
595
$tsf = \the_seo_framework();
596
597
+ // phpcs:disable, WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase -- Not this file's issue.
598
//* Only get true/false values.
599
+ $page_id = $tsf->get_the_real_ID();
600
+ $is_query_exploited = $tsf->is_query_exploited();
601
+ $query_supports_seo = $tsf->query_supports_seo() ? 'yes' : 'no';
602
+ $is_404 = $tsf->is_404();
603
+ $is_admin = $tsf->is_admin();
604
+ $is_attachment = $tsf->is_attachment();
605
+ $is_archive = $tsf->is_archive();
606
+ $is_term_edit = $tsf->is_term_edit();
607
+ $is_post_edit = $tsf->is_post_edit();
608
+ $is_wp_lists_edit = $tsf->is_wp_lists_edit();
609
+ $is_author = $tsf->is_author();
610
+ $is_blog_page = $tsf->is_blog_page();
611
+ $is_category = $tsf->is_category();
612
+ $is_date = $tsf->is_date();
613
+ $is_year = $tsf->is_year();
614
+ $is_month = $tsf->is_month();
615
+ $is_day = $tsf->is_day();
616
+ $is_feed = $tsf->is_feed();
617
+ $is_real_front_page = $tsf->is_real_front_page();
618
+ $is_front_page_by_id = $tsf->is_front_page_by_id( $page_id );
619
+ $is_home = $tsf->is_home();
620
+ $is_page = $tsf->is_page();
621
+ $page = $tsf->page();
622
+ $paged = $tsf->paged();
623
+ $is_preview = $tsf->is_preview();
624
+ $is_customize_preview = $tsf->is_customize_preview();
625
+ $is_search = $tsf->is_search();
626
+ $is_single = $tsf->is_single();
627
+ $is_singular = $tsf->is_singular();
628
+ $is_static_frontpage = $tsf->is_static_frontpage();
629
+ $is_tag = $tsf->is_tag();
630
+ $is_tax = $tsf->is_tax();
631
+ $is_shop = $tsf->is_shop();
632
+ $is_wc_shop = $tsf->is_wc_shop();
633