The SEO Framework - Version 2.7.3

Version Description

  • Incandescently Binate =

Release date:

  • January 5th 2017

Did you know?

  • The SEO Framework - Extension Manager has been published on WordPress.org.
  • More extensions are coming soon! Stay tuned :)

Summarized:

  • This update makes sure no conflicts arise anymore with WP Engine's staging services when WordPress is at a major version release.

Sorry, no SEO tip of the Update

Detailed log:

Remember, a changelog's details flows from our website.

Download this release

Release Info

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

Code changes from version 2.6.6 to 2.7.3

Files changed (59) hide show
  1. autodescription.php +46 -24
  2. inc/classes/{admininit.class.php → admin-init.class.php} +93 -108
  3. inc/classes/adminpages.class.php +183 -263
  4. inc/classes/compat.class.php +38 -1
  5. inc/classes/core.class.php +250 -90
  6. inc/classes/debug.class.php +160 -136
  7. inc/classes/detect.class.php +144 -158
  8. inc/classes/doingitright.class.php +225 -269
  9. inc/classes/feed.class.php +14 -2
  10. inc/classes/generate-description.class.php +88 -76
  11. inc/classes/generate-image.class.php +88 -29
  12. inc/classes/generate-ldjson.class.php +136 -66
  13. inc/classes/generate-title.class.php +130 -174
  14. inc/classes/generate-url.class.php +228 -153
  15. inc/classes/generate.class.php +72 -48
  16. inc/classes/init.class.php +28 -45
  17. inc/classes/inpost.class.php +122 -82
  18. inc/classes/metaboxes.class.php +203 -2046
  19. inc/classes/postdata.class.php +42 -24
  20. inc/classes/query.class.php +494 -394
  21. inc/classes/render.class.php +368 -383
  22. inc/classes/sanitize.class.php +134 -60
  23. inc/classes/search.class.php +95 -36
  24. inc/classes/sitemaps.class.php +128 -73
  25. inc/classes/siteoptions.class.php +212 -91
  26. inc/classes/termdata.class.php +172 -223
  27. inc/classes/transients.class.php +93 -55
  28. inc/deprecated/deprecated.class.php +306 -130
  29. inc/deprecated/deprecated.php +69 -4
  30. inc/functions/benchmark.php +0 -369
  31. inc/functions/compat.php +55 -72
  32. inc/functions/optionsapi.php +85 -56
  33. inc/functions/upgrade.php +110 -0
  34. inc/views/debug/index.php +2 -0
  35. inc/views/debug/output.php +62 -0
  36. inc/views/index.php +13 -0
  37. inc/views/metaboxes/description-metabox.php +149 -0
  38. inc/views/metaboxes/feed-metabox.php +49 -0
  39. inc/views/metaboxes/homepage-metabox.php +393 -0
  40. inc/views/metaboxes/index.php +2 -0
  41. inc/views/metaboxes/knowledge-metabox.php +230 -0
  42. inc/views/metaboxes/robots-metabox.php +172 -0
  43. inc/views/metaboxes/schema-metabox.php +87 -0
  44. inc/views/metaboxes/sitemaps-metabox.php +265 -0
  45. inc/views/metaboxes/social-metabox.php +323 -0
  46. inc/views/metaboxes/title-metabox.php +257 -0
  47. inc/views/metaboxes/webmaster-metabox.php +69 -0
  48. language/autodescription.pot +759 -723
  49. lib/css/autodescription-rtl.css +220 -123
  50. lib/css/autodescription-rtl.min.css +1 -1
  51. lib/css/autodescription.css +220 -123
  52. lib/css/autodescription.min.css +1 -1
  53. lib/js/autodescription.js +273 -141
  54. lib/js/autodescription.min.js +25 -24
  55. load.class.php +53 -25
  56. patch/2.6.6.patch +0 -3633
  57. patch/2.7.3.patch +47 -0
  58. readme.txt +116 -469
  59. seotips/seotips.txt +9 -0
autodescription.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://wordpress.org/plugins/autodescription/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
6
- * Version: 2.6.6
7
* Author: Sybre Waaijer
8
* Author URI: https://cyberwire.nl/
9
* License: GPLv3
@@ -11,6 +11,8 @@
11
* Domain Path: /language
12
*/
13
14
/**
15
* The SEO Framework plugin
16
* Copyright (C) 2015 - 2016 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
@@ -34,6 +36,8 @@
34
// define( 'THE_SEO_FRAMEWORK_DEBUG', true );
35
// define( 'THE_SEO_FRAMEWORK_DEBUG_HIDDEN', true );
36
// define( 'THE_SEO_FRAMEWORK_DISABLE_TRANSIENTS', true );
37
//}
38
//}},0);
39
@@ -42,7 +46,13 @@
42
* Not many caching plugins use CDN in dashboard. What a shame. Firefox does cache.
43
* @since 1.0.0
44
*/
45
- define( 'THE_SEO_FRAMEWORK_VERSION', '2.6.6' );
46
47
/**
48
* Plugin options filter.
@@ -56,6 +66,18 @@ define( 'THE_SEO_FRAMEWORK_SITE_OPTIONS', (string) apply_filters( 'the_seo_frame
56
*/
57
define( 'THE_SEO_FRAMEWORK_NETWORK_OPTIONS', (string) apply_filters( 'the_seo_framework_network_settings', 'autodescription-network-settings' ) );
58
59
/**
60
* The plugin map url.
61
* Used for calling browser files.
@@ -82,17 +104,23 @@ define( 'THE_SEO_FRAMEWORK_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
82
*/
83
define( 'THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE', __FILE__ );
84
85
/**
86
* The plugin class map absolute path.
87
* @since 2.2.9
88
*/
89
- define( 'THE_SEO_FRAMEWORK_DIR_PATH_CLASS', THE_SEO_FRAMEWORK_DIR_PATH . '/inc/classes/' );
90
91
/**
92
* The plugin function map absolute path.
93
* @since 2.2.9
94
*/
95
- define( 'THE_SEO_FRAMEWORK_DIR_PATH_FUNCT', THE_SEO_FRAMEWORK_DIR_PATH . '/inc/functions/' );
96
97
add_action( 'plugins_loaded', 'the_seo_framework_locale_init', 10 );
98
/**
@@ -109,51 +137,45 @@ function the_seo_framework_locale_init() {
109
* @since 1.0.0
110
* @uses THE_SEO_FRAMEWORK_DIR_PATH
111
*/
112
- require_once( THE_SEO_FRAMEWORK_DIR_PATH . '/load.class.php' );
113
114
//* Load deprecated functions.
115
- //require_once( THE_SEO_FRAMEWORK_DIR_PATH . 'inc/deprecated/deprecated.php' );
116
117
- /**
118
- * FLush permalinks on activation/deactivation.
119
- * Calls functions statically.
120
- * @since 2.2.9
121
- */
122
register_activation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, 'the_seo_framework_flush_rewrite_rules_activation' );
123
- register_deactivation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, 'the_seo_framework_flush_rewrite_rules_deactivation' );
124
-
125
/**
126
* Add and Flush rewrite rules on plugin activation.
127
*
128
- * @global object $wp_rewrite
129
- *
130
* @since 2.6.6
131
* @access private
132
*/
133
function the_seo_framework_flush_rewrite_rules_activation() {
134
- global $wp_rewrite;
135
136
$the_seo_framework = the_seo_framework();
137
- $the_seo_framework->rewrite_rule_sitemap( true );
138
139
- $wp_rewrite->init();
140
- $wp_rewrite->flush_rules( true );
141
}
142
143
/**
144
* Flush rewrite rules on plugin deactivation.
145
*
146
- * @global object $wp_rewrite
147
- *
148
* @since 2.6.6
149
* @access private
150
*/
151
function the_seo_framework_flush_rewrite_rules_deactivation() {
152
global $wp_rewrite;
153
154
- $wp_rewrite->init();
155
-
156
unset( $wp_rewrite->extra_rules_top['sitemap\.xml#x27;] );
157
158
- $wp_rewrite->flush_rules( true );
159
}
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://wordpress.org/plugins/autodescription/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
6
+ * Version: 2.7.3
7
* Author: Sybre Waaijer
8
* Author URI: https://cyberwire.nl/
9
* License: GPLv3
11
* Domain Path: /language
12
*/
13
14
+ defined( 'ABSPATH' ) or die;
15
+
16
/**
17
* The SEO Framework plugin
18
* Copyright (C) 2015 - 2016 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
36
// define( 'THE_SEO_FRAMEWORK_DEBUG', true );
37
// define( 'THE_SEO_FRAMEWORK_DEBUG_HIDDEN', true );
38
// define( 'THE_SEO_FRAMEWORK_DISABLE_TRANSIENTS', true );
39
+ // update_option( 'the_seo_framework_upgraded_db_version', '0' );
40
+ // add_filter( 'the_seo_framework_use_object_cache', '__return_false' );
41
//}
42
//}},0);
43
46
* Not many caching plugins use CDN in dashboard. What a shame. Firefox does cache.
47
* @since 1.0.0
48
*/
49
+ define( 'THE_SEO_FRAMEWORK_VERSION', '2.7.3' );
50
+
51
+ /**
52
+ * Plugin Database version for lightweight version comparing.
53
+ * @since 2.7.0
54
+ */
55
+ define( 'THE_SEO_FRAMEWORK_DB_VERSION', '2701' );
56
57
/**
58
* Plugin options filter.
66
*/
67
define( 'THE_SEO_FRAMEWORK_NETWORK_OPTIONS', (string) apply_filters( 'the_seo_framework_network_settings', 'autodescription-network-settings' ) );
68
69
+ /**
70
+ * Plugin term options filter.
71
+ * @since 2.7.0
72
+ */
73
+ define( 'THE_SEO_FRAMEWORK_TERM_OPTIONS', (string) apply_filters( 'the_seo_framework_term_options', 'autodescription-term-settings' ) );
74
+
75
+ /**
76
+ * Plugin term options filter.
77
+ * @since 2.7.0
78
+ */
79
+ define( 'THE_SEO_FRAMEWORK_USER_OPTIONS', (string) apply_filters( 'the_seo_framework_user_options', 'autodescription-user-settings' ) );
80
+
81
/**
82
* The plugin map url.
83
* Used for calling browser files.
104
*/
105
define( 'THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE', __FILE__ );
106
107
+ /**
108
+ * The plugin views map absolute path.
109
+ * @since 2.7.0
110
+ */
111
+ define( 'THE_SEO_FRAMEWORK_DIR_PATH_VIEWS', THE_SEO_FRAMEWORK_DIR_PATH . 'inc/views/' );
112
+
113
/**
114
* The plugin class map absolute path.
115
* @since 2.2.9
116
*/
117
+ define( 'THE_SEO_FRAMEWORK_DIR_PATH_CLASS', THE_SEO_FRAMEWORK_DIR_PATH . 'inc/classes/' );
118
119
/**
120
* The plugin function map absolute path.
121
* @since 2.2.9
122
*/
123
+ define( 'THE_SEO_FRAMEWORK_DIR_PATH_FUNCT', THE_SEO_FRAMEWORK_DIR_PATH . 'inc/functions/' );
124
125
add_action( 'plugins_loaded', 'the_seo_framework_locale_init', 10 );
126
/**
137
* @since 1.0.0
138
* @uses THE_SEO_FRAMEWORK_DIR_PATH
139
*/
140
+ require_once( THE_SEO_FRAMEWORK_DIR_PATH . 'load.class.php' );
141
142
//* Load deprecated functions.
143
+ require_once( THE_SEO_FRAMEWORK_DIR_PATH . 'inc/deprecated/deprecated.php' );
144
145
register_activation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, 'the_seo_framework_flush_rewrite_rules_activation' );
146
/**
147
* Add and Flush rewrite rules on plugin activation.
148
*
149
* @since 2.6.6
150
+ * @since 2.7.1: 1. Now no longer reinitializes global $wp_rewrite.
151
+ * 2. Now always listens to the preconditions of the sitemap addition.
152
+ * 3. Now flushes the rules on shutdown.
153
* @access private
154
*/
155
function the_seo_framework_flush_rewrite_rules_activation() {
156
157
$the_seo_framework = the_seo_framework();
158
159
+ if ( isset( $the_seo_framework ) ) {
160
+ $the_seo_framework->rewrite_rule_sitemap();
161
+ add_action( 'shutdown', 'flush_rewrite_rules' );
162
+ }
163
}
164
165
+ register_deactivation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, 'the_seo_framework_flush_rewrite_rules_deactivation' );
166
/**
167
* Flush rewrite rules on plugin deactivation.
168
*
169
* @since 2.6.6
170
+ * @since 2.7.1: 1. Now no longer reinitializes global $wp_rewrite.
171
+ * 2. Now flushes the rules on shutdown.
172
* @access private
173
+ * @global object $wp_rewrite
174
*/
175
function the_seo_framework_flush_rewrite_rules_deactivation() {
176
global $wp_rewrite;
177
178
unset( $wp_rewrite->extra_rules_top['sitemap\.xml#x27;] );
179
180
+ add_action( 'shutdown', 'flush_rewrite_rules' );
181
}
inc/classes/{admininit.class.php → admin-init.class.php} RENAMED
@@ -16,6 +16,8 @@
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/**
20
* Class AutoDescription_Admin_Init
21
*
@@ -27,47 +29,55 @@
27
class AutoDescription_Admin_Init extends AutoDescription_Init {
28
29
/**
30
- * Page Hook.
31
*
32
* @since 2.5.2.2
33
*
34
- * @var String Holds Admin Page hook.
35
*/
36
- protected $page_hook;
37
38
/**
39
* JavaScript name identifier to be used with enqueuing.
40
*
41
* @since 2.5.2.2
42
*
43
- * @var array JavaScript name identifier.
44
*/
45
- public $js_name;
46
47
/**
48
* CSS script name identifier to be used with enqueuing.
49
*
50
* @since 2.6.0
51
*
52
- * @var array CSS name identifier.
53
*/
54
- public $css_name;
55
56
/**
57
- * Constructor, load parent constructor
58
- *
59
- * Initalizes wp-admin functions
60
*/
61
public function __construct() {
62
parent::__construct();
63
64
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 0, 1 );
65
66
- $this->js_name = 'autodescription';
67
- $this->css_name = 'autodescription';
68
-
69
//* Admin AJAX for counter options.
70
- add_action( 'wp_ajax_the_seo_framework_update_counter', array( $this, 'the_counter_visualized' ) );
71
72
}
73
@@ -76,7 +86,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
76
*
77
* @since 2.3.3
78
*
79
- * @param $hook the current page
80
*/
81
public function enqueue_admin_scripts( $hook ) {
82
@@ -92,39 +102,39 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
92
* Check hook first.
93
* @since 2.3.9
94
*/
95
- if ( isset( $hook ) && $hook && in_array( $hook, $enqueue_hooks ) ) {
96
/**
97
* @uses $this->post_type_supports_custom_seo()
98
* @since 2.3.9
99
*/
100
if ( $this->post_type_supports_custom_seo() )
101
$this->init_admin_scripts();
102
-
103
}
104
-
105
}
106
107
/**
108
- * Register and output Admin scripts.
109
*
110
* @since 2.6.0
111
*/
112
- public function init_admin_scripts() {
113
114
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_css' ), 1 );
115
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_javascript' ), 1 );
116
117
}
118
119
/**
120
- * AutoDescription JavaScript helper file
121
*
122
* @since 2.0.2
123
*
124
- * @usedby add_inpost_seo_box
125
- * @usedby enqueue_javascript
126
- *
127
- * @param string|array|object $hook the current page
128
*/
129
public function enqueue_admin_javascript( $hook ) {
130
@@ -132,7 +142,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
132
* Put hook and js name in class vars.
133
* @since 2.5.2.2
134
*/
135
- $this->page_hook = $this->page_hook ? $this->page_hook : $hook;
136
137
//* Register the script.
138
$this->register_admin_javascript();
@@ -148,11 +158,10 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
148
}
149
150
/**
151
- * Registers Admin CSS.
152
*
153
* @since 2.6.0
154
* @staticvar bool $registered : Prevents Re-registering of the style.
155
- *
156
* @access private
157
*/
158
public function register_admin_javascript() {
@@ -174,6 +183,8 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
174
* Localizes admin javascript.
175
*
176
* @since 2.5.2.2
177
*/
178
public function localize_admin_javascript() {
179
@@ -195,6 +206,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
195
*
196
* @since 2.6.0
197
* @staticvar array $strings : The l10n strings.
198
*
199
* @return array $strings The l10n strings.
200
*/
@@ -214,7 +226,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
214
$home_tagline = $this->get_option( 'homepage_title_tagline' );
215
$title_location = $this->get_option( 'title_location' );
216
$title_add_additions = $this->add_title_additions();
217
- $counter_type = $this->get_option( 'counter_type' );
218
219
//* Enunciate the lenghts of Titles and Descriptions.
220
$good = __( 'Good', 'autodescription' );
@@ -222,19 +234,13 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
222
$bad = __( 'Bad', 'autodescription' );
223
$unknown = __( 'Unknown', 'autodescription' );
224
225
- $separator = $this->get_separator( 'title', true );
226
227
- $rtl = (bool) is_rtl();
228
$ishome = false;
229
230
- /**
231
- * We're gaining UX in exchange for resource usage.
232
- *
233
- * Any way to cache this?
234
- *
235
- * @since 2.2.4
236
- */
237
- if ( isset( $this->page_hook ) && $this->page_hook ) {
238
// We're somewhere within default WordPress pages.
239
$post_id = $this->get_the_real_ID();
240
@@ -248,7 +254,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
248
} else {
249
$additions = '';
250
}
251
- } else if ( $post_id ) {
252
//* We're on post.php
253
$generated_doctitle_args = array(
254
'term_id' => $post_id,
@@ -265,7 +271,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
265
$additions = '';
266
$tagline = false;
267
}
268
- } else if ( $this->is_archive() ) {
269
//* Category or Tag.
270
global $current_screen;
271
@@ -278,21 +284,19 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
278
'term_id' => $term_id,
279
'taxonomy' => $current_screen->taxonomy,
280
'notagline' => true,
281
- 'get_custom_field' => false
282
);
283
284
$title = $this->title( '', '', '', $generated_doctitle_args );
285
$additions = $title_add_additions ? $blog_name : '';
286
}
287
}
288
-
289
} else {
290
//* We're in a special place.
291
// Can't fetch title.
292
$title = '';
293
$additions = $title_add_additions ? $blog_name : '';
294
}
295
-
296
} else {
297
// We're on our SEO settings pages.
298
if ( $this->has_page_on_front() ) {
@@ -306,22 +310,26 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
306
$additions = $home_tagline ? $home_tagline : $description;
307
}
308
309
return $strings = array(
310
- 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.', 'autodescription' ),
311
- 'confirmReset' => __( 'Are you sure you want to reset all SEO settings to their defaults?', 'autodescription' ),
312
- 'siteTitle' => $title,
313
- 'titleAdditions' => $additions,
314
- 'blogDescription' => $description,
315
- 'titleTagline' => $tagline,
316
- 'titleSeparator' => $separator,
317
- 'titleLocation' => $title_location,
318
- 'isRTL' => $rtl,
319
'isHome' => $ishome,
320
- 'counterType' => $counter_type,
321
- 'good' => $good,
322
- 'okay' => $okay,
323
- 'bad' => $bad,
324
- 'unknown' => $unknown,
325
);
326
}
327
@@ -341,7 +349,7 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
341
* Put hook and js name in class vars.
342
* @since 2.5.2.2
343
*/
344
- $this->page_hook = $this->page_hook ? $this->page_hook : $hook;
345
346
//* Register the script.
347
$this->register_admin_css();
@@ -355,7 +363,6 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
355
*
356
* @since 2.6.0
357
* @staticvar bool $registered : Prevents Re-registering of the style.
358
- *
359
* @access private
360
*/
361
protected function register_admin_css() {
@@ -365,38 +372,12 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
365
if ( isset( $registered ) )
366
return;
367
368
- $rtl = '';
369
-
370
- if ( is_rtl() )
371
- $rtl = '-rtl';
372
-
373
$suffix = $this->script_debug ? '' : '.min';
374
-
375
- wp_register_style( $this->css_name, THE_SEO_FRAMEWORK_DIR_URL . "lib/css/autodescription{$rtl}{$suffix}.css", array(), THE_SEO_FRAMEWORK_VERSION, 'all' );
376
-
377
$registered = true;
378
379
- }
380
-
381
- /**
382
- * Checks the screen hook.
383
- *
384
- * @since 2.2.2
385
- * @global string $page_hook the current page hook.
386
- *
387
- * @return bool true if screen match.
388
- */
389
- public function is_menu_page( $pagehook = '' ) {
390
- global $page_hook;
391
-
392
- if ( isset( $page_hook ) && $page_hook === $pagehook )
393
- return true;
394
-
395
- //* May be too early for $page_hook
396
- if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === $pagehook )
397
- return true;
398
399
- return false;
400
}
401
402
/**
@@ -408,9 +389,6 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
408
* @param string $page Menu slug.
409
* @param array $query_args Optional. Associative array of query string arguments
410
* (key => value). Default is an empty array.
411
- *
412
- * @credits StudioPress for some code.
413
- *
414
* @return null Return early if first argument is false.
415
*/
416
public function admin_redirect( $page, array $query_args = array() ) {
@@ -422,47 +400,54 @@ class AutoDescription_Admin_Init extends AutoDescription_Init {
422
423
foreach ( $query_args as $key => $value ) {
424
if ( empty( $key ) || empty( $value ) )
425
- unset( $query_args[$key] );
426
}
427
428
$url = add_query_arg( $query_args, $url );
429
430
- wp_redirect( esc_url_raw( $url ) );
431
exit;
432
}
433
434
-
435
/**
436
* Handles counter option update on AJAX request.
437
*
438
* @since 2.6.0
439
* @access private
440
*/
441
- public function the_counter_visualized() {
442
443
if ( $this->is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) {
444
- //* If current user isn't allowed to edit posts, don't do anything.
445
if ( ! current_user_can( 'publish_posts' ) )
446
exit;
447
448
- $options = $this->get_all_options();
449
450
/**
451
* Count up, reset to 0 if needed. We have 4 options: 0, 1, 2, 3
452
- * We're not accepting any $_POST values. Keeping it clean.
453
- * Yet we should for consistency. @TODO
454
- * @priority high 2.6.2
455
*/
456
- $options['counter_type'] = $options['counter_type'] + 1;
457
- if ( $options['counter_type'] > 3 )
458
- $options['counter_type'] = 0;
459
460
- update_option( $this->settings_field, $options );
461
462
//* Kill PHP.
463
exit;
464
}
465
-
466
}
467
-
468
}
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
+ defined( 'ABSPATH' ) or die;
20
+
21
/**
22
* Class AutoDescription_Admin_Init
23
*
29
class AutoDescription_Admin_Init extends AutoDescription_Init {
30
31
/**
32
+ * The page base file.
33
*
34
* @since 2.5.2.2
35
*
36
+ * @var string Holds Admin page base file.
37
*/
38
+ protected $page_base_file;
39
40
/**
41
* JavaScript name identifier to be used with enqueuing.
42
*
43
* @since 2.5.2.2
44
*
45
+ * @var string JavaScript name identifier.
46
*/
47
+ public $js_name = 'autodescription';
48
49
/**
50
* CSS script name identifier to be used with enqueuing.
51
*
52
* @since 2.6.0
53
*
54
+ * @var string CSS name identifier.
55
*/
56
+ public $css_name = 'autodescription';
57
58
/**
59
+ * Unserializing instances of this class is forbidden.
60
+ */
61
+ private function __wakeup() { }
62
+
63
+ /**
64
+ * Handle unapproachable invoked methods.
65
+ */
66
+ public function __call( $name, $arguments ) {
67
+ parent::__call( $name, $arguments );
68
+ }
69
+
70
+ /**
71
+ * Constructor. Loads parent constructor, registers script names and adds actions.
72
*/
73
public function __construct() {
74
parent::__construct();
75
76
+ //* Enqueues admin scripts.
77
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 0, 1 );
78
79
//* Admin AJAX for counter options.
80
+ add_action( 'wp_ajax_the_seo_framework_update_counter', array( $this, 'wp_ajax_update_counter_type' ) );
81
82
}
83
86
*
87
* @since 2.3.3
88
*
89
+ * @param string $hook The current page hook.
90
*/
91
public function enqueue_admin_scripts( $hook ) {
92
102
* Check hook first.
103
* @since 2.3.9
104
*/
105
+ if ( isset( $hook ) && $hook && in_array( $hook, $enqueue_hooks, true ) ) {
106
/**
107
* @uses $this->post_type_supports_custom_seo()
108
* @since 2.3.9
109
*/
110
if ( $this->post_type_supports_custom_seo() )
111
$this->init_admin_scripts();
112
}
113
}
114
115
/**
116
+ * Registers admin scripts and styles.
117
*
118
* @since 2.6.0
119
*/
120
+ public function init_admin_scripts( $direct = false ) {
121
122
+ if ( $direct ) {
123
+ $this->enqueue_admin_css( $this->page_base_file );
124
+ $this->enqueue_admin_javascript( $this->page_base_file );
125
+ } else {
126
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_css' ), 1 );
127
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_javascript' ), 1 );
128
+ }
129
130
}
131
132
/**
133
+ * Enqueues scripts.
134
*
135
* @since 2.0.2
136
*
137
+ * @param string $hook The current page hook.
138
*/
139
public function enqueue_admin_javascript( $hook ) {
140
142
* Put hook and js name in class vars.
143
* @since 2.5.2.2
144
*/
145
+ $this->page_base_file = $this->page_base_file ? $this->page_base_file : $hook;
146
147
//* Register the script.
148
$this->register_admin_javascript();
158
}
159
160
/**
161
+ * Registers admin CSS.
162
*
163
* @since 2.6.0
164
* @staticvar bool $registered : Prevents Re-registering of the style.
165
* @access private
166
*/
167
public function register_admin_javascript() {
183
* Localizes admin javascript.
184
*
185
* @since 2.5.2.2
186
+ * @staticvar bool $localized : Prevents Re-registering of the l10n.
187
+ * @access private
188
*/
189
public function localize_admin_javascript() {
190
206
*
207
* @since 2.6.0
208
* @staticvar array $strings : The l10n strings.
209
+ * @since 2.7.0 Added AJAX nonce: 'autodescription-ajax-nonce'
210
*
211
* @return array $strings The l10n strings.
212
*/
226
$home_tagline = $this->get_option( 'homepage_title_tagline' );
227
$title_location = $this->get_option( 'title_location' );
228
$title_add_additions = $this->add_title_additions();
229
+ $counter_type = (int) $this->get_user_option( 0, 'counter_type', 3 );
230
231
//* Enunciate the lenghts of Titles and Descriptions.
232
$good = __( 'Good', 'autodescription' );
234
$bad = __( 'Bad', 'autodescription' );
235
$unknown = __( 'Unknown', 'autodescription' );
236
237
+ $title_separator = $this->get_separator( 'title' );
238
+ $description_separator = $this->get_separator( 'description' );
239
240
+ $isrtl = (bool) is_rtl();
241
$ishome = false;
242
243
+ if ( isset( $this->page_base_file ) && $this->page_base_file ) {
244
// We're somewhere within default WordPress pages.
245
$post_id = $this->get_the_real_ID();
246
254
} else {
255
$additions = '';
256
}
257
+ } elseif ( $post_id ) {
258
//* We're on post.php
259
$generated_doctitle_args = array(
260
'term_id' => $post_id,
271
$additions = '';
272
$tagline = false;
273
}
274
+ } elseif ( $this->is_archive() ) {
275
//* Category or Tag.
276
global $current_screen;
277
284
'term_id' => $term_id,
285
'taxonomy' => $current_screen->taxonomy,
286
'notagline' => true,
287
+ 'get_custom_field' => false,
288
);
289
290
$title = $this->title( '', '', '', $generated_doctitle_args );
291
$additions = $title_add_additions ? $blog_name : '';
292
}
293
}
294
} else {
295
//* We're in a special place.
296
// Can't fetch title.
297
$title = '';
298
$additions = $title_add_additions ? $blog_name : '';
299
}
300
} else {
301
// We're on our SEO settings pages.
302
if ( $this->has_page_on_front() ) {
310
$additions = $home_tagline ? $home_tagline : $description;
311
}
312
313
+ $nonce = wp_create_nonce( 'autodescription-ajax-nonce' );
314
+
315
return $strings = array(
316
+ 'saveAlert' => esc_html__( 'The changes you made will be lost if you navigate away from this page.', 'autodescription' ),
317
+ 'confirmReset' => esc_html__( 'Are you sure you want to reset all SEO settings to their defaults?', 'autodescription' ),
318
+ 'siteTitle' => esc_html( $title ),
319
+ 'titleAdditions' => esc_html( $additions ),
320
+ 'blogDescription' => esc_html( $description ),
321
+ 'titleTagline' => $tagline,
322
+ 'titleSeparator' => esc_html( $title_separator ),
323
+ 'titleLocation' => esc_html( $title_location ),
324
+ 'descriptionSeparator' => esc_html( $description_separator ),
325
+ 'isRTL' => $isrtl,
326
'isHome' => $ishome,
327
+ 'counterType' => absint( $counter_type ),
328
+ 'good' => esc_html( $good ),
329
+ 'okay' => esc_html( $okay ),
330
+ 'bad' => esc_html( $bad ),
331
+ 'unknown' => esc_html( $unknown ),
332
+ 'nonce' => $nonce,
333
);
334
}
335
349
* Put hook and js name in class vars.
350
* @since 2.5.2.2
351
*/
352
+ $this->page_base_file = $this->page_base_file ? $this->page_base_file : $hook;
353
354
//* Register the script.
355
$this->register_admin_css();
363
*
364
* @since 2.6.0
365
* @staticvar bool $registered : Prevents Re-registering of the style.
366
* @access private
367
*/
368
protected function register_admin_css() {
372
if ( isset( $registered ) )
373
return;
374
375
+ $rtl = is_rtl() ? '-rtl' : '';
376
$suffix = $this->script_debug ? '' : '.min';
377
$registered = true;
378
379
+ wp_register_style( $this->css_name, THE_SEO_FRAMEWORK_DIR_URL . "lib/css/autodescription{$rtl}{$suffix}.css", array(), THE_SEO_FRAMEWORK_VERSION, 'all' );
380
381
}
382
383
/**
389
* @param string $page Menu slug.
390
* @param array $query_args Optional. Associative array of query string arguments
391
* (key => value). Default is an empty array.
392
* @return null Return early if first argument is false.
393
*/
394
public function admin_redirect( $page, array $query_args = array() ) {
400
401
foreach ( $query_args as $key => $value ) {
402
if ( empty( $key ) || empty( $value ) )
403
+ unset( $query_args[ $key ] );
404
}
405
406
$url = add_query_arg( $query_args, $url );
407
408
+ wp_safe_redirect( esc_url_raw( $url ), 302 );
409
exit;
410
}
411
412
/**
413
* Handles counter option update on AJAX request.
414
*
415
* @since 2.6.0
416
* @access private
417
*/
418
+ public function wp_ajax_update_counter_type() {
419
420
if ( $this->is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) {
421
+
422
+ //* If current user isn't allowed to edit posts, don't do anything and kill PHP.
423
if ( ! current_user_can( 'publish_posts' ) )
424
exit;
425
426
+ check_ajax_referer( 'autodescription-ajax-nonce', 'nonce' );
427
428
/**
429
* Count up, reset to 0 if needed. We have 4 options: 0, 1, 2, 3
430
+ * $_POST['val'] already contains updated number.
431
*/
432
+ $value = isset( $_POST['val'] ) ? intval( $_POST['val'] ) : $this->get_user_option( 0, 'counter_type', 3 ) + 1;
433
+ $value = absint( $value );
434
+
435
+ if ( $value > 3 )
436
+ $value = 0;
437
+
438
+ //* Update the option and get results of action.
439
+ $type = $this->update_user_option( 0, 'counter_type', $value ) ? 'success' : 'error';
440
441
+ $results = array(
442
+ 'type' => $type,
443
+ 'value' => $value,
444
+ );
445
+
446
+ //* Encode and echo results. Requires JSON decode within JS.
447
+ echo json_encode( $results );
448
449
//* Kill PHP.
450
exit;
451
}
452
}
453
}
inc/classes/adminpages.class.php CHANGED
@@ -16,6 +16,8 @@
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/**
20
* Class AutoDescription_Siteoptions
21
*
@@ -37,20 +39,11 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
37
/**
38
* Name of the page hook when the menu is registered.
39
*
40
- * @since 2.2.2
41
- *
42
- * @var string Page hook
43
- */
44
- public $pagehook;
45
-
46
- /**
47
- * Name of the network page hook when the menu is registered.
48
- *
49
- * @since 2.2.2
50
*
51
* @var string Page hook
52
*/
53
- public $network_pagehook;
54
55
/**
56
* Load the options.
@@ -62,7 +55,19 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
62
public $load_options;
63
64
/**
65
- * Constructor, load parent constructor and set up variables.
66
*/
67
public function __construct() {
68
parent::__construct();
@@ -73,19 +78,23 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
73
*/
74
$this->load_options = (bool) apply_filters( 'the_seo_framework_load_options', true );
75
76
- if ( $this->load_options ) {
77
add_action( 'admin_init', array( $this, 'enqueue_page_defaults' ), 1 );
78
79
- // Add menu links and register $this->pagehook
80
add_action( 'admin_menu', array( $this, 'add_menu_link' ) );
81
82
- /**
83
- * Add specific Multisite options
84
- * @TODO
85
- * @priority low 3.0.0
86
- */
87
- // if ( is_multisite() ) add_action( 'network_admin_menu', array( $this, 'add_network_menu_link' ) );
88
-
89
//* Load the page content
90
add_action( 'admin_init', array( $this, 'settings_init' ) );
91
@@ -111,12 +120,12 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
111
$this->page_defaults = (array) apply_filters(
112
'the_seo_framework_admin_page_defaults',
113
array(
114
- 'save_button_text' => __( 'Save Settings', 'autodescription' ),
115
- 'reset_button_text' => __( 'Reset Settings', 'autodescription' ),
116
- 'saved_notice_text' => __( 'Settings are saved.', 'autodescription' ),
117
- 'reset_notice_text' => __( 'Settings are reset.', 'autodescription' ),
118
- 'error_notice_text' => __( 'Error saving settings.', 'autodescription' ),
119
- 'plugin_update_text' => __( 'New SEO Settings have been updated.', 'autodescription' ),
120
)
121
);
122
@@ -132,18 +141,18 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
132
public function add_menu_link() {
133
134
$menu = array(
135
- 'pagetitle' => __( 'SEO Settings', 'autodescription' ),
136
- 'menutitle' => __( 'SEO', 'autodescription' ),
137
- 'capability' => $this->settings_capability(),
138
- 'menu_slug' => 'autodescription-settings',
139
- 'callback' => array( $this, 'admin' ),
140
- 'icon' => 'dashicons-search',
141
- 'position' => '90.9001',
142
);
143
144
- $this->pagehook = add_menu_page(
145
- $menu['pagetitle'],
146
- $menu['menutitle'],
147
$menu['capability'],
148
$menu['menu_slug'],
149
$menu['callback'],
@@ -151,55 +160,24 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
151
$menu['position']
152
);
153
154
- //* Enqueue styles
155
- add_action( 'admin_print_styles-' . $this->pagehook, array( $this, 'enqueue_admin_css' ), 11 );
156
-
157
- //* Enqueue scripts
158
- add_action( 'admin_print_scripts-' . $this->pagehook, array( $this, 'enqueue_admin_javascript' ), 11 );
159
-
160
- }
161
-
162
- /**
163
- * Adds menu links under "settings" in the wp-admin dashboard
164
- *
165
- * Applies `autodescription_settings_capability` filters.
166
- * This filter changes the minimum role for viewing and editing the plugin's settings.
167
- *
168
- * @since 2.2.2
169
- * @return void
170
- *
171
- * @TODO Everything.
172
- * @priority low 3.0.0
173
- */
174
- public function add_network_menu_link() {
175
-
176
- $menu = array(
177
- 'pagetitle' => __( 'Network SEO Settings', 'autodescription' ),
178
- 'menutitle' => __( 'Network SEO', 'autodescription' ),
179
-
180
- 'capability' => 'manage_network',
181
-
182
- 'menu_slug' => 'autodescription-network-settings',
183
- 'callback' => array( $this, 'network_admin' ),
184
- 'icon' => 'dashicons-search',
185
- 'position' => '99.9001',
186
- );
187
-
188
- $this->network_pagehook = add_menu_page(
189
- $menu['pagetitle'],
190
- $menu['menutitle'],
191
$menu['capability'],
192
$menu['menu_slug'],
193
- $menu['callback'],
194
- $menu['icon'],
195
- $menu['position']
196
);
197
198
- // Enqueue styles
199
- add_action( 'admin_print_styles-' . $this->network_pagehook, array( $this, 'enqueue_admin_css' ), 11 );
200
201
- // Enqueue scripts
202
- add_action( 'admin_print_scripts-' . $this->network_pagehook, array( $this, 'enqueue_admin_javascript' ), 11 );
203
204
}
205
@@ -210,8 +188,8 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
210
*/
211
public function settings_init() {
212
213
- add_action( $this->pagehook . '_settings_page_boxes', array( $this, 'do_metaboxes' ) );
214
- add_action( 'load-' . $this->pagehook, array( $this, 'metaboxes' ) );
215
216
}
217
@@ -229,26 +207,26 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
229
<div class="metabox-holder columns-2">
230
<div class="postbox-container-1">
231
<?php
232
- do_action( 'the_seo_framework_before_siteadmin_metaboxes', $this->pagehook );
233
234
- do_meta_boxes( $this->pagehook, 'main', null );
235
236
- if ( isset( $wp_meta_boxes[$this->pagehook]['main_extra'] ) )
237
- do_meta_boxes( $this->pagehook, 'main_extra', null );
238
239
- do_action( 'the_seo_framework_after_siteadmin_metaboxes', $this->pagehook );
240
?>
241
</div>
242
<div class="postbox-container-2">
243
<?php
244
- do_action( 'the_seo_framework_before_siteadmin_metaboxes_side', $this->pagehook );
245
246
/**
247
* @TODO fill this in
248
* @priority low 2.9.0
249
*/
250
251
- do_action( 'the_seo_framework_after_siteadmin_metaboxes_side', $this->pagehook );
252
?>
253
</div>
254
</div>
@@ -279,115 +257,125 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
279
*
280
* @since 2.2.4
281
*/
282
- $title = (bool) apply_filters( 'the_seo_framework_title_metabox', true );
283
- $description = (bool) apply_filters( 'the_seo_framework_description_metabox', true );
284
- $robots = (bool) apply_filters( 'the_seo_framework_robots_metabox', true );
285
- $home = (bool) apply_filters( 'the_seo_framework_home_metabox', true );
286
- $social = (bool) apply_filters( 'the_seo_framework_social_metabox', true );
287
- $knowledge = (bool) apply_filters( 'the_seo_framework_knowledge_metabox', true );
288
- $schema = (bool) apply_filters( 'the_seo_framework_schema_metabox', true );
289
- $webmaster = (bool) apply_filters( 'the_seo_framework_webmaster_metabox', true );
290
- $sitemap = (bool) apply_filters( 'the_seo_framework_sitemap_metabox', true );
291
- $feed = (bool) apply_filters( 'the_seo_framework_feed_metabox', true );
292
293
//* Title Meta Box
294
if ( $title )
295
add_meta_box(
296
'autodescription-title-settings',
297
- __( 'Title Settings', 'autodescription' ),
298
array( $this, 'title_metabox' ),
299
- $this->pagehook,
300
- 'main'
301
);
302
303
//* Description Meta Box
304
if ( $description )
305
add_meta_box(
306
'autodescription-description-settings',
307
- __( 'Description Meta Settings', 'autodescription' ),
308
array( $this, 'description_metabox' ),
309
- $this->pagehook,
310
- 'main'
311
);
312
313
//* Home Page Meta Box
314
if ( $home )
315
add_meta_box(
316
'autodescription-homepage-settings',
317
- __( 'Home Page Settings', 'autodescription' ),
318
array( $this, 'homepage_metabox' ),
319
- $this->pagehook,
320
- 'main'
321
);
322
323
//* Social Meta Box
324
if ( $social )
325
add_meta_box(
326
'autodescription-social-settings',
327
- __( 'Social Meta Settings', 'autodescription' ),
328
array( $this, 'social_metabox' ),
329
- $this->pagehook,
330
- 'main'
331
);
332
333
//* Knowledge Graph Meta Box
334
if ( $knowledge )
335
add_meta_box(
336
'autodescription-knowledgegraph-settings',
337
- __( 'Knowledge Graph Settings', 'autodescription' ),
338
array( $this, 'knowledge_metabox' ),
339
- $this->pagehook,
340
- 'main'
341
);
342
343
//* Title Meta Box
344
if ( $schema )
345
add_meta_box(
346
'autodescription-schema-settings',
347
- __( 'Schema Settings', 'autodescription' ),
348
array( $this, 'schema_metabox' ),
349
- $this->pagehook,
350
- 'main'
351
);
352
353
//* Robots Meta Box
354
if ( $robots )
355
add_meta_box(
356
'autodescription-robots-settings',
357
- __( 'Robots Meta Settings', 'autodescription' ),
358
array( $this, 'robots_metabox' ),
359
- $this->pagehook,
360
- 'main'
361
);
362
363
//* Webmaster Meta Box
364
if ( $webmaster )
365
add_meta_box(
366
'autodescription-webmaster-settings',
367
- __( 'Webmaster Meta Settings', 'autodescription' ),
368
array( $this, 'webmaster_metabox' ),
369
- $this->pagehook,
370
- 'main'
371
);
372
373
//* Sitemaps Meta Box
374
if ( $sitemap )
375
add_meta_box(
376
'autodescription-sitemap-settings',
377
- __( 'Sitemap Settings', 'autodescription' ),
378
array( $this, 'sitemaps_metabox' ),
379
- $this->pagehook,
380
- 'main'
381
);
382
383
//* Feed Meta Box
384
if ( $feed )
385
add_meta_box(
386
'autodescription-feed-settings',
387
- __( 'Feed Settings', 'autodescription' ),
388
array( $this, 'feed_metabox' ),
389
- $this->pagehook,
390
- 'main'
391
);
392
393
}
@@ -401,16 +389,16 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
401
public function admin() {
402
403
?>
404
- <div class="wrap autodescription-metaboxes">
405
<form method="post" action="options.php">
406
407
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
408
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
409
<?php settings_fields( $this->settings_field ); ?>
410
411
- <div class="top-wrap">
412
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
413
- <p class="top-buttons">
414
<?php
415
submit_button( $this->page_defaults['save_button_text'], 'primary', 'submit', false, array( 'id' => '' ) );
416
submit_button( $this->page_defaults['reset_button_text'], 'secondary autodescription-js-confirm-reset', $this->get_field_name( 'reset' ), false, array( 'id' => '' ) );
@@ -418,58 +406,9 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
418
</p>
419
</div>
420
421
- <?php do_action( "{$this->pagehook}_settings_page_boxes", $this->pagehook ); ?>
422
-
423
- <div class="bottom-buttons">
424
- <?php
425
- submit_button( $this->page_defaults['save_button_text'], 'primary', 'submit', false, array( 'id' => '' ) );
426
- submit_button( $this->page_defaults['reset_button_text'], 'secondary autodescription-js-confirm-reset', $this->get_field_name( 'reset' ), false, array( 'id' => '' ) );
427
- ?>
428
- </div>
429
- </form>
430
- </div>
431
- <?php // Add postbox listeners ?>
432
- <script type="text/javascript">
433
- //<![CDATA[
434
- jQuery(document).ready( function ($) {
435
- // close postboxes that should be closed
436
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
437
- // postboxes setup
438
- postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
439
- });
440
- //]]>
441
- </script>
442
- <?php
443
-
444
- }
445
-
446
- /**
447
- * Use this as the settings admin callback to create an admin page with sortable metaboxes.
448
- * Create a 'settings_boxes' method to add metaboxes.
449
- *
450
- * @since 2.2.2
451
- */
452
- public function network_admin() {
453
-
454
- ?>
455
- <div class="wrap autodescription-metaboxes">
456
- <form method="post" action="options.php">
457
-
458
- <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
459
- <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
460
- <?php settings_fields( $this->network_settings_field ); ?>
461
462
- <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
463
- <p class="top-buttons">
464
- <?php
465
- submit_button( $this->page_defaults['save_button_text'], 'primary', 'submit', false, array( 'id' => '' ) );
466
- submit_button( $this->page_defaults['reset_button_text'], 'secondary autodescription-js-confirm-reset', $this->get_field_name( 'reset' ), false, array( 'id' => '' ) );
467
- ?>
468
- </p>
469
-
470
- <?php do_action( "{$this->network_pagehook}_settings_page_boxes", $this->network_pagehook ); ?>
471
-
472
- <div class="bottom-buttons">
473
<?php
474
submit_button( $this->page_defaults['save_button_text'], 'primary', 'submit', false, array( 'id' => '' ) );
475
submit_button( $this->page_defaults['reset_button_text'], 'secondary autodescription-js-confirm-reset', $this->get_field_name( 'reset' ), false, array( 'id' => '' ) );
@@ -484,7 +423,7 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
484
// close postboxes that should be closed
485
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
486
// postboxes setup
487
- postboxes.add_postbox_toggles('<?php echo $this->network_pagehook; ?>');
488
});
489
//]]>
490
</script>
@@ -501,17 +440,17 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
501
*/
502
public function notices() {
503
504
- if ( false === $this->is_seo_settings_page() )
505
return;
506
507
if ( isset( $_REQUEST['settings-updated'] ) && 'true' === $_REQUEST['settings-updated'] )
508
- echo $this->generate_dismissible_notice( $this->page_defaults['saved_notice_text'], 'updated' );
509
elseif ( isset( $_REQUEST['reset'] ) && 'true' === $_REQUEST['reset'] )
510
- echo $this->generate_dismissible_notice( $this->page_defaults['reset_notice_text'], 'warning' );
511
elseif ( isset( $_REQUEST['error'] ) && 'true' === $_REQUEST['error'] )
512
- echo $this->generate_dismissible_notice( $this->page_defaults['error_notice_text'], 'error' );
513
elseif ( isset( $_REQUEST['seo-updated'] ) && 'true' === $_REQUEST['seo-updated'] )
514
- echo $this->generate_dismissible_notice( $this->page_defaults['plugin_update_text'], 'updated' );
515
516
}
517
@@ -534,13 +473,12 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
534
* Echo constructed name attributes in form fields.
535
*
536
* @since 2.2.2
537
- *
538
* @uses $this->get_field_name() Construct name attributes for use in form fields.
539
*
540
* @param string $name Field name base
541
*/
542
public function field_name( $name ) {
543
- echo $this->get_field_name( $name );
544
}
545
546
/**
@@ -559,7 +497,6 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
559
* Echo constructed id attributes in form fields.
560
*
561
* @since 2.2.2
562
- *
563
* @uses $this->get_field_id() Constructs id attributes for use in form fields.
564
*
565
* @param string $id Field id base
@@ -569,7 +506,7 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
569
public function field_id( $id, $echo = true ) {
570
571
if ( $echo ) {
572
- echo $this->get_field_id( $id );
573
} else {
574
return $this->get_field_id( $id );
575
}
@@ -578,7 +515,6 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
578
/**
579
* Helper function that returns a setting value from this form's settings
580
* field for use in form fields.
581
- *
582
* Fetches blog option.
583
*
584
* @since 2.2.2
@@ -590,32 +526,16 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
590
return $this->get_option( $key, $this->settings_field );
591
}
592
593
- /**
594
- * Helper function that returns a setting value from this form's settings
595
- * field for use in form fields.
596
- *
597
- * Fetches network option.
598
- *
599
- * @since 2.2.2
600
- *
601
- * @param string $key Field key
602
- * @return string Field value
603
- */
604
- public function get_field_value_network( $key ) {
605
- return $this->get_site_option( $key, $this->settings_field );
606
- }
607
-
608
/**
609
* Echo a setting value from this form's settings field for use in form fields.
610
*
611
- * @uses $this->get_field_value() Constructs value attributes for use in form fields.
612
- *
613
* @since 2.2.2
614
*
615
* @param string $key Field key
616
*/
617
public function field_value( $key ) {
618
- echo $this->get_field_value( $key );
619
}
620
621
/**
@@ -623,9 +543,8 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
623
*
624
* @since 2.6.0
625
*
626
- * @param string $input The input to wrap.
627
* @param bool $echo Whether to echo or return.
628
- *
629
* @return Wrapped $input.
630
*/
631
public function wrap_fields( $input = '', $echo = false ) {
@@ -633,28 +552,33 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
633
if ( is_array( $input ) )
634
$input = implode( "\r\n", $input );
635
636
- if ( $echo )
637
- echo '<div class="theseoframework-fields">' . "\r\n" . $input . "\r\n" . '</div>';
638
- else
639
- return '<div class="theseoframework-fields">' . "\r\n" . $input . "\r\n" . '</div>';
640
}
641
642
/**
643
* Return a chechbox wrapper.
644
*
645
* @since 2.6.0
646
*
647
* @param string $field_id The option ID. Must be within the Autodescription settings.
648
- * @param string $label The checkbox description label
649
* @param string $description Addition description to place beneath the checkbox.
650
- *
651
* @return HTML checkbox output.
652
*/
653
- public function make_checkbox( $field_id = '', $label = '', $description = '' ) {
654
655
- $description = $description ? '<p class="description theseoframework-option-spacer">' . $description . '</p>' : '';
656
657
- $output = '<span class="toblock">'
658
. '<label for="' . $this->get_field_id( $field_id ) . '">'
659
. '<input '
660
. 'type="checkbox" '
@@ -681,20 +605,22 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
681
* @param string $description The descriptive on-hover title.
682
* @param string $link The non-escaped link.
683
* @param bool $echo Whether to echo or return.
684
- *
685
- * @return HTML checkbox output.
686
*/
687
public function make_info( $description = '', $link = '', $echo = true ) {
688
689
- if ( $link )
690
$output = '<a href="' . esc_url( $link ) . '" target="_blank" title="' . esc_attr( $description ) . '">[?]</a>';
691
- else
692
$output = '<span title="' . esc_attr( $description ) . '">[?]</span>';
693
694
- if ( $echo )
695
echo $output;
696
- else
697
return $output;
698
}
699
700
/**
@@ -704,11 +630,11 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
704
*/
705
public function load_assets() {
706
//* Hook scripts method
707
- add_action( "load-{$this->pagehook}", array( $this, 'metabox_scripts' ) );
708
}
709
710
/**
711
- * Include the necessary sortable metabox scripts.
712
*
713
* @since 2.2.2
714
*/
@@ -738,13 +664,14 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
738
$default = $this->get_default_settings( $key, $setting );
739
740
if ( 1 === $default )
741
- $class = 'seoframework-default-selected';
742
743
if ( $echo ) {
744
- if ( $wrap )
745
- printf( 'class="%s"', $class );
746
- else
747
- echo $class;
748
} else {
749
if ( $wrap )
750
return sprintf( 'class="%s"', $class );
@@ -756,16 +683,12 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
756
/**
757
* Returns the HTML class wrap for warning Checkbox options.
758
*
759
- * This function does nothing special. But is merely a simple wrapper.
760
- * Just like code_wrap.
761
*
762
* @param string $key required The option name which returns boolean.
763
* @param string $setting optional The settings field
764
* @param bool $wrap optional output class="" or just the class name.
765
* @param bool $echo optional echo or return the output.
766
- *
767
- * @since 2.3.4
768
- *
769
* @return string Empty on echo or The class with an optional wrapper.
770
*/
771
public function is_warning_checked( $key, $setting = '', $wrap = true, $echo = true ) {
@@ -775,13 +698,13 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
775
$warned = $this->get_warned_settings( $key, $setting );
776
777
if ( 1 === $warned )
778
- $class = 'seoframework-warning-selected';
779
780
if ( $echo ) {
781
if ( $wrap ) {
782
- printf( 'class="%s"', $class );
783
} else {
784
- echo $class;
785
}
786
} else {
787
if ( $wrap )
@@ -826,41 +749,39 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
826
827
if ( '' !== $default && '' !== $warned ) {
828
$class = $default . ' ' . $warned;
829
- } else if ( '' !== $default ) {
830
$class = $default;
831
- } else if ( '' !== $warned ) {
832
$class = $warned;
833
}
834
835
if ( $echo ) {
836
if ( $wrap ) {
837
- printf( 'class="%s"', $class );
838
} else {
839
- echo $class;
840
}
841
} else {
842
- if ( $wrap ) {
843
return sprintf( 'class="%s"', $class );
844
- } else {
845
- return $class;
846
- }
847
}
848
}
849
850
/**
851
* Returns the HTML class wrap for default radio options.
852
*
853
- * @param string $key required The option name which returns boolean.
854
- * @param string $value required The option value which returns boolean.
855
- * @param string $setting optional The settings field
856
- * @param bool $wrap optional output class="" or just the class name.
857
- * @param bool $echo optional echo or return the output.
858
- *
859
* @since 2.2.5
860
*
861
* @TODO use this
862
* @priority low 2.8.0+
863
*
864
* @return string|null the default selected class.
865
*/
866
public function is_default_radio( $key, $value, $setting = '', $wrap = true, $echo = true ) {
@@ -870,13 +791,13 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
870
$default = $this->get_default_settings( $key, $setting );
871
872
if ( $value === $default )
873
- $class = 'seoframework-default-selected';
874
875
if ( $echo ) {
876
if ( $wrap ) {
877
- echo sprintf( 'class="%s"', $class );
878
} else {
879
- echo $class;
880
}
881
} else {
882
if ( $wrap )
@@ -885,5 +806,4 @@ class AutoDescription_Adminpages extends AutoDescription_Inpost {
885
return $class;
886
}
887
}
888
-
889
}
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
+ defined( 'ABSPATH' ) or die;
20
+
21
/**
22
* Class AutoDescription_Siteoptions
23
*
39
/**
40
* Name of the page hook when the menu is registered.
41
*
42
+ * @since 2.7.0
43
*
44
* @var string Page hook
45
*/
46
+ public $seo_settings_page_hook;
47
48
/**
49
* Load the options.
55
public $load_options;
56
57
/**
58
+ * Unserializing instances of this class is forbidden.
59
+ */
60
+ private function __wakeup() { }
61
+
62
+ /**
63
+ * Handle unapproachable invoked methods.
64
+ */
65
+ public function __call( $name, $arguments ) {
66
+ parent::__call( $name, $arguments );
67
+ }
68
+
69
+ /**
70
+ * Constructor. Loads parent constructor, does actions and sets up variables.
71
*/
72
public function __construct() {
73
parent::__construct();
78
*/
79
$this->load_options = (bool) apply_filters( 'the_seo_framework_load_options', true );
80
81
+ add_action( 'init', array( $this, 'init_admin_actions' ), 0 );
82
+ }
83
+
84
+ /**
85
+ * Initializes Admin Menu actions.
86
+ *
87
+ * @since 2.7.0
88
+ */
89
+ public function init_admin_actions() {
90
+
91
+ if ( $this->load_options && $this->is_admin() ) {
92
+ // Enqueue i18n defaults.
93
add_action( 'admin_init', array( $this, 'enqueue_page_defaults' ), 1 );
94
95
+ // Add menu links and register $this->seo_settings_page_hook
96
add_action( 'admin_menu', array( $this, 'add_menu_link' ) );
97
98
//* Load the page content
99
add_action( 'admin_init', array( $this, 'settings_init' ) );
100
120
$this->page_defaults = (array) apply_filters(
121
'the_seo_framework_admin_page_defaults',
122
array(
123
+ 'save_button_text' => esc_html__( 'Save Settings', 'autodescription' ),
124
+ 'reset_button_text' => esc_html__( 'Reset Settings', 'autodescription' ),
125
+ 'saved_notice_text' => esc_html__( 'Settings are saved.', 'autodescription' ),
126
+ 'reset_notice_text' => esc_html__( 'Settings are reset.', 'autodescription' ),
127
+ 'error_notice_text' => esc_html__( 'Error saving settings.', 'autodescription' ),
128
+ 'plugin_update_text' => esc_html__( 'New SEO Settings have been updated.', 'autodescription' ),
129
)
130
);
131
141
public function add_menu_link() {
142
143
$menu = array(
144
+ 'page_title' => esc_html__( 'SEO Settings', 'autodescription' ),
145
+ 'menu_title' => esc_html__( 'SEO', 'autodescription' ),
146
+ 'capability' => $this->settings_capability(),
147
+ 'menu_slug' => $this->seo_settings_page_slug,
148
+ 'callback' => array( $this, 'admin' ),
149
+ 'icon' => 'dashicons-search',
150
+ 'position' => '90.9001',
151
);
152
153
+ $this->seo_settings_page_hook = add_menu_page(
154
+ $menu['page_title'],
155
+ $menu['menu_title'],
156
$menu['capability'],
157
$menu['menu_slug'],
158
$menu['callback'],
160
$menu['position']
161
);
162
163
+ /**
164
+ * Simply copy the previous, but rename the submenu entry.
165
+ * The function add_submenu_page() takes care of the duplications.
166
+ */
167
+ add_submenu_page(
168
+ $menu['menu_slug'],
169
+ $menu['page_title'],
170
+ $menu['page_title'],
171
$menu['capability'],
172
$menu['menu_slug'],
173
+ $menu['callback']
174
);
175
176
+ //* Enqueue styles
177
+ add_action( 'admin_print_styles-' . $this->seo_settings_page_hook, array( $this, 'enqueue_admin_css' ), 11 );
178
179
+ //* Enqueue scripts
180
+ add_action( 'admin_print_scripts-' . $this->seo_settings_page_hook, array( $this, 'enqueue_admin_javascript' ), 11 );
181
182
}
183
188
*/
189
public function settings_init() {
190
191
+ add_action( $this->seo_settings_page_hook . '_settings_page_boxes', array( $this, 'do_metaboxes' ) );
192
+ add_action( 'load-' . $this->seo_settings_page_hook, array( $this, 'metaboxes' ) );
193
194
}
195
207
<div class="metabox-holder columns-2">
208
<div class="postbox-container-1">
209
<?php
210
+ do_action( 'the_seo_framework_before_siteadmin_metaboxes', $this->seo_settings_page_hook );
211
212
+ do_meta_boxes( $this->seo_settings_page_hook, 'main', null );
213
214
+ if ( isset( $wp_meta_boxes[ $this->seo_settings_page_hook ]['main_extra'] ) )
215
+ do_meta_boxes( $this->seo_settings_page_hook, 'main_extra', null );
216
217
+ do_action( 'the_seo_framework_after_siteadmin_metaboxes', $this->seo_settings_page_hook );
218
?>
219
</div>
220
<div class="postbox-container-2">
221
<?php
222
+ do_action( 'the_seo_framework_before_siteadmin_metaboxes_side', $this->seo_settings_page_hook );
223
224
/**
225
* @TODO fill this in
226
* @priority low 2.9.0
227
*/
228
229
+ do_action( 'the_seo_framework_after_siteadmin_metaboxes_side', $this->seo_settings_page_hook );
230
?>
231
</div>
232
</div>
257
*
258
* @since 2.2.4
259
*/
260
+ $title = (bool) apply_filters( 'the_seo_framework_title_metabox', true );
261
+ $description = (bool) apply_filters( 'the_seo_framework_description_metabox', true );
262
+ $robots = (bool) apply_filters( 'the_seo_framework_robots_metabox', true );
263
+ $home = (bool) apply_filters( 'the_seo_framework_home_metabox', true );
264
+ $social = (bool) apply_filters( 'the_seo_framework_social_metabox', true );
265
+ $knowledge = (bool) apply_filters( 'the_seo_framework_knowledge_metabox', true );
266
+ $schema = (bool) apply_filters( 'the_seo_framework_schema_metabox', true );
267
+ $webmaster = (bool) apply_filters( 'the_seo_framework_webmaster_metabox', true );
268
+ $sitemap = (bool) apply_filters( 'the_seo_framework_sitemap_metabox', true );
269
+ $feed = (bool) apply_filters( 'the_seo_framework_feed_metabox', true );
270
271
//* Title Meta Box
272
if ( $title )
273
add_meta_box(
274
'autodescription-title-settings',
275
+ esc_html__( 'Title Settings', 'autodescription' ),
276
array( $this, 'title_metabox' ),
277
+ $this->seo_settings_page_hook,
278
+ 'main',
279
+ array()
280
);
281
282
//* Description Meta Box
283
if ( $description )
284
add_meta_box(
285
'autodescription-description-settings',
286
+ esc_html__( 'Description Meta Settings', 'autodescription' ),
287
array( $this, 'description_metabox' ),
288
+ $this->seo_settings_page_hook,
289
+ 'main',
290
+ array()
291
);
292
293
//* Home Page Meta Box
294
if ( $home )
295
add_meta_box(
296
'autodescription-homepage-settings',
297
+ esc_html__( 'Home Page Settings', 'autodescription' ),
298
array( $this, 'homepage_metabox' ),
299
+ $this->seo_settings_page_hook,
300
+ 'main',
301
+ array()
302
);
303
304
//* Social Meta Box
305
if ( $social )
306
add_meta_box(
307
'autodescription-social-settings',
308
+ esc_html__( 'Social Meta Settings', 'autodescription' ),
309
array( $this, 'social_metabox' ),
310
+ $this->seo_settings_page_hook,
311
+ 'main',
312
+ array()
313
);
314
315
//* Knowledge Graph Meta Box
316
if ( $knowledge )
317
add_meta_box(
318
'autodescription-knowledgegraph-settings',
319
+ esc_html__( 'Knowledge Graph Settings', 'autodescription' ),
320
array( $this, 'knowledge_metabox' ),
321
+ $this->seo_settings_page_hook,
322
+ 'main',
323
+ array()
324
);
325
326
//* Title Meta Box
327
if ( $schema )
328
add_meta_box(
329
'autodescription-schema-settings',
330
+ esc_html__( 'Schema Settings', 'autodescription' ),
331
array( $this, 'schema_metabox' ),
332
+ $this->seo_settings_page_hook,
333
+ 'main',
334
+ array()
335
);
336
337
//* Robots Meta Box
338
if ( $robots )
339
add_meta_box(
340
'autodescription-robots-settings',
341
+ esc_html__( 'Robots Meta Settings', 'autodescription' ),
342
array( $this, 'robots_metabox' ),
343
+ $this->seo_settings_page_hook,
344
+ 'main',
345
+ array()
346
);
347
348
//* Webmaster Meta Box
349
if ( $webmaster )
350
add_meta_box(
351
'autodescription-webmaster-settings',
352
+ esc_html__( 'Webmaster Meta Settings', 'autodescription' ),
353
array( $this, 'webmaster_metabox' ),
354
+ $this->seo_settings_page_hook,
355
+ 'main',
356
+ array()
357
);
358
359
//* Sitemaps Meta Box
360
if ( $sitemap )
361
add_meta_box(
362
'autodescription-sitemap-settings',
363
+ esc_html__( 'Sitemap Settings', 'autodescription' ),
364
array( $this, 'sitemaps_metabox' ),
365
+ $this->seo_settings_page_hook,
366
+ 'main',
367
+ array()
368
);
369
370
//* Feed Meta Box
371
if ( $feed )
372
add_meta_box(
373
'autodescription-feed-settings',
374
+ esc_html__( 'Feed Settings', 'autodescription' ),
375
array( $this, 'feed_metabox' ),
376
+ $this->seo_settings_page_hook,
377
+ 'main',
378
+ array()
379
);
380
381
}
389
public function admin() {
390
391
?>
392
+ <div class="wrap tsf-metaboxes">
393
<form method="post" action="options.php">
394
395
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
396
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
397
<?php settings_fields( $this->settings_field ); ?>
398
399
+ <div class="tsf-top-wrap">
400
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
401
+ <p class="tsf-top-buttons">
402
<?php
403
submit_button( $this->page_defaults['save_button_text'], 'primary', 'submit', false, array( 'id' => '' ) );
404
submit_button( $this->page_defaults['reset_button_text'], 'secondary autodescription-js-confirm-reset', $this->get_field_name( 'reset' ), false, array( 'id' => '' ) );
406
</p>
407
</div>
408
409
+ <?php do_action( "{$this->seo_settings_page_hook}_settings_page_boxes", $this->seo_settings_page_hook ); ?>
410
411
+ <div class="tsf-bottom-buttons">
412
<?php
413
submit_button( $this->page_defaults['save_button_text'], 'primary', 'submit', false, array( 'id' => '' ) );
414
submit_button( $this->page_defaults['reset_button_text'], 'secondary autodescription-js-confirm-reset', $this->get_field_name( 'reset' ), false, array( 'id' => '' ) );
423
// close postboxes that should be closed
424
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
425
// postboxes setup
426
+ postboxes.add_postbox_toggles('<?php echo esc_js( $this->seo_settings_page_hook ); ?>');
427
});
428
//]]>
429
</script>
440
*/
441
public function notices() {
442
443
+ if ( false === $this->is_seo_settings_page( true ) )
444
return;
445
446
if ( isset( $_REQUEST['settings-updated'] ) && 'true' === $_REQUEST['settings-updated'] )
447
+ $this->do_dismissible_notice( $this->page_defaults['saved_notice_text'], 'updated' );
448
elseif ( isset( $_REQUEST['reset'] ) && 'true' === $_REQUEST['reset'] )
449
+ $this->do_dismissible_notice( $this->page_defaults['reset_notice_text'], 'warning' );
450
elseif ( isset( $_REQUEST['error'] ) && 'true' === $_REQUEST['error'] )
451
+ $this->do_dismissible_notice( $this->page_defaults['error_notice_text'], 'error' );
452
elseif ( isset( $_REQUEST['seo-updated'] ) && 'true' === $_REQUEST['seo-updated'] )
453
+ $this->do_dismissible_notice( $this->page_defaults['plugin_update_text'], 'updated' );
454
455
}
456
473
* Echo constructed name attributes in form fields.
474
*
475
* @since 2.2.2
476
* @uses $this->get_field_name() Construct name attributes for use in form fields.
477
*
478
* @param string $name Field name base
479
*/
480
public function field_name( $name ) {
481
+ echo esc_attr( $this->get_field_name( $name ) );
482
}
483
484
/**
497
* Echo constructed id attributes in form fields.
498
*
499
* @since 2.2.2
500
* @uses $this->get_field_id() Constructs id attributes for use in form fields.
501
*
502
* @param string $id Field id base
506
public function field_id( $id, $echo = true ) {
507
508
if ( $echo ) {
509
+ echo esc_attr( $this->get_field_id( $id ) );
510
} else {
511
return $this->get_field_id( $id );
512
}
515
/**
516
* Helper function that returns a setting value from this form's settings
517
* field for use in form fields.
518
* Fetches blog option.
519
*
520
* @since 2.2.2
526
return $this->get_option( $key, $this->settings_field );
527
}
528
529
/**
530
* Echo a setting value from this form's settings field for use in form fields.
531
*
532
* @since 2.2.2
533
+ * @uses $this->get_field_value() Constructs value attributes for use in form fields.
534
*
535
* @param string $key Field key
536
*/
537
public function field_value( $key ) {
538
+ echo esc_attr( $this->get_field_value( $key ) );
539
}
540
541
/**
543
*
544
* @since 2.6.0
545
*
546
+ * @param string $input The input to wrap. Should already be escaped.
547
* @param bool $echo Whether to echo or return.
548
* @return Wrapped $input.
549
*/
550
public function wrap_fields( $input = '', $echo = false ) {
552
if ( is_array( $input ) )
553
$input = implode( "\r\n", $input );
554
555
+ if ( $echo ) {
556
+ echo '<div class="tsf-fields">' . "\r\n" . $input . "\r\n" . '</div>';
557
+ } else {
558
+ return '<div class="tsf-fields">' . "\r\n" . $input . "\r\n" . '</div>';
559
+ }
560
}
561
562
/**
563
* Return a chechbox wrapper.
564
*
565
* @since 2.6.0
566
+ * @since 2.7.0 Added escape parameter. Defaults to true.
567
*
568
* @param string $field_id The option ID. Must be within the Autodescription settings.
569
+ * @param string $label The checkbox description label.
570
* @param string $description Addition description to place beneath the checkbox.
571
+ * @param bool $escape Whether to escape the label and description.
572
* @return HTML checkbox output.
573
*/
574
+ public function make_checkbox( $field_id = '', $label = '', $description = '', $escape = true ) {
575
+
576
+ $description = $escape ? esc_html( $description ) : $description;
577
+ $label = $escape ? esc_html( $label ) : $label;
578
579
+ $description = $description ? '<p class="description tsf-option-spacer">' . $description . '</p>' : '';
580
581
+ $output = '<span class="tsf-toblock">'
582
. '<label for="' . $this->get_field_id( $field_id ) . '">'
583
. '<input '
584
. 'type="checkbox" '
605
* @param string $description The descriptive on-hover title.
606
* @param string $link The non-escaped link.
607
* @param bool $echo Whether to echo or return.
608
+ * @return HTML checkbox output if $echo is false.
609
*/
610
public function make_info( $description = '', $link = '', $echo = true ) {
611
612
+ if ( $link ) {
613
$output = '<a href="' . esc_url( $link ) . '" target="_blank" title="' . esc_attr( $description ) . '">[?]</a>';
614
+ } else {
615
$output = '<span title="' . esc_attr( $description ) . '">[?]</span>';
616
+ }
617
618
+ if ( $echo ) {
619
+ //* Already escaped.
620
echo $output;
621
+ } else {
622
return $output;
623
+ }
624
}
625
626
/**
630
*/
631
public function load_assets() {
632
//* Hook scripts method
633
+ add_action( "load-{$this->seo_settings_page_hook}", array( $this, 'metabox_scripts' ) );
634
}
635
636
/**
637
+ * Includes the necessary sortable metabox scripts.
638
*
639
* @since 2.2.2
640
*/
664
$default = $this->get_default_settings( $key, $setting );
665
666
if ( 1 === $default )
667
+ $class = 'tsf-default-selected';
668
669
if ( $echo ) {
670
+ if ( $wrap ) {
671
+ printf( 'class="%s"', esc_attr( $class ) );
672
+ } else {
673
+ echo esc_attr( $class );
674
+ }
675
} else {
676
if ( $wrap )
677
return sprintf( 'class="%s"', $class );
683
/**
684
* Returns the HTML class wrap for warning Checkbox options.
685
*
686
+ * @since 2.3.4
687
*
688
* @param string $key required The option name which returns boolean.
689
* @param string $setting optional The settings field
690
* @param bool $wrap optional output class="" or just the class name.
691
* @param bool $echo optional echo or return the output.
692
* @return string Empty on echo or The class with an optional wrapper.
693
*/
694
public function is_warning_checked( $key, $setting = '', $wrap = true, $echo = true ) {
698
$warned = $this->get_warned_settings( $key, $setting );
699
700
if ( 1 === $warned )
701
+ $class = 'tsf-warning-selected';
702
703
if ( $echo ) {
704
if ( $wrap ) {
705
+ printf( 'class="%s"', esc_attr( $class ) );
706
} else {
707
+ echo esc_attr( $class );
708
}
709
} else {
710
if ( $wrap )
749
750
if ( '' !== $default && '' !== $warned ) {
751
$class = $default . ' ' . $warned;
752
+ } elseif ( '' !== $default ) {
753
$class = $default;
754
+ } elseif ( '' !== $warned ) {
755
$class = $warned;
756
}
757
758
if ( $echo ) {
759
if ( $wrap ) {
760
+ printf( 'class="%s"', esc_attr( $class ) );
761
} else {
762
+ echo esc_attr( $class );
763
}
764
} else {
765
+ if ( $wrap )
766
return sprintf( 'class="%s"', $class );
767
+
768
+ return $class;
769
}
770
}
771
772
/**
773
* Returns the HTML class wrap for default radio options.
774
*
775
* @since 2.2.5
776
*
777
* @TODO use this
778
* @priority low 2.8.0+
779
*
780
+ * @param string $key required The option name which returns boolean.
781
+ * @param string $value required The option value which returns boolean.
782
+ * @param string $setting optional The settings field
783
+ * @param bool $wrap optional output class="" or just the class name.
784
+ * @param bool $echo optional echo or return the output.
785
* @return string|null the default selected class.
786
*/
787
public function is_default_radio( $key, $value, $setting = '', $wrap = true, $echo = true ) {
791
$default = $this->get_default_settings( $key, $setting );
792
793
if ( $value === $default )
794
+ $class = 'tsf-default-selected';
795
796
if ( $echo ) {
797
if ( $wrap ) {
798
+ echo sprintf( 'class="%s"', esc_attr( $class ) );
799
} else {
800
+ echo esc_attr( $class );
801
}
802
} else {
803
if ( $wrap )
806
return $class;
807
}
808
}
809
}
inc/classes/compat.class.php CHANGED
@@ -16,6 +16,8 @@
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/**
20
* Class AutoDescription_Compat
21
*
@@ -25,6 +27,18 @@
25
*/
26
class AutoDescription_Compat extends AutoDescription_Debug {
27
28
/**
29
* Constructor, load parent constructor
30
*/
@@ -41,12 +55,16 @@ class AutoDescription_Compat extends AutoDescription_Debug {
41
//* Jetpack compat.
42
add_action( 'init', array( $this, 'jetpack_compat' ) );
43
44
}
45
46
/**
47
* Adds Genesis SEO compatibility.
48
*
49
* @since 2.6.0
50
*/
51
public function genesis_compat() {
52
@@ -64,6 +82,7 @@ class AutoDescription_Compat extends AutoDescription_Debug {
64
* Removes the Genesis SEO meta boxes on the SEO Settings page
65
*
66
* @since 2.2.4
67
*
68
* @param array $plugins, overwritten as this filter will fire the
69
* detection, regardless of other SEO plugins.
@@ -85,7 +104,12 @@ class AutoDescription_Compat extends AutoDescription_Debug {
85
/**
86
* Adds compatibility with various JetPack modules.
87
*
88
* @since 2.6.0
89
*/
90
public function jetpack_compat() {
91
@@ -93,8 +117,21 @@ class AutoDescription_Compat extends AutoDescription_Debug {
93
//* Disable Jetpack Publicize's Open Graph.
94
add_filter( 'jetpack_enable_open_graph', '__return_false', 99 );
95
}
96
-
97
}
98
99
100
}
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
+ defined( 'ABSPATH' ) or die;
20
+
21
/**
22
* Class AutoDescription_Compat
23
*
27
*/
28
class AutoDescription_Compat extends AutoDescription_Debug {
29
30
+ /**
31
+ * Unserializing instances of this class is forbidden.
32
+ */
33
+ private function __wakeup() { }
34
+
35
+ /**
36
+ * Handle unapproachable invoked methods.
37
+ */
38
+ public function __call( $name, $arguments ) {
39
+ parent::__call( $name, $arguments );
40
+ }
41
+
42
/**
43
* Constructor, load parent constructor
44
*/
55
//* Jetpack compat.
56
add_action( 'init', array( $this, 'jetpack_compat' ) );
57
58
+ //* BuddyPress compat.
59
+ add_action( 'init', array( $this, 'buddypress_compat' ) );
60
+
61
}
62
63
/**
64
* Adds Genesis SEO compatibility.
65
*
66
* @since 2.6.0
67
+ * @access private
68
*/
69
public function genesis_compat() {
70
82
* Removes the Genesis SEO meta boxes on the SEO Settings page
83
*
84
* @since 2.2.4
85
+ * @access private
86
*
87
* @param array $plugins, overwritten as this filter will fire the
88
* detection, regardless of other SEO plugins.
104
/**
105
* Adds compatibility with various JetPack modules.
106
*
107
+ * Recently, JetPack made sure this filter doesn't run when The SEO Framework
108
+ * is active as they've added their own compatibility check towards this plugin.
109
+ * Let's wait until everyone has updated before removing this.
110
+ *
111
* @since 2.6.0
112
+ * @access private
113
*/
114
public function jetpack_compat() {
115
117
//* Disable Jetpack Publicize's Open Graph.
118
add_filter( 'jetpack_enable_open_graph', '__return_false', 99 );
119
}
120
}
121
122
+ /**
123
+ * Removes canonical URL from BuddyPress. Regardless of The SEO Framework settings.
124
+ *
125
+ * @since 2.7.0
126
+ * @access private
127
+ */
128
+ public function buddypress_compat() {
129
+
130
+ //* Nothing to do on admin.
131
+ if ( $this->is_admin() )
132
+ return;
133
134
+ remove_action( 'wp_head', '_bp_maybe_remove_rel_canonical', 8 );
135
+
136
+ }
137
}
inc/classes/core.class.php CHANGED
@@ -16,6 +16,8 @@
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/**
20
* Class AutoDescription_Core
21
*
@@ -25,6 +27,47 @@
25
*/
26
class AutoDescription_Core {
27
28
/**
29
* Constructor. Loads actions and filters.
30
* Latest Class. Doesn't have parent.
@@ -41,6 +84,38 @@ class AutoDescription_Core {
41
42
}
43
44
/**
45
* Proportionate dimensions based on Width and Height.
46
* AKA Aspect Ratio.
@@ -63,7 +138,7 @@ class AutoDescription_Core {
63
}
64
65
/**
66
- * Adds post type support
67
*
68
* Applies filters the_seo_framework_supported_post_types : The supported post types.
69
* @since 2.3.1
@@ -72,16 +147,14 @@ class AutoDescription_Core {
72
*/
73
public function post_type_support() {
74
75
- /**
76
- * Added product post type.
77
- *
78
- * @since 2.3.1
79
- */
80
$defaults = array(
81
- 'post', 'page',
82
'product',
83
- 'forum', 'topic',
84
- 'jetpack-testimonial', 'jetpack-portfolio',
85
);
86
87
$post_types = (array) apply_filters( 'the_seo_framework_supported_post_types', $defaults );
@@ -102,14 +175,14 @@ class AutoDescription_Core {
102
*/
103
public function plugin_action_links( $links = array() ) {
104
105
- $framework_links = array();
106
107
if ( $this->load_options )
108
- $framework_links['settings'] = '<a href="' . esc_url( admin_url( 'admin.php?page=' . $this->page_id ) ) . '">' . __( 'SEO Settings', 'autodescription' ) . '</a>';
109
110
- $framework_links['home'] = '<a href="'. esc_url( 'https://theseoframework.com/' ) . '" target="_blank">' . _x( 'Plugin Home', 'As in: The Plugin Home Page', 'autodescription' ) . '</a>';
111
112
- return array_merge( $framework_links, $links );
113
}
114
115
/**
@@ -130,23 +203,35 @@ class AutoDescription_Core {
130
}
131
132
/**
133
- * Generate dismissible notice.
134
- *
135
- * @param $message The notice message.
136
- * @param $type The notice type : 'updated', 'error', 'warning'
137
*
138
* @since 2.6.0
139
*/
140
- public function generate_dismissible_notice( $message = '', $type = 'updated' ) {
141
142
if ( empty( $message ) )
143
return '';
144
145
if ( 'warning' === $type )
146
$type = 'notice-warning';
147
148
- $notice = '<div class="notice ' . $type . ' seo-notice"><p>';
149
- $notice .= '<a class="hide-if-no-js autodescription-dismiss" title="' . __( 'Dismiss', 'AutoDescription' ) . '"></a>';
150
$notice .= '<strong>' . $message . '</strong>';
151
$notice .= '</p></div>';
152
@@ -154,35 +239,73 @@ class AutoDescription_Core {
154
}
155
156
/**
157
- * Mark up content with code tags.
158
*
159
* Escapes all HTML, so `<` gets changed to `&lt;` and displays correctly.
160
*
161
* @since 2.0.0
162
*
163
* @param string $content Content to be wrapped in code tags.
164
- *
165
* @return string Content wrapped in code tags.
166
*/
167
public function code_wrap( $content ) {
168
- return '<code>' . esc_html( $content ) . '</code>';
169
}
170
171
/**
172
* Mark up content with code tags.
173
- *
174
* Escapes no HTML.
175
*
176
* @since 2.2.2
177
*
178
* @param string $content Content to be wrapped in code tags.
179
- *
180
* @return string Content wrapped in code tags.
181
*/
182
public function code_wrap_noesc( $content ) {
183
return '<code>' . $content . '</code>';
184
}
185
186
/**
187
* Return custom field post meta data.
188
*
@@ -190,54 +313,42 @@ class AutoDescription_Core {
190
* blank or not set.
191
*
192
* @since 2.0.0
193
*
194
* @param string $field Custom field key.
195
* @param int $post_id The post ID
196
- *
197
* @return string|boolean Return value or false on failure.
198
- *
199
- * @thanks StudioPress (http://www.studiopress.com/) for some code.
200
- *
201
- * @staticvar array $field_cache
202
- * @since 2.2.5
203
*/
204
public function get_custom_field( $field, $post_id = null ) {
205
206
- //* No field has been provided.
207
- if ( empty( $field ) )
208
return false;
209
210
- //* Setup cache.
211
static $field_cache = array();
212
213
- //* Check field cache.
214
- if ( isset( $field_cache[$field][$post_id] ) )
215
- //* Field has been cached.
216
- return $field_cache[$field][$post_id];
217
218
- if ( null === $post_id || empty( $post_id ) )
219
$post_id = $this->get_the_real_ID();
220
221
- if ( null === $post_id || empty( $post_id ) )
222
- return '';
223
-
224
$custom_field = get_post_meta( $post_id, $field, true );
225
226
- // If custom field is empty, return null.
227
if ( empty( $custom_field ) )
228
- $field_cache[$field][$post_id] = '';
229
230
//* Render custom field, slashes stripped, sanitized if string
231
- $field_cache[$field][$post_id] = is_array( $custom_field ) ? stripslashes_deep( $custom_field ) : stripslashes( wp_kses_decode_entities( $custom_field ) );
232
233
- return $field_cache[$field][$post_id];
234
}
235
236
/**
237
* Google docs language determinator.
238
*
239
* @since 2.2.2
240
- *
241
* @staticvar string $language
242
*
243
* @return string language code
@@ -253,8 +364,8 @@ class AutoDescription_Core {
253
if ( isset( $language ) )
254
return $language;
255
256
- //* Language shorttag to be used in Google help pages,
257
- $language = _x( 'en', 'e.g. en for English, nl for Dutch, fi for Finish, de for German', 'autodescription' );
258
259
return $language;
260
}
@@ -262,10 +373,8 @@ class AutoDescription_Core {
262
/**
263
* Whether to allow external redirect through the 301 redirect option.
264
*
265
- * Applies filters the_seo_framework_allow_external_redirect : bool
266
- * @staticvar bool $allowed
267
- *
268
* @since 2.6.0
269
*
270
* @return bool Whether external redirect is allowed.
271
*/
@@ -276,6 +385,10 @@ class AutoDescription_Core {
276
if ( isset( $allowed ) )
277
return $allowed;
278
279
return $allowed = (bool) apply_filters( 'the_seo_framework_allow_external_redirect', true );
280
}
281
@@ -301,13 +414,12 @@ class AutoDescription_Core {
301
/**
302
* Object cache get wrapper.
303
*
304
* @param string $key The Object cache key.
305
* @param string $group The Object cache group.
306
* @param bool $force Whether to force an update of the local cache.
307
* @param bool $found Whether the key was found in the cache. Disambiguates a return of false, a storable value.
308
- *
309
- * @since 2.4.3
310
- *
311
* @return mixed wp_cache_get if object caching is allowed. False otherwise.
312
*/
313
public function object_cache_get( $key, $group = 'the_seo_framework', $force = false, &$found = null ) {
@@ -318,34 +430,6 @@ class AutoDescription_Core {
318
return false;
319
}
320
321
- /**
322
- * Faster way of doing an in_array search compared to default PHP behavior.
323
- * @NOTE only to show improvement with large arrays. Might slow down with small arrays.
324
- * @NOTE can't do type checks. Always assume the comparing value is a string.
325
- *
326
- * @since 2.5.2
327
- *
328
- * @param string|array $needle The needle(s) to search for
329
- * @param array $array The single dimensional array to search in.
330
- * @return bool true if value is in array.
331
- */
332
- public function in_array( $needle, $array ) {
333
-
334
- $array = array_flip( $array );
335
-
336
- if ( is_string( $needle ) ) {
337
- if ( isset( $array[$needle] ) )
338
- return true;
339
- } else if ( is_array( $needle ) ) {
340
- foreach ( $needle as $str ) {
341
- if ( isset( $array[$str] ) )
342
- return true;
343
- }
344
- }
345
-
346
- return false;
347
- }
348
-
349
/**
350
* Checks if the string input is exactly '1'.
351
*
@@ -432,10 +516,10 @@ class AutoDescription_Core {
432
433
static $lowercase = array();
434
435
- if ( isset( $lowercase[$noun] ) )
436
- return $lowercase[$noun];
437
438
- return $lowercase[$noun] = $this->check_wp_locale( 'de' ) ? $noun : strtolower( $noun );
439
}
440
441
/**
@@ -465,7 +549,7 @@ class AutoDescription_Core {
465
if ( $this->load_options ) {
466
//* Options are allowed to be loaded.
467
468
- $url = html_entity_decode( menu_page_url( $this->page_id, 0 ) );
469
470
return esc_url( $url );
471
}
@@ -481,7 +565,6 @@ class AutoDescription_Core {
481
*
482
* @param bool $guess : If true, the timezone will be guessed from the
483
* WordPress core gmt_offset option.
484
- *
485
* @return string|empty PHP Timezone String.
486
*/
487
public function get_timezone_string( $guess = false ) {
@@ -505,7 +588,6 @@ class AutoDescription_Core {
505
* @since 2.6.0
506
*
507
* @param int $offset The GMT offzet.
508
- *
509
* @return string PHP Timezone String.
510
*/
511
protected function get_tzstring_from_offset( $offset = 0 ) {
@@ -532,7 +614,6 @@ class AutoDescription_Core {
532
* @param string $tzstring Optional. The PHP Timezone string. Best to leave empty to always get a correct one.
533
* @link http://php.net/manual/en/timezones.php
534
* @param bool $reset Whether to reset to default. Ignoring first parameter.
535
- *
536
* @return bool True on success. False on failure.
537
*/
538
public function set_timezone( $tzstring = '', $reset = false ) {
@@ -565,4 +646,83 @@ class AutoDescription_Core {
565
return $this->set_timezone( '', true );
566
}
567
568
}
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
+ defined( 'ABSPATH' ) or die;
20
+
21
/**
22
* Class AutoDescription_Core
23
*
27
*/
28
class AutoDescription_Core {
29
30
+ /**
31
+ * Unserializing instances of this class is forbidden.
32
+ */
33
+ private function __wakeup() { }
34
+
35
+ /**
36
+ * Cloning of this class is forbidden.
37
+ */
38
+ private function __clone() { }
39
+
40
+ /**
41
+ * __get() deprecation handler.
42
+ * @since 2.7.0
43
+ * @return mixed $var The object variable.
44
+ */
45
+ public function __get( $name ) {
46
+
47
+ switch ( $name ) :
48
+ case 'pagehook' :
49
+ $this->_deprecated_function( 'the_seo_framework()->' . esc_html( $name ), '2.7.0', 'the_seo_framework()->seo_settings_page_hook' );
50
+ return $this->seo_settings_page_hook;
51
+ break;
52
+
53
+ default:
54
+ break;
55
+ endswitch;
56
+
57
+ //* Invoke default error.
58
+ return $this->$name;
59
+ }
60
+
61
+ /**
62
+ * Handle unapproachable invoked methods.
63
+ * @return void
64
+ */
65
+ public function __call( $name, $arguments ) {
66
+ $_this = the_seo_framework();
67
+ $_this->_inaccessible_p_or_m( 'the_seo_framework()->' . esc_html( $name ) . '()' );
68
+ return;
69
+ }
70
+
71
/**
72
* Constructor. Loads actions and filters.
73
* Latest Class. Doesn't have parent.
84
85
}
86
87
+ /**
88
+ * Fetches files based on input to reduce memory overhead.
89
+ * Passes on input vars.
90
+ *
91
+ * @param string $view The file name.
92
+ * @param array $args The arguments to be supplied within the file name.
93
+ * Each array key is converted to a variable with its value attached.
94
+ * @param string $instance The instance suffix to call back upon.
95
+ *
96
+ * @credits Akismet For some code.
97
+ */
98
+ protected function get_view( $view, array $args = array(), $instance = 'main' ) {
99
+
100
+ foreach ( $args as $key => $val )
101
+ $key = $val;
102
+
103
+ $file = THE_SEO_FRAMEWORK_DIR_PATH_VIEWS . $view . '.php';
104
+
105
+ include( $file );
106
+ }
107
+
108
+ /**
109
+ * Fetches view instance for switch.
110
+ *
111
+ * @param string $base The instance basename (namespace).
112
+ * @param string $instance The instance suffix to call back upon.
113
+ * @return string The file instance case.
114
+ */
115
+ protected function get_view_instance( $base, $instance = 'main' ) {
116
+ return $base . '_' . str_replace( '-', '_', $instance );
117
+ }
118
+
119
/**
120
* Proportionate dimensions based on Width and Height.
121
* AKA Aspect Ratio.
138
}
139
140
/**
141
+ * Adds post type support for The SEO Framework.
142
*
143
* Applies filters the_seo_framework_supported_post_types : The supported post types.
144
* @since 2.3.1
147
*/
148
public function post_type_support() {
149
150
$defaults = array(
151
+ 'post',
152
+ 'page',
153
'product',
154
+ 'forum',
155
+ 'topic',
156
+ 'jetpack-testimonial',
157
+ 'jetpack-portfolio',
158
);
159
160
$post_types = (array) apply_filters( 'the_seo_framework_supported_post_types', $defaults );
175
*/
176
public function plugin_action_links( $links = array() ) {
177
178
+ $tsf_links = array();
179
180
if ( $this->load_options )
181
+ $tsf_links['settings'] = '<a href="' . esc_url( admin_url( 'admin.php?page=' . $this->seo_settings_page_slug ) ) . '">' . esc_html__( 'SEO Settings', 'autodescription' ) . '</a>';
182
183
+ $tsf_links['home'] = '<a href="' . esc_url( 'https://theseoframework.com/' ) . '" target="_blank">' . esc_html_x( 'Plugin Home', 'As in: The Plugin Home Page', 'autodescription' ) . '</a>';
184
185
+ return array_merge( $tsf_links, $links );
186
}
187
188
/**
203
}
204
205
/**
206
+ * Generates dismissible notice.
207
+ * Also loads scripts and styles if out of The SEO Framework's context.
208
*
209
* @since 2.6.0
210
+ *
211
+ * @param string $message The notice message. Expected to be escaped if $escape is false.
212
+ * @param string $type The notice type : 'updated', 'error', 'warning'. Expected to be escaped.
213
+ * @param bool $a11y Whether to add an accessibility icon.
214
+ * @param bool $escape Whether to escape the whole output.
215
+ * @return string The dismissible error notice.
216
*/
217
+ public function generate_dismissible_notice( $message = '', $type = 'updated', $a11y = true, $escape = true ) {
218
219
if ( empty( $message ) )
220
return '';
221
222
+ if ( $escape )
223
+ $message = esc_html( $message );
224
+
225
+ //* Make sure the scripts are loaded.
226
+ $this->init_admin_scripts( true );
227
+
228
if ( 'warning' === $type )
229
$type = 'notice-warning';
230
231
+ $a11y = $a11y ? 'tsf-show-icon' : '';
232
+
233
+ $notice = '<div class="notice ' . esc_attr( $type ) . ' tsf-notice ' . $a11y . '"><p>';
234
+ $notice .= '<a class="hide-if-no-js tsf-dismiss" title="' . esc_attr__( 'Dismiss', 'AutoDescription' ) . '"></a>';
235
$notice .= '<strong>' . $message . '</strong>';
236
$notice .= '</p></div>';
237
239
}
240
241
/**
242
+ * Echos generated dismissible notice.
243
*
244
+ * @since 2.7.0
245
+ *
246
+ * @param $message The notice message. Expected to be escaped if $escape is false.
247
+ * @param $type The notice type : 'updated', 'error', 'warning'. Expected to be escaped.
248
+ * @param bool $a11y Whether to add an accessibility icon.
249
+ * @param bool $escape Whether to escape the whole output.
250
+ */
251
+ public function do_dismissible_notice( $message = '', $type = 'updated', $a11y = true, $escape = true ) {
252
+ echo $this->generate_dismissible_notice( $message, $type, $a11y, $escape );
253
+ }
254
+
255
+ /**
256
+ * Mark up content with code tags.
257
* Escapes all HTML, so `<` gets changed to `&lt;` and displays correctly.
258
*
259
* @since 2.0.0
260
*
261
* @param string $content Content to be wrapped in code tags.
262
* @return string Content wrapped in code tags.
263
*/
264
public function code_wrap( $content ) {
265
+ return $this->code_wrap_noesc( esc_html( $content ) );
266
}
267
268
/**
269
* Mark up content with code tags.