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 (56) 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 -3568
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$'] );
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$'] );
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.
 
270
  * Escapes no HTML.
271
  *
272
  * @since 2.2.2
273
  *
274
  * @param string $content Content to be wrapped in code tags.
 
275
  * @return string Content wrapped in code tags.
276
  */
277
  public function code_wrap_noesc( $content ) {
278
  return '<code>' . $content . '</code>';
279
  }
280
 
281
+ /**
282
+ * Mark up content in description wrap.
283
+ * Escapes all HTML, so `<` gets changed to `&lt;` and displays correctly.
284
+ *
285
+ * @since 2.7.0
286
+ *
287
+ * @param string $content Content to be wrapped in the description wrap.
288
+ * @param bool $block Whether to wrap the content in <p> tags.
289
+ * @return string Content wrapped int he description wrap.
290
+ */
291
+ public function description( $content, $block = true ) {
292
+ $this->description_noesc( esc_html( $content ), $block );
293
+ }
294
+
295
+ /**
296
+ * Mark up content in description wrap.
297
+ *
298
+ * @since 2.7.0
299
+ *
300
+ * @param string $content Content to be wrapped in the description wrap. Expected to be escaped.
301
+ * @param bool $block Whether to wrap the content in <p> tags.
302
+ * @return string Content wrapped int he description wrap.
303
+ */
304
+ public function description_noesc( $content, $block = true ) {
305
+ $output = '<span class="description">' . $content . '</span>';
306
+ echo $block ? '<p>' . $output . '</p>' : $output;
307
+ }
308
+
309
  /**
310
  * Return custom field post meta data.
311
  *
313
  * blank or not set.
314
  *
315
  * @since 2.0.0
316
+ * @staticvar array $field_cache
317
  *
318
  * @param string $field Custom field key.
319
  * @param int $post_id The post ID
 
320
  * @return string|boolean Return value or false on failure.
 
 
 
 
 
321
  */
322
  public function get_custom_field( $field, $post_id = null ) {
323
 
324
+ //* If field is falsy, get_post_meta() will return an array.
325
+ if ( ! $field )
326
  return false;
327
 
 
328
  static $field_cache = array();
329
 
330
+ if ( isset( $field_cache[ $field ][ $post_id ] ) )
331
+ return $field_cache[ $field ][ $post_id ];
 
 
332
 
333
+ if ( empty( $post_id ) )
334
  $post_id = $this->get_the_real_ID();
335
 
 
 
 
336
  $custom_field = get_post_meta( $post_id, $field, true );
337
 
338
+ //* If custom field is empty, empty cache..
339
  if ( empty( $custom_field ) )
340
+ $field_cache[ $field ][ $post_id ] = '';
341
 
342
  //* Render custom field, slashes stripped, sanitized if string
343
+ $field_cache[ $field ][ $post_id ] = is_array( $custom_field ) ? stripslashes_deep( $custom_field ) : stripslashes( wp_kses_decode_entities( $custom_field ) );
344
 
345
+ return $field_cache[ $field ][ $post_id ];
346
  }
347
 
348
  /**
349
  * Google docs language determinator.
350
  *
351
  * @since 2.2.2
 
352
  * @staticvar string $language
353
  *
354
  * @return string language code
364
  if ( isset( $language ) )
365
  return $language;
366
 
367
+ //* Language shorttag to be used in Google help pages.
368
+ $language = esc_html_x( 'en', 'e.g. en for English, nl for Dutch, fi for Finish, de for German', 'autodescription' );
369
 
370
  return $language;
371
  }
373
  /**
374
  * Whether to allow external redirect through the 301 redirect option.
375
  *
 
 
 
376
  * @since 2.6.0
377
+ * @staticvar bool $allowed
378
  *
379
  * @return bool Whether external redirect is allowed.
380
  */
385
  if ( isset( $allowed ) )
386
  return $allowed;
387
 
388
+ /**
389
+ * Applies filters the_seo_framework_allow_external_redirect : bool
390
+ * @since 2.1.0
391
+ */
392
  return $allowed = (bool) apply_filters( 'the_seo_framework_allow_external_redirect', true );
393
  }
394
 
414
  /**
415
  * Object cache get wrapper.
416
  *
417
+ * @since 2.4.3
418
+ *
419
  * @param string $key The Object cache key.
420
  * @param string $group The Object cache group.
421
  * @param bool $force Whether to force an update of the local cache.
422
  * @param bool $found Whether the key was found in the cache. Disambiguates a return of false, a storable value.
 
 
 
423
  * @return mixed wp_cache_get if object caching is allowed. False otherwise.
424
  */
425
  public function object_cache_get( $key, $group = 'the_seo_framework', $force = false, &$found = null ) {
430
  return false;
431
  }
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  /**
434
  * Checks if the string input is exactly '1'.
435
  *
516
 
517
  static $lowercase = array();
518
 
519
+ if ( isset( $lowercase[ $noun ] ) )
520
+ return $lowercase[ $noun ];
521
 
522
+ return $lowercase[ $noun ] = $this->check_wp_locale( 'de' ) ? $noun : strtolower( $noun );
523
  }
524
 
525
  /**
549
  if ( $this->load_options ) {
550
  //* Options are allowed to be loaded.
551
 
552
+ $url = html_entity_decode( menu_page_url( $this->seo_settings_page_slug, 0 ) );
553
 
554
  return esc_url( $url );
555
  }
565
  *
566
  * @param bool $guess : If true, the timezone will be guessed from the
567
  * WordPress core gmt_offset option.
 
568
  * @return string|empty PHP Timezone String.
569
  */
570
  public function get_timezone_string( $guess = false ) {
588
  * @since 2.6.0
589
  *
590
  * @param int $offset The GMT offzet.
 
591
  * @return string PHP Timezone String.
592
  */
593
  protected function get_tzstring_from_offset( $offset = 0 ) {
614
  * @param string $tzstring Optional. The PHP Timezone string. Best to leave empty to always get a correct one.
615
  * @link http://php.net/manual/en/timezones.php
616
  * @param bool $reset Whether to reset to default. Ignoring first parameter.
 
617
  * @return bool True on success. False on failure.
618
  */
619
  public function set_timezone( $tzstring = '', $reset = false ) {
646
  return $this->set_timezone( '', true );
647
  }
648
 
649
+ /**
650
+ * Converts time from GMT input to given format.
651
+ *
652
+ * @since 2.7.0
653
+ *
654
+ * @param string $format The datetime format.
655
+ * @param string $time The GMT time. Expects timezone to be omitted.
656
+ * @return string The converted time. Empty string if no $time is given.
657
+ */
658
+ public function gmt2date( $format = 'Y-m-d', $time = '' ) {
659
+
660
+ if ( $time )
661
+ return date( $format, strtotime( $time . ' GMT' ) );
662
+
663
+ return '';
664
+ }
665
+
666
+ /**
667
+ * Counts words encounters from input string.
668
+ * Case insensitive. Returns first encounter of each word if found multiple times.
669
+ *
670
+ * @since 2.7.0
671
+ *
672
+ * @param string $string Required. The string to count words in.
673
+ * @param int $amount Minimum amount of words to encounter in the string. Set to 0 to count all words longer than $bother_length.
674
+ * @param int $amount_bother Minimum amount of words to encounter in the string that fall under the $bother_length. Set to 0 to count all words shorter than $bother_length.
675
+ * @param int $bother_length The maximum string length of a word to pass for $amount_bother instead of $amount. Set to 0 to pass all words through $amount_bother
676
+ * @return array Containing arrays of words with their count.
677
+ */
678
+ public function get_word_count( $string, $amount = 3, $amount_bother = 5, $bother_length = 3 ) {
679
+
680
+ //* Convert string's special characters into PHP readable words.
681
+ $string = htmlentities( $string, ENT_COMPAT, 'UTF-8' );
682
+
683
+ //* Count the words. Because we've converted all characters to XHTML codes, the odd ones should be only numerical.
684
+ $words = str_word_count( strtolower( $string ), 2, '&#0123456789;' );
685
+
686
+ $words_too_many = array();
687
+
688
+ if ( is_array( $words ) ) {
689
+
690
+ /**
691
+ * Applies filters 'the_seo_framework_bother_me_desc_length' : int Min Character length to bother you with.
692
+ * @since 2.6.0
693
+ */
694
+ $bother_me_length = (int) apply_filters( 'the_seo_framework_bother_me_desc_length', $bother_length );
695
+
696
+ $word_count = array_count_values( $words );
697
+
698
+ //* Parse word counting.
699
+ if ( is_array( $word_count ) ) {
700
+ //* We're going to fetch words based on position, and then flip it to become the key.
701
+ $word_keys = array_flip( array_reverse( $words, true ) );
702
+
703
+ foreach ( $word_count as $word => $count ) {
704
+
705
+ if ( mb_strlen( html_entity_decode( $word ) ) < $bother_me_length ) {
706
+ $run = $count >= $amount_bother;
707
+ } else {
708
+ $run = $count >= $amount;
709
+ }
710
+
711
+ if ( $run ) {
712
+ //* The encoded word is longer or equal to the bother lenght.
713
+
714
+ $word_len = mb_strlen( $word );
715
+
716
+ $position = $word_keys[ $word ];
717
+ $first_encountered_word = mb_substr( $string, $position, $word_len );
718
+
719
+ //* Found words that are used too frequently.
720
+ $words_too_many[] = array( $first_encountered_word => $count );
721
+ }
722
+ }
723
+ }
724
+ }
725
+
726
+ return $words_too_many;
727
+ }
728
  }
inc/classes/debug.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_Debug
21
  *
@@ -39,10 +41,23 @@ class AutoDescription_Debug extends AutoDescription_Core {
39
  *
40
  * @since 2.6.5
41
  *
42
- * @var bool Whether to add to AutoDescription_Debug::debug_output.
 
43
  */
44
  protected $add_debug_output = true;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Constructor, load parent constructor and add actions.
48
  */
@@ -54,7 +69,6 @@ class AutoDescription_Debug extends AutoDescription_Core {
54
  add_action( 'admin_footer', array( $this, 'debug_output' ) );
55
  add_action( 'wp_footer', array( $this, 'debug_output' ) );
56
  }
57
-
58
  }
59
 
60
  /**
@@ -96,9 +110,11 @@ class AutoDescription_Debug extends AutoDescription_Core {
96
 
97
  if ( function_exists( '__' ) ) {
98
  if ( isset( $replacement ) )
 
99
  trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework! Use %3$s instead.', 'autodescription' ), $function, $version, $replacement ) );
100
  else
101
- trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework with no alternative available.' ), $function, $version ) );
 
102
  } else {
103
  if ( isset( $replacement ) )
104
  trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework! Use %3$s instead.', $function, $version, $replacement ) );
@@ -161,7 +177,6 @@ class AutoDescription_Debug extends AutoDescription_Core {
161
  'https://codex.wordpress.org/Debugging_in_WordPress'
162
  );
163
 
164
- /* translators: 1: Function name, 2: Message, 3: Plugin Version notification */
165
  trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
166
  }
167
 
@@ -169,6 +184,51 @@ class AutoDescription_Debug extends AutoDescription_Core {
169
  }
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /**
173
  * The SEO Framework error handler.
174
  *
@@ -224,10 +284,33 @@ class AutoDescription_Debug extends AutoDescription_Core {
224
  }
225
 
226
  /**
227
- * Echo's error.
228
  *
229
- * @access private
230
- * Please don't use this error handler.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  *
232
  * @since 2.6.0
233
  *
@@ -248,95 +331,35 @@ class AutoDescription_Debug extends AutoDescription_Core {
248
  }
249
 
250
  /**
251
- * Echo found screens in the admin footer when debugging is enabled.
252
  *
 
253
  * @uses bool $this->the_seo_framework_debug
254
- * @global array $current_screen
255
- *
256
  * @access private
257
- * @since 2.5.2
258
  */
259
  public function debug_screens() {
260
  global $current_screen;
261
 
262
- $this->debug_init( __CLASS__, __FUNCTION__, false, '', get_defined_vars() );
263
 
264
  }
265
 
266
  /**
267
  * Echos debug output.
268
  *
269
- * @access private
270
  * @since 2.6.0
 
271
  */
272
  public function debug_output() {
273
-
274
- if ( $this->debug_output ) {
275
- if ( $this->the_seo_framework_debug_hidden ) {
276
- echo "\r\n<!--\r\n:: THE SEO FRAMEWORK DEBUG :: \r\n" . $this->debug_output . "\r\n:: / THE SEO FRAMEWORK DEBUG ::\r\n-->\r\n";
277
- } else {
278
-
279
- $id = $this->get_the_real_ID();
280
- $mdash = ' &mdash; ';
281
- $term = $this->is_archive() ? $this->fetch_the_term( $id ) : '';
282
- $taxonomy = isset( $term->taxonomy ) ? $term->taxonomy : '';
283
-
284
- //* This will return 'Page' on all non-archive types (except the home page)
285
- $type = ! $this->is_archive() && $this->is_front_page( $id ) ? 'Front Page' : $this->get_the_term_name( $term );
286
- $cache_key = $this->generate_cache_key( $this->get_the_real_ID(), $taxonomy );
287
-
288
- if ( $this->is_admin() ) {
289
- ?>
290
- <div style="color:#444;font-family:Georgio,sans-serif;font-size:14px;clear:both;float:left;position:relative;width:calc( 100% - 200px );min-height:700px;padding:0;margin:20px 20px 40px 180px;overflow:hidden;border:1px solid #ccc;border-radius:3px;font:'Open Sans',sans-serif">
291
- <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom:2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">
292
- SEO Debug Information
293
- <?php
294
- if ( $this->is_post_edit() || $this->is_term_edit() ) :
295
- echo ' :: ';
296
- echo 'Type: ' . $type;
297
- echo $mdash . 'ID: ' . $id;
298
- echo $mdash . 'Cache key: ' . $cache_key;
299
- endif;
300
- ?>
301
- </h3>
302
- <div style="position:absolute;bottom:0;right:0;left:0;top:41px;margin:0;padding:0;background:#fff;border-radius:3px;overflow-x:hidden;">
303
- <?php echo $this->debug_header_output(); ?>
304
- <?php echo $this->debug_query_output(); ?>
305
- <?php echo $this->debug_output; ?>
306
- </div>
307
- </div>
308
- <?php
309
- } else {
310
- ?>
311
- <style type="text/css">.wp-ui-notification{color:#fff;background-color:#d54e21}.code.highlight{font-family:Consolas,Monaco,monospace;font-size:14px;}</style>
312
- <div style="color:#444;font-family:Georgio,sans-serif;font-size:14px;clear:both;float:left;position:relative;width:calc( 100% - 80px );min-height:700px;padding:0;margin:40px;overflow:hidden;border:1px solid #ccc;border-radius:3px;font:'Open Sans',sans-serif">
313
- <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom:2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">
314
- SEO Debug Information
315
- <?php
316
- echo ' :: ';
317
- echo 'Type: ' . $type;
318
- echo $mdash . 'ID: ' . $id;
319
- echo $mdash . 'Cache key: ' . $cache_key;
320
- ?>
321
- </h3>
322
- <div style="position:absolute;bottom:0;right:0;left:0;top:41px;margin:0;padding:0;background:#fff;border-radius:3px;overflow-x:hidden;">
323
- <?php echo $this->debug_header_output(); ?>
324
- <?php echo $this->debug_query_output(); ?>
325
- <?php echo $this->debug_output; ?>
326
- </div>
327
- </div>
328
- <?php
329
- }
330
- }
331
- }
332
-
333
  }
334
 
335
  /**
336
  * Parses input values and wraps them in human-readable elements.
337
  *
338
- * @access private
339
  * @since 2.6.0
 
340
  *
341
  * @param mixed $values Values to be parsed.
342
  * @return string $output The parsed value.
@@ -348,7 +371,7 @@ class AutoDescription_Debug extends AutoDescription_Core {
348
  if ( $this->the_seo_framework_debug ) {
349
 
350
  $output .= "\r\n";
351
- $output .= $this->the_seo_framework_debug_hidden ? '' : '<span class="code highlight">';
352
 
353
  if ( is_null( $values ) ) {
354
  $output .= $this->debug_value_wrapper( "Debug message: Value isn't set." ) . "\r\n";
@@ -383,15 +406,15 @@ class AutoDescription_Debug extends AutoDescription_Core {
383
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
384
  $output .= $this->debug_value_wrapper( "''" );
385
  $output .= "\r\n";
386
- } else if ( is_string( $value ) || is_int( $value ) ) {
387
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
388
  $output .= $this->debug_value_wrapper( $value );
389
  $output .= "\r\n";
390
- } else if ( is_bool( $value ) ) {
391
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
392
  $output .= $this->debug_value_wrapper( $value ? 'true' : 'false' );
393
  $output .= "\r\n";
394
- } else if ( is_array( $value ) ) {
395
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
396
  $output .= "Array[\r\n";
397
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<p style="margin:0;padding-left:12px">';
@@ -400,13 +423,13 @@ class AutoDescription_Debug extends AutoDescription_Core {
400
  if ( '' === $v ) {
401
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
402
  $output .= $this->debug_value_wrapper( "''" );
403
- } else if ( is_string( $v ) || is_int( $v ) ) {
404
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
405
  $output .= $this->debug_value_wrapper( $v );
406
- } else if ( is_bool( $v ) ) {
407
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
408
  $output .= $this->debug_value_wrapper( $v ? 'true' : 'false' );
409
- } else if ( is_array( $v ) ) {
410
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
411
  $output .= $this->debug_value_wrapper( 'Debug message: Three+ dimensional array' );
412
  } else {
@@ -418,7 +441,7 @@ class AutoDescription_Debug extends AutoDescription_Core {
418
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<br>';
419
  }
420
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</p>';
421
- $output .= "]";
422
  } else {
423
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
424
  $output .= $this->debug_value_wrapper( $value );
@@ -427,13 +450,13 @@ class AutoDescription_Debug extends AutoDescription_Core {
427
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<br>';
428
  }
429
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
430
- } else if ( '' === $values ) {
431
  $output .= "\t\t";
432
  $output .= $this->debug_value_wrapper( "''" );
433
- } else if ( is_string( $values ) || is_int( $values ) ) {
434
  $output .= "\t\t";
435
  $output .= $this->debug_value_wrapper( $values );
436
- } else if ( is_bool( $values ) ) {
437
  $output .= "\t\t";
438
  $output .= $this->debug_value_wrapper( $values ? 'true' : 'false' );
439
  } else {
@@ -462,9 +485,9 @@ class AutoDescription_Debug extends AutoDescription_Core {
462
  public function debug_key_wrapper( $key, $ignore = false ) {
463
 
464
  if ( $ignore || false === $this->the_seo_framework_debug_hidden )
465
- return '<font color="chucknorris">' . esc_attr( (string) $key ) . '</font>';
466
 
467
- return esc_attr( (string) $key );
468
  }
469
 
470
  /**
@@ -487,9 +510,9 @@ class AutoDescription_Debug extends AutoDescription_Core {
487
  return html_entity_decode( $value );
488
 
489
  if ( $ignore || false === $this->the_seo_framework_debug_hidden )
490
- return '<span class="wp-ui-notification">' . esc_attr( (string) trim( $value ) ) . '</span>';
491
 
492
- return esc_attr( (string) $value );
493
  }
494
 
495
  /**
@@ -499,28 +522,27 @@ class AutoDescription_Debug extends AutoDescription_Core {
499
  *
500
  * @access private
501
  *
502
- * @param string $class The class name.
503
  * @param string $method The function name.
504
  * @param bool $store Whether to store the output in cache for next run to pick up on.
505
  * @param double $debug_key Use $debug_key as variable, it's reserved.
506
  * @param mixed function args.
507
  * @return void early if debugging is disabled or when storing cache values.
508
  */
509
- protected function debug_init( $class, $method, $store, $debug_key ) {
510
 
511
  if ( false === $this->the_seo_framework_debug || false === $this->add_debug_output )
512
  return;
513
 
514
  $output = '';
515
 
516
- if ( func_num_args() >= 5 ) {
517
 
518
  //* Cache the args for $store.
519
  static $cached_args = array();
520
  static $hold_args = array();
521
 
522
- $args = array_slice( func_get_args(), 4 );
523
- $key = $class . '_' . $method . '_' . $debug_key;
524
 
525
  if ( $store ) {
526
  $this->profile( false, false, 'time', $key ) . ' seconds';
@@ -528,8 +550,8 @@ class AutoDescription_Debug extends AutoDescription_Core {
528
 
529
  unset( $args[0]['debug_key'] );
530
 
531
- $cached_args[$class][$method] = $args;
532
- $hold_args[$class][$method] = $args;
533
  return;
534
  } else {
535
 
@@ -545,43 +567,39 @@ class AutoDescription_Debug extends AutoDescription_Core {
545
 
546
  if ( $this->is_admin() && 'admin_footer' !== current_action() ) {
547
  echo "\r\n";
548
- echo $this->the_seo_framework_debug_hidden ? $debug_key . ' action. ' : '<p>' . $debug_key . '</p>';
549
  }
550
 
551
  $output .= "\r\n";
552
- $output .= $this->the_seo_framework_debug_hidden ? $debug_key . ' output. ' : '<h3>' . $debug_key . '</h3>';
553
 
554
- if ( isset( $cached_args[$class][$method] ) ) {
555
  $args[] = array(
556
  'profile' => array(
557
  'time' => $this->profile( false, true, 'time', $key ) . ' seconds',
558
- 'memory' => $this->profile( false, true, 'memory', $key ) . ' bytes'
559
- )
560
  );
561
 
562
- $args = array_merge( $cached_args[$class][$method], $args );
563
 
564
  //* Reset args for next run.
565
- $cached_args[$class][$method] = null;
566
  }
567
  }
568
 
569
  if ( $args ) {
570
 
571
- if ( $class ) {
572
- $output .= $class . '::' . $method . '( ';
573
- } else {
574
- $output .= $method . '( ';
575
- }
576
 
577
- if ( isset( $hold_args[$class][$method][0] ) ) {
578
- if ( is_array( $hold_args[$class][$method][0] ) ) {
579
- foreach ( $hold_args[$class][$method][0] as $var => $a ) {
580
  $output .= gettype( $a ) . ' $' . $var . ', ';
581
  }
582
  }
583
  $output = rtrim( $output, ', ' );
584
- $hold_args[$class][$method] = null;
585
  }
586
 
587
  $output .= ' )';
@@ -597,7 +615,7 @@ class AutoDescription_Debug extends AutoDescription_Core {
597
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<div style="padding-left:12px">';
598
  $output .= "\t\t" . $this->get_debug_information( $v );
599
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
600
- $output .= "\t " . ']' . "\r\n";
601
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
602
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
603
  }
@@ -632,7 +650,6 @@ class AutoDescription_Debug extends AutoDescription_Core {
632
  $this->debug_output .= $output;
633
  $this->debug_output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
634
  }
635
-
636
  }
637
 
638
  /**
@@ -658,26 +675,26 @@ class AutoDescription_Debug extends AutoDescription_Core {
658
  static $plugin_time = array();
659
  static $plugin_memory = array();
660
 
661
- $timer_start[$key] = isset( $timer_start[$key] ) ? $timer_start[$key] : 0;
662
- $memory_start[$key] = isset( $memory_start[$key] ) ? $memory_start[$key] : 0;
663
- $plugin_time[$key] = isset( $plugin_time[$key] ) ? $plugin_time[$key] : 0;
664
- $plugin_memory[$key] = isset( $plugin_memory[$key] ) ? $plugin_memory[$key] : 0;
665
 
666
  //* Get now.
667
  $time_now = microtime( true );
668
  $memory_usage_now = memory_get_usage();
669
 
670
  //* Calculate difference.
671
- $difference_time = $time_now - $timer_start[$key];
672
- $difference_memory = $memory_usage_now - $memory_start[$key];
673
 
674
  //* Add difference to total.
675
- $plugin_time[$key] = $plugin_time[$key] + $difference_time;
676
- $plugin_memory[$key] = $plugin_memory[$key] + $difference_memory;
677
 
678
  //* Reset timer and memory
679
- $timer_start[$key] = $time_now;
680
- $memory_start[$key] = $memory_usage_now;
681
 
682
  if ( $from_last ) {
683
  if ( false === $echo ) {
@@ -695,14 +712,14 @@ class AutoDescription_Debug extends AutoDescription_Core {
695
  if ( false === $echo ) {
696
  //* Return early if not allowed to echo.
697
  if ( 'time' === $what )
698
- return number_format( $plugin_time[$key], 5 );
699
 
700
  return $plugin_memory[$key];
701
  }
702
 
703
  //* Convert to string and echo if not returned yet.
704
- echo (string) "\r\n" . $plugin_time[$key] . "s\r\n";
705
- echo (string) ( $plugin_memory[$key] / 1024 ) . "kiB\r\n";
706
  }
707
 
708
  }
@@ -739,10 +756,10 @@ class AutoDescription_Debug extends AutoDescription_Core {
739
  */
740
  protected function debug_header_output() {
741
 
742
- if ( $this->is_admin() && ! $this->is_term_edit() && ! $this->is_post_edit() && ! $this->is_seo_settings_page() )
743
  return;
744
 
745
- if ( $this->is_seo_settings_page() )
746
  add_filter( 'the_seo_framework_current_object_id', array( $this, 'get_the_front_page_ID' ) );
747
 
748
  //* Start timer.
@@ -787,7 +804,7 @@ class AutoDescription_Debug extends AutoDescription_Core {
787
 
788
  //* Escape it, replace EOL with breaks, and style everything between quotes (which are ending with space).
789
  $output = str_replace( PHP_EOL, '<br>' . PHP_EOL, esc_html( $output ) );
790
- $output = preg_replace( "/(&quot;.*?&quot;)(\s)/", '<font color="arnoldschwarzenegger">$1</font> ', $output );
791
 
792
  $output = '<div style="display:inline-block;width:100%;padding:20px;font-family:Consolas,Monaco,monospace;font-size:14px;">' . $output . '</div>';
793
  $output = '<div style="display:block;width:100%;background:#23282D;color:#ddd;border-bottom:1px solid #ccc">' . $title . $timer . $output . '</div>';
@@ -810,6 +827,8 @@ class AutoDescription_Debug extends AutoDescription_Core {
810
  //* Don't register this output.
811
  $this->add_debug_output = false;
812
 
 
 
813
  //* Only get true/false values.
814
  $is_404 = $this->is_404();
815
  $is_admin = $this->is_admin();
@@ -829,6 +848,8 @@ class AutoDescription_Debug extends AutoDescription_Core {
829
  $is_home = $this->is_home();
830
  $is_month = $this->is_month();
831
  $is_page = $this->is_page();
 
 
832
  $is_preview = $this->is_preview();
833
  $is_search = $this->is_search();
834
  $is_single = $this->is_single();
@@ -840,7 +861,7 @@ class AutoDescription_Debug extends AutoDescription_Core {
840
  $is_wc_shop = $this->is_wc_shop();
841
  $is_wc_product = $this->is_wc_product();
842
  $is_year = $this->is_year();
843
- $is_seo_settings_page = $this->is_seo_settings_page();
844
 
845
  //* Get all above vars, split them in two (true and false) and sort them by key names.
846
  $vars = get_defined_vars();
@@ -854,10 +875,12 @@ class AutoDescription_Debug extends AutoDescription_Core {
854
  $output = '';
855
  foreach ( $current as $name => $value ) {
856
  $type = '(' . gettype( $value ) . ')';
857
- if ( is_bool( $value ) )
 
858
  $value = $value ? 'true' : 'false';
859
- else
860
  $value = esc_attr( var_export( $value, true ) );
 
861
 
862
  $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>';
863
  $out = $name . ' => ' . $value;
@@ -866,10 +889,12 @@ class AutoDescription_Debug extends AutoDescription_Core {
866
 
867
  foreach ( $not_current as $name => $value ) {
868
  $type = '(' . gettype( $value ) . ')';
869
- if ( is_bool( $value ) )
 
870
  $value = $value ? 'true' : 'false';
871
- else
872
  $value = esc_attr( var_export( $value, true ) );
 
873
 
874
  $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>';
875
  $out = $name . ' => ' . $value;
@@ -886,5 +911,4 @@ class AutoDescription_Debug extends AutoDescription_Core {
886
 
887
  return $output;
888
  }
889
-
890
  }
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_Debug
23
  *
41
  *
42
  * @since 2.6.5
43
  *
44
+ * @var bool Whether to continue adding to AutoDescription_Debug::debug_output
45
+ * within AutoDescription_Debug::debug_init().
46
  */
47
  protected $add_debug_output = true;
48
 
49
+ /**
50
+ * Unserializing instances of this class is forbidden.
51
+ */
52
+ private function __wakeup() { }
53
+
54
+ /**
55
+ * Handle unapproachable invoked methods.
56
+ */
57
+ public function __call( $name, $arguments ) {
58
+ parent::__call( $name, $arguments );
59
+ }
60
+
61
  /**
62
  * Constructor, load parent constructor and add actions.
63
  */
69
  add_action( 'admin_footer', array( $this, 'debug_output' ) );
70
  add_action( 'wp_footer', array( $this, 'debug_output' ) );
71
  }
 
72
  }
73
 
74
  /**
110
 
111
  if ( function_exists( '__' ) ) {
112
  if ( isset( $replacement ) )
113
+ /* translators: 1: Function name, 2: Plugin Version notification, 3: Replacement function */
114
  trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework! Use %3$s instead.', 'autodescription' ), $function, $version, $replacement ) );
115
  else
116
+ /* translators: 1: Function name, 2: Plugin Version notification */
117
+ trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework with no alternative available.', 'autodescription' ), $function, $version ) );
118
  } else {
119
  if ( isset( $replacement ) )
120
  trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework! Use %3$s instead.', $function, $version, $replacement ) );
177
  'https://codex.wordpress.org/Debugging_in_WordPress'
178
  );
179
 
 
180
  trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
181
  }
182
 
184
  }
185
  }
186
 
187
+ /**
188
+ * Mark a property or method inaccessible when it has been used.
189
+
190
+ * The current behavior is to trigger a user error if WP_DEBUG is true.
191
+ *
192
+ * @since 2.7.0
193
+ * @access private
194
+ *
195
+ * @param string $p_or_m The Property or Method.
196
+ * @param string $message A message explaining what has been done incorrectly.
197
+ */
198
+ public function _inaccessible_p_or_m( $p_or_m, $message = '' ) {
199
+
200
+ /**
201
+ * Fires when the inaccessible property or method is being used.
202
+ *
203
+ * @since 2.7.0
204
+ *
205
+ * @param string $p_or_m The Property or Method.
206
+ * @param string $message A message explaining what has been done incorrectly.
207
+ */
208
+ do_action( 'the_seo_framework_inaccessible_p_or_m_run', $p_or_m, $message );
209
+
210
+ /**
211
+ * Filter whether to trigger an error for _doing_it_wrong() calls.
212
+ *
213
+ * @since 3.1.0
214
+ *
215
+ * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
216
+ */
217
+ if ( WP_DEBUG && apply_filters( 'the_seo_framework_inaccessible_p_or_m_trigger_error', true ) ) {
218
+
219
+ set_error_handler( array( $this, 'error_handler_inaccessible_call' ) );
220
+
221
+ if ( function_exists( '__' ) ) {
222
+ /* translators: 1: Method or Property name, 2: Message */
223
+ trigger_error( sprintf( __( '%1$s is not <strong>accessible</strong>. %2$s', 'autodescription' ), $p_or_m, $message ) );
224
+ } else {
225
+ trigger_error( sprintf( '%s is not <strong>accessible</strong>. %s', $p_or_m, $message ) );
226
+ }
227
+
228
+ restore_error_handler();
229
+ }
230
+ }
231
+
232
  /**
233
  * The SEO Framework error handler.
234
  *
284
  }
285
 
286
  /**
287
+ * The SEO Framework error handler.
288
  *
289
+ * Only handles notices.
290
+ * @see E_USER_NOTICE
291
+ *
292
+ * @since 2.6.0
293
+ *
294
+ * @param int Error handling code.
295
+ * @param string The error message.
296
+ */
297
+ protected function error_handler_inaccessible_call( $code, $message ) {
298
+
299
+ if ( $code >= 1024 && isset( $message ) ) {
300
+
301
+ $backtrace = debug_backtrace();
302
+ /**
303
+ * 0 = This function. 1 = Debug function. 2 = debug function. 3-29 = 26 classes loop, 30 = user call.
304
+ */
305
+ $error = $backtrace[30];
306
+
307
+ $this->error_handler( $error, $message );
308
+ }
309
+
310
+ }
311
+
312
+ /**
313
+ * Echos error.
314
  *
315
  * @since 2.6.0
316
  *
331
  }
332
 
333
  /**
334
+ * Echos found screens in the admin footer when debugging is enabled.
335
  *
336
+ * @since 2.5.2
337
  * @uses bool $this->the_seo_framework_debug
 
 
338
  * @access private
339
+ * @global object $current_screen
340
  */
341
  public function debug_screens() {
342
  global $current_screen;
343
 
344
+ $this->debug_init( __METHOD__, false, '', get_defined_vars() );
345
 
346
  }
347
 
348
  /**
349
  * Echos debug output.
350
  *
 
351
  * @since 2.6.0
352
+ * @access private
353
  */
354
  public function debug_output() {
355
+ $this->get_view( 'debug/output' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  }
357
 
358
  /**
359
  * Parses input values and wraps them in human-readable elements.
360
  *
 
361
  * @since 2.6.0
362
+ * @access private
363
  *
364
  * @param mixed $values Values to be parsed.
365
  * @return string $output The parsed value.
371
  if ( $this->the_seo_framework_debug ) {
372
 
373
  $output .= "\r\n";
374
+ $output .= $this->the_seo_framework_debug_hidden ? '' : '<span class="code highlight">';
375
 
376
  if ( is_null( $values ) ) {
377
  $output .= $this->debug_value_wrapper( "Debug message: Value isn't set." ) . "\r\n";
406
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
407
  $output .= $this->debug_value_wrapper( "''" );
408
  $output .= "\r\n";
409
+ } elseif ( is_string( $value ) || is_int( $value ) ) {
410
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
411
  $output .= $this->debug_value_wrapper( $value );
412
  $output .= "\r\n";
413
+ } elseif ( is_bool( $value ) ) {
414
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
415
  $output .= $this->debug_value_wrapper( $value ? 'true' : 'false' );
416
  $output .= "\r\n";
417
+ } elseif ( is_array( $value ) ) {
418
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
419
  $output .= "Array[\r\n";
420
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<p style="margin:0;padding-left:12px">';
423
  if ( '' === $v ) {
424
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
425
  $output .= $this->debug_value_wrapper( "''" );
426
+ } elseif ( is_string( $v ) || is_int( $v ) ) {
427
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
428
  $output .= $this->debug_value_wrapper( $v );
429
+ } elseif ( is_bool( $v ) ) {
430
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
431
  $output .= $this->debug_value_wrapper( $v ? 'true' : 'false' );
432
+ } elseif ( is_array( $v ) ) {
433
  $output .= $this->debug_key_wrapper( $k ) . ' => ';
434
  $output .= $this->debug_value_wrapper( 'Debug message: Three+ dimensional array' );
435
  } else {
441
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<br>';
442
  }
443
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</p>';
444
+ $output .= ']';
445
  } else {
446
  $output .= $this->debug_key_wrapper( $key ) . ' => ';
447
  $output .= $this->debug_value_wrapper( $value );
450
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<br>';
451
  }
452
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
453
+ } elseif ( '' === $values ) {
454
  $output .= "\t\t";
455
  $output .= $this->debug_value_wrapper( "''" );
456
+ } elseif ( is_string( $values ) || is_int( $values ) ) {
457
  $output .= "\t\t";
458
  $output .= $this->debug_value_wrapper( $values );
459
+ } elseif ( is_bool( $values ) ) {
460
  $output .= "\t\t";
461
  $output .= $this->debug_value_wrapper( $values ? 'true' : 'false' );
462
  } else {
485
  public function debug_key_wrapper( $key, $ignore = false ) {
486
 
487
  if ( $ignore || false === $this->the_seo_framework_debug_hidden )
488
+ return '<font color="chucknorris">' . esc_attr( $key ) . '</font>';
489
 
490
+ return esc_attr( $key );
491
  }
492
 
493
  /**
510
  return html_entity_decode( $value );
511
 
512
  if ( $ignore || false === $this->the_seo_framework_debug_hidden )
513
+ return '<span class="wp-ui-notification">' . esc_attr( trim( $value ) ) . '</span>';
514
 
515
+ return esc_attr( $value );
516
  }
517
 
518
  /**
522
  *
523
  * @access private
524
  *
 
525
  * @param string $method The function name.
526
  * @param bool $store Whether to store the output in cache for next run to pick up on.
527
  * @param double $debug_key Use $debug_key as variable, it's reserved.
528
  * @param mixed function args.
529
  * @return void early if debugging is disabled or when storing cache values.
530
  */
531
+ protected function debug_init( $method, $store, $debug_key ) {
532
 
533
  if ( false === $this->the_seo_framework_debug || false === $this->add_debug_output )
534
  return;
535
 
536
  $output = '';
537
 
538
+ if ( func_num_args() >= 4 ) {
539
 
540
  //* Cache the args for $store.
541
  static $cached_args = array();
542
  static $hold_args = array();
543
 
544
+ $args = array_slice( func_get_args(), 3 );
545
+ $key = $method . '_' . $debug_key;
546
 
547
  if ( $store ) {
548
  $this->profile( false, false, 'time', $key ) . ' seconds';
550
 
551
  unset( $args[0]['debug_key'] );
552
 
553
+ $cached_args[ $method ] = $args;
554
+ $hold_args[ $method ] = $args;
555
  return;
556
  } else {
557
 
567
 
568
  if ( $this->is_admin() && 'admin_footer' !== current_action() ) {
569
  echo "\r\n";
570
+ echo $this->the_seo_framework_debug_hidden ? esc_html( $debug_key ) . ' action. ' : '<p>' . esc_html( $debug_key ) . '</p>';
571
  }
572
 
573
  $output .= "\r\n";
574
+ $output .= $this->the_seo_framework_debug_hidden ? esc_html( $debug_key ) . ' output. ' : '<h3>' . esc_html( $debug_key ) . '</h3>';
575
 
576
+ if ( isset( $cached_args[ $method ] ) ) {
577
  $args[] = array(
578
  'profile' => array(
579
  'time' => $this->profile( false, true, 'time', $key ) . ' seconds',
580
+ 'memory' => $this->profile( false, true, 'memory', $key ) . ' bytes',
581
+ ),
582
  );
583
 
584
+ $args = array_merge( $cached_args[ $method ], $args );
585
 
586
  //* Reset args for next run.
587
+ $cached_args[ $method ] = null;
588
  }
589
  }
590
 
591
  if ( $args ) {
592
 
593
+ $output .= $method . '( ';
 
 
 
 
594
 
595
+ if ( isset( $hold_args[ $method ][0] ) ) {
596
+ if ( is_array( $hold_args[ $method ][0] ) ) {
597
+ foreach ( $hold_args[ $method ][0] as $var => $a ) {
598
  $output .= gettype( $a ) . ' $' . $var . ', ';
599
  }
600
  }
601
  $output = rtrim( $output, ', ' );
602
+ $hold_args[ $method ] = null;
603
  }
604
 
605
  $output .= ' )';
615
  $output .= $this->the_seo_framework_debug_hidden ? '' : '<div style="padding-left:12px">';
616
  $output .= "\t\t" . $this->get_debug_information( $v );
617
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
618
+ $output .= "\t " . ']' . "\r\n";
619
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
620
  $output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
621
  }
650
  $this->debug_output .= $output;
651
  $this->debug_output .= $this->the_seo_framework_debug_hidden ? '' : '</div>';
652
  }
 
653
  }
654
 
655
  /**
675
  static $plugin_time = array();
676
  static $plugin_memory = array();
677
 
678
+ $timer_start[ $key ] = isset( $timer_start[ $key ] ) ? $timer_start[ $key ] : 0;
679
+ $memory_start[ $key ] = isset( $memory_start[ $key ] ) ? $memory_start[ $key ] : 0;
680
+ $plugin_time[ $key ] = isset( $plugin_time[ $key ] ) ? $plugin_time[ $key ] : 0;
681
+ $plugin_memory[ $key ] = isset( $plugin_memory[ $key ] ) ? $plugin_memory[ $key ] : 0;
682
 
683
  //* Get now.
684
  $time_now = microtime( true );
685
  $memory_usage_now = memory_get_usage();
686
 
687
  //* Calculate difference.
688
+ $difference_time = $time_now - $timer_start[ $key ];
689
+ $difference_memory = $memory_usage_now - $memory_start[ $key ];
690
 
691
  //* Add difference to total.
692
+ $plugin_time[ $key ] = $plugin_time[ $key ] + $difference_time;
693
+ $plugin_memory[ $key ] = $plugin_memory[ $key ] + $difference_memory;
694
 
695
  //* Reset timer and memory
696
+ $timer_start[ $key ] = $time_now;
697
+ $memory_start[ $key ] = $memory_usage_now;
698
 
699
  if ( $from_last ) {
700
  if ( false === $echo ) {
712
  if ( false === $echo ) {
713
  //* Return early if not allowed to echo.
714
  if ( 'time' === $what )
715
+ return number_format( $plugin_time[ $key ], 5 );
716
 
717
  return $plugin_memory[$key];
718
  }
719
 
720
  //* Convert to string and echo if not returned yet.
721
+ echo (string) "\r\n" . $plugin_time[ $key ] . "s\r\n";
722
+ echo (string) ( $plugin_memory[ $key ] / 1024 ) . "kiB\r\n";
723
  }
724
 
725
  }
756
  */
757
  protected function debug_header_output() {
758
 
759
+ if ( $this->is_admin() && ! $this->is_term_edit() && ! $this->is_post_edit() && ! $this->is_seo_settings_page( true ) )
760
  return;
761
 
762
+ if ( $this->is_seo_settings_page( true ) )
763
  add_filter( 'the_seo_framework_current_object_id', array( $this, 'get_the_front_page_ID' ) );
764
 
765
  //* Start timer.
804
 
805
  //* Escape it, replace EOL with breaks, and style everything between quotes (which are ending with space).
806
  $output = str_replace( PHP_EOL, '<br>' . PHP_EOL, esc_html( $output ) );
807
+ $output = preg_replace( '/(&quot;.*?&quot;)(\s)/', '<font color="arnoldschwarzenegger">$1</font> ', $output );
808
 
809
  $output = '<div style="display:inline-block;width:100%;padding:20px;font-family:Consolas,Monaco,monospace;font-size:14px;">' . $output . '</div>';
810
  $output = '<div style="display:block;width:100%;background:#23282D;color:#ddd;border-bottom:1px solid #ccc">' . $title . $timer . $output . '</div>';
827
  //* Don't register this output.
828
  $this->add_debug_output = false;
829
 
830
+ global $multipage, $numpages;
831
+
832
  //* Only get true/false values.
833
  $is_404 = $this->is_404();
834
  $is_admin = $this->is_admin();
848
  $is_home = $this->is_home();
849
  $is_month = $this->is_month();
850
  $is_page = $this->is_page();
851
+ $page = $this->page();
852
+ $paged = $this->paged();
853
  $is_preview = $this->is_preview();
854
  $is_search = $this->is_search();
855
  $is_single = $this->is_single();
861
  $is_wc_shop = $this->is_wc_shop();
862
  $is_wc_product = $this->is_wc_product();
863
  $is_year = $this->is_year();
864
+ $is_seo_settings_page = $this->is_seo_settings_page( true );
865
 
866
  //* Get all above vars, split them in two (true and false) and sort them by key names.
867
  $vars = get_defined_vars();
875
  $output = '';
876
  foreach ( $current as $name => $value ) {
877
  $type = '(' . gettype( $value ) . ')';
878
+
879
+ if ( is_bool( $value ) ) {
880
  $value = $value ? 'true' : 'false';
881
+ } else {
882
  $value = esc_attr( var_export( $value, true ) );
883
+ }
884
 
885
  $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>';
886
  $out = $name . ' => ' . $value;
889
 
890
  foreach ( $not_current as $name => $value ) {
891
  $type = '(' . gettype( $value ) . ')';
892
+
893
+ if ( is_bool( $value ) ) {
894
  $value = $value ? 'true' : 'false';
895
+ } else {
896
  $value = esc_attr( var_export( $value, true ) );
897
+ }
898
 
899
  $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>';
900
  $out = $name . ' => ' . $value;
911
 
912
  return $output;
913
  }
 
914
  }
inc/classes/detect.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_Detect
21
  *
@@ -25,6 +27,18 @@
25
  */
26
  class AutoDescription_Detect extends AutoDescription_Render {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor
30
  */
@@ -37,7 +51,6 @@ class AutoDescription_Detect extends AutoDescription_Render {
37
  *
38
  * @since 2.6.1
39
  * @staticvar array $active_plugins
40
- *
41
  * @credits JetPack for most code.
42
  *
43
  * @return array List of active plugins.
@@ -70,7 +83,6 @@ class AutoDescription_Detect extends AutoDescription_Render {
70
  *
71
  * Applies filters 'the_seo_framework_conflicting_plugins' : array
72
  * @since 2.6.0
73
- *
74
  * @credits JetPack for most code.
75
  *
76
  * @return array List of conflicting plugins.
@@ -91,20 +103,18 @@ class AutoDescription_Detect extends AutoDescription_Render {
91
  'Google XML Sitemaps for qTranslate' => 'google-xml-sitemaps-v3-for-qtranslate/sitemap.php',
92
  'XML Sitemap & Google News feeds' => 'xml-sitemap-feed/xml-sitemap.php',
93
  'Google Sitemap by BestWebSoft' => 'google-sitemap-plugin/google-sitemap-plugin.php',
94
- 'WordPress SEO by Yoast' => 'wordpress-seo/wp-seo.php',
95
- 'WordPress SEO Premium by Yoast' => 'wordpress-seo-premium/wp-seo-premium.php',
96
  'All in One SEO Pack' => 'all-in-one-seo-pack/all_in_one_seo_pack.php',
97
  'Sitemap' => 'sitemap/sitemap.php',
98
  'Simple Wp Sitemap' => 'simple-wp-sitemap/simple-wp-sitemap.php',
99
  'Simple Sitemap' => 'simple-sitemap/simple-sitemap.php',
100
  'XML Sitemaps' => 'xml-sitemaps/xml-sitemaps.php',
101
- 'MSM Sitemaps' => 'msm-sitemap/msm-sitemap.php',
102
  ),
103
  'open_graph' => array(
104
  '2 Click Social Media Buttons' => '2-click-socialmedia-buttons/2-click-socialmedia-buttons.php',
105
  'Add Link to Facebook' => 'add-link-to-facebook/add-link-to-facebook.php',
106
  'Add Meta Tags' => 'add-meta-tags/add-meta-tags.php',
107
- 'Easy Facebook Share Thumbnail' => 'easy-facebook-share-thumbnails/esft.php',
108
  'Facebook' => 'facebook/facebook.php',
109
  'Facebook AWD All in one' => 'facebook-awd/AWD_facebook.php',
110
  'Facebook Featured Image & OG Meta Tags' => 'facebook-featured-image-and-open-graph-meta-tags/fb-featured-image.php',
@@ -119,31 +129,19 @@ class AutoDescription_Detect extends AutoDescription_Render {
119
  'NextScripts SNAP' => 'social-networks-auto-poster-facebook-twitter-g/NextScripts_SNAP.php',
120
  'Open Graph' => 'opengraph/opengraph.php',
121
  'Open Graph Protocol Framework' => 'open-graph-protocol-framework/open-graph-protocol-framework.php',
122
- 'SEO Facebook Comments' => 'seo-facebook-comments/seofacebook.php',
123
  'Shareaholic' => 'sexybookmarks/sexy-bookmarks.php',
124
  'Shareaholic2' => 'shareaholic/sexy-bookmarks.php',
125
  'SharePress' => 'sharepress/sharepress.php',
126
- 'Simple Facebook Connect' => 'simple-facebook-connect/sfc.php',
127
- 'Social Discussions' => 'social-discussions/social-discussions.php',
128
  'Social Sharing Toolkit' => 'social-sharing-toolkit/social_sharing_toolkit.php',
129
- 'Socialize' => 'socialize/socialize.php',
130
  'Tweet, Like, Google +1 and Share' => 'only-tweet-like-share-and-google-1/tweet-like-plusone.php',
131
- 'Wordbooker' => 'wordbooker/wordbooker.php',
132
  'WordPress Social Sharing Optimization' => 'wpsso/wpsso.php',
133
- 'WP Caregiver' => 'wp-caregiver/wp-caregiver.php',
134
- 'WP Facebook Like Send & Open Graph Meta' => 'wp-facebook-like-send-open-graph-meta/wp-facebook-like-send-open-graph-meta.php',
135
  'WP Facebook Open Graph protocol' => 'wp-facebook-open-graph-protocol/wp-facebook-ogp.php',
136
- 'WP-OGP' => 'wp-ogp/wp-ogp.php',
137
- 'Zolton.org Social Plugin' => 'zoltonorg-social-plugin/zosp.php',
138
- 'WP Facebook Like Button' => 'wp-fb-share-like-button/wp_fb_share-like_widget.php'
139
  ),
140
  'twitter_card' => array(
141
  'Twitter' => 'twitter/twitter.php',
142
  'Eewee Twitter Card' => 'eewee-twitter-card/index.php',
143
- 'IG:Twitter Cards' => 'ig-twitter-cards/ig-twitter-cards.php',
144
  'Twitter Cards' => 'twitter-cards/twitter-cards.php',
145
  'Twitter Cards Meta' => 'twitter-cards-meta/twitter-cards-meta.php',
146
- 'WP Twitter Cards' => 'wp-twitter-cards/twitter_cards.php',
147
  ),
148
  );
149
 
@@ -153,10 +151,9 @@ class AutoDescription_Detect extends AutoDescription_Render {
153
  /**
154
  * Fetches type of conflicting plugins.
155
  *
156
- * @param string $type The Key from $this->conflicting_plugins()
157
- *
158
  * @since 2.6.0
159
  *
 
160
  * @return array
161
  */
162
  public function get_conflicting_plugins( $type = 'seo_tools' ) {
@@ -175,7 +172,6 @@ class AutoDescription_Detect extends AutoDescription_Render {
175
  * @since 1.3.0
176
  *
177
  * @param array $plugins Array of array for constants, classes and / or functions to check for plugin existence.
178
- *
179
  * @return boolean True if plugin exists or false if plugin constant, class or function not detected.
180
  */
181
  public function detect_plugin( $plugins ) {
@@ -218,13 +214,12 @@ class AutoDescription_Detect extends AutoDescription_Render {
218
  * Detect if you can use the given constants, functions and classes.
219
  * All must be available to return true.
220
  *
221
- * @param array $plugins Array of array for constants, classes and / or functions to check for plugin existence.
222
- * @param bool $use_cache Bypasses cache if false
223
- *
224
  * @staticvar array $cache
225
  * @uses $this->detect_plugin_multi()
226
  *
227
- * @since 2.5.2
 
228
  */
229
  public function can_i_use( array $plugins = array(), $use_cache = true ) {
230
 
@@ -246,7 +241,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
246
  $func = array_flip( $func );
247
 
248
  //* Glue with underscore and space for debugging purposes.
249
- $mapped[$key] = $key . '_' . implode( ' ', $func );
250
  }
251
 
252
  ksort( $mapped );
@@ -254,10 +249,10 @@ class AutoDescription_Detect extends AutoDescription_Render {
254
  //* Glue with dash instead of underscore for debugging purposes.
255
  $plugins_cache = implode( '-', $mapped );
256
 
257
- if ( isset( $cache[$plugins_cache] ) )
258
- return $cache[$plugins_cache];
259
 
260
- return $cache[$plugins_cache] = $this->detect_plugin_multi( $plugins );
261
  }
262
 
263
  /**
@@ -267,7 +262,6 @@ class AutoDescription_Detect extends AutoDescription_Render {
267
  * @since 2.5.2
268
  *
269
  * @param array $plugins Array of array for constants, classes and / or functions to check for plugin existence.
270
- *
271
  * @return boolean True if ALL functions classes and constants exists or false if plugin constant, class or function not detected.
272
  */
273
  public function detect_plugin_multi( array $plugins ) {
@@ -309,30 +303,26 @@ class AutoDescription_Detect extends AutoDescription_Render {
309
  /**
310
  * Checks if the (parent) theme name is loaded.
311
  *
312
- * @NOTE will return true if ANY of the array values matches.
313
- *
314
- * @param string|array $themes the current theme name
315
- * @param bool $depr If set to false don't use cache.
316
- *
317
  * @since 2.1.0
318
  *
 
319
  * @return bool is theme active.
320
  */
321
- public function is_theme( $themes = null, $depr = null ) {
322
 
323
- if ( ! isset( $themes ) )
324
  return false;
325
 
326
  $wp_get_theme = wp_get_theme();
327
 
328
- $theme_parent = strtolower( $wp_get_theme->get('Template') );
329
- $theme_name = strtolower( $wp_get_theme->get('Name') );
330
 
331
  if ( is_string( $themes ) ) {
332
  $themes = strtolower( $themes );
333
  if ( $themes === $theme_parent || $themes === $theme_name )
334
  return true;
335
- } else if ( is_array( $themes ) ) {
336
  foreach ( $themes as $theme ) {
337
  $theme = strtolower( $theme );
338
  if ( $theme === $theme_parent || $theme === $theme_name ) {
@@ -346,13 +336,10 @@ class AutoDescription_Detect extends AutoDescription_Render {
346
  }
347
 
348
  /**
349
- * SEO plugin detection
350
  *
351
  * @since 1.3.0
352
  *
353
- * @staticvar bool $detected
354
- * @since 2.2.5
355
- *
356
  * Applies filters 'the_seo_framework_seo_plugin_detected' : bool
357
  * @since 2.6.1
358
  *
@@ -376,28 +363,25 @@ class AutoDescription_Detect extends AutoDescription_Render {
376
  $conflicting_plugins = $this->get_conflicting_plugins( 'seo_tools' );
377
 
378
  foreach ( $conflicting_plugins as $plugin ) {
379
- if ( in_array( $plugin, $active_plugins ) ) {
380
  $detected = apply_filters( 'the_seo_framework_seo_plugin_detected', true );
381
  break;
382
  }
383
  }
384
  }
385
 
386
- return $detected = $detected ? true : false;
387
  }
388
 
389
  /**
390
- * Open Graph plugin detection
391
  *
392
  * @since 1.3.0
393
  *
394
- * @staticvar bool $detected
395
- * @since 2.2.5
396
- *
397
  * Applies filters 'the_seo_framework_og_plugin_detected' : bool
398
  * @since 2.6.1
399
  *
400
- * @return bool OG plugin detected.
401
  */
402
  public function detect_og_plugin() {
403
 
@@ -411,7 +395,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
411
  if ( $detected )
412
  return $detected;
413
 
414
- //* Old style filter.
415
  $detected = $this->has_og_plugin();
416
  if ( isset( $detected ) )
417
  return $detected;
@@ -422,23 +406,21 @@ class AutoDescription_Detect extends AutoDescription_Render {
422
  $conflicting_plugins = $this->get_conflicting_plugins( 'open_graph' );
423
 
424
  foreach ( $conflicting_plugins as $plugin ) {
425
- if ( in_array( $plugin, $active_plugins ) ) {
426
  $detected = apply_filters( 'the_seo_framework_og_plugin_detected', true );
427
  break;
428
  }
429
  }
430
  }
431
 
432
- return $detected = $detected ? true : false;
433
  }
434
 
435
  /**
436
- * Open Graph plugin detection
437
  *
438
  * @since 2.6.0
439
- *
440
  * @staticvar bool $detected
441
- * @since 2.6.0
442
  *
443
  * @return bool Twitter Card plugin detected.
444
  */
@@ -460,25 +442,23 @@ class AutoDescription_Detect extends AutoDescription_Render {
460
  $conflicting_plugins = $this->get_conflicting_plugins( 'twitter_card' );
461
 
462
  foreach ( $conflicting_plugins as $plugin ) {
463
- if ( in_array( $plugin, $active_plugins ) ) {
464
  $detected = apply_filters( 'the_seo_framework_twittercard_plugin_detected', true );
465
  break;
466
  }
467
  }
468
  }
469
 
470
- return $detected = $detected ? true : false;
471
  }
472
 
473
  /**
474
- * Detects if plugins outputting ld+json exists
475
  *
476
  * @since 1.3.0
 
477
  *
478
- * Always return false.
479
- * @since 2.6.1
480
- *
481
- * @return bool false
482
  */
483
  public function has_json_ld_plugin() {
484
  /**
@@ -489,7 +469,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
489
  }
490
 
491
  /**
492
- * Detecs sitemap plugins
493
  *
494
  * @since 2.1.0
495
  * @staticvar bool $detected
@@ -509,18 +489,18 @@ class AutoDescription_Detect extends AutoDescription_Render {
509
  $conflicting_plugins = $this->get_conflicting_plugins( 'sitemaps' );
510
 
511
  foreach ( $conflicting_plugins as $plugin ) {
512
- if ( in_array( $plugin, $active_plugins ) ) {
513
  $detected = apply_filters( 'the_seo_framework_sitemap_plugin_detected', true );
514
  break;
515
  }
516
  }
517
  }
518
 
519
- return $detected = $detected ? true : false;
520
  }
521
 
522
  /**
523
- * Whether able to add a line within robots based by plugin detection, or sitemap output option.
524
  *
525
  * @since 2.6.0
526
  *
@@ -546,9 +526,10 @@ class AutoDescription_Detect extends AutoDescription_Render {
546
  /**
547
  * Detects presence of robots.txt in root folder.
548
  *
 
549
  * @staticvar $has_robots
550
  *
551
- * @since 2.5.2
552
  */
553
  public function has_robots_txt() {
554
 
@@ -568,7 +549,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
568
  * @since 2.5.2
569
  * @staticvar bool $has_map
570
  *
571
- * @return bool
572
  */
573
  public function has_sitemap_xml() {
574
 
@@ -586,13 +567,12 @@ class AutoDescription_Detect extends AutoDescription_Render {
586
  * Determines if WP is above or below a version
587
  *
588
  * @since 2.2.1
 
 
 
589
  *
590
  * @param string $version the three part version to compare to WordPress
591
  * @param string $compare the comparing operator, default "$version >= Current WP Version"
592
- *
593
- * @staticvar array $cache
594
- * @since 2.3.8
595
- *
596
  * @return bool wp version is "compare" to
597
  */
598
  public function wp_version( $version = '4.3.0', $compare = '>=' ) {
@@ -602,36 +582,28 @@ class AutoDescription_Detect extends AutoDescription_Render {
602
  if ( empty( $compare ) )
603
  $compare = '>=';
604
 
605
- if ( isset( $cache[$version][$compare] ) )
606
- return $cache[$version][$compare];
607
 
608
- global $wp_version;
609
 
610
  // Add a .0 if WP outputs something like 4.3 instead of 4.3.0
611
  if ( 3 === strlen( $wp_version ) )
612
  $wp_version = $wp_version . '.0';
613
 
614
- if ( version_compare( $wp_version, $version, $compare ) )
615
- return $cache[$version][$compare] = true;
616
-
617
- return $cache[$version][$compare] = false;
618
  }
619
 
620
  /**
621
  * Checks for current theme support.
622
  *
623
- * Also, if it's cached as true from an array, it will be cached as string as well.
624
- * This is desired.
625
- *
626
- * @NOTE will return true if ANY of the array values matches.
627
  *
628
  * @since 2.2.5
 
629
  *
630
  * @param string|array required $feature The features to check for.
631
  * @param bool $use_cache If set to false don't use cache.
632
- *
633
- * @staticvar array $cache
634
- *
635
  * @return bool theme support.
636
  */
637
  public function detect_theme_support( $features, $use_cache = true ) {
@@ -648,6 +620,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
648
  return true;
649
  break;
650
  }
 
651
  }
652
  }
653
 
@@ -658,16 +631,16 @@ class AutoDescription_Detect extends AutoDescription_Render {
658
  static $cache = array();
659
 
660
  //* Check theme support cache
661
- if ( is_string( $features ) && isset( $cache[$features] ) )
662
  //* Feature support check has been cached
663
- return $cache[$features];
664
 
665
  //* Check theme support array cache
666
  if ( is_array( $features ) ) {
667
  foreach ( $features as $feature ) {
668
- if ( isset( $cache[$feature] ) && in_array( $cache[$feature], $features ) && $cache[$feature] ) {
669
- // Feature is found and true
670
- return $cache[$feature];
671
  break;
672
  }
673
  }
@@ -676,27 +649,28 @@ class AutoDescription_Detect extends AutoDescription_Render {
676
  //* Setup cache values
677
  if ( is_string( $features ) ) {
678
  if ( current_theme_supports( $features ) ) {
679
- return $cache[$features] = true;
680
  } else {
681
- return $cache[$features] = false;
682
  }
683
- } else if ( is_array( $features ) ) {
684
  foreach ( $features as $feature ) {
685
  if ( current_theme_supports( $feature ) ) {
686
- return $cache[$feature] = true;
687
  break;
688
  } else {
689
- $cache[$feature] = false;
 
690
  }
691
  }
692
- return $cache[$feature];
693
  }
694
 
695
- // No true value found so far, let's return false.
696
- if ( ! isset( $cache[$features] ) )
697
- $cache[$features] = false;
698
 
699
- return $cache[$features];
700
  }
701
 
702
  /**
@@ -704,7 +678,6 @@ class AutoDescription_Detect extends AutoDescription_Render {
704
  *
705
  * @since 2.6.0
706
  * @staticvar bool $supports
707
- *
708
  * @global array $_wp_theme_features
709
  *
710
  * @return bool
@@ -718,18 +691,28 @@ class AutoDescription_Detect extends AutoDescription_Render {
718
 
719
  global $_wp_theme_features;
720
 
721
- if ( isset( $_wp_theme_features['title-tag'] ) && true === $_wp_theme_features['title-tag'] )
722
- return $supports = true;
723
 
724
- return $supports = false;
 
 
 
 
 
 
 
 
 
 
 
725
  }
726
 
727
  /**
728
- * Add doing it wrong html code in the footer.
729
  *
730
  * @since 2.5.2.1
731
- * @staticvar bool $no_spam
732
- *
733
  * @staticvar string $sep_output
734
  * @staticvar string $display_output
735
  * @staticvar string $seplocation_output
@@ -738,19 +721,18 @@ class AutoDescription_Detect extends AutoDescription_Render {
738
  * @param null|string $sep The separator
739
  * @param null|string $seplocation Whether the blogname is left or right.
740
  * @param bool $output Whether to store cache values or echo the output in the footer.
741
- *
742
  * @return void
743
  */
744
  public function tell_title_doing_it_wrong( $title = null, $sep = null, $seplocation = null, $output = true ) {
745
 
746
  if ( $output ) {
747
- //* Prevent error log spam.
748
- static $no_spam = null;
749
 
750
- if ( isset( $no_spam ) )
751
  return;
752
 
753
- $no_spam = true;
754
  }
755
 
756
  static $title_output = null;
@@ -769,20 +751,20 @@ class AutoDescription_Detect extends AutoDescription_Render {
769
  if ( '' === $seplocation )
770
  $seplocation = 'empty';
771
 
772
- $title_output = ! isset( $title ) ? 'notset' : esc_attr( $title );
773
- $sep_output = ! isset( $sep ) ? 'notset' : esc_attr( $sep );
774
- $seplocation_output = ! isset( $seplocation ) ? 'notset' : esc_attr( $seplocation );
775
  }
776
 
777
  //* Echo the HTML comment.
778
  if ( $output )
779
- echo '<!-- Title diw: "' . $title_output . '" : "' . $sep_output . '" : "' . $seplocation_output . '" -->' . "\r\n";
780
 
781
  return;
782
  }
783
 
784
  /**
785
- * Detect WPMUdev Domain Mapping plugin.
786
  *
787
  * @since 2.3.0
788
  * @staticvar bool $active
@@ -800,7 +782,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
800
  }
801
 
802
  /**
803
- * Detect Donncha Domain Mapping plugin.
804
  *
805
  * @since 2.4.0
806
  * @staticvar bool $active
@@ -818,7 +800,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
818
  }
819
 
820
  /**
821
- * Detect WPML plugin.
822
  *
823
  * @since 2.6.0
824
  * @staticvar bool $active
@@ -867,19 +849,19 @@ class AutoDescription_Detect extends AutoDescription_Render {
867
 
868
  static $is_page = array();
869
 
870
- if ( isset( $is_page[$type] ) )
871
- return $is_page[$type];
872
 
873
  $post_page = (array) get_post_types( array( 'public' => true ) );
874
 
875
  foreach ( $post_page as $screen ) {
876
  if ( $type === $screen ) {
877
- return $is_page[$type] = true;
878
  break;
879
  }
880
  }
881
 
882
- return $is_page[$type] = false;
883
  }
884
 
885
  /**
@@ -890,7 +872,6 @@ class AutoDescription_Detect extends AutoDescription_Render {
890
  * @param bool $use_cache Set to false to bypass the cache.
891
  *
892
  * @staticvar array $locale
893
- * @staticvar string $get_locale
894
  *
895
  * @since 2.6.0
896
  *
@@ -902,27 +883,22 @@ class AutoDescription_Detect extends AutoDescription_Render {
902
  return false;
903
 
904
  if ( true !== $use_cache )
905
- return (bool) strpos( get_locale(), $locale );
906
 
907
  static $cache = array();
908
 
909
- if ( isset( $cache[$locale] ) )
910
- return $cache[$locale];
911
-
912
- static $get_locale = null;
913
 
914
- if ( ! isset( $get_locale ) )
915
- $get_locale = get_locale();
916
-
917
- return $cache[$locale] = false !== strpos( $get_locale, $locale ) ? true : false;
918
  }
919
 
920
  /**
921
  * Determines if the post type is compatible with The SEO Framework inpost metabox.
922
  *
923
  * @since 2.3.5
924
- * @param string|null $post_type
925
  *
 
926
  * @return bool True if post type is supported.
927
  */
928
  public function post_type_supports_inpost( $post_type = null ) {
@@ -954,13 +930,11 @@ class AutoDescription_Detect extends AutoDescription_Render {
954
  * Doesn't work on admin_init.
955
  *
956
  * @since 2.3.9
957
- *
958
- * @param string $post_type The current post type.
959
- *
960
  * @staticvar string $post_type
961
  * @staticvar bool $supported
962
  * @staticvar array $post_page
963
  *
 
964
  * @return bool true of post type is supported.
965
  */
966
  public function post_type_supports_custom_seo( $post_type = '' ) {
@@ -972,8 +946,8 @@ class AutoDescription_Detect extends AutoDescription_Render {
972
 
973
  static $supported = array();
974
 
975
- if ( isset( $supported[$post_type] ) )
976
- return $supported[$post_type];
977
 
978
  /**
979
  * We now support all posts that allow a title, content editor and excerpt.
@@ -982,9 +956,9 @@ class AutoDescription_Detect extends AutoDescription_Render {
982
  * @since 2.3.5
983
  */
984
  if ( post_type_supports( $post_type, 'autodescription-meta' ) || $this->post_type_supports_inpost( $post_type ) )
985
- return $supported[$post_type] = true;
986
 
987
- return $supported[$post_type] = false;
988
  }
989
 
990
  /**
@@ -1014,8 +988,8 @@ class AutoDescription_Detect extends AutoDescription_Render {
1014
 
1015
  static $cache = array();
1016
 
1017
- if ( isset( $cache[$public][$post_type] ) )
1018
- return $cache[$public][$post_type];
1019
 
1020
  $object = get_post_type_object( $post_type );
1021
 
@@ -1040,9 +1014,9 @@ class AutoDescription_Detect extends AutoDescription_Render {
1040
 
1041
  //* No supported post type has been found.
1042
  if ( empty( $post_type ) )
1043
- return $cache[$public][$post_type] = false;
1044
 
1045
- return $cache[$public][$post_type] = $post_type;
1046
  }
1047
 
1048
  /**
@@ -1087,10 +1061,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
1087
  if ( isset( $fixed ) )
1088
  return $fixed;
1089
 
1090
- if ( defined( 'THE_SEO_FRAMEWORK_TITLE_FIX' ) && THE_SEO_FRAMEWORK_TITLE_FIX )
1091
- return $fixed = true;
1092
-
1093
- return $fixed = false;
1094
  }
1095
 
1096
  /**
@@ -1101,11 +1072,7 @@ class AutoDescription_Detect extends AutoDescription_Render {
1101
  * @return bool True if we can manipulate title.
1102
  */
1103
  public function can_manipulate_title() {
1104
-
1105
- if ( $this->theme_title_doing_it_right() || $this->theme_title_fix_active() )
1106
- return true;
1107
-
1108
- return false;
1109
  }
1110
 
1111
  /**
@@ -1123,7 +1090,26 @@ class AutoDescription_Detect extends AutoDescription_Render {
1123
  if ( isset( $pof ) )
1124
  return $pof;
1125
 
1126
- return $pof = 'page' === get_option( 'show_on_front' ) ? true : false;
1127
  }
1128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
  }
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_Detect
23
  *
27
  */
28
  class AutoDescription_Detect extends AutoDescription_Render {
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
  */
51
  *
52
  * @since 2.6.1
53
  * @staticvar array $active_plugins
 
54
  * @credits JetPack for most code.
55
  *
56
  * @return array List of active plugins.
83
  *
84
  * Applies filters 'the_seo_framework_conflicting_plugins' : array
85
  * @since 2.6.0
 
86
  * @credits JetPack for most code.
87
  *
88
  * @return array List of conflicting plugins.
103
  'Google XML Sitemaps for qTranslate' => 'google-xml-sitemaps-v3-for-qtranslate/sitemap.php',
104
  'XML Sitemap & Google News feeds' => 'xml-sitemap-feed/xml-sitemap.php',
105
  'Google Sitemap by BestWebSoft' => 'google-sitemap-plugin/google-sitemap-plugin.php',
106
+ 'Yoast SEO' => 'wordpress-seo/wp-seo.php',
107
+ 'Yoast SEO Premium' => 'wordpress-seo-premium/wp-seo-premium.php',
108
  'All in One SEO Pack' => 'all-in-one-seo-pack/all_in_one_seo_pack.php',
109
  'Sitemap' => 'sitemap/sitemap.php',
110
  'Simple Wp Sitemap' => 'simple-wp-sitemap/simple-wp-sitemap.php',
111
  'Simple Sitemap' => 'simple-sitemap/simple-sitemap.php',
112
  'XML Sitemaps' => 'xml-sitemaps/xml-sitemaps.php',
 
113
  ),
114
  'open_graph' => array(
115
  '2 Click Social Media Buttons' => '2-click-socialmedia-buttons/2-click-socialmedia-buttons.php',
116
  'Add Link to Facebook' => 'add-link-to-facebook/add-link-to-facebook.php',
117
  'Add Meta Tags' => 'add-meta-tags/add-meta-tags.php',
 
118
  'Facebook' => 'facebook/facebook.php',
119
  'Facebook AWD All in one' => 'facebook-awd/AWD_facebook.php',
120
  'Facebook Featured Image & OG Meta Tags' => 'facebook-featured-image-and-open-graph-meta-tags/fb-featured-image.php',
129
  'NextScripts SNAP' => 'social-networks-auto-poster-facebook-twitter-g/NextScripts_SNAP.php',
130
  'Open Graph' => 'opengraph/opengraph.php',
131
  'Open Graph Protocol Framework' => 'open-graph-protocol-framework/open-graph-protocol-framework.php',
 
132
  'Shareaholic' => 'sexybookmarks/sexy-bookmarks.php',
133
  'Shareaholic2' => 'shareaholic/sexy-bookmarks.php',
134
  'SharePress' => 'sharepress/sharepress.php',
 
 
135
  'Social Sharing Toolkit' => 'social-sharing-toolkit/social_sharing_toolkit.php',
 
136
  'Tweet, Like, Google +1 and Share' => 'only-tweet-like-share-and-google-1/tweet-like-plusone.php',
 
137
  'WordPress Social Sharing Optimization' => 'wpsso/wpsso.php',
 
 
138
  'WP Facebook Open Graph protocol' => 'wp-facebook-open-graph-protocol/wp-facebook-ogp.php',
 
 
 
139
  ),
140
  'twitter_card' => array(
141
  'Twitter' => 'twitter/twitter.php',
142
  'Eewee Twitter Card' => 'eewee-twitter-card/index.php',
 
143
  'Twitter Cards' => 'twitter-cards/twitter-cards.php',
144
  'Twitter Cards Meta' => 'twitter-cards-meta/twitter-cards-meta.php',
 
145
  ),
146
  );
147
 
151
  /**
152
  * Fetches type of conflicting plugins.
153
  *
 
 
154
  * @since 2.6.0
155
  *
156
+ * @param string $type The Key from $this->conflicting_plugins()
157
  * @return array
158
  */
159
  public function get_conflicting_plugins( $type = 'seo_tools' ) {
172
  * @since 1.3.0
173
  *
174
  * @param array $plugins Array of array for constants, classes and / or functions to check for plugin existence.
 
175
  * @return boolean True if plugin exists or false if plugin constant, class or function not detected.
176
  */
177
  public function detect_plugin( $plugins ) {
214
  * Detect if you can use the given constants, functions and classes.
215
  * All must be available to return true.
216
  *
217
+ * @since 2.5.2
 
 
218
  * @staticvar array $cache
219
  * @uses $this->detect_plugin_multi()
220
  *
221
+ * @param array $plugins Array of array for constants, classes and / or functions to check for plugin existence.
222
+ * @param bool $use_cache Bypasses cache if false
223
  */
224
  public function can_i_use( array $plugins = array(), $use_cache = true ) {
225
 
241
  $func = array_flip( $func );
242
 
243
  //* Glue with underscore and space for debugging purposes.
244
+ $mapped[ $key ] = $key . '_' . implode( ' ', $func );
245
  }
246
 
247
  ksort( $mapped );
249
  //* Glue with dash instead of underscore for debugging purposes.
250
  $plugins_cache = implode( '-', $mapped );
251
 
252
+ if ( isset( $cache[ $plugins_cache ] ) )
253
+ return $cache[ $plugins_cache ];
254
 
255
+ return $cache[ $plugins_cache ] = $this->detect_plugin_multi( $plugins );
256
  }
257
 
258
  /**
262
  * @since 2.5.2
263
  *
264
  * @param array $plugins Array of array for constants, classes and / or functions to check for plugin existence.
 
265
  * @return boolean True if ALL functions classes and constants exists or false if plugin constant, class or function not detected.
266
  */
267
  public function detect_plugin_multi( array $plugins ) {
303
  /**
304
  * Checks if the (parent) theme name is loaded.
305
  *
 
 
 
 
 
306
  * @since 2.1.0
307
  *
308
+ * @param string|array $themes the current theme name.
309
  * @return bool is theme active.
310
  */
311
+ public function is_theme( $themes = '' ) {
312
 
313
+ if ( empty( $themes ) )
314
  return false;
315
 
316
  $wp_get_theme = wp_get_theme();
317
 
318
+ $theme_parent = strtolower( $wp_get_theme->get( 'Template' ) );
319
+ $theme_name = strtolower( $wp_get_theme->get( 'Name' ) );
320
 
321
  if ( is_string( $themes ) ) {
322
  $themes = strtolower( $themes );
323
  if ( $themes === $theme_parent || $themes === $theme_name )
324
  return true;
325
+ } elseif ( is_array( $themes ) ) {
326
  foreach ( $themes as $theme ) {
327
  $theme = strtolower( $theme );
328
  if ( $theme === $theme_parent || $theme === $theme_name ) {
336
  }
337
 
338
  /**
339
+ * Determines if other SEO plugins are active.
340
  *
341
  * @since 1.3.0
342
  *
 
 
 
343
  * Applies filters 'the_seo_framework_seo_plugin_detected' : bool
344
  * @since 2.6.1
345
  *
363
  $conflicting_plugins = $this->get_conflicting_plugins( 'seo_tools' );
364
 
365
  foreach ( $conflicting_plugins as $plugin ) {
366
+ if ( in_array( $plugin, $active_plugins, true ) ) {
367
  $detected = apply_filters( 'the_seo_framework_seo_plugin_detected', true );
368
  break;
369
  }
370
  }
371
  }
372
 
373
+ return $detected = (bool) $detected;
374
  }
375
 
376
  /**
377
+ * Determines if other Open Graph or SEO plugins are active.
378
  *
379
  * @since 1.3.0
380
  *
 
 
 
381
  * Applies filters 'the_seo_framework_og_plugin_detected' : bool
382
  * @since 2.6.1
383
  *
384
+ * @return bool True if OG or SEO plugin detected.
385
  */
386
  public function detect_og_plugin() {
387
 
395
  if ( $detected )
396
  return $detected;
397
 
398
+ //* Old style filter. Emits warning if used.
399
  $detected = $this->has_og_plugin();
400
  if ( isset( $detected ) )
401
  return $detected;
406
  $conflicting_plugins = $this->get_conflicting_plugins( 'open_graph' );
407
 
408
  foreach ( $conflicting_plugins as $plugin ) {
409
+ if ( in_array( $plugin, $active_plugins, true ) ) {
410
  $detected = apply_filters( 'the_seo_framework_og_plugin_detected', true );
411
  break;
412
  }
413
  }
414
  }
415
 
416
+ return $detected = (bool) $detected;
417
  }
418
 
419
  /**
420
+ * Determines if other Twitter Card plugins are active.
421
  *
422
  * @since 2.6.0
 
423
  * @staticvar bool $detected
 
424
  *
425
  * @return bool Twitter Card plugin detected.
426
  */
442
  $conflicting_plugins = $this->get_conflicting_plugins( 'twitter_card' );
443
 
444
  foreach ( $conflicting_plugins as $plugin ) {
445
+ if ( in_array( $plugin, $active_plugins, true ) ) {
446
  $detected = apply_filters( 'the_seo_framework_twittercard_plugin_detected', true );
447
  break;
448
  }
449
  }
450
  }
451
 
452
+ return $detected = (bool) $detected;
453
  }
454
 
455
  /**
456
+ * Determines if other Schema.org LD+Json plugins are active.
457
  *
458
  * @since 1.3.0
459
+ * @since 2.6.1 Always return false. Let other plugin authors decide its value.
460
  *
461
+ * @return bool Whether another Schema.org plugin is active.
 
 
 
462
  */
463
  public function has_json_ld_plugin() {
464
  /**
469
  }
470
 
471
  /**
472
+ * Determines if other Sitemap plugins are active.
473
  *
474
  * @since 2.1.0
475
  * @staticvar bool $detected
489
  $conflicting_plugins = $this->get_conflicting_plugins( 'sitemaps' );
490
 
491
  foreach ( $conflicting_plugins as $plugin ) {
492
+ if ( in_array( $plugin, $active_plugins, true ) ) {
493
  $detected = apply_filters( 'the_seo_framework_sitemap_plugin_detected', true );
494
  break;
495
  }
496
  }
497
  }
498
 
499
+ return $detected = (bool) $detected;
500
  }
501
 
502
  /**
503
+ * Determines whether to add a line within robots based by plugin detection, or sitemap output option.
504
  *
505
  * @since 2.6.0
506
  *
526
  /**
527
  * Detects presence of robots.txt in root folder.
528
  *
529
+ * @since 2.5.2
530
  * @staticvar $has_robots
531
  *
532
+ * @return bool Whether the robots.txt file exists.
533
  */
534
  public function has_robots_txt() {
535
 
549
  * @since 2.5.2
550
  * @staticvar bool $has_map
551
  *
552
+ * @return bool Whether the sitemap.xml file exists.
553
  */
554
  public function has_sitemap_xml() {
555
 
567
  * Determines if WP is above or below a version
568
  *
569
  * @since 2.2.1
570
+ * @since 2.3.8: Added caching
571
+ * @since 2.8.0: No longer overwrites global $wp_version
572
+ * @staticvar array $cache
573
  *
574
  * @param string $version the three part version to compare to WordPress
575
  * @param string $compare the comparing operator, default "$version >= Current WP Version"
 
 
 
 
576
  * @return bool wp version is "compare" to
577
  */
578
  public function wp_version( $version = '4.3.0', $compare = '>=' ) {
582
  if ( empty( $compare ) )
583
  $compare = '>=';
584
 
585
+ if ( isset( $cache[ $version ][ $compare ] ) )
586
+ return $cache[ $version ][ $compare ];
587
 
588
+ $wp_version = $GLOBALS['wp_version'];
589
 
590
  // Add a .0 if WP outputs something like 4.3 instead of 4.3.0
591
  if ( 3 === strlen( $wp_version ) )
592
  $wp_version = $wp_version . '.0';
593
 
594
+ return $cache[ $version ][ $compare ] = (bool) version_compare( $wp_version, $version, $compare );
 
 
 
595
  }
596
 
597
  /**
598
  * Checks for current theme support.
599
  *
600
+ * Maintains detection cache, array and strings are mixed through foreach loops.
 
 
 
601
  *
602
  * @since 2.2.5
603
+ * @staticvar array $cache
604
  *
605
  * @param string|array required $feature The features to check for.
606
  * @param bool $use_cache If set to false don't use cache.
 
 
 
607
  * @return bool theme support.
608
  */
609
  public function detect_theme_support( $features, $use_cache = true ) {
620
  return true;
621
  break;
622
  }
623
+ continue;
624
  }
625
  }
626
 
631
  static $cache = array();
632
 
633
  //* Check theme support cache
634
+ if ( is_string( $features ) && isset( $cache[ $features ] ) )
635
  //* Feature support check has been cached
636
+ return $cache[ $features ];
637
 
638
  //* Check theme support array cache
639
  if ( is_array( $features ) ) {
640
  foreach ( $features as $feature ) {
641
+ if ( isset( $cache[ $feature ] ) && $cache[ $feature ] ) {
642
+ // Feature is found and true.
643
+ return $cache[ $feature ];
644
  break;
645
  }
646
  }
649
  //* Setup cache values
650
  if ( is_string( $features ) ) {
651
  if ( current_theme_supports( $features ) ) {
652
+ return $cache[ $features ] = true;
653
  } else {
654
+ return $cache[ $features ] = false;
655
  }
656
+ } elseif ( is_array( $features ) ) {
657
  foreach ( $features as $feature ) {
658
  if ( current_theme_supports( $feature ) ) {
659
+ return $cache[ $feature ] = true;
660
  break;
661
  } else {
662
+ $cache[ $feature ] = false;
663
+ continue;
664
  }
665
  }
666
+ return $cache[ $feature ];
667
  }
668
 
669
+ // No true value found so far, return false.
670
+ if ( ! isset( $cache[ $features ] ) )
671
+ $cache[ $features ] = false;
672
 
673
+ return $cache[ $features ];
674
  }
675
 
676
  /**
678
  *
679
  * @since 2.6.0
680
  * @staticvar bool $supports
 
681
  * @global array $_wp_theme_features
682
  *
683
  * @return bool
691
 
692
  global $_wp_theme_features;
693
 
694
+ return $supports = isset( $_wp_theme_features['title-tag'] ) && true === $_wp_theme_features['title-tag'];
695
+ }
696
 
697
+ /**
698
+ * Sets up doing it wrong html code for in the footer.
699
+ *
700
+ * @since 2.7.0
701
+ *
702
+ * @param null|string $title The given title
703
+ * @param null|string $sep The separator
704
+ * @param null|string $seplocation Whether the blogname is left or right.
705
+ * @return void
706
+ */
707
+ public function set_tell_title_doing_it_wrong( $title = null, $sep = null, $seplocation = null ) {
708
+ return $this->tell_title_doing_it_wrong( $title, $sep, $seplocation, false );
709
  }
710
 
711
  /**
712
+ * Adds doing it wrong html code in the footer.
713
  *
714
  * @since 2.5.2.1
715
+ * @staticvar bool $run
 
716
  * @staticvar string $sep_output
717
  * @staticvar string $display_output
718
  * @staticvar string $seplocation_output
721
  * @param null|string $sep The separator
722
  * @param null|string $seplocation Whether the blogname is left or right.
723
  * @param bool $output Whether to store cache values or echo the output in the footer.
 
724
  * @return void
725
  */
726
  public function tell_title_doing_it_wrong( $title = null, $sep = null, $seplocation = null, $output = true ) {
727
 
728
  if ( $output ) {
729
+ //* Prevent multiple output.
730
+ static $run = null;
731
 
732
+ if ( isset( $run ) )
733
  return;
734
 
735
+ $run = true;
736
  }
737
 
738
  static $title_output = null;
751
  if ( '' === $seplocation )
752
  $seplocation = 'empty';
753
 
754
+ $title_output = ! isset( $title ) ? 'notset' : $title;
755
+ $sep_output = ! isset( $sep ) ? 'notset' : $sep;
756
+ $seplocation_output = ! isset( $seplocation ) ? 'notset' : $seplocation;
757
  }
758
 
759
  //* Echo the HTML comment.
760
  if ( $output )
761
+ echo '<!-- Title diw: "' . esc_html( $title_output ) . '" : "' . esc_html( $sep_output ) . '" : "' . esc_html( $seplocation_output ) . '" -->' . "\r\n";
762
 
763
  return;
764
  }
765
 
766
  /**
767
+ * Detects WPMUdev Domain Mapping plugin.
768
  *
769
  * @since 2.3.0
770
  * @staticvar bool $active
782
  }
783
 
784
  /**
785
+ * Detects Donncha Domain Mapping plugin.
786
  *
787
  * @since 2.4.0
788
  * @staticvar bool $active
800
  }
801
 
802
  /**
803
+ * Detects WPML plugin.
804
  *
805
  * @since 2.6.0
806
  * @staticvar bool $active
849
 
850
  static $is_page = array();
851
 
852
+ if ( isset( $is_page[ $type ] ) )
853
+ return $is_page[ $type ];
854
 
855
  $post_page = (array) get_post_types( array( 'public' => true ) );
856
 
857
  foreach ( $post_page as $screen ) {
858
  if ( $type === $screen ) {
859
+ return $is_page[ $type ] = true;
860
  break;
861
  }
862
  }
863
 
864
+ return $is_page[ $type ] = false;
865
  }
866
 
867
  /**
872
  * @param bool $use_cache Set to false to bypass the cache.
873
  *
874
  * @staticvar array $locale
 
875
  *
876
  * @since 2.6.0
877
  *
883
  return false;
884
 
885
  if ( true !== $use_cache )
886
+ return false !== strpos( get_locale(), $locale );
887
 
888
  static $cache = array();
889
 
890
+ if ( isset( $cache[ $locale ] ) )
891
+ return $cache[ $locale ];
 
 
892
 
893
+ return $cache[ $locale ] = false !== strpos( get_locale(), $locale );
 
 
 
894
  }
895
 
896
  /**
897
  * Determines if the post type is compatible with The SEO Framework inpost metabox.
898
  *
899
  * @since 2.3.5
 
900
  *
901
+ * @param string|null $post_type
902
  * @return bool True if post type is supported.
903
  */
904
  public function post_type_supports_inpost( $post_type = null ) {
930
  * Doesn't work on admin_init.
931
  *
932
  * @since 2.3.9
 
 
 
933
  * @staticvar string $post_type
934
  * @staticvar bool $supported
935
  * @staticvar array $post_page
936
  *
937
+ * @param string $post_type The current post type.
938
  * @return bool true of post type is supported.
939
  */
940
  public function post_type_supports_custom_seo( $post_type = '' ) {
946
 
947
  static $supported = array();
948
 
949
+ if ( isset( $supported[ $post_type ] ) )
950
+ return $supported[ $post_type ];
951
 
952
  /**
953
  * We now support all posts that allow a title, content editor and excerpt.
956
  * @since 2.3.5
957
  */
958
  if ( post_type_supports( $post_type, 'autodescription-meta' ) || $this->post_type_supports_inpost( $post_type ) )
959
+ return $supported[ $post_type ] = true;
960
 
961
+ return $supported[ $post_type ] = false;
962
  }
963
 
964
  /**
988
 
989
  static $cache = array();
990
 
991
+ if ( isset( $cache[ $public ][ $post_type ] ) )
992
+ return $cache[ $public ][ $post_type ];
993
 
994
  $object = get_post_type_object( $post_type );
995
 
1014
 
1015
  //* No supported post type has been found.
1016
  if ( empty( $post_type ) )
1017
+ return $cache[ $public ][ $post_type ] = false;
1018
 
1019
+ return $cache[ $public ][ $post_type ] = $post_type;
1020
  }
1021
 
1022
  /**
1061
  if ( isset( $fixed ) )
1062
  return $fixed;
1063
 
1064
+ return $fixed = defined( 'THE_SEO_FRAMEWORK_TITLE_FIX' ) && THE_SEO_FRAMEWORK_TITLE_FIX;
 
 
 
1065
  }
1066
 
1067
  /**
1072
  * @return bool True if we can manipulate title.
1073
  */
1074
  public function can_manipulate_title() {
1075
+ return $this->theme_title_doing_it_right() || $this->theme_title_fix_active();
 
 
 
 
1076
  }
1077
 
1078
  /**
1090
  if ( isset( $pof ) )
1091
  return $pof;
1092
 
1093
+ return $pof = 'page' === get_option( 'show_on_front' );
1094
  }
1095
 
1096
+
1097
+ /**
1098
+ * Determines whether we can use the new WordPress core term meta functionality.
1099
+ *
1100
+ * @since 2.7.0
1101
+ * @staticvar bool $cache
1102
+ *
1103
+ * @return bool True when WordPress is at version 4.4 or higher and has an
1104
+ * accordingly upgraded database.
1105
+ */
1106
+ public function can_get_term_meta() {
1107
+
1108
+ static $cache = null;
1109
+
1110
+ if ( isset( $cache ) )
1111
+ return $cache;
1112
+
1113
+ return $cache = get_option( 'db_version' ) >= 34370 && get_option( 'the_seo_framework_upgraded_db_version' ) >= '2700' && $this->wp_version( '4.4' );
1114
+ }
1115
  }
inc/classes/doingitright.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_DoingItRight
21
  *
@@ -26,6 +28,18 @@
26
  */
27
  class AutoDescription_DoingItRight extends AutoDescription_Search {
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * Constructor, load parent constructor.
31
  * Initalizes columns and load post states.
@@ -37,16 +51,14 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
37
  add_action( 'current_screen', array( $this, 'post_state' ) );
38
 
39
  //* Ajax handlers for columns.
40
- add_action( 'admin_init', array( $this, 'init_columns_ajax' ) );
41
  //* Initialize columns.
42
  add_action( 'current_screen', array( $this, 'init_columns' ) );
43
 
44
  }
45
 
46
  /**
47
- * Add post state on edit.php to the page or post that has been altered
48
- *
49
- * Applies filters `the_seo_framework_allow_states` : boolean Whether to allow post states output.
50
  *
51
  * @uses $this->add_post_state
52
  *
@@ -57,6 +69,10 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
57
  //* Only load on singular pages.
58
  if ( $this->is_singular() ) {
59
 
 
 
 
 
60
  $allow_states = (bool) apply_filters( 'the_seo_framework_allow_states', true );
61
 
62
  if ( $allow_states )
@@ -82,7 +98,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
82
  $searchexclude = (bool) $this->get_custom_field( 'exclude_local_search', $post_id );
83
 
84
  if ( $searchexclude )
85
- $states[] = __( 'No Search', 'autodescription' );
86
  }
87
 
88
  return $states;
@@ -95,12 +111,15 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
95
  */
96
  public function init_columns_ajax() {
97
 
98
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
 
 
 
99
 
100
- /**
101
- * Securely check the referrer, instead of leaving holes everywhere.
102
- */
103
- if ( current_user_can( 'publish_posts' ) && check_ajax_referer( 'add-tag', '_wpnonce_add-tag', false ) )
104
  $this->init_columns( '', true );
105
  }
106
 
@@ -120,11 +139,10 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
120
 
121
  $show_seo_column = (bool) apply_filters( 'the_seo_framework_show_seo_column', true );
122
 
123
- if ( $doing_ajax ) {
124
  $post_type = isset( $_POST['post_type'] ) ? $_POST['post_type'] : '';
125
- } else {
126
  $post_type = isset( $screen->post_type ) ? $screen->post_type : '';
127
- }
128
 
129
  if ( $show_seo_column && $this->post_type_supports_custom_seo( $post_type ) ) {
130
 
@@ -137,7 +155,6 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
137
  add_filter( 'manage_' . $id . '_columns', array( $this, 'add_column' ), 1 );
138
  add_action( 'manage_' . $taxonomy . '_custom_column', array( $this, 'seo_bar_ajax' ), 1, 3 );
139
  }
140
-
141
  } else {
142
 
143
  $id = isset( $screen->id ) ? $screen->id : '';
@@ -159,10 +176,8 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
159
  add_action( 'manage_posts_custom_column', array( $this, 'seo_bar' ), 1, 3 );
160
  add_action( 'manage_pages_custom_column', array( $this, 'seo_bar' ), 1, 3 );
161
  }
162
-
163
  }
164
  }
165
-
166
  }
167
 
168
  }
@@ -180,7 +195,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
180
  */
181
  public function add_column( $columns ) {
182
 
183
- $seocolumn = array( 'ad_seo' => 'SEO' );
184
 
185
  $column_keys = array_keys( $columns );
186
 
@@ -255,7 +270,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
255
  $post_id = $tax_id;
256
  }
257
 
258
- if ( 'ad_seo' === $column )
259
  echo $this->post_status( $post_id, $type, true );
260
 
261
  }
@@ -283,8 +298,8 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
283
  $post_id = $tax_id;
284
  }
285
 
286
- if ( 'ad_seo' === $column ) {
287
- $context = __( 'Refresh to see the SEO Bar status.', 'autodescription' );
288
 
289
  $ajax_id = $column . $post_id;
290
 
@@ -309,7 +324,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
309
  $classes = $this->get_the_seo_bar_classes();
310
 
311
  $args = array();
312
- $args['class'] = $classes[$color];
313
  $args['width'] = $classes['100%'];
314
  $args['notice'] = $context;
315
  $args['indicator'] = $symbol;
@@ -365,7 +380,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
365
  $post_i18n = __( 'Post', 'autodescription' );
366
  $is_term = false;
367
  $term = false;
368
- } else if ( 'page' === $type ) {
369
  $post_i18n = __( 'Page', 'autodescription' );
370
  $is_term = false;
371
  $term = false;
@@ -380,7 +395,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
380
 
381
  if ( $is_term ) {
382
  //* We're on a term or taxonomy. Try fetching names. Default back to "Page".
383
- $term = get_term_by( 'id', $post_id, $type, OBJECT );
384
  $post_i18n = $this->get_the_term_name( $term );
385
 
386
  /**
@@ -389,7 +404,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
389
  *
390
  * @since 2.3.1
391
  */
392
- if ( $is_term && $this->is_post_type_page( $type ) )
393
  $is_term = false;
394
  }
395
 
@@ -410,7 +425,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
410
  return $this->the_seo_bar_page( $args );
411
  }
412
  } else {
413
- $context = __( 'Failed to fetch post ID.', 'autodescription' );
414
 
415
  return $this->post_status_special( $context, '!', 'bad' );
416
  }
@@ -431,11 +446,12 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
431
  */
432
  protected function wrap_the_seo_bar_block( $args ) {
433
 
434
- $wrap = '<span class="ad-sec-wrap ' . $args['width'] . '">'
435
  . '<a onclick="return false;" class="' . $args['class'] . '" aria-label="' . $args['notice'] . '" data-desc="' . $args['notice'] . '">'
436
  . $args['indicator']
437
  . '</a>'
438
- . '</span>';
 
439
 
440
  return $wrap;
441
  }
@@ -464,17 +480,17 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
464
  $width = $is_term ? ' ' . $classes['100%'] : '';
465
  $pill = $this->pill_the_seo_bar() ? ' ' . $classes['pill'] : '';
466
 
467
- $class = 'ad-seo clearfix' . $width . $pill;
468
  }
469
 
470
  if ( isset( $ajax_id ) ) {
471
  //* Ajax handler.
472
- $script = '<script>jQuery("#' . esc_attr( $ajax_id ) . '").on( "hover click", autodescription.statusBarHover );</script>';
473
 
474
- return sprintf( '<span class="%s" id="%s"><span class="ad-bar-wrap">%s</span></span>', $class, $ajax_id, $content ) . $script;
475
  }
476
 
477
- return sprintf( '<span class="%s"><span class="ad-bar-wrap">%s</span></span>', $class, $content );
478
  }
479
 
480
  /**
@@ -485,7 +501,6 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
485
  * @param array $args {
486
  * 'is_term' => bool $is_term,
487
  * 'term' => object $term,
488
- * 'post_id' => int $post_id,
489
  * 'post_i18n' => string $post_i18n,
490
  * 'post_low' => string $post_low,
491
  * 'type' => string $type,
@@ -494,30 +509,24 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
494
  */
495
  protected function the_seo_bar_term( $args ) {
496
 
497
- $post_id = $args['post_id'];
498
  $term = $args['term'];
499
  $post = $args['post_i18n'];
500
  $is_term = true;
501
 
502
- $noindex = isset( $term->admeta['noindex'] ) && $this->is_checked( $term->admeta['noindex'] ) ? true : false;
503
- $redirect = false; // We don't apply redirect on taxonomies (yet)
504
-
505
- $ad_savedflag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] ) ? true : false;
506
- $flag = $ad_savedflag;
507
 
508
- //* Genesis data fetch
509
- if ( false === $noindex && false === $flag && isset( $term->meta['noindex'] ) )
510
- $noindex = $this->is_checked( $term->meta['noindex'] ) ? true : false;
511
 
512
  //* Blocked SEO, return simple bar.
513
  if ( $redirect || $noindex )
514
  return $this->the_seo_bar_blocked( array( 'is_term' => $is_term, 'redirect' => $redirect, 'noindex' => $noindex, 'post_i18n' => $post ) );
515
 
516
- $title_notice = $this->the_seo_bar_title_notice( $args );
517
- $description_notice = $this->the_seo_bar_description_notice( $args );
518
- $index_notice = $this->the_seo_bar_index_notice( $args );
519
- $follow_notice = $this->the_seo_bar_follow_notice( $args );
520
- $archive_notice = $this->the_seo_bar_archive_notice( $args );
521
 
522
  $content = $title_notice . $description_notice . $index_notice . $follow_notice . $archive_notice;
523
 
@@ -558,12 +567,12 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
558
  if ( $redirect || $noindex )
559
  return $this->the_seo_bar_blocked( array( 'is_term' => $is_term, 'redirect' => $redirect, 'noindex' => $noindex, 'post_i18n' => $post ) );
560
 
561
- $title_notice = $this->the_seo_bar_title_notice( $args );
562
- $description_notice = $this->the_seo_bar_description_notice( $args );
563
- $index_notice = $this->the_seo_bar_index_notice( $args );
564
- $follow_notice = $this->the_seo_bar_follow_notice( $args );
565
- $archive_notice = $this->the_seo_bar_archive_notice( $args );
566
- $redirect_notice = $this->the_seo_bar_redirect_notice( $args );
567
 
568
  $content = $title_notice . $description_notice . $index_notice . $follow_notice . $archive_notice . $redirect_notice;
569
 
@@ -592,13 +601,13 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
592
 
593
  static $data = array();
594
 
595
- if ( isset( $data[$post_id] ) )
596
- return $data[$post_id];
597
 
598
  if ( $args['is_term'] ) {
599
- return $data[$post_id] = $this->the_seo_bar_term_data( $args );
600
  } else {
601
- return $data[$post_id] = $this->the_seo_bar_post_data( $args );
602
  }
603
  }
604
 
@@ -621,47 +630,32 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
621
  protected function the_seo_bar_term_data( $args ) {
622
 
623
  $term = $args['term'];
624
- $post_id = $args['post_id'];
625
  $taxonomy = $args['type'];
626
 
627
- $flag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] ) ? true : false;
628
 
629
- $title_custom_field = isset( $term->admeta['doctitle'] ) ? $term->admeta['doctitle'] : '';
630
- $description_custom_field = isset( $term->admeta['description'] ) ? $term->admeta['description'] : '';
631
- $nofollow = isset( $term->admeta['nofollow'] ) ? $term->admeta['nofollow'] : '';
632
- $noarchive = isset( $term->admeta['noarchive'] ) ? $term->admeta['noarchive'] : '';
633
-
634
- //* Genesis data fetch
635
- if ( false === $flag && isset( $term->meta ) ) {
636
- if ( empty( $title_custom_field ) && isset( $term->meta['doctitle'] ) )
637
- $title_custom_field = $term->meta['doctitle'];
638
-
639
- if ( empty( $description_custom_field ) && isset( $term->meta['description'] ) )
640
- $description_custom_field = $term->meta['description'];
641
-
642
- if ( empty( $nofollow ) && isset( $term->meta['nofollow'] ) )
643
- $nofollow = $term->meta['nofollow'];
644
-
645
- if ( empty( $noarchive ) && isset( $term->meta['noarchive'] ) )
646
- $noarchive = $term->meta['noarchive'];
647
- }
648
 
649
  $title_is_from_custom_field = (bool) $title_custom_field;
650
  if ( $title_is_from_custom_field ) {
651
- $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'taxonomy' => $taxonomy, 'get_custom_field' => true ) );
652
  } else {
653
- $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'taxonomy' => $taxonomy, 'get_custom_field' => false ) );
654
  }
655
 
656
  $description_is_from_custom_field = (bool) $description_custom_field;
657
  if ( $description_is_from_custom_field ) {
658
- $taxonomy = isset( $term->taxonomy ) && $term->taxonomy ? $term->taxonomy : '';
659
- $description_args = $taxonomy ? array( 'id' => $post_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => true ) : array( 'get_custom_field' => true );
660
 
661
  $description = $this->generate_description( '', $description_args );
662
  } else {
663
- $taxonomy = isset( $term->taxonomy ) && $term->taxonomy ? $term->taxonomy : '';
664
- $description_args = $taxonomy ? array( 'id' => $post_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => false ) : array( 'get_custom_field' => false );
665
 
666
  $description = $this->generate_description( '', $description_args );
667
  }
@@ -675,7 +669,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
675
  'description' => $description,
676
  'description_is_from_custom_field' => $description_is_from_custom_field,
677
  'nofollow' => $nofollow,
678
- 'noarchive' => $noarchive
679
  );
680
  }
681
 
@@ -713,16 +707,18 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
713
  }
714
 
715
  $title_is_from_custom_field = (bool) $title_custom_field;
716
- if ( $title_is_from_custom_field )
717
  $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'page_on_front' => $page_on_front, 'get_custom_field' => true ) );
718
- else
719
  $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'page_on_front' => $page_on_front, 'get_custom_field' => false ) );
 
720
 
721
  $description_is_from_custom_field = (bool) $description_custom_field;
722
- if ( $description_is_from_custom_field )
723
  $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => true ) );
724
- else
725
  $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => false ) );
 
726
 
727
  $nofollow = $this->is_checked( $nofollow );
728
  $noarchive = $this->is_checked( $noarchive );
@@ -749,8 +745,8 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
749
 
750
  //* Fetch data
751
  $data = $this->the_seo_bar_data( $args );
752
- $title = $data['title'];
753
- $title_is_from_custom_field = $data['title_is_from_custom_field'];
754
 
755
  //* Fetch CSS classes.
756
  $classes = $this->get_the_seo_bar_classes();
@@ -758,10 +754,10 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
758
 
759
  //* Fetch i18n and put in vars
760
  $i18n = $this->get_the_seo_bar_i18n();
761
- $title_short = $i18n['title_short'];
762
- $generated = $i18n['generated_short'];
763
- $and_i18n = $i18n['and'];
764
- $but_i18n = $i18n['but'];
765
 
766
  //* Initialize notice.
767
  $notice = $i18n['title'];
@@ -799,7 +795,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
799
  $but_and = $title_length_warning['but'] ? $but_i18n : $and_i18n;
800
 
801
  /* translators: %s = But or And */
802
- $notice .= '<br>' . sprintf( __( '%s the Title contains the Blogname multiple times.', 'autodescription' ), $but_and );
803
  $class = $classes['bad'];
804
  }
805
 
@@ -900,24 +896,26 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
900
  $okay = $classes['okay'];
901
  $good = $classes['good'];
902
 
 
 
903
  if ( $desc_len < 100 ) {
904
- $notice = ' ' . __( 'Length is far too short.', 'autodescription' );
905
  $class = $bad;
906
- } else if ( $desc_len < 137 ) {
907
- $notice = ' ' . __( 'Length is too short.', 'autodescription' );
908
 
909
  // Don't make it okay if it's already bad.
910
  $class = $bad === $class ? $class : $okay;
911
- } else if ( $desc_len > 155 && $desc_len < 175 ) {
912
- $notice = ' ' . __( 'Length is too long.', 'autodescription' );
913
 
914
  // Don't make it okay if it's already bad.
915
  $class = $bad === $class ? $class : $okay;
916
- } else if ( $desc_len >= 175 ) {
917
- $notice = ' ' . __( 'Length is far too long.', 'autodescription' );
918
  $class = $bad;
919
  } else {
920
- $notice = ' ' . __( 'Length is good.', 'autodescription' );
921
 
922
  // Don't make it good if it's already bad or okay.
923
  $class = $good !== $class ? $class : $good;
@@ -925,7 +923,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
925
 
926
  return array(
927
  'notice' => $notice,
928
- 'class' => $class
929
  );
930
  }
931
 
@@ -942,79 +940,33 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
942
  protected function get_the_seo_bar_description_words_warning( $description, $class ) {
943
 
944
  $notice = '';
945
- $desc_too_many = '';
946
-
947
- //* Convert description's special characters into PHP readable words.
948
- $description = htmlentities( $description, ENT_COMPAT, "UTF-8" );
949
-
950
- //* Because we've converted all characters to XHTML codes, the odd ones should be only numerical.
951
- $html_special_chars = '&0123456789;';
952
-
953
- //* Count the words.
954
- $desc_words = str_word_count( strtolower( $description ), 2, $html_special_chars );
955
-
956
- static $bother_me_length = null;
957
- /**
958
- * Applies filters 'the_seo_framework_bother_me_desc_length' : int Min Character length to bother you with.
959
- * @since 2.6.0
960
- */
961
- if ( is_null( $bother_me_length ) )
962
- $bother_me_length = (int) apply_filters( 'the_seo_framework_bother_me_desc_length', 3 );
963
-
964
- if ( is_array( $desc_words ) ) {
965
- //* We're going to fetch word based on key, and the last element (as first)
966
- $word_keys = array_flip( array_reverse( $desc_words, true ) );
967
-
968
- $desc_word_count = array_count_values( $desc_words );
969
-
970
- //* Parse word counting.
971
- if ( is_array( $desc_word_count ) ) {
972
- foreach ( $desc_word_count as $desc_word => $desc_word_count ) {
973
-
974
- if ( mb_strlen( html_entity_decode( $desc_word ) ) < $bother_me_length ) {
975
- $run = $desc_word_count >= 5 ? true : false;
976
- } else {
977
- $run = $desc_word_count >= 3 ? true : false;
978
- }
979
-
980
- if ( $run ) {
981
- //* The encoded word is longer or equal to the bother lenght.
982
 
983
- $word_len = mb_strlen( $desc_word );
984
 
985
- $position = $word_keys[$desc_word];
986
- $first_word_original = mb_substr( $description, $position, $word_len );
987
-
988
- //* Found words that are used too frequently.
989
- $desc_too_many[] = array( $first_word_original => $desc_word_count );
990
- }
991
- }
992
- }
993
- }
994
-
995
- if ( '' !== $desc_too_many && is_array( $desc_too_many ) ) {
996
 
997
  $classes = $this->get_the_seo_bar_classes();
998
  $bad = $classes['bad'];
999
  $okay = $classes['okay'];
1000
 
1001
- $words_count = count( $desc_too_many );
1002
  //* Don't make it okay if it's already bad.
1003
  $class = $bad !== $class && $words_count <= 1 ? $okay : $bad;
1004
 
1005
  $i = 1;
1006
- $count = count( $desc_too_many );
1007
- foreach ( $desc_too_many as $desc_array ) {
1008
  foreach ( $desc_array as $desc_value => $desc_count ) {
1009
  $notice .= ' ';
1010
 
1011
  /**
1012
- * Don't ucfirst abbrivations.
1013
  * @since 2.4.1
1014
  */
1015
  $desc_value = ctype_upper( $desc_value ) ? $desc_value : ucfirst( $desc_value );
1016
 
1017
- $notice .= sprintf( __( '%s is used %d times.', 'autodescription' ), '<span>' . $desc_value . '</span>', $desc_count );
 
1018
 
1019
  //* Don't add break at last occurence.
1020
  $notice .= $i === $count ? '' : '<br>';
@@ -1025,7 +977,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1025
 
1026
  return array(
1027
  'notice' => $notice,
1028
- 'class' => $class
1029
  );
1030
  }
1031
 
@@ -1046,19 +998,19 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1046
  $data = $this->the_seo_bar_data( $args );
1047
 
1048
  $classes = $this->get_the_seo_bar_classes();
1049
- $unknown = $classes['unknown'];
1050
- $bad = $classes['bad'];
1051
- $okay = $classes['okay'];
1052
- $good = $classes['good'];
1053
- $ad_125 = $classes['12.5%'];
1054
 
1055
  $i18n = $this->get_the_seo_bar_i18n();
1056
- $index_short = $i18n['index_short'];
1057
- $but_i18n = $i18n['but'];
1058
- $and_i18n = $i18n['and'];
1059
- $ind_notice = $i18n['index'];
1060
 
1061
- $ind_notice .= ' ' . sprintf( __( "%s is being indexed.", 'autodescription' ), $post_i18n );
1062
  $ind_class = $good;
1063
 
1064
  /**
@@ -1067,7 +1019,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1067
  * @since 2.2.2
1068
  */
1069
  if ( $this->is_option_checked( 'site_noindex' ) ) {
1070
- $ind_notice .= '<br>' . __( "But you've disabled indexing for the whole site.", 'autodescription' );
1071
  $ind_class = $unknown;
1072
  $ind_but = true;
1073
  }
@@ -1091,7 +1043,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1091
  $label = $this->get_the_term_name( $term, false );
1092
 
1093
  /* translators: 1: But or And, 2: Current taxonomy term plural label */
1094
- $ind_notice .= '<br>' . sprintf( __( '%1$s indexing for %2$s have been disabled.', 'autodescription' ), $but_and, $label );
1095
  $ind_class = $unknown;
1096
  $ind_but = true;
1097
  }
@@ -1101,7 +1053,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1101
  if ( false === $this->is_blog_public() ) {
1102
  $but_and = isset( $ind_but ) ? $and_i18n : $but_i18n;
1103
  /* translators: %s = But or And */
1104
- $ind_notice .= '<br>' . sprintf( __( "%s the blog isn't set to public. This means WordPress discourages indexing.", 'autodescription' ), $but_and );
1105
  $ind_class = $bad;
1106
  $ind_but = true;
1107
  }
@@ -1115,16 +1067,16 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1115
  $but_and = isset( $ind_but ) ? $and_i18n : $but_i18n;
1116
 
1117
  /* translators: %s = But or And */
1118
- $ind_notice .= '<br>' . sprintf( __( "%s there are no posts in this term; therefore, indexing has been disabled.", 'autodescription' ), $but_and );
1119
  //* Don't make it unknown if it's not good.
1120
  $ind_class = $ind_class !== $good ? $ind_class : $unknown;
1121
  }
1122
 
1123
  $ind_wrap_args = array(
1124
  'indicator' => $index_short,
1125
- 'notice' => $ind_notice,
1126
- 'width' => $ad_125,
1127
- 'class' => $ind_class,
1128
  );
1129
 
1130
  $index_notice = $this->wrap_the_seo_bar_block( $ind_wrap_args );
@@ -1154,13 +1106,13 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1154
  if ( $taxonomy ) {
1155
  static $cache = array();
1156
 
1157
- if ( isset( $cache[$type][$taxonomy] ) )
1158
- return $cache[$type][$taxonomy];
1159
 
1160
  if ( $this->is_option_checked( $taxonomy . '_' . $type ) )
1161
- return $cache[$type][$taxonomy] = true;
1162
 
1163
- return $cache[$type][$taxonomy] = false;
1164
  }
1165
 
1166
  return false;
@@ -1186,26 +1138,26 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1186
  $nofollow = $data['nofollow'];
1187
 
1188
  $classes = $this->get_the_seo_bar_classes();
1189
- $unknown = $classes['unknown'];
1190
- $bad = $classes['bad'];
1191
- $okay = $classes['okay'];
1192
- $good = $classes['good'];
1193
- $ad_125 = $classes['12.5%'];
1194
 
1195
  $i18n = $this->get_the_seo_bar_i18n();
1196
- $follow_i18n = $i18n['follow'];
1197
- $but_i18n = $i18n['but'];
1198
- $and_i18n = $i18n['and'];
1199
- $follow_short = $i18n['follow_short'];
1200
 
1201
  if ( $nofollow ) {
1202
- $fol_notice = $follow_i18n . ' ' . sprintf( __( "%s links aren't being followed.", 'autodescription' ), $post_i18n );
1203
  $fol_class = $unknown;
1204
  $fol_but = true;
1205
 
1206
  $followed = false;
1207
  } else {
1208
- $fol_notice = $follow_i18n . ' ' . sprintf( __( '%s links are being followed.', 'autodescription' ), $post_i18n );
1209
  $fol_class = $good;
1210
  }
1211
 
@@ -1217,7 +1169,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1217
  if ( $this->is_option_checked( 'site_nofollow' ) ) {
1218
  $but_and = isset( $fol_but ) ? $and_i18n : $but_i18n;
1219
  /* translators: %s = But or And */
1220
- $fol_notice .= '<br>' . sprintf( __( "%s you've disabled the following of links for the whole site.", 'autodescription' ), $but_and );
1221
  $fol_class = $unknown;
1222
  $fol_but = true;
1223
 
@@ -1243,7 +1195,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1243
  $label = $this->get_the_term_name( $term, false );
1244
 
1245
  /* translators: 1: But or And, 2: Current taxonomy term plural label */
1246
- $fol_notice .= '<br>' . sprintf( __( '%1$s following for %2$s have been disabled.', 'autodescription' ), $but_and, $label );
1247
  $fol_class = $unknown;
1248
 
1249
  $followed = false;
@@ -1255,7 +1207,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1255
  $but_and = $followed || ! isset( $fol_but ) ? $and_i18n : $but_i18n;
1256
 
1257
  /* translators: %s = But or And */
1258
- $fol_notice .= '<br>' . sprintf( __( "%s the blog isn't set to public. This means WordPress allows the links to be followed regardless.", 'autodescription' ), $but_and );
1259
  $fol_class = $followed ? $fol_class : $okay;
1260
  $fol_but = true;
1261
 
@@ -1264,9 +1216,9 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1264
 
1265
  $fol_wrap_args = array(
1266
  'indicator' => $follow_short,
1267
- 'notice' => $fol_notice,
1268
- 'width' => $ad_125,
1269
- 'class' => $fol_class,
1270
  );
1271
 
1272
  $follow_notice = $this->wrap_the_seo_bar_block( $fol_wrap_args );
@@ -1294,25 +1246,25 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1294
  $noarchive = $data['noarchive'];
1295
 
1296
  $classes = $this->get_the_seo_bar_classes();
1297
- $unknown = $classes['unknown'];
1298
- $bad = $classes['bad'];
1299
- $okay = $classes['okay'];
1300
- $good = $classes['good'];
1301
- $ad_125 = $classes['12.5%'];
1302
 
1303
  $i18n = $this->get_the_seo_bar_i18n();
1304
- $archive_i18n = $i18n['archive'];
1305
- $but_i18n = $i18n['but'];
1306
- $and_i18n = $i18n['and'];
1307
- $archive_short = $i18n['archive_short'];
1308
 
1309
  if ( $noarchive ) {
1310
- $arc_notice = $archive_i18n . ' ' . sprintf( __( "Search Engine aren't allowed to archive this %s.", 'autodescription' ), $post_low );
1311
  $arc_class = $unknown;
1312
  $archived = false;
1313
  $arc_but = true;
1314
  } else {
1315
- $arc_notice = $archive_i18n . ' ' . sprintf( __( 'Search Engine are allowed to archive this %s.', 'autodescription' ), $post_low );
1316
  $arc_class = $good;
1317
  }
1318
 
@@ -1324,7 +1276,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1324
  if ( $this->is_option_checked( 'site_noarchive' ) ) {
1325
  $but_and = isset( $arc_but ) ? $and_i18n : $but_i18n;
1326
 
1327
- $arc_notice .= '<br>' . sprintf( __( "But you've disabled archiving for the whole site.", 'autodescription' ), $but_and );
1328
  $arc_class = $unknown;
1329
  $arc_but = true;
1330
 
@@ -1350,7 +1302,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1350
  $label = $this->get_the_term_name( $term, false );
1351
 
1352
  /* translators: 1: But or And, 2: Current taxonomy term plural label */
1353
- $arc_notice .= '<br>' . sprintf( __( '%1$s archiving for %2$s have been disabled.', 'autodescription' ), $but_and, $label );
1354
  $arc_class = $unknown;
1355
  $arc_but = true;
1356
 
@@ -1363,7 +1315,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1363
  $but_and = $archived || ! isset( $arc_but ) ? $and_i18n : $but_i18n;
1364
 
1365
  /* translators: %s = But or And */
1366
- $arc_notice .= '<br>' . sprintf( __( "%s the blog isn't set to public. This means WordPress allows the blog to be archived regardless.", 'autodescription' ), $but_and );
1367
  $arc_but = true;
1368
 
1369
  $arc_class = $archived ? $arc_class : $okay;
@@ -1409,7 +1361,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1409
  $redirect_i18n = $i18n['redirect'];
1410
  $redirect_short = $i18n['redirect_short'];
1411
 
1412
- $red_notice = $redirect_i18n . ' ' . sprintf( __( "%s isn't being redirected.", 'autodescription' ), $post );
1413
  $red_class = $classes['good'];
1414
 
1415
  $red_wrap_args = array(
@@ -1451,10 +1403,10 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1451
  if ( $redirect && $noindex ) {
1452
  //* Redirect and noindex found, why bother showing SEO info?
1453
 
1454
- $red_notice = $i18n['redirect'] . ' ' . sprintf( __( "%s is being redirected. This means no SEO values have to be set.", 'autodescription' ), $post );
1455
  $red_class = $classes['unknown'];
1456
 
1457
- $noi_notice = $i18n['index'] . ' ' . sprintf( __( "%s is not being indexed. This means no SEO values have to be set.", 'autodescription' ), $post );
1458
  $noi_class = $classes['unknown'];
1459
 
1460
  $red_wrap_args = array(
@@ -1477,10 +1429,10 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1477
  $content = $redirect_notice . $noindex_notice;
1478
 
1479
  return $this->get_the_seo_bar_wrap( $content, $is_term );
1480
- } else if ( $redirect && false === $noindex ) {
1481
  //* Redirect found, why bother showing SEO info?
1482
 
1483
- $red_notice = $i18n['redirect'] . ' ' . sprintf( __( "%s is being redirected. This means no SEO values have to be set.", 'autodescription' ), $post );
1484
  $red_class = $classes['unknown'];
1485
 
1486
  $red_wrap_args = array(
@@ -1493,10 +1445,10 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1493
  $redirect_notice = $this->wrap_the_seo_bar_block( $red_wrap_args );
1494
 
1495
  return $this->get_the_seo_bar_wrap( $redirect_notice, $is_term );
1496
- } else if ( $noindex && false === $redirect ) {
1497
  //* Noindex found, why bother showing SEO info?
1498
 
1499
- $noi_notice = $i18n['index'] . ' ' . sprintf( __( "%s is not being indexed. This means no SEO values have to be set.", 'autodescription' ), $post );
1500
  $noi_class = $classes['unknown'];
1501
 
1502
  $noi_wrap_args = array(
@@ -1530,26 +1482,28 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1530
  protected function get_the_seo_bar_title_length_warning( $tit_len, $class ) {
1531
 
1532
  $classes = $this->get_the_seo_bar_classes();
1533
- $bad = $classes['bad'];
1534
- $okay = $classes['okay'];
1535
- $good = $classes['good'];
1536
 
1537
  $but = false;
1538
 
 
 
1539
  if ( $tit_len < 25 ) {
1540
- $notice = ' ' . __( 'Length is far too short.', 'autodescription' );
1541
  $class = $bad;
1542
- } else if ( $tit_len < 42 ) {
1543
- $notice = ' ' . __( 'Length is too short.', 'autodescription' );
1544
  $class = $okay;
1545
- } else if ( $tit_len > 55 && $tit_len < 75 ) {
1546
- $notice = ' ' . __( 'Length is too long.', 'autodescription' );
1547
  $class = $okay;
1548
- } else if ( $tit_len >= 75 ) {
1549
- $notice = ' ' . __( 'Length is far too long.', 'autodescription' );
1550
  $class = $bad;
1551
  } else {
1552
- $notice = ' ' . __( 'Length is good.', 'autodescription' );
1553
  $class = $good;
1554
  $but = true;
1555
  }
@@ -1557,7 +1511,7 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1557
  return array(
1558
  'notice' => $notice,
1559
  'class' => $class,
1560
- 'but' => $but
1561
  );
1562
  }
1563
 
@@ -1570,25 +1524,25 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1570
  */
1571
  public function get_the_seo_bar_classes() {
1572
  return array(
1573
- 'bad' => 'ad-seo-bad',
1574
- 'okay' => 'ad-seo-okay',
1575
- 'good' => 'ad-seo-good',
1576
- 'unknown' => 'ad-seo-unknown',
1577
 
1578
  'pill' => 'pill',
1579
 
1580
- '100%' => 'ad-100',
1581
- '60%' => 'ad-60',
1582
- '50%' => 'ad-50',
1583
- '40%' => 'ad-40',
1584
- '33%' => 'ad-33',
1585
- '25%' => 'ad-25',
1586
- '25%' => 'ad-25',
1587
- '20%' => 'ad-20',
1588
- '16%' => 'ad-16',
1589
- '12.5%' => 'ad-12-5',
1590
  '11%' => 'ad-11',
1591
- '10%' => 'ad-10',
1592
  );
1593
  }
1594
 
@@ -1608,25 +1562,31 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1608
  return $i18n;
1609
 
1610
  return $i18n = array(
1611
- 'title' => __( 'Title:', 'autodescription' ),
1612
- 'description' => __( 'Description:', 'autodescription' ),
1613
- 'index' => __( 'Index:', 'autodescription' ),
1614
- 'follow' => __( 'Follow:', 'autodescription' ),
1615
- 'archive' => __( 'Archive:', 'autodescription' ),
1616
- 'redirect' => __( 'Redirect:', 'autodescription' ),
1617
-
1618
- 'generated' => __( 'Generated: Automatically generated.', 'autodescription'),
1619
-
1620
- 'generated_short' => _x( 'G', 'Generated', 'autodescription' ),
1621
- 'title_short' => _x( 'T', 'Title', 'autodescription' ),
1622
- 'description_short' => _x( 'D', 'Description', 'autodescription' ),
1623
- 'index_short' => _x( 'I', 'no-Index', 'autodescription' ),
1624
- 'follow_short' => _x( 'F', 'no-Follow', 'autodescription' ),
1625
- 'archive_short' => _x( 'A', 'no-Archive', 'autodescription' ),
1626
- 'redirect_short' => _x( 'R', 'Redirect', 'autodescription' ),
1627
-
1628
- 'but' => _x( 'But', 'But there are...', 'autodescription' ),
1629
- 'and' => _x( 'And', 'And there are...', 'autodescription' ),
 
 
 
 
 
 
1630
  );
1631
  }
1632
 
@@ -1647,10 +1607,6 @@ class AutoDescription_DoingItRight extends AutoDescription_Search {
1647
  if ( isset( $cache ) )
1648
  return $cache;
1649
 
1650
- //* TODO add option.
1651
- $filter = (bool) apply_filters( 'the_seo_framework_seo_bar_pill', false );
1652
-
1653
- return $cache = $filter ? true : false;
1654
  }
1655
-
1656
  }
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_DoingItRight
23
  *
28
  */
29
  class AutoDescription_DoingItRight extends AutoDescription_Search {
30
 
31
+ /**
32
+ * Unserializing instances of this class is forbidden.
33
+ */
34
+ private function __wakeup() { }
35
+
36
+ /**
37
+ * Handle unapproachable invoked methods.
38
+ */
39
+ public function __call( $name, $arguments ) {
40
+ parent::__call( $name, $arguments );
41
+ }
42
+
43
  /**
44
  * Constructor, load parent constructor.
45
  * Initalizes columns and load post states.
51
  add_action( 'current_screen', array( $this, 'post_state' ) );
52
 
53
  //* Ajax handlers for columns.
54
+ add_action( 'wp_ajax_add-tag', array( $this, 'init_columns_ajax' ), -1 );
55
  //* Initialize columns.
56
  add_action( 'current_screen', array( $this, 'init_columns' ) );
57
 
58
  }
59
 
60
  /**
61
+ * Add post state on edit.php to the page or post that has been altered.
 
 
62
  *
63
  * @uses $this->add_post_state
64
  *
69
  //* Only load on singular pages.
70
  if ( $this->is_singular() ) {
71
 
72
+ /**
73
+ * Applies filters `the_seo_framework_allow_states` : boolean Whether to allow post states output.
74
+ * @since 2.1.0
75
+ */
76
  $allow_states = (bool) apply_filters( 'the_seo_framework_allow_states', true );
77
 
78
  if ( $allow_states )
98
  $searchexclude = (bool) $this->get_custom_field( 'exclude_local_search', $post_id );
99
 
100
  if ( $searchexclude )
101
+ $states[] = esc_html__( 'No Search', 'autodescription' );
102
  }
103
 
104
  return $states;
111
  */
112
  public function init_columns_ajax() {
113
 
114
+ /**
115
+ * Securely check the referrer, instead of leaving holes everywhere.
116
+ */
117
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'add-tag', '_wpnonce_add-tag', false ) ) {
118
 
119
+ $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag';
120
+ $tax = get_taxonomy( $taxonomy );
121
+
122
+ if ( current_user_can( $tax->cap->edit_terms ) )
123
  $this->init_columns( '', true );
124
  }
125
 
139
 
140
  $show_seo_column = (bool) apply_filters( 'the_seo_framework_show_seo_column', true );
141
 
142
+ if ( $doing_ajax )
143
  $post_type = isset( $_POST['post_type'] ) ? $_POST['post_type'] : '';
144
+ else
145
  $post_type = isset( $screen->post_type ) ? $screen->post_type : '';
 
146
 
147
  if ( $show_seo_column && $this->post_type_supports_custom_seo( $post_type ) ) {
148
 
155
  add_filter( 'manage_' . $id . '_columns', array( $this, 'add_column' ), 1 );
156
  add_action( 'manage_' . $taxonomy . '_custom_column', array( $this, 'seo_bar_ajax' ), 1, 3 );
157
  }
 
158
  } else {
159
 
160
  $id = isset( $screen->id ) ? $screen->id : '';
176
  add_action( 'manage_posts_custom_column', array( $this, 'seo_bar' ), 1, 3 );
177
  add_action( 'manage_pages_custom_column', array( $this, 'seo_bar' ), 1, 3 );
178
  }
 
179
  }
180
  }
 
181
  }
182
 
183
  }
195
  */
196
  public function add_column( $columns ) {
197
 
198
+ $seocolumn = array( 'tsf-seo-bar-wrap' => 'SEO' );
199
 
200
  $column_keys = array_keys( $columns );
201
 
270
  $post_id = $tax_id;
271
  }
272
 
273
+ if ( 'tsf-seo-bar-wrap' === $column )
274
  echo $this->post_status( $post_id, $type, true );
275
 
276
  }
298
  $post_id = $tax_id;
299
  }
300
 
301
+ if ( 'tsf-seo-bar-wrap' === $column ) {
302
+ $context = esc_html__( 'Refresh to see the SEO Bar status.', 'autodescription' );
303
 
304
  $ajax_id = $column . $post_id;
305
 
324
  $classes = $this->get_the_seo_bar_classes();
325
 
326
  $args = array();
327
+ $args['class'] = $classes[ $color ];
328
  $args['width'] = $classes['100%'];
329
  $args['notice'] = $context;
330
  $args['indicator'] = $symbol;
380
  $post_i18n = __( 'Post', 'autodescription' );
381
  $is_term = false;
382
  $term = false;
383
+ } elseif ( 'page' === $type ) {
384
  $post_i18n = __( 'Page', 'autodescription' );
385
  $is_term = false;
386
  $term = false;
395
 
396
  if ( $is_term ) {
397
  //* We're on a term or taxonomy. Try fetching names. Default back to "Page".
398
+ $term = $this->fetch_the_term( $post_id );
399
  $post_i18n = $this->get_the_term_name( $term );
400
 
401
  /**
404
  *
405
  * @since 2.3.1
406
  */
407
+ if ( $this->is_post_type_page( $type ) )
408
  $is_term = false;
409
  }
410
 
425
  return $this->the_seo_bar_page( $args );
426
  }
427
  } else {
428
+ $context = esc_attr__( 'Failed to fetch post ID.', 'autodescription' );
429
 
430
  return $this->post_status_special( $context, '!', 'bad' );
431
  }
446
  */
447
  protected function wrap_the_seo_bar_block( $args ) {
448
 
449
+ $wrap = '<span class="tsf-seo-bar-section-wrap ' . $args['width'] . '">'
450
  . '<a onclick="return false;" class="' . $args['class'] . '" aria-label="' . $args['notice'] . '" data-desc="' . $args['notice'] . '">'
451
  . $args['indicator']
452
  . '</a>'
453
+ . '</span>'
454
+ ;
455
 
456
  return $wrap;
457
  }
480
  $width = $is_term ? ' ' . $classes['100%'] : '';
481
  $pill = $this->pill_the_seo_bar() ? ' ' . $classes['pill'] : '';
482
 
483
+ $class = esc_attr( 'tsf-seo-bar clearfix' . $width . $pill );
484
  }
485
 
486
  if ( isset( $ajax_id ) ) {
487
  //* Ajax handler.
488
+ $script = '<script>jQuery("#' . esc_js( $ajax_id ) . '").on( "hover click", autodescription.statusBarHover );</script>';
489
 
490
+ return sprintf( '<span class="%s" id="%s"><span class="tsf-seo-bar-inner-wrap">%s</span></span>', $class, esc_attr( $ajax_id ), $content ) . $script;
491
  }
492
 
493
+ return sprintf( '<span class="%s"><span class="tsf-seo-bar-inner-wrap">%s</span></span>', $class, $content );
494
  }
495
 
496
  /**
501
  * @param array $args {
502
  * 'is_term' => bool $is_term,
503
  * 'term' => object $term,
 
504
  * 'post_i18n' => string $post_i18n,
505
  * 'post_low' => string $post_low,
506
  * 'type' => string $type,
509
  */
510
  protected function the_seo_bar_term( $args ) {
511
 
 
512
  $term = $args['term'];
513
  $post = $args['post_i18n'];
514
  $is_term = true;
515
 
516
+ $data = $this->get_term_data( $term, $term->term_id );
 
 
 
 
517
 
518
+ $noindex = isset( $data['noindex'] ) && $this->is_checked( $data['noindex'] );
519
+ $redirect = false; // We don't apply redirect on taxonomies (yet)
 
520
 
521
  //* Blocked SEO, return simple bar.
522
  if ( $redirect || $noindex )
523
  return $this->the_seo_bar_blocked( array( 'is_term' => $is_term, 'redirect' => $redirect, 'noindex' => $noindex, 'post_i18n' => $post ) );
524
 
525
+ $title_notice = $this->the_seo_bar_title_notice( $args );
526
+ $description_notice = $this->the_seo_bar_description_notice( $args );
527
+ $index_notice = $this->the_seo_bar_index_notice( $args );
528
+ $follow_notice = $this->the_seo_bar_follow_notice( $args );
529
+ $archive_notice = $this->the_seo_bar_archive_notice( $args );
530
 
531
  $content = $title_notice . $description_notice . $index_notice . $follow_notice . $archive_notice;
532
 
567
  if ( $redirect || $noindex )
568
  return $this->the_seo_bar_blocked( array( 'is_term' => $is_term, 'redirect' => $redirect, 'noindex' => $noindex, 'post_i18n' => $post ) );
569
 
570
+ $title_notice = $this->the_seo_bar_title_notice( $args );
571
+ $description_notice = $this->the_seo_bar_description_notice( $args );
572
+ $index_notice = $this->the_seo_bar_index_notice( $args );
573
+ $follow_notice = $this->the_seo_bar_follow_notice( $args );
574
+ $archive_notice = $this->the_seo_bar_archive_notice( $args );
575
+ $redirect_notice = $this->the_seo_bar_redirect_notice( $args );
576
 
577
  $content = $title_notice . $description_notice . $index_notice . $follow_notice . $archive_notice . $redirect_notice;
578
 
601
 
602
  static $data = array();
603
 
604
+ if ( isset( $data[ $post_id ] ) )
605
+ return $data[ $post_id ];
606
 
607
  if ( $args['is_term'] ) {
608
+ return $data[ $post_id ] = $this->the_seo_bar_term_data( $args );
609
  } else {
610
+ return $data[ $post_id ] = $this->the_seo_bar_post_data( $args );
611
  }
612
  }
613
 
630
  protected function the_seo_bar_term_data( $args ) {
631
 
632
  $term = $args['term'];
633
+ $term_id = $args['post_id'];
634
  $taxonomy = $args['type'];
635
 
636
+ $data = $this->get_term_data( $term, $term_id );
637
 
638
+ $title_custom_field = isset( $data['doctitle'] ) ? $data['doctitle'] : '';
639
+ $description_custom_field = isset( $data['description'] ) ? $data['description'] : '';
640
+ $nofollow = isset( $data['nofollow'] ) ? $data['nofollow'] : '';
641
+ $noarchive = isset( $data['noarchive'] ) ? $data['noarchive'] : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
642
 
643
  $title_is_from_custom_field = (bool) $title_custom_field;
644
  if ( $title_is_from_custom_field ) {
645
+ $title = $this->title( '', '', '', array( 'term_id' => $term_id, 'taxonomy' => $taxonomy, 'get_custom_field' => true ) );
646
  } else {
647
+ $title = $this->title( '', '', '', array( 'term_id' => $term_id, 'taxonomy' => $taxonomy, 'get_custom_field' => false ) );
648
  }
649
 
650
  $description_is_from_custom_field = (bool) $description_custom_field;
651
  if ( $description_is_from_custom_field ) {
652
+ $taxonomy = ! empty( $term->taxonomy ) ? $term->taxonomy : '';
653
+ $description_args = $taxonomy ? array( 'id' => $term_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => true ) : array( 'get_custom_field' => true );
654
 
655
  $description = $this->generate_description( '', $description_args );
656
  } else {
657
+ $taxonomy = ! empty( $term->taxonomy ) ? $term->taxonomy : '';
658
+ $description_args = $taxonomy ? array( 'id' => $term_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => false ) : array( 'get_custom_field' => false );
659
 
660
  $description = $this->generate_description( '', $description_args );
661
  }
669
  'description' => $description,
670
  'description_is_from_custom_field' => $description_is_from_custom_field,
671
  'nofollow' => $nofollow,
672
+ 'noarchive' => $noarchive,
673
  );
674
  }
675
 
707
  }
708
 
709
  $title_is_from_custom_field = (bool) $title_custom_field;
710
+ if ( $title_is_from_custom_field ) {
711
  $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'page_on_front' => $page_on_front, 'get_custom_field' => true ) );
712
+ } else {
713
  $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'page_on_front' => $page_on_front, 'get_custom_field' => false ) );
714
+ }
715
 
716
  $description_is_from_custom_field = (bool) $description_custom_field;
717
+ if ( $description_is_from_custom_field ) {
718
  $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => true ) );
719
+ } else {
720
  $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => false ) );
721
+ }
722
 
723
  $nofollow = $this->is_checked( $nofollow );
724
  $noarchive = $this->is_checked( $noarchive );
745
 
746
  //* Fetch data
747
  $data = $this->the_seo_bar_data( $args );
748
+ $title = $data['title'];
749
+ $title_is_from_custom_field = $data['title_is_from_custom_field'];
750
 
751
  //* Fetch CSS classes.
752
  $classes = $this->get_the_seo_bar_classes();
754
 
755
  //* Fetch i18n and put in vars
756
  $i18n = $this->get_the_seo_bar_i18n();
757
+ $title_short = $i18n['title_short'];
758
+ $generated = $i18n['generated_short'];
759
+ $and_i18n = $i18n['and'];
760
+ $but_i18n = $i18n['but'];
761
 
762
  //* Initialize notice.
763
  $notice = $i18n['title'];
795
  $but_and = $title_length_warning['but'] ? $but_i18n : $and_i18n;
796
 
797
  /* translators: %s = But or And */
798
+ $notice .= '<br>' . sprintf( esc_attr__( '%s the Title contains the Blogname multiple times.', 'autodescription' ), $but_and );
799
  $class = $classes['bad'];
800
  }
801
 
896
  $okay = $classes['okay'];
897
  $good = $classes['good'];
898
 
899
+ $i18n = $this->get_the_seo_bar_i18n();
900
+
901
  if ( $desc_len < 100 ) {
902
+ $notice = $i18n['length_far_too_short'];
903
  $class = $bad;
904
+ } elseif ( $desc_len < 137 ) {
905
+ $notice = $i18n['length_too_short'];
906
 
907
  // Don't make it okay if it's already bad.
908
  $class = $bad === $class ? $class : $okay;
909
+ } elseif ( $desc_len > 155 && $desc_len < 175 ) {
910
+ $notice = $i18n['length_too_long'];
911
 
912
  // Don't make it okay if it's already bad.
913
  $class = $bad === $class ? $class : $okay;
914
+ } elseif ( $desc_len >= 175 ) {
915
+ $notice = $i18n['length_far_too_long'];
916
  $class = $bad;
917
  } else {
918
+ $notice = $i18n['length_good'];
919
 
920
  // Don't make it good if it's already bad or okay.
921
  $class = $good !== $class ? $class : $good;
923
 
924
  return array(
925
  'notice' => $notice,
926
+ 'class' => $class,
927
  );
928
  }
929
 
940
  protected function get_the_seo_bar_description_words_warning( $description, $class ) {
941
 
942
  $notice = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
943
 
944
+ $words_too_many = $this->get_word_count( $description );
945
 
946
+ if ( ! empty( $words_too_many ) ) {
 
 
 
 
 
 
 
 
 
 
947
 
948
  $classes = $this->get_the_seo_bar_classes();
949
  $bad = $classes['bad'];
950
  $okay = $classes['okay'];
951
 
952
+ $words_count = count( $words_too_many );
953
  //* Don't make it okay if it's already bad.
954
  $class = $bad !== $class && $words_count <= 1 ? $okay : $bad;
955
 
956
  $i = 1;
957
+ $count = count( $words_too_many );
958
+ foreach ( $words_too_many as $desc_array ) {
959
  foreach ( $desc_array as $desc_value => $desc_count ) {
960
  $notice .= ' ';
961
 
962
  /**
963
+ * Don't ucfirst abbreviations.
964
  * @since 2.4.1
965
  */
966
  $desc_value = ctype_upper( $desc_value ) ? $desc_value : ucfirst( $desc_value );
967
 
968
+ /* translators: 1: Word, 2: Occurences */
969
+ $notice .= sprintf( esc_attr__( '%1$s is used %2$d times.', 'autodescription' ), '<span>' . $desc_value . '</span>', $desc_count );
970
 
971
  //* Don't add break at last occurence.
972
  $notice .= $i === $count ? '' : '<br>';
977
 
978
  return array(
979
  'notice' => $notice,
980
+ 'class' => $class,
981
  );
982
  }
983
 
998
  $data = $this->the_seo_bar_data( $args );
999
 
1000
  $classes = $this->get_the_seo_bar_classes();
1001
+ $unknown = $classes['unknown'];
1002
+ $bad = $classes['bad'];
1003
+ $okay = $classes['okay'];
1004
+ $good = $classes['good'];
1005
+ $ad_125 = $classes['12.5%'];
1006
 
1007
  $i18n = $this->get_the_seo_bar_i18n();
1008
+ $index_short = $i18n['index_short'];
1009
+ $but_i18n = $i18n['but'];
1010
+ $and_i18n = $i18n['and'];
1011
+ $ind_notice = $i18n['index'];
1012
 
1013
+ $ind_notice .= ' ' . sprintf( esc_attr__( '%s is being indexed.', 'autodescription' ), $post_i18n );
1014
  $ind_class = $good;
1015
 
1016
  /**
1019
  * @since 2.2.2
1020
  */
1021
  if ( $this->is_option_checked( 'site_noindex' ) ) {
1022
+ $ind_notice .= '<br>' . esc_attr__( "But you've disabled indexing for the whole site.", 'autodescription' );
1023
  $ind_class = $unknown;
1024
  $ind_but = true;
1025
  }
1043
  $label = $this->get_the_term_name( $term, false );
1044
 
1045
  /* translators: 1: But or And, 2: Current taxonomy term plural label */
1046
+ $ind_notice .= '<br>' . sprintf( esc_attr__( '%1$s indexing for %2$s have been disabled.', 'autodescription' ), $but_and, $label );
1047
  $ind_class = $unknown;
1048
  $ind_but = true;
1049
  }
1053
  if ( false === $this->is_blog_public() ) {
1054
  $but_and = isset( $ind_but ) ? $and_i18n : $but_i18n;
1055
  /* translators: %s = But or And */
1056
+ $ind_notice .= '<br>' . sprintf( esc_attr__( "%s the blog isn't set to public. This means WordPress discourages indexing.", 'autodescription' ), $but_and );
1057
  $ind_class = $bad;
1058
  $ind_but = true;
1059
  }
1067
  $but_and = isset( $ind_but ) ? $and_i18n : $but_i18n;
1068
 
1069
  /* translators: %s = But or And */
1070
+ $ind_notice .= '<br>' . sprintf( esc_attr__( '%s there are no posts in this term; therefore, indexing has been disabled.', 'autodescription' ), $but_and );
1071
  //* Don't make it unknown if it's not good.
1072
  $ind_class = $ind_class !== $good ? $ind_class : $unknown;
1073
  }
1074
 
1075
  $ind_wrap_args = array(
1076
  'indicator' => $index_short,
1077
+ 'notice' => $ind_notice,
1078
+ 'width' => $ad_125,
1079
+ 'class' => $ind_class,
1080
  );
1081
 
1082
  $index_notice = $this->wrap_the_seo_bar_block( $ind_wrap_args );
1106
  if ( $taxonomy ) {
1107
  static $cache = array();
1108
 
1109
+ if ( isset( $cache[ $type ] ) )
1110
+ return $cache[ $type ];
1111
 
1112
  if ( $this->is_option_checked( $taxonomy . '_' . $type ) )
1113
+ return $cache[ $type ] = true;
1114
 
1115
+ return $cache[ $type ] = false;
1116
  }
1117
 
1118
  return false;
1138
  $nofollow = $data['nofollow'];
1139
 
1140
  $classes = $this->get_the_seo_bar_classes();
1141
+ $unknown = $classes['unknown'];
1142
+ $bad = $classes['bad'];
1143
+ $okay = $classes['okay'];
1144
+ $good = $classes['good'];
1145
+ $ad_125 = $classes['12.5%'];
1146
 
1147
  $i18n = $this->get_the_seo_bar_i18n();
1148
+ $follow_i18n = $i18n['follow'];
1149
+ $but_i18n = $i18n['but'];
1150
+ $and_i18n = $i18n['and'];
1151
+ $follow_short = $i18n['follow_short'];
1152
 
1153
  if ( $nofollow ) {
1154
+ $fol_notice = $follow_i18n . ' ' . sprintf( esc_attr__( "%s links aren't being followed.", 'autodescription' ), $post_i18n );
1155
  $fol_class = $unknown;
1156
  $fol_but = true;
1157
 
1158
  $followed = false;
1159
  } else {
1160
+ $fol_notice = $follow_i18n . ' ' . sprintf( esc_attr__( '%s links are being followed.', 'autodescription' ), $post_i18n );
1161
  $fol_class = $good;
1162
  }
1163
 
1169
  if ( $this->is_option_checked( 'site_nofollow' ) ) {
1170
  $but_and = isset( $fol_but ) ? $and_i18n : $but_i18n;
1171
  /* translators: %s = But or And */
1172
+ $fol_notice .= '<br>' . sprintf( esc_attr__( "%s you've disabled the following of links for the whole site.", 'autodescription' ), $but_and );
1173
  $fol_class = $unknown;
1174
  $fol_but = true;
1175
 
1195
  $label = $this->get_the_term_name( $term, false );
1196
 
1197
  /* translators: 1: But or And, 2: Current taxonomy term plural label */
1198
+ $fol_notice .= '<br>' . sprintf( esc_attr__( '%1$s following for %2$s have been disabled.', 'autodescription' ), $but_and, $label );
1199
  $fol_class = $unknown;
1200
 
1201
  $followed = false;
1207
  $but_and = $followed || ! isset( $fol_but ) ? $and_i18n : $but_i18n;
1208
 
1209
  /* translators: %s = But or And */
1210
+ $fol_notice .= '<br>' . sprintf( esc_attr__( "%s the blog isn't set to public. This means WordPress allows the links to be followed regardless.", 'autodescription' ), $but_and );
1211
  $fol_class = $followed ? $fol_class : $okay;
1212
  $fol_but = true;
1213
 
1216
 
1217
  $fol_wrap_args = array(
1218
  'indicator' => $follow_short,
1219
+ 'notice' => $fol_notice,
1220
+ 'width' => $ad_125,
1221
+ 'class' => $fol_class,
1222
  );
1223
 
1224
  $follow_notice = $this->wrap_the_seo_bar_block( $fol_wrap_args );
1246
  $noarchive = $data['noarchive'];
1247
 
1248
  $classes = $this->get_the_seo_bar_classes();
1249
+ $unknown = $classes['unknown'];
1250
+ $bad = $classes['bad'];
1251
+ $okay = $classes['okay'];
1252
+ $good = $classes['good'];
1253
+ $ad_125 = $classes['12.5%'];
1254
 
1255
  $i18n = $this->get_the_seo_bar_i18n();
1256
+ $archive_i18n = $i18n['archive'];
1257
+ $but_i18n = $i18n['but'];
1258
+ $and_i18n = $i18n['and'];
1259
+ $archive_short = $i18n['archive_short'];
1260
 
1261
  if ( $noarchive ) {
1262
+ $arc_notice = $archive_i18n . ' ' . sprintf( esc_attr__( "Search Engine aren't allowed to archive this %s.", 'autodescription' ), $post_low );
1263
  $arc_class = $unknown;
1264
  $archived = false;
1265
  $arc_but = true;
1266
  } else {
1267
+ $arc_notice = $archive_i18n . ' ' . sprintf( esc_attr__( 'Search Engine are allowed to archive this %s.', 'autodescription' ), $post_low );
1268
  $arc_class = $good;
1269
  }
1270
 
1276
  if ( $this->is_option_checked( 'site_noarchive' ) ) {
1277
  $but_and = isset( $arc_but ) ? $and_i18n : $but_i18n;
1278
 
1279
+ $arc_notice .= '<br>' . sprintf( esc_attr__( "But you've disabled archiving for the whole site.", 'autodescription' ), $but_and );
1280
  $arc_class = $unknown;
1281
  $arc_but = true;
1282
 
1302
  $label = $this->get_the_term_name( $term, false );
1303
 
1304
  /* translators: 1: But or And, 2: Current taxonomy term plural label */
1305
+ $arc_notice .= '<br>' . sprintf( esc_attr__( '%1$s archiving for %2$s have been disabled.', 'autodescription' ), $but_and, $label );
1306
  $arc_class = $unknown;
1307
  $arc_but = true;
1308
 
1315
  $but_and = $archived || ! isset( $arc_but ) ? $and_i18n : $but_i18n;
1316
 
1317
  /* translators: %s = But or And */
1318
+ $arc_notice .= '<br>' . sprintf( esc_attr__( "%s the blog isn't set to public. This means WordPress allows the blog to be archived regardless.", 'autodescription' ), $but_and );
1319
  $arc_but = true;
1320
 
1321
  $arc_class = $archived ? $arc_class : $okay;
1361
  $redirect_i18n = $i18n['redirect'];
1362
  $redirect_short = $i18n['redirect_short'];
1363
 
1364
+ $red_notice = $redirect_i18n . ' ' . sprintf( esc_attr__( "%s isn't being redirected.", 'autodescription' ), $post );
1365
  $red_class = $classes['good'];
1366
 
1367
  $red_wrap_args = array(
1403
  if ( $redirect && $noindex ) {
1404
  //* Redirect and noindex found, why bother showing SEO info?
1405
 
1406
+ $red_notice = $i18n['redirect'] . ' ' . sprintf( esc_attr__( '%s is being redirected. This means no SEO values have to be set.', 'autodescription' ), $post );
1407
  $red_class = $classes['unknown'];
1408
 
1409
+ $noi_notice = $i18n['index'] . ' ' . sprintf( esc_attr__( '%s is not being indexed. This means no SEO values have to be set.', 'autodescription' ), $post );
1410
  $noi_class = $classes['unknown'];
1411
 
1412
  $red_wrap_args = array(
1429
  $content = $redirect_notice . $noindex_notice;
1430
 
1431
  return $this->get_the_seo_bar_wrap( $content, $is_term );
1432
+ } elseif ( $redirect && false === $noindex ) {
1433
  //* Redirect found, why bother showing SEO info?
1434
 
1435
+ $red_notice = $i18n['redirect'] . ' ' . sprintf( esc_attr__( '%s is being redirected. This means no SEO values have to be set.', 'autodescription' ), $post );
1436
  $red_class = $classes['unknown'];
1437
 
1438
  $red_wrap_args = array(
1445
  $redirect_notice = $this->wrap_the_seo_bar_block( $red_wrap_args );
1446
 
1447
  return $this->get_the_seo_bar_wrap( $redirect_notice, $is_term );
1448
+ } elseif ( $noindex && false === $redirect ) {
1449
  //* Noindex found, why bother showing SEO info?
1450
 
1451
+ $noi_notice = $i18n['index'] . ' ' . sprintf( esc_attr__( '%s is not being indexed. This means no SEO values have to be set.', 'autodescription' ), $post );
1452
  $noi_class = $classes['unknown'];
1453
 
1454
  $noi_wrap_args = array(
1482
  protected function get_the_seo_bar_title_length_warning( $tit_len, $class ) {
1483
 
1484
  $classes = $this->get_the_seo_bar_classes();
1485
+ $bad = $classes['bad'];
1486
+ $okay = $classes['okay'];
1487
+ $good = $classes['good'];
1488
 
1489
  $but = false;
1490
 
1491
+ $i18n = $this->get_the_seo_bar_i18n();
1492
+
1493
  if ( $tit_len < 25 ) {
1494
+ $notice = $i18n['length_far_too_short'];
1495
  $class = $bad;
1496
+ } elseif ( $tit_len < 42 ) {
1497
+ $notice = $i18n['length_too_short'];
1498
  $class = $okay;
1499
+ } elseif ( $tit_len > 55 && $tit_len < 75 ) {
1500
+ $notice = $i18n['length_too_long'];
1501
  $class = $okay;
1502
+ } elseif ( $tit_len >= 75 ) {
1503
+ $notice = $i18n['length_far_too_long'];
1504
  $class = $bad;
1505
  } else {
1506
+ $notice = $i18n['length_good'];
1507
  $class = $good;
1508
  $but = true;
1509
  }
1511
  return array(
1512
  'notice' => $notice,
1513
  'class' => $class,
1514
+ 'but' => $but,
1515
  );
1516
  }
1517
 
1524
  */
1525
  public function get_the_seo_bar_classes() {
1526
  return array(
1527
+ 'bad' => 'tsf-seo-bar-bad',
1528
+ 'okay' => 'tsf-seo-bar-okay',
1529
+ 'good' => 'tsf-seo-bar-good',
1530
+ 'unknown' => 'tsf-seo-bar-unknown',
1531
 
1532
  'pill' => 'pill',
1533
 
1534
+ '100%' => 'tsf-100',
1535
+ '60%' => 'tsf-60',
1536
+ '50%' => 'tsf-50',
1537
+ '40%' => 'tsf-40',
1538
+ '33%' => 'tsf-33',
1539
+ '25%' => 'tsf-25',
1540
+ '25%' => 'tsf-25',
1541
+ '20%' => 'tsf-20',
1542
+ '16%' => 'tsf-16',
1543
+ '12.5%' => 'tsf-12-5',
1544
  '11%' => 'ad-11',
1545
+ '10%' => 'tsf-10',
1546
  );
1547
  }
1548
 
1562
  return $i18n;
1563
 
1564
  return $i18n = array(
1565
+ 'title' => esc_attr__( 'Title:', 'autodescription' ),
1566
+ 'description' => esc_attr__( 'Description:', 'autodescription' ),
1567
+ 'index' => esc_attr__( 'Index:', 'autodescription' ),
1568
+ 'follow' => esc_attr__( 'Follow:', 'autodescription' ),
1569
+ 'archive' => esc_attr__( 'Archive:', 'autodescription' ),
1570
+ 'redirect' => esc_attr__( 'Redirect:', 'autodescription' ),
1571
+
1572
+ 'generated' => esc_attr__( 'Generated: Automatically generated.', 'autodescription' ),
1573
+
1574
+ 'generated_short' => esc_html_x( 'G', 'Generated', 'autodescription' ),
1575
+ 'title_short' => esc_html_x( 'T', 'Title', 'autodescription' ),
1576
+ 'description_short' => esc_html_x( 'D', 'Description', 'autodescription' ),
1577
+ 'index_short' => esc_html_x( 'I', 'no-Index', 'autodescription' ),
1578
+ 'follow_short' => esc_html_x( 'F', 'no-Follow', 'autodescription' ),
1579
+ 'archive_short' => esc_html_x( 'A', 'no-Archive', 'autodescription' ),
1580
+ 'redirect_short' => esc_html_x( 'R', 'Redirect', 'autodescription' ),
1581
+
1582
+ 'but' => esc_attr_x( 'But', 'But there are...', 'autodescription' ),
1583
+ 'and' => esc_attr_x( 'And', 'And there are...', 'autodescription' ),
1584
+
1585
+ 'length_far_too_short' => ' ' . esc_attr__( 'Length is far too short.', 'autodescription' ),
1586
+ 'length_too_short' => ' ' . esc_attr__( 'Length is too short.', 'autodescription' ),
1587
+ 'length_too_long' => ' ' . esc_attr__( 'Length is too long.', 'autodescription' ),
1588
+ 'length_far_too_long' => ' ' . esc_attr__( 'Length is far too long.', 'autodescription' ),
1589
+ 'length_good' => ' ' . esc_attr__( 'Length is good.', 'autodescription' ),
1590
  );
1591
  }
1592
 
1607
  if ( isset( $cache ) )
1608
  return $cache;
1609
 
1610
+ return $cache = (bool) apply_filters( 'the_seo_framework_seo_bar_pill', false );
 
 
 
1611
  }
 
1612
  }
inc/classes/feed.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_Feed
21
  *
@@ -26,6 +28,18 @@
26
  */
27
  class AutoDescription_Feed extends AutoDescription_Transients {
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * Constructor, load parent constructor and run functions.
31
  */
@@ -133,10 +147,8 @@ class AutoDescription_Feed extends AutoDescription_Transients {
133
  $source_i18n = (string) apply_filters( 'the_seo_framework_feed_source_link_text', _x( 'Source', 'The content source', 'autodescription' ) );
134
  $content .= "\r\n" . '<p><a href="' . $permalink . '" rel="external nofollow">' . $source_i18n . '</a></p>';
135
  }
136
-
137
  }
138
 
139
  return $content;
140
  }
141
-
142
  }
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_Feed
23
  *
28
  */
29
  class AutoDescription_Feed extends AutoDescription_Transients {
30
 
31
+ /**
32
+ * Unserializing instances of this class is forbidden.
33
+ */
34
+ private function __wakeup() { }
35
+
36
+ /**
37
+ * Handle unapproachable invoked methods.
38
+ */
39
+ public function __call( $name, $arguments ) {
40
+ parent::__call( $name, $arguments );
41
+ }
42
+
43
  /**
44
  * Constructor, load parent constructor and run functions.
45
  */
147
  $source_i18n = (string) apply_filters( 'the_seo_framework_feed_source_link_text', _x( 'Source', 'The content source', 'autodescription' ) );
148
  $content .= "\r\n" . '<p><a href="' . $permalink . '" rel="external nofollow">' . $source_i18n . '</a></p>';
149
  }
 
150
  }
151
 
152
  return $content;
153
  }
 
154
  }
inc/classes/generate-description.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_Generate_Description
21
  *
@@ -34,6 +36,18 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
34
  */
35
  protected $using_manual_excerpt = false;
36
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * Constructor, loads parent constructor.
39
  */
@@ -171,14 +185,14 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
171
  $default_args = $this->parse_description_args( '', '', true );
172
 
173
  if ( is_array( $args ) ) {
174
- if ( empty( $args ) ) {
175
  $args = $default_args;
176
  } else {
177
  $args = $this->parse_description_args( $args, $default_args );
178
  }
179
  } else {
180
  //* Old style parameters are used. Doing it wrong.
181
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.5.0' );
182
  $args = $default_args;
183
  }
184
 
@@ -196,7 +210,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
196
  * @param bool $is_home We're generating for the home page.
197
  * }
198
  * @param bool $escape Escape the output if true.
199
- * @return string|mixed The description, might be unsafe for html output.
200
  */
201
  public function description_from_custom_field( $args = array(), $escape = true ) {
202
 
@@ -210,13 +224,14 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
210
  $description = $this->get_custom_homepage_description( $args );
211
 
212
  if ( empty( $description ) ) {
213
- if ( $this->is_archive() )
214
  $description = $this->get_custom_archive_description( $args );
215
- else
216
  $description = $this->get_custom_singular_description( $args['id'] );
 
217
  }
218
 
219
- if ( $escape && $description )
220
  $description = $this->escape_description( $description );
221
 
222
  return $description;
@@ -284,28 +299,12 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
284
  if ( $this->is_category() || $this->is_tag() || $this->is_tax() ) {
285
 
286
  $term = $this->fetch_the_term( $args['id'] );
 
287
 
288
- if ( isset( $term->admeta['description'] ) ) {
289
- if ( $this->is_tax() )
290
- $description = empty( $term->admeta['description'] ) ? $description : wp_kses_stripslashes( wp_kses_decode_entities( $term->admeta['description'] ) );
291
- else
292
- $description = empty( $term->admeta['description'] ) ? $description : $term->admeta['description'];
293
- }
294
-
295
- $flag = isset( $term->admeta['saved_flag'] ) ? $this->is_checked( $term->admeta['saved_flag'] ) : false;
296
-
297
- if ( false === $flag && empty( $description ) && isset( $term->meta['description'] ) )
298
- $description = empty( $term->meta['description'] ) ? $description : $term->meta['description'];
299
  }
300
-
301
- /**
302
- * @TODO add filter.
303
- * @priority medium 2.7.0
304
- */
305
- // if ( $this->is_author() ) {}
306
  }
307
 
308
-
309
  return $description;
310
  }
311
 
@@ -326,7 +325,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
326
  */
327
  public function generate_description_from_id( $args = array(), $escape = true ) {
328
 
329
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, true, $debug_key = microtime(true), get_defined_vars() );
330
 
331
  /**
332
  * Applies filters bool 'the_seo_framework_enable_auto_description' : Enable or disable the description.
@@ -342,7 +341,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
342
  if ( $escape )
343
  $description = $this->escape_description( $description );
344
 
345
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key, array( 'description' => $description, 'transient_key' => $this->auto_description_transient ) );
346
 
347
  return (string) $description;
348
  }
@@ -373,19 +372,25 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
373
 
374
  //* Home Page description
375
  if ( $args['is_home'] || $this->is_front_page() || $this->is_static_frontpage( $args['id'] ) )
376
- return $this->generate_home_page_description( $args['get_custom_field'] );
377
 
378
  $term = $this->fetch_the_term( $args['id'] );
379
 
 
 
 
 
 
380
  //* Whether the post ID has a manual excerpt.
381
- if ( empty( $term ) && has_excerpt( $args['id'] ) )
382
  $this->using_manual_excerpt = true;
383
-
384
- $title_on_blogname = $this->generate_description_additions( $args['id'], $term, false );
385
- $title = $title_on_blogname['title'];
386
- $on = $title_on_blogname['on'];
387
- $blogname = $title_on_blogname['blogname'];
388
- $sep = $title_on_blogname['sep'];
 
389
 
390
  /**
391
  * Setup transient.
@@ -407,7 +412,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
407
  $additions = trim( $title . " $on " . $blogname );
408
  //* If there are additions, add a trailing space.
409
  if ( $additions )
410
- $additions .= " ";
411
 
412
  $max_char_length_normal = 155 - mb_strlen( html_entity_decode( $additions ) );
413
  $max_char_length_social = 200;
@@ -419,7 +424,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
419
  //* Put in array to be accessed later.
420
  $excerpt = array(
421
  'normal' => $excerpt_normal,
422
- 'social' => $excerpt_social
423
  );
424
 
425
  /**
@@ -448,7 +453,6 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
448
 
449
  if ( empty( $excerpt['normal'] ) ) {
450
  //* Fetch additions ignoring options.
451
-
452
  $title_on_blogname = $this->generate_description_additions( $args['id'], $term, true );
453
  $title = $title_on_blogname['title'];
454
  $on = $title_on_blogname['on'];
@@ -457,11 +461,11 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
457
  }
458
 
459
  /* translators: 1: Title, 2: on, 3: Blogname */
460
- $title_on_blogname = trim( sprintf( __( '%1$s %2$s %3$s', 'autodescription' ), $title, $on, $blogname ) );
461
 
462
  if ( $excerpt['normal'] ) {
463
- /* translators: 1: Title on Blogname, 2: Separator, 3: Excerpt */
464
- $description = sprintf( __( '%1$s %2$s %3$s', 'autodescription' ), $title_on_blogname, $sep, $excerpt['normal'] );
465
  } else {
466
  //* We still add the additions when no excerpt has been found.
467
  // i.e. home page or empty/shortcode filled page.
@@ -481,9 +485,10 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
481
  * @since 2.6.0
482
  *
483
  * @param bool $custom_field whether to check the Custom Field.
 
484
  * @return string The description.
485
  */
486
- public function generate_home_page_description( $custom_field = true ) {
487
 
488
  $id = $this->get_the_front_page_ID();
489
 
@@ -494,8 +499,14 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
494
  */
495
  if ( $custom_field ) {
496
  $description = $this->get_custom_homepage_description( array( 'is_home' => true ) );
497
- if ( $description )
 
 
 
 
 
498
  return $description;
 
499
  }
500
 
501
  $title_on_blogname = $this->generate_description_additions( $id, '', true );
@@ -504,6 +515,12 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
504
  $on = $title_on_blogname['on'];
505
  $blogname = $title_on_blogname['blogname'];
506
 
 
 
 
 
 
 
507
  return $description = sprintf( '%s %s %s', $title, $on, $blogname );
508
  }
509
 
@@ -511,33 +528,27 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
511
  * Determines whether to add description additions. (╯°□°)╯︵ ┻━┻
512
  *
513
  * @since 2.6.0
514
- * @staticvar bool $cache
 
515
  *
516
  * @param int $id The current page or post ID.
517
- * @param object|emptystring $term The current Term.
518
  * @return bool Whether to add description additions.
519
  */
520
  public function add_description_additions( $id = '', $term = '' ) {
521
 
522
- static $cache = null;
523
-
524
- if ( isset( $cache ) )
525
- return $cache;
526
-
527
  /**
528
  * Applies filters the_seo_framework_add_description_additions : {
529
  * @param bool true to add prefix.
530
  * @param int $id The Term object ID or The Page ID.
531
  * @param object $term The Term object.
532
  * }
533
- *
534
  * @since 2.6.0
535
  */
536
- $filter = (bool) apply_filters( 'the_seo_framework_add_description_additions', true, $id, $term );
537
- $option = (bool) $this->get_option( 'description_additions' );
538
- $excerpt = ! $this->using_manual_excerpt;
539
 
540
- return $cache = $option && $filter && $excerpt ? true : false;
541
  }
542
 
543
  /**
@@ -547,7 +558,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
547
  * @since 2.3.9
548
  * @staticvar string $sep
549
  *
550
- * @return string The Separator
551
  */
552
  public function get_description_separator() {
553
 
@@ -556,7 +567,7 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
556
  if ( isset( $sep ) )
557
  return $sep;
558
 
559
- return $sep = (string) apply_filters( 'the_seo_framework_description_separator', $this->get_separator( 'description' ) );
560
  }
561
 
562
  /**
@@ -583,8 +594,8 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
583
 
584
  if ( $ignore || $this->add_description_additions( $id, $term ) ) {
585
 
586
- if ( ! isset( $title[$id] ) )
587
- $title[$id] = $this->generate_description_title( $id, $term, $ignore );
588
 
589
  if ( $ignore || $this->is_option_checked( 'description_blogname' ) ) {
590
 
@@ -604,14 +615,14 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
604
  //* Already cached.
605
  $sep = $this->get_description_separator();
606
  } else {
607
- $title[$id] = '';
608
  $on = '';
609
  $blogname = '';
610
  $sep = '';
611
  }
612
 
613
  return array(
614
- 'title' => $title[$id],
615
  'on' => $on,
616
  'blogname' => $blogname,
617
  'sep' => $sep,
@@ -655,14 +666,16 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
655
  */
656
  /* translators: Front-end output. */
657
  $title = __( 'Latest posts:', 'autodescription' ) . ' ' . $title;
658
- } else if ( $term && is_object( $term ) ) {
659
  //* We're on a taxonomy now.
660
 
661
- if ( isset( $term->admeta['doctitle'] ) && $term->admeta['doctitle'] ) {
662
- $title = $term->admeta['doctitle'];
663
- } else if ( isset( $term->name ) && $term->name ) {
 
 
664
  $title = $term->name;
665
- } else if ( isset( $term->slug ) && $term->slug ) {
666
  $title = $term->slug;
667
  }
668
  } else {
@@ -701,35 +714,35 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
701
  $term_id = isset( $term->term_id ) ? $term->term_id : false;
702
 
703
  //* Put excerpt in cache.
704
- if ( ! isset( $excerpt_cache[$page_id][$term_id] ) ) {
705
  if ( $this->is_singular( $page_id ) ) {
706
  //* We're on the blog page now.
707
  $excerpt = $this->get_excerpt_by_id( '', $page_id );
708
- } else if ( $term && is_object( $term ) ) {
709
- //* We're on a taxonomy now.
710
  $excerpt = empty( $term->description ) ? $this->get_excerpt_by_id( '', '', $page_id ) : $this->s_description( $term->description );
711
- } else if ( $this->is_author() ) {
712
  $excerpt = $this->s_description( get_the_author_meta( 'description', (int) get_query_var( 'author' ) ) );
713
  } else {
714
  $excerpt = '';
715
  }
716
 
717
- $excerpt_cache[$page_id][$term_id] = $excerpt;
718
  }
719
 
720
  //* Fetch excerpt from cache.
721
- $excerpt = $excerpt_cache[$page_id][$term_id];
722
 
723
  /**
724
  * Put excerptlength in cache.
725
  * Why cache? My tests have shown that mb_strlen is 1.03x faster than cache fetching.
726
  * However, _mb_strlen (compat) is about 1740x slower. And this is the reason it's cached!
727
  */
728
- if ( ! isset( $excerptlength_cache[$page_id][$term_id] ) )
729
- $excerptlength_cache[$page_id][$term_id] = mb_strlen( $excerpt );
730
 
731
  //* Fetch the length from cache.
732
- $excerpt_length = $excerptlength_cache[$page_id][$term_id];
733
 
734
  //* Trunculate if the excerpt is longer than the max char length
735
  $excerpt = $this->trim_excerpt( $excerpt, $excerpt_length, $max_char_length );
@@ -801,12 +814,11 @@ class AutoDescription_Generate_Description extends AutoDescription_Generate {
801
 
802
  $stops = array( '.', '?', '!' );
803
  //* Add three dots if there's no full stop at the end of the excerpt.
804
- if ( ! in_array( $last_char, $stops ) )
805
  $excerpt .= '...';
806
 
807
  }
808
 
809
  return trim( $excerpt );
810
  }
811
-
812
  }
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_Generate_Description
23
  *
36
  */
37
  protected $using_manual_excerpt = false;
38
 
39
+ /**
40
+ * Unserializing instances of this class is forbidden.
41
+ */
42
+ private function __wakeup() { }
43
+
44
+ /**
45
+ * Handle unapproachable invoked methods.
46
+ */
47
+ public function __call( $name, $arguments ) {
48
+ parent::__call( $name, $arguments );
49
+ }
50
+
51
  /**
52
  * Constructor, loads parent constructor.
53
  */
185
  $default_args = $this->parse_description_args( '', '', true );
186
 
187
  if ( is_array( $args ) ) {
188
+ if ( empty( $args ) ) {
189
  $args = $default_args;
190
  } else {
191
  $args = $this->parse_description_args( $args, $default_args );
192
  }
193
  } else {
194
  //* Old style parameters are used. Doing it wrong.
195
+ $this->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.5.0' );
196
  $args = $default_args;
197
  }
198
 
210
  * @param bool $is_home We're generating for the home page.
211
  * }
212
  * @param bool $escape Escape the output if true.
213
+ * @return string|mixed The description.
214
  */
215
  public function description_from_custom_field( $args = array(), $escape = true ) {
216
 
224
  $description = $this->get_custom_homepage_description( $args );
225
 
226
  if ( empty( $description ) ) {
227
+ if ( $this->is_archive() ) {
228
  $description = $this->get_custom_archive_description( $args );
229
+ } else {
230
  $description = $this->get_custom_singular_description( $args['id'] );
231
+ }
232
  }
233
 
234
+ if ( $escape )
235
  $description = $this->escape_description( $description );
236
 
237
  return $description;
299
  if ( $this->is_category() || $this->is_tag() || $this->is_tax() ) {
300
 
301
  $term = $this->fetch_the_term( $args['id'] );
302
+ $data = $this->get_term_data( $term, $args['id'] );
303
 
304
+ $description = empty( $data['description'] ) ? $description : $data['description'];
 
 
 
 
 
 
 
 
 
 
305
  }
 
 
 
 
 
 
306
  }
307
 
 
308
  return $description;
309
  }
310
 
325
  */
326
  public function generate_description_from_id( $args = array(), $escape = true ) {
327
 
328
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, true, $debug_key = microtime( true ), get_defined_vars() );
329
 
330
  /**
331
  * Applies filters bool 'the_seo_framework_enable_auto_description' : Enable or disable the description.
341
  if ( $escape )
342
  $description = $this->escape_description( $description );
343
 
344
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, false, $debug_key, array( 'description' => $description, 'transient_key' => $this->auto_description_transient ) );
345
 
346
  return (string) $description;
347
  }
372
 
373
  //* Home Page description
374
  if ( $args['is_home'] || $this->is_front_page() || $this->is_static_frontpage( $args['id'] ) )
375
+ return $this->generate_home_page_description( $args['get_custom_field'], $escape );
376
 
377
  $term = $this->fetch_the_term( $args['id'] );
378
 
379
+ $title = '';
380
+ $on = '';
381
+ $blogname = '';
382
+ $sep = '';
383
+
384
  //* Whether the post ID has a manual excerpt.
385
+ if ( empty( $term ) && has_excerpt( $args['id'] ) ) {
386
  $this->using_manual_excerpt = true;
387
+ } else {
388
+ $title_on_blogname = $this->generate_description_additions( $args['id'], $term, false );
389
+ $title = $title_on_blogname['title'];
390
+ $on = $title_on_blogname['on'];
391
+ $blogname = $title_on_blogname['blogname'];
392
+ $sep = $title_on_blogname['sep'];
393
+ }
394
 
395
  /**
396
  * Setup transient.
412
  $additions = trim( $title . " $on " . $blogname );
413
  //* If there are additions, add a trailing space.
414
  if ( $additions )
415
+ $additions .= ' ';
416
 
417
  $max_char_length_normal = 155 - mb_strlen( html_entity_decode( $additions ) );
418
  $max_char_length_social = 200;
424
  //* Put in array to be accessed later.
425
  $excerpt = array(
426
  'normal' => $excerpt_normal,
427
+ 'social' => $excerpt_social,
428
  );
429
 
430
  /**
453
 
454
  if ( empty( $excerpt['normal'] ) ) {
455
  //* Fetch additions ignoring options.
 
456
  $title_on_blogname = $this->generate_description_additions( $args['id'], $term, true );
457
  $title = $title_on_blogname['title'];
458
  $on = $title_on_blogname['on'];
461
  }
462
 
463
  /* translators: 1: Title, 2: on, 3: Blogname */
464
+ $title_on_blogname = trim( sprintf( _x( '%1$s %2$s %3$s', '1: Title, 2: on, 3: Blogname', 'autodescription' ), $title, $on, $blogname ) );
465
 
466
  if ( $excerpt['normal'] ) {
467
+ /* translators: 1: Title, 2: Separator, 3: Excerpt */
468
+ $description = sprintf( _x( '%1$s %2$s %3$s', '1: Title, 2: Separator, 3: Excerpt', 'autodescription' ), $title_on_blogname, $sep, $excerpt['normal'] );
469
  } else {
470
  //* We still add the additions when no excerpt has been found.
471
  // i.e. home page or empty/shortcode filled page.
485
  * @since 2.6.0
486
  *
487
  * @param bool $custom_field whether to check the Custom Field.
488
+ * @param bool $escape Whether to escape the output.
489
  * @return string The description.
490
  */
491
+ public function generate_home_page_description( $custom_field = true, $escape = true ) {
492
 
493
  $id = $this->get_the_front_page_ID();
494
 
499
  */
500
  if ( $custom_field ) {
501
  $description = $this->get_custom_homepage_description( array( 'is_home' => true ) );
502
+
503
+ if ( $description ) {
504
+
505
+ if ( $escape )
506
+ $description = $this->escape_description( $description );
507
+
508
  return $description;
509
+ }
510
  }
511
 
512
  $title_on_blogname = $this->generate_description_additions( $id, '', true );
515
  $on = $title_on_blogname['on'];
516
  $blogname = $title_on_blogname['blogname'];
517
 
518
+ if ( $escape ) {
519
+ $title = $this->escape_description( $title );
520
+ $on = $this->escape_description( $on );
521
+ $blogname = $this->escape_description( $blogname );
522
+ }
523
+
524
  return $description = sprintf( '%s %s %s', $title, $on, $blogname );
525
  }
526
 
528
  * Determines whether to add description additions. (╯°□°)╯︵ ┻━┻
529
  *
530
  * @since 2.6.0
531
+ * @since 2.7.0 Removed cache.
532
+ * Whether an excerpt is available is no longer part of this check.
533
  *
534
  * @param int $id The current page or post ID.
535
+ * @param object|string $term The current Term.
536
  * @return bool Whether to add description additions.
537
  */
538
  public function add_description_additions( $id = '', $term = '' ) {
539
 
 
 
 
 
 
540
  /**
541
  * Applies filters the_seo_framework_add_description_additions : {
542
  * @param bool true to add prefix.
543
  * @param int $id The Term object ID or The Page ID.
544
  * @param object $term The Term object.
545
  * }
 
546
  * @since 2.6.0
547
  */
548
+ $filter = apply_filters( 'the_seo_framework_add_description_additions', true, $id, $term );
549
+ $option = $this->get_option( 'description_additions' );
 
550
 
551
+ return $option && $filter;
552
  }
553
 
554
  /**
558
  * @since 2.3.9
559
  * @staticvar string $sep
560
  *
561
+ * @return string The Separator, unescaped.
562
  */
563
  public function get_description_separator() {
564
 
567
  if ( isset( $sep ) )
568
  return $sep;
569
 
570
+ return $sep = (string) apply_filters( 'the_seo_framework_description_separator', $this->get_separator( 'description', false ) );
571
  }
572
 
573
  /**
594
 
595
  if ( $ignore || $this->add_description_additions( $id, $term ) ) {
596
 
597
+ if ( ! isset( $title[ $id ] ) )
598
+ $title[ $id ] = $this->generate_description_title( $id, $term, $ignore );
599
 
600
  if ( $ignore || $this->is_option_checked( 'description_blogname' ) ) {
601
 
615
  //* Already cached.
616
  $sep = $this->get_description_separator();
617
  } else {
618
+ $title[ $id ] = '';
619
  $on = '';
620
  $blogname = '';
621
  $sep = '';
622
  }
623
 
624
  return array(
625
+ 'title' => $title[ $id ],
626
  'on' => $on,
627
  'blogname' => $blogname,
628
  'sep' => $sep,
666
  */
667
  /* translators: Front-end output. */
668
  $title = __( 'Latest posts:', 'autodescription' ) . ' ' . $title;
669
+ } elseif ( $term && isset( $term->term_id ) ) {
670
  //* We're on a taxonomy now.
671
 
672
+ $data = $this->get_term_data( $term, $term->term_id );
673
+
674
+ if ( ! empty( $data['doctitle'] ) ) {
675
+ $title = $data['doctitle'];
676
+ } elseif ( ! empty( $term->name ) ) {
677
  $title = $term->name;
678
+ } elseif ( ! empty( $term->slug ) ) {
679
  $title = $term->slug;
680
  }
681
  } else {
714
  $term_id = isset( $term->term_id ) ? $term->term_id : false;
715
 
716
  //* Put excerpt in cache.
717
+ if ( ! isset( $excerpt_cache[ $page_id ][ $term_id ] ) ) {
718
  if ( $this->is_singular( $page_id ) ) {
719
  //* We're on the blog page now.
720
  $excerpt = $this->get_excerpt_by_id( '', $page_id );
721
+ } elseif ( $term_id ) {
722
+ //* We're on a taxonomy now. Fetch excerpt from latest term post.
723
  $excerpt = empty( $term->description ) ? $this->get_excerpt_by_id( '', '', $page_id ) : $this->s_description( $term->description );
724
+ } elseif ( $this->is_author() ) {
725
  $excerpt = $this->s_description( get_the_author_meta( 'description', (int) get_query_var( 'author' ) ) );
726
  } else {
727
  $excerpt = '';
728
  }
729
 
730
+ $excerpt_cache[ $page_id ][ $term_id ] = $excerpt;
731
  }
732
 
733
  //* Fetch excerpt from cache.
734
+ $excerpt = $excerpt_cache[ $page_id ][ $term_id ];
735
 
736
  /**
737
  * Put excerptlength in cache.
738
  * Why cache? My tests have shown that mb_strlen is 1.03x faster than cache fetching.
739
  * However, _mb_strlen (compat) is about 1740x slower. And this is the reason it's cached!
740
  */
741
+ if ( ! isset( $excerptlength_cache[ $page_id ][ $term_id ] ) )
742
+ $excerptlength_cache[ $page_id ][ $term_id ] = mb_strlen( $excerpt );
743
 
744
  //* Fetch the length from cache.
745
+ $excerpt_length = $excerptlength_cache[ $page_id ][ $term_id ];
746
 
747
  //* Trunculate if the excerpt is longer than the max char length
748
  $excerpt = $this->trim_excerpt( $excerpt, $excerpt_length, $max_char_length );
814
 
815
  $stops = array( '.', '?', '!' );
816
  //* Add three dots if there's no full stop at the end of the excerpt.
817
+ if ( ! in_array( $last_char, $stops, true ) )
818
  $excerpt .= '...';
819
 
820
  }
821
 
822
  return trim( $excerpt );
823
  }
 
824
  }
inc/classes/generate-image.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_Generate_Image
21
  *
@@ -25,6 +27,27 @@
25
  */
26
  class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, loads parent constructor.
30
  */
@@ -39,12 +62,13 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
39
  * @since 2.5.2 Applies filters string the_seo_framework_og_image_after_header
40
  *
41
  * @todo listen to attached images within post.
 
42
  * @priority medium 2.7.0+
43
  *
44
  * @param string $post_id The post ID.
45
  * @param array $args The image arguments.
46
  * @param bool $escape Whether to escape the image URL.
47
- * @return string the Open Graph Image URL.
48
  */
49
  public function get_image( $post_id = '', $args = array(), $escape = true ) {
50
 
@@ -70,7 +94,7 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
70
  $all_allowed = empty( $args['disallowed'] );
71
 
72
  //* 1. Fetch image from featured
73
- if ( empty( $image ) && ( $all_allowed || ! in_array( 'featured', $args['disallowed'] ) ) )
74
  $image = $this->get_image_from_post_thumbnail( $args );
75
 
76
  //* 2. Fetch image from fallback filter 1
@@ -78,21 +102,17 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
78
  $image = (string) apply_filters( 'the_seo_framework_og_image_after_featured', '', $args['post_id'] );
79
 
80
  //* 3. Fallback: Get header image if exists
81
- if ( empty( $image ) && ( $all_allowed || ! in_array( 'header', $args['disallowed'] ) ) && current_theme_supports( 'custom-header', 'default-image' ) )
82
- $image = get_header_image();
83
 
84
  //* 4. Fetch image from fallback filter 2
85
  if ( empty( $image ) )
86
  $image = (string) apply_filters( 'the_seo_framework_og_image_after_header', '', $args['post_id'] );
87
 
88
  //* 5. Get the WP 4.3.0 Site Icon
89
- if ( empty( $image ) && ( $all_allowed || ! in_array( 'icon', $args['disallowed'] ) ) )
90
- $image = $this->site_icon();
91
 
92
- /**
93
- * Escape in Generation.
94
- * @since 2.5.2
95
- */
96
  if ( $escape && $image )
97
  return esc_url( $image );
98
 
@@ -105,11 +125,11 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
105
  * @since 2.5.0
106
  *
107
  * @since 2.0.1 Applies filters the_seo_framework_og_image_args : {
108
- * @param string image The image url
109
- * @param mixed size The image size
110
- * @param bool icon Fetch Image icon
111
- * @param array attr Image attributes
112
- * @param array disallowed Disallowed image types : {
113
  * array (
114
  * string 'featured'
115
  * string 'header'
@@ -175,7 +195,7 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
175
  }
176
  } else {
177
  //* Old style parameters are used. Doing it wrong.
178
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.5.0' );
179
  $args = $default_args;
180
  }
181
 
@@ -202,6 +222,8 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
202
 
203
  $id = get_post_thumbnail_id( $args['post_id'] );
204
 
 
 
205
  $image = $id ? $this->parse_og_image( $id, $args ) : '';
206
 
207
  return $image;
@@ -256,8 +278,9 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
256
  return;
257
 
258
  static $called = array();
 
259
  //* Don't parse image twice. Return empty on second run.
260
- if ( isset( $called[$id] ) )
261
  return '';
262
 
263
  if ( empty( $args ) )
@@ -276,19 +299,19 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
276
  //* Square
277
  $w = 1500;
278
  $h = 1500;
279
- } else if ( $w > $h ) {
280
- //* Landscape
281
  $h = $this->proportionate_dimensions( $h, $w, $w = 1500 );
282
- } else if ( $h > $w ) {
283
- //* Portrait
284
  $w = $this->proportionate_dimensions( $w, $h, $h = 1500 );
285
  }
286
 
287
  //* Get path of image and load it into the wp_get_image_editor
288
  $i_file_path = get_attached_file( $id );
289
 
290
- $i_file_old_name = basename( get_attached_file( $id ) );
291
- $i_file_ext = pathinfo( $i_file_path, PATHINFO_EXTENSION );
292
 
293
  if ( $i_file_ext ) {
294
  $i_file_dir_name = pathinfo( $i_file_path, PATHINFO_DIRNAME );
@@ -327,7 +350,12 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
327
  }
328
  }
329
 
330
- return $called[$id] = $i;
 
 
 
 
 
331
  }
332
 
333
  /**
@@ -335,10 +363,11 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
335
  *
336
  * @since 2.2.1
337
  *
338
- * @param string $size The icon size, accepts 'full' and pixel values
339
- * @return string url site icon, not escaped.
 
340
  */
341
- public function site_icon( $size = 'full' ) {
342
 
343
  $icon = '';
344
 
@@ -350,9 +379,15 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
350
  $url_data = wp_get_attachment_image_src( $site_icon_id, $size );
351
 
352
  $icon = $url_data ? $url_data[0] : '';
353
- }
354
 
355
- } else if ( is_int( $size ) && function_exists( 'has_site_icon' ) && $this->wp_version( '4.3', '>=' ) ) {
 
 
 
 
 
 
 
356
  //* Also applies (MultiSite) filters.
357
  $icon = get_site_icon_url( $size );
358
  }
@@ -360,4 +395,28 @@ class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
360
  return $icon;
361
  }
362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  }
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_Generate_Image
23
  *
27
  */
28
  class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
29
 
30
+ /**
31
+ * Holds the image dimensions, if found.
32
+ *
33
+ * @since 2.7.0
34
+ *
35
+ * @var array
36
+ */
37
+ public $image_dimensions = array();
38
+
39
+ /**
40
+ * Unserializing instances of this class is forbidden.
41
+ */
42
+ private function __wakeup() { }
43
+
44
+ /**
45
+ * Handle unapproachable invoked methods.
46
+ */
47
+ public function __call( $name, $arguments ) {
48
+ parent::__call( $name, $arguments );
49
+ }
50
+
51
  /**
52
  * Constructor, loads parent constructor.
53
  */
62
  * @since 2.5.2 Applies filters string the_seo_framework_og_image_after_header
63
  *
64
  * @todo listen to attached images within post.
65
+ * @todo set archive and front page image listener, now it simply fail on some calls.
66
  * @priority medium 2.7.0+
67
  *
68
  * @param string $post_id The post ID.
69
  * @param array $args The image arguments.
70
  * @param bool $escape Whether to escape the image URL.
71
+ * @return string the image URL.
72
  */
73
  public function get_image( $post_id = '', $args = array(), $escape = true ) {
74
 
94
  $all_allowed = empty( $args['disallowed'] );
95
 
96
  //* 1. Fetch image from featured
97
+ if ( empty( $image ) && ( $all_allowed || ! in_array( 'featured', $args['disallowed'], true ) ) )
98
  $image = $this->get_image_from_post_thumbnail( $args );
99
 
100
  //* 2. Fetch image from fallback filter 1
102
  $image = (string) apply_filters( 'the_seo_framework_og_image_after_featured', '', $args['post_id'] );
103
 
104
  //* 3. Fallback: Get header image if exists
105
+ if ( empty( $image ) && ( $all_allowed || ! in_array( 'header', $args['disallowed'], true ) ) && current_theme_supports( 'custom-header', 'default-image' ) )
106
+ $image = $this->get_header_image( true );
107
 
108
  //* 4. Fetch image from fallback filter 2
109
  if ( empty( $image ) )
110
  $image = (string) apply_filters( 'the_seo_framework_og_image_after_header', '', $args['post_id'] );
111
 
112
  //* 5. Get the WP 4.3.0 Site Icon
113
+ if ( empty( $image ) && ( $all_allowed || ! in_array( 'icon', $args['disallowed'], true ) ) )
114
+ $image = $this->site_icon( 'full', true );
115
 
 
 
 
 
116
  if ( $escape && $image )
117
  return esc_url( $image );
118
 
125
  * @since 2.5.0
126
  *
127
  * @since 2.0.1 Applies filters the_seo_framework_og_image_args : {
128
+ * @param string $image The image url
129
+ * @param mixed $size The image size
130
+ * @param bool $icon Fetch Image icon
131
+ * @param array $attr Image attributes
132
+ * @param array $disallowed Disallowed image types : {
133
  * array (
134
  * string 'featured'
135
  * string 'header'
195
  }
196
  } else {
197
  //* Old style parameters are used. Doing it wrong.
198
+ $this->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.5.0' );
199
  $args = $default_args;
200
  }
201
 
222
 
223
  $id = get_post_thumbnail_id( $args['post_id'] );
224
 
225
+ $args['get_the_real_ID'] = true;
226
+
227
  $image = $id ? $this->parse_og_image( $id, $args ) : '';
228
 
229
  return $image;
278
  return;
279
 
280
  static $called = array();
281
+
282
  //* Don't parse image twice. Return empty on second run.
283
+ if ( isset( $called[ $id ] ) )
284
  return '';
285
 
286
  if ( empty( $args ) )
299
  //* Square
300
  $w = 1500;
301
  $h = 1500;
302
+ } elseif ( $w > $h ) {
303
+ //* Landscape, set $w to 1500.
304
  $h = $this->proportionate_dimensions( $h, $w, $w = 1500 );
305
+ } elseif ( $h > $w ) {
306
+ //* Portrait, set $h to 1500.
307
  $w = $this->proportionate_dimensions( $w, $h, $h = 1500 );
308
  }
309
 
310
  //* Get path of image and load it into the wp_get_image_editor
311
  $i_file_path = get_attached_file( $id );
312
 
313
+ $i_file_old_name = basename( get_attached_file( $id ) );
314
+ $i_file_ext = pathinfo( $i_file_path, PATHINFO_EXTENSION );
315
 
316
  if ( $i_file_ext ) {
317
  $i_file_dir_name = pathinfo( $i_file_path, PATHINFO_DIRNAME );
350
  }
351
  }
352
 
353
+ //* Whether to use the post ID (Post Thumbnail) or input ID (ID was known beforehand)
354
+ $usage_id = isset( $args['get_the_real_ID'] ) && $args['get_the_real_ID'] ? $this->get_the_real_ID() : $id;
355
+
356
+ $this->image_dimensions = $this->image_dimensions + array( $usage_id => array( 'width' => $w, 'height' => $h ) );
357
+
358
+ return $called[ $id ] = $i;
359
  }
360
 
361
  /**
363
  *
364
  * @since 2.2.1
365
  *
366
+ * @param string $size The icon size, accepts 'full' and pixel values.
367
+ * @param bool $set_og_dimensions Whether to set size for OG image. Always falls back to the current post ID.
368
+ * @return string URL site icon, not escaped.
369
  */
370
+ public function site_icon( $size = 'full', $set_og_dimensions = false ) {
371
 
372
  $icon = '';
373
 
379
  $url_data = wp_get_attachment_image_src( $site_icon_id, $size );
380
 
381
  $icon = $url_data ? $url_data[0] : '';
 
382
 
383
+ if ( $set_og_dimensions && $icon ) {
384
+ $w = $url_data[1];
385
+ $h = $url_data[2];
386
+
387
+ $this->image_dimensions = $this->image_dimensions + array( $this->get_the_real_ID() => array( 'width' => $w, 'height' => $h ) );
388
+ }
389
+ }
390
+ } elseif ( is_int( $size ) && function_exists( 'has_site_icon' ) && $this->wp_version( '4.3', '>=' ) ) {
391
  //* Also applies (MultiSite) filters.
392
  $icon = get_site_icon_url( $size );
393
  }
395
  return $icon;
396
  }
397
 
398
+ /**
399
+ * Returns header image URL.
400
+ * Also sets image dimensions. Falls back to current post ID for index.
401
+ *
402
+ * @since 2.7.0
403
+ *
404
+ * @param bool $set_og_dimensions Whether to set size for OG image. Always falls back to the current post ID.
405
+ * @return string The header image URL, not escaped.
406
+ */
407
+ public function get_header_image( $set_og_dimensions = false ) {
408
+
409
+ $image = get_header_image();
410
+
411
+ if ( $set_og_dimensions && $image ) {
412
+
413
+ $w = (int) get_theme_support( 'custom-header', 'width' );
414
+ $h = (int) get_theme_support( 'custom-header', 'height' );
415
+
416
+ if ( $w && $h )
417
+ $this->image_dimensions = $this->image_dimensions + array( $this->get_the_real_ID() => array( 'width' => $w, 'height' => $h ) );
418
+ }
419
+
420
+ return $image;
421
+ }
422
  }
inc/classes/generate-ldjson.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_Generate
21
  *
@@ -26,6 +28,18 @@
26
  */
27
  class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * Constructor, load parent constructor
31
  */
@@ -47,7 +61,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
47
 
48
  $this->setup_ld_json_transient( $this->get_the_real_ID() );
49
 
50
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key = microtime(true), array( 'LD Json transient' => $this->ld_json_transient, 'Output from transient' => false !== $this->get_transient( $this->ld_json_transient ) ) );
51
 
52
  $output = $this->get_transient( $this->ld_json_transient );
53
  if ( false === $output ) {
@@ -91,7 +105,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
91
  * Debug output.
92
  * @since 2.4.2
93
  */
94
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key, array( 'LD Json transient output' => $output ) );
95
 
96
  return $output;
97
  }
@@ -189,7 +203,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
189
  /**
190
  * Returns 'ListItem' json encoded type name.
191
  *
192
- * @staticvar string $crumblist
193
  * @since 2.6.0
194
  *
195
  * @return string The json encoded 'ListItem'.
@@ -204,6 +218,52 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
204
  return $listitem = json_encode( 'ListItem' );
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  /**
208
  * Generate LD+Json search helper.
209
  *
@@ -222,8 +282,15 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
222
  $name = $this->schema_blog_name();
223
  $actiontype = json_encode( 'SearchAction' );
224
 
 
 
 
 
 
 
 
225
  // Remove trailing quote and add it back.
226
- $target = mb_substr( json_encode( $this->the_home_url_from_cache( true ) . '?s=' ), 0, -1 ) . '{search_term_string}"';
227
 
228
  $queryaction = json_encode( 'required name=search_term_string' );
229
 
@@ -231,7 +298,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
231
 
232
  $output = '';
233
  if ( $json )
234
- $output = '<script type="application/ld+json">' . $json . "</script>" . "\r\n";
235
 
236
  return $output;
237
  }
@@ -253,7 +320,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
253
 
254
  if ( $this->is_single() || $this->is_wc_product() ) {
255
  $output = $this->ld_json_breadcrumbs_post();
256
- } else if ( false === $this->is_front_page() && $this->is_page() ) {
257
  $output = $this->ld_json_breadcrumbs_page();
258
  }
259
 
@@ -285,11 +352,9 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
285
  if ( ! $r || is_wp_error( $r ) )
286
  return '';
287
 
288
- //* Get categories.
289
- $cats = wp_get_object_terms( $post_id, $cat_type, array( 'fields' => 'all_with_object_id', 'orderby' => 'parent' ) );
290
-
291
- if ( empty( $cats ) || is_wp_error( $cats ) )
292
- return '';
293
 
294
  $assigned_ids = array();
295
  $kittens = array();
@@ -297,20 +362,17 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
297
  $parents_merge = array();
298
 
299
  //* Fetch cats children id's, if any.
300
- foreach ( $cats as $cat ) {
301
- //* The category objects. The cats.
302
- $cat_id = $cat->term_id;
303
-
304
  //* Store to filter unused Cat ID's from the post.
305
- $assigned_ids[] = $cat_id;
306
 
307
  // Check if they have kittens.
308
- $children = get_term_children( $cat_id, $cat->taxonomy );
309
- $ancestors = get_ancestors( $cat_id, $cat->taxonomy );
310
 
311
  //* Save children id's as kittens.
312
- $kittens[$cat_id] = $children;
313
- $parents[$cat_id] = $ancestors;
314
  }
315
 
316
  foreach ( $kittens as $kit_id => $child_id ) {
@@ -320,8 +382,8 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
320
  * Seed out children that aren't assigned.
321
  * (from levels too deep as get_term_children gets them all).
322
  */
323
- if ( $cid && false === in_array( $cid, $assigned_ids ) )
324
- unset( $kittens[$kit_id][$ckey] );
325
 
326
  /**
327
  * Make the tree count down multiple children are assigned.
@@ -337,12 +399,12 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
337
  *
338
  * We want a tree for "Cat 1+2+3", "Cat 1+2", and "Cat 3".
339
  *
340
- * We could add Cat 1, but that's will give two single category lines, which could be misinterperted.
341
  * So we only use what we know: The kittens (child tree).
342
  */
343
- if ( isset( $parents[$cid] ) && ! empty( $parents[$kit_id] ) ) {
344
- $parents_merge[$kit_id] = $parents[$kit_id];
345
- unset( $kittens[$kit_id] );
346
  }
347
  }
348
  }
@@ -372,7 +434,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
372
  array_push( $parents_ids, $child_id );
373
 
374
  //* Temporarily array.
375
- $kitten[$pid] = $parents_ids;
376
 
377
  $trees = $this->build_breadcrumb_trees( $kitten, $trees );
378
  } else {
@@ -412,36 +474,37 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
412
  $tree_ids = array_reverse( $tree_ids, false );
413
 
414
  foreach ( $tree_ids as $position => $child_id ) {
415
- if ( in_array( $child_id, $assigned_ids ) ) {
416
  //* Cat has been assigned, continue.
417
 
418
  //* Fetch item from cache if available.
419
- if ( isset( $item_cache[$child_id] ) ) {
420
  $pos = $position + 2;
421
- $item_cache[$child_id]['pos'] = $pos;
422
- $items .= $this->make_breadcrumb( $item_cache[$child_id], true );
423
-
424
  } else {
425
-
426
  $pos = $position + 2;
427
 
428
  $cat = get_term_by( 'id', $child_id, $cat_type, OBJECT, 'raw' );
 
429
 
430
  $id = json_encode( $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'is_term' => true, 'term' => $cat ) ) );
431
 
432
- $custom_field_name = isset( $cat->admeta['doctitle'] ) ? $cat->admeta['doctitle'] : '';
433
- $cat_name = $custom_field_name ? $custom_field_name : $cat->name;
434
  $name = json_encode( $cat_name );
435
 
 
 
436
  //* Store in cache.
437
- $item_cache[$child_id] = array(
438
- 'type' => $item_type,
439
- 'pos' => (string) $pos,
440
- 'id' => $id,
441
- 'name' => $name
 
442
  );
443
 
444
- $items .= $this->make_breadcrumb( $item_cache[$child_id], true );
445
  }
446
  }
447
  }
@@ -462,16 +525,18 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
462
  //* The position of the current item is always static here.
463
  $pos = '2';
464
 
 
 
465
  //* $tree_ids is a single ID here.
466
  $cat = get_term_by( 'id', $tree_ids, $cat_type, OBJECT, 'raw' );
 
467
 
468
  $id = json_encode( $this->the_url( '', array( 'get_custom_field' => false, 'is_term' => true, 'external' => true, 'term' => $cat ) ) );
469
 
470
- $custom_field_name = isset( $cat->admeta['doctitle'] ) ? $cat->admeta['doctitle'] : '';
471
- $cat_name = $custom_field_name ? $custom_field_name : $cat->name;
472
  $name = json_encode( $cat_name );
473
 
474
- $items .= sprintf( '{"@type":%s,"position":%s,"item":{"@id":%s,"name":%s}},', $item_type, (string) $pos, $id, $name );
475
 
476
  if ( $items ) {
477
 
@@ -482,7 +547,6 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
482
  $output .= '<script type="application/ld+json">' . $breadcrumbhelper . '</script>' . "\r\n";
483
  }
484
  }
485
-
486
  }
487
  }
488
 
@@ -524,12 +588,14 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
524
  $parent_name = $custom_field_name ? $custom_field_name : $this->title( '', '', '', array( 'term_id' => $parent_id, 'meta' => true, 'get_custom_field' => false, 'placeholder' => true, 'notagline' => true, 'description_title' => true ) );
525
 
526
  $name = json_encode( $parent_name );
 
527
 
528
  $breadcrumb = array(
529
- 'type' => $item_type,
530
- 'pos' => (string) $pos,
531
- 'id' => $id,
532
- 'name' => $name
 
533
  );
534
 
535
  $items .= $this->make_breadcrumb( $breadcrumb, true );
@@ -575,7 +641,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
575
 
576
  if ( $home_title ) {
577
  $custom_name = $home_title;
578
- } else if ( $this->has_page_on_front() ) {
579
  $home_id = (int) get_option( 'page_on_front' );
580
 
581
  $custom_name = $this->get_custom_field( '_genesis_title', $home_id );
@@ -585,12 +651,14 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
585
  }
586
 
587
  $custom_name = json_encode( $custom_name );
 
588
 
589
  $breadcrumb = array(
590
- 'type' => $item_type,
591
- 'pos' => '1',
592
- 'id' => $id,
593
- 'name' => $custom_name
 
594
  );
595
 
596
  return $first_item = $this->make_breadcrumb( $breadcrumb, true );
@@ -620,7 +688,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
620
  * This shouldn't run anyway. Pos should always be provided.
621
  */
622
  if ( is_null( $pos ) )
623
- $pos = '2';
624
 
625
  //* Add current page.
626
  $pos = $pos + 1;
@@ -649,11 +717,14 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
649
  $name = json_encode( $name );
650
  }
651
 
 
 
652
  $breadcrumb = array(
653
- 'type' => $item_type,
654
- 'pos' => (string) $pos,
655
- 'id' => $id,
656
- 'name' => $name
 
657
  );
658
 
659
  return $this->make_breadcrumb( $breadcrumb, false );
@@ -675,7 +746,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
675
  */
676
  public function make_breadcrumb( $item, $comma = true ) {
677
  $comma = $comma ? ',' : '';
678
- return sprintf( '{"@type":%s,"position":%s,"item":{"@id":%s,"name":%s}}%s', $item['type'], $item['pos'], $item['id'], $item['name'], $comma );
679
  }
680
 
681
  /**
@@ -706,7 +777,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
706
 
707
  foreach ( $kitten as $kit => $kat ) {
708
  //* Only add if non-existent in $trees.
709
- if ( ! in_array( $kat, $trees ) )
710
  $add[] = $kat;
711
  }
712
 
@@ -852,7 +923,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
852
  $filter = (bool) apply_filters( 'the_seo_framework_json_breadcrumb_output', true );
853
  $option = $this->is_option_checked( 'ld_json_breadcrumbs' );
854
 
855
- return $cache = $filter && $option ? true : false;
856
  }
857
 
858
  /**
@@ -877,7 +948,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
877
  $filter = (bool) apply_filters( 'the_seo_framework_json_sitename_output', true );
878
  $option = $this->is_option_checked( 'ld_json_sitename' );
879
 
880
- return $cache = $filter && $option ? true : false;
881
  }
882
 
883
  /**
@@ -902,7 +973,7 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
902
  $filter = (bool) apply_filters( 'the_seo_framework_json_search_output', true );
903
  $option = $this->is_option_checked( 'ld_json_searchbox' );
904
 
905
- return $cache = $filter && $option ? true : false;
906
  }
907
 
908
  /**
@@ -927,7 +998,6 @@ class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
927
  $filter = (bool) apply_filters( 'the_seo_framework_json_knowledge_output', true );
928
  $option = $this->is_option_checked( 'knowledge_output' );
929
 
930
- return $cache = $filter && $option ? true : false;
931
  }
932
-
933
  }
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_Generate
23
  *
28
  */
29
  class AutoDescription_Generate_Ldjson extends AutoDescription_Generate_Image {
30
 
31
+ /**
32
+ * Unserializing instances of this class is forbidden.
33
+ */
34
+ private function __wakeup() { }
35
+
36
+ /**
37
+ * Handle unapproachable invoked methods.
38
+ */
39
+ public function __call( $name, $arguments ) {
40
+ parent::__call( $name, $arguments );
41
+ }
42
+
43
  /**
44
  * Constructor, load parent constructor
45
  */
61
 
62
  $this->setup_ld_json_transient( $this->get_the_real_ID() );
63
 
64
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, false, $debug_key = microtime( true ), array( 'LD Json transient' => $this->ld_json_transient, 'Output from transient' => false !== $this->get_transient( $this->ld_json_transient ) ) );
65
 
66
  $output = $this->get_transient( $this->ld_json_transient );
67
  if ( false === $output ) {
105
  * Debug output.
106
  * @since 2.4.2
107
  */
108
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, false, $debug_key, array( 'LD Json transient output' => $output ) );
109
 
110
  return $output;
111
  }
203
  /**
204
  * Returns 'ListItem' json encoded type name.
205
  *
206
+ * @staticvar string $listitem
207
  * @since 2.6.0
208
  *
209
  * @return string The json encoded 'ListItem'.
218
  return $listitem = json_encode( 'ListItem' );
219
  }
220
 
221
+ /**
222
+ * Returns 'image' json encoded value.
223
+ *
224
+ * @staticvar array $images
225
+ * @since 2.7.0
226
+ * @todo implement blog page image.
227
+ * @priority low 2.7.0+ extension.
228
+ *
229
+ * @param int|string $id The page, post, product or term ID.
230
+ * @param bool $singular Whether the ID is singular.
231
+ */
232
+ public function schema_image( $id = 0, $singular = false ) {
233
+
234
+ static $images = array();
235
+
236
+ $id = (int) $id;
237
+
238
+ if ( isset( $images[ $id ][ $singular ] ) )
239
+ return $images[ $id ][ $singular ];
240
+
241
+ $image = '';
242
+
243
+ if ( $singular ) {
244
+ if ( $id === $this->get_the_real_ID() ) {
245
+ $image = $this->get_image_from_cache( $id );
246
+ } elseif ( $id ) {
247
+ //* No ID (0) results in the home page being a blog. This will be handled in the future.
248
+ $image = $this->get_image( $id );
249
+ }
250
+ } else {
251
+ //* Placeholder.
252
+ $image = '';
253
+ }
254
+
255
+ /**
256
+ * Applies filters 'the_seo_framework_ld_json_breadcrumb_image' : string
257
+ * @since 2.7.0
258
+ * @param string $image The current image.
259
+ * @param int $id The page, post, product or term ID.
260
+ * @param bool $singular Whether the ID is singular.
261
+ */
262
+ $image = apply_filters( 'the_seo_framework_ld_json_breadcrumb_image', $image, $id, $singular );
263
+
264
+ return $images[ $id ][ $singular ] = json_encode( esc_url_raw( $image ) );
265
+ }
266
+
267
  /**
268
  * Generate LD+Json search helper.
269
  *
282
  $name = $this->schema_blog_name();
283
  $actiontype = json_encode( 'SearchAction' );
284
 
285
+ /**
286
+ * Applies filters 'the_seo_framework_ld_json_search_url' : string
287
+ * @since 2.7.0
288
+ * @param string $search_url The default WordPress search URL without query parameters.
289
+ */
290
+ $search_url = (string) apply_filters( 'the_seo_framework_ld_json_search_url', $this->the_home_url_from_cache( true ) . '?s=' );
291
+
292
  // Remove trailing quote and add it back.
293
+ $target = mb_substr( json_encode( $search_url ), 0, -1 ) . '{search_term_string}"';
294
 
295
  $queryaction = json_encode( 'required name=search_term_string' );
296
 
298
 
299
  $output = '';
300
  if ( $json )
301
+ $output = '<script type="application/ld+json">' . $json . '</script>' . "\r\n";
302
 
303
  return $output;
304
  }
320
 
321
  if ( $this->is_single() || $this->is_wc_product() ) {
322
  $output = $this->ld_json_breadcrumbs_post();
323
+ } elseif ( false === $this->is_front_page() && $this->is_page() ) {
324
  $output = $this->ld_json_breadcrumbs_page();
325
  }
326
 
352
  if ( ! $r || is_wp_error( $r ) )
353
  return '';
354
 
355
+ $cats = get_the_terms( $post_id, $cat_type );
356
+ $cats = wp_list_pluck( $cats, 'parent', 'term_id' );
357
+ asort( $cats, SORT_NUMERIC );
 
 
358
 
359
  $assigned_ids = array();
360
  $kittens = array();
362
  $parents_merge = array();
363
 
364
  //* Fetch cats children id's, if any.
365
+ foreach ( $cats as $term_id => $parent_id ) {
 
 
 
366
  //* Store to filter unused Cat ID's from the post.
367
+ $assigned_ids[] = $term_id;
368
 
369
  // Check if they have kittens.
370
+ $children = get_term_children( $term_id, $cat_type );
371
+ $ancestors = get_ancestors( $term_id, $cat_type );
372
 
373
  //* Save children id's as kittens.
374
+ $kittens[ $term_id ] = $children;
375
+ $parents[ $term_id ] = $ancestors;
376
  }
377
 
378
  foreach ( $kittens as $kit_id => $child_id ) {
382
  * Seed out children that aren't assigned.
383
  * (from levels too deep as get_term_children gets them all).
384
  */
385
+ if ( $cid && false === in_array( $cid, $assigned_ids, true ) )
386
+ unset( $kittens[ $kit_id ][ $ckey ] );
387
 
388
  /**
389
  * Make the tree count down multiple children are assigned.
399
  *
400
  * We want a tree for "Cat 1+2+3", "Cat 1+2", and "Cat 3".
401
  *
402
+ * We could add Cat 1 as well, but that's will give two single category lines, which could be misinterperted.
403
  * So we only use what we know: The kittens (child tree).
404
  */
405
+ if ( isset( $parents[ $cid ] ) && ! empty( $parents[ $kit_id ] ) ) {
406
+ $parents_merge[ $kit_id ] = $parents[ $kit_id ];
407
+ unset( $kittens[ $kit_id ] );
408
  }
409
  }
410
  }
434
  array_push( $parents_ids, $child_id );
435
 
436
  //* Temporarily array.
437
+ $kitten[ $pid ] = $parents_ids;
438
 
439
  $trees = $this->build_breadcrumb_trees( $kitten, $trees );
440
  } else {
474
  $tree_ids = array_reverse( $tree_ids, false );
475
 
476
  foreach ( $tree_ids as $position => $child_id ) {
477
+ if ( in_array( $child_id, $assigned_ids, true ) ) {
478
  //* Cat has been assigned, continue.
479
 
480
  //* Fetch item from cache if available.
481
+ if ( isset( $item_cache[ $child_id ] ) ) {
482
  $pos = $position + 2;
483
+ $item_cache[ $child_id ]['pos'] = $pos;
484
+ $items .= $this->make_breadcrumb( $item_cache[ $child_id ], true );
 
485
  } else {
 
486
  $pos = $position + 2;
487
 
488
  $cat = get_term_by( 'id', $child_id, $cat_type, OBJECT, 'raw' );
489
+ $data = $this->get_term_data( $cat, $child_id );
490
 
491
  $id = json_encode( $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'is_term' => true, 'term' => $cat ) ) );
492
 
493
+ $cat_name = empty( $data['doctitle'] ) ? $cat->name : $data['doctitle'];
 
494
  $name = json_encode( $cat_name );
495
 
496
+ $image = $this->schema_image( $child_id );
497
+
498
  //* Store in cache.
499
+ $item_cache[ $child_id ] = array(
500
+ 'type' => $item_type,
501
+ 'pos' => (string) $pos,
502
+ 'id' => $id,
503
+ 'name' => $name,
504
+ 'image' => $image,
505
  );
506
 
507
+ $items .= $this->make_breadcrumb( $item_cache[ $child_id ], true );
508
  }
509
  }
510
  }
525
  //* The position of the current item is always static here.
526
  $pos = '2';
527
 
528
+ $image = $this->schema_image( $tree_ids );
529
+
530
  //* $tree_ids is a single ID here.
531
  $cat = get_term_by( 'id', $tree_ids, $cat_type, OBJECT, 'raw' );
532
+ $data = $this->get_term_data( $cat, $tree_ids );
533
 
534
  $id = json_encode( $this->the_url( '', array( 'get_custom_field' => false, 'is_term' => true, 'external' => true, 'term' => $cat ) ) );
535
 
536
+ $cat_name = empty( $data['doctitle'] ) ? $cat->name : $data['doctitle'];
 
537
  $name = json_encode( $cat_name );
538
 
539
+ $items .= sprintf( '{"@type":%s,"position":%s,"item":{"@id":%s,"name":%s,"image":%s}},', $item_type, (string) $pos, $id, $name, $image );
540
 
541
  if ( $items ) {
542
 
547
  $output .= '<script type="application/ld+json">' . $breadcrumbhelper . '</script>' . "\r\n";
548
  }
549
  }
 
550
  }
551
  }
552
 
588
  $parent_name = $custom_field_name ? $custom_field_name : $this->title( '', '', '', array( 'term_id' => $parent_id, 'meta' => true, 'get_custom_field' => false, 'placeholder' => true, 'notagline' => true, 'description_title' => true ) );
589
 
590
  $name = json_encode( $parent_name );
591
+ $image = $this->schema_image( $parent_id );
592
 
593
  $breadcrumb = array(
594
+ 'type' => $item_type,
595
+ 'pos' => (string) $pos,
596
+ 'id' => $id,
597
+ 'name' => $name,
598
+ 'image' => $image,
599
  );
600
 
601
  $items .= $this->make_breadcrumb( $breadcrumb, true );
641
 
642
  if ( $home_title ) {
643
  $custom_name = $home_title;
644
+ } elseif ( $this->has_page_on_front() ) {
645
  $home_id = (int) get_option( 'page_on_front' );
646
 
647
  $custom_name = $this->get_custom_field( '_genesis_title', $home_id );
651
  }
652
 
653
  $custom_name = json_encode( $custom_name );
654
+ $image = $this->schema_image( $this->get_the_front_page_ID(), true );
655
 
656
  $breadcrumb = array(
657
+ 'type' => $item_type,
658
+ 'pos' => '1',
659
+ 'id' => $id,
660
+ 'name' => $custom_name,
661
+ 'image' => $image,
662
  );
663
 
664
  return $first_item = $this->make_breadcrumb( $breadcrumb, true );
688
  * This shouldn't run anyway. Pos should always be provided.
689
  */
690
  if ( is_null( $pos ) )
691
+ $pos = 2;
692
 
693
  //* Add current page.
694
  $pos = $pos + 1;
717
  $name = json_encode( $name );
718
  }
719
 
720
+ $image = $this->schema_image( $post_id, true );
721
+
722
  $breadcrumb = array(
723
+ 'type' => $item_type,
724
+ 'pos' => (string) $pos,
725
+ 'id' => $id,
726
+ 'name' => $name,
727
+ 'image' => $image,
728
  );
729
 
730
  return $this->make_breadcrumb( $breadcrumb, false );
746
  */
747
  public function make_breadcrumb( $item, $comma = true ) {
748
  $comma = $comma ? ',' : '';
749
+ return sprintf( '{"@type":%s,"position":%s,"item":{"@id":%s,"name":%s,"image":%s}}%s', $item['type'], $item['pos'], $item['id'], $item['name'], $item['image'], $comma );
750
  }
751
 
752
  /**
777
 
778
  foreach ( $kitten as $kit => $kat ) {
779
  //* Only add if non-existent in $trees.
780
+ if ( ! in_array( $kat, $trees, true ) )
781
  $add[] = $kat;
782
  }
783
 
923
  $filter = (bool) apply_filters( 'the_seo_framework_json_breadcrumb_output', true );
924
  $option = $this->is_option_checked( 'ld_json_breadcrumbs' );
925
 
926
+ return $cache = $filter && $option;
927
  }
928
 
929
  /**
948
  $filter = (bool) apply_filters( 'the_seo_framework_json_sitename_output', true );
949
  $option = $this->is_option_checked( 'ld_json_sitename' );
950
 
951
+ return $cache = $filter && $option;
952
  }
953
 
954
  /**
973
  $filter = (bool) apply_filters( 'the_seo_framework_json_search_output', true );
974
  $option = $this->is_option_checked( 'ld_json_searchbox' );
975
 
976
+ return $cache = $filter && $option;
977
  }
978
 
979
  /**
998
  $filter = (bool) apply_filters( 'the_seo_framework_json_knowledge_output', true );
999
  $option = $this->is_option_checked( 'knowledge_output' );
1000
 
1001
+ return $cache = $filter && $option;
1002
  }
 
1003
  }
inc/classes/generate-title.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_Generate_Title
21
  *
@@ -25,6 +27,18 @@
25
  */
26
  class AutoDescription_Generate_Title extends AutoDescription_Generate_Description {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor
30
  */
@@ -33,7 +47,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
33
  }
34
 
35
  /**
36
- * Get the title. God function.
37
  * Always use this function for the title unless you're absolutely sure what you're doing.
38
  *
39
  * This function is used for all these: Taxonomies and Terms, Posts, Pages, Blog, front page, front-end, back-end.
@@ -57,7 +71,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
57
  * @param bool description_title Fetch title for description.
58
  * @param bool is_front_page Fetch front page title.
59
  * }
60
- *
61
  * @return string $title Title
62
  */
63
  public function title( $title = '', $sep = '', $seplocation = '', $args = array() ) {
@@ -82,22 +95,9 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
82
  */
83
  if ( false === $args['meta'] && false === $this->is_admin() ) {
84
  if ( false === $this->current_theme_supports_title_tag() && doing_filter( 'wp_title' ) ) {
85
- if ( $seplocation ) {
86
- //* Set doing it wrong parameters.
87
- $this->tell_title_doing_it_wrong( $title, $sep, $seplocation, false );
88
- //* And echo them.
89
- add_action( 'wp_footer', array( $this, 'tell_title_doing_it_wrong' ), 20 );
90
-
91
- //* Notify cache.
92
- $this->title_doing_it_wrong = true;
93
-
94
- //* Notify transients
95
- $this->set_theme_dir_transient( false );
96
-
97
- return $this->build_title_doingitwrong( $title, $sep, $seplocation, $args );
98
- } else if ( $sep ) {
99
  //* Set doing it wrong parameters.
100
- $this->tell_title_doing_it_wrong( $title, $sep, $seplocation, false );
101
  //* And echo them.
102
  add_action( 'wp_footer', array( $this, 'tell_title_doing_it_wrong' ), 20 );
103
 
@@ -108,7 +108,8 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
108
  $this->set_theme_dir_transient( false );
109
 
110
  //* Title is empty.
111
- $args['empty_title'] = true;
 
112
 
113
  return $this->build_title_doingitwrong( $title, $sep, $seplocation, $args );
114
  }
@@ -130,11 +131,10 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
130
  /**
131
  * Escapes and beautifies title.
132
  *
133
- * @param string $title The title to escape and beautify.
134
- * @param bool $trim Whether to trim the title from whitespaces.
135
- *
136
  * @since 2.5.2
137
  *
 
 
138
  * @return string Escaped and beautified title.
139
  */
140
  public function escape_title( $title = '', $trim = true ) {
@@ -151,11 +151,10 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
151
  /**
152
  * Parse and sanitize title args.
153
  *
154
- * @param array $args required The passed arguments.
155
- * @param array $defaults The default arguments.
156
- * @param bool $get_defaults Return the default arguments. Ignoring $args.
157
  *
158
- * @applies filters the_seo_framework_title_args : {
 
159
  * @param int term_id The Taxonomy Term ID when taxonomy is also filled in. Else post ID.
160
  * @param string taxonomy The Taxonomy name.
161
  * @param bool page_on_front Page on front condition for example generation.
@@ -166,7 +165,9 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
166
  * @param bool is_front_page Fetch front page title.
167
  * }
168
  *
169
- * @since 2.4.0
 
 
170
  * @return array $args parsed args.
171
  */
172
  public function parse_title_args( $args = array(), $defaults = array(), $get_defaults = false ) {
@@ -185,7 +186,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
185
  'escape' => true,
186
  );
187
 
188
- //* @since 2.5.0
189
  $defaults = (array) apply_filters( 'the_seo_framework_title_args', $defaults, $args );
190
  }
191
 
@@ -208,11 +208,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
208
  }
209
 
210
  /**
211
- * Reparse title args.
212
- *
213
- * @param array $args required The passed arguments.
214
  *
215
  * @since 2.6.0
 
 
216
  * @return array $args parsed args.
217
  */
218
  public function reparse_title_args( $args = array() ) {
@@ -227,7 +227,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
227
  }
228
  } else {
229
  //* Old style parameters are used. Doing it wrong.
230
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.5.0' );
231
  $args = $default_args;
232
  }
233
 
@@ -235,16 +235,15 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
235
  }
236
 
237
  /**
238
- * Build the title based on input, without tagline.
 
 
239
  *
240
  * @param array $args : accepted args : {
241
  * @param int term_id The Taxonomy Term ID
242
  * @param bool placeholder Generate placeholder, ignoring options.
243
  * @param bool page_on_front Page on front condition for example generation
244
  * }
245
- *
246
- * @since 2.4.0
247
- *
248
  * @return string Title without tagline.
249
  */
250
  protected function build_title_notagline( $args = array() ) {
@@ -269,14 +268,13 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
269
  * Build the title based on input, without tagline.
270
  * Note: Not escaped.
271
  *
 
 
272
  * @param array $args : accepted args : {
273
  * @param int term_id The Taxonomy Term ID
274
  * @param bool placeholder Generate placeholder, ignoring options.
275
  * @param bool page_on_front Page on front condition for example generation
276
  * }
277
- *
278
- * @since 2.6.0
279
- *
280
  * @return string Title without tagline.
281
  */
282
  protected function get_notagline_title( $args = array() ) {
@@ -295,10 +293,12 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
295
  }
296
 
297
  /**
298
- * Build the title based on input for themes that are doing it wrong.
299
- * Pretty much a duplicate of build_title but contains many more variables.
300
  * Keep this in mind.
301
  *
 
 
302
  * @param string $title The Title to return
303
  * @param string $sep The Title sepeartor
304
  * @param string $seplocation The Title sepeartor location ( accepts 'left' or 'right' )
@@ -308,14 +308,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
308
  * @param bool placeholder Generate placeholder, ignoring options.
309
  * @param bool get_custom_field Do not fetch custom title when false.
310
  * }
311
- *
312
- * @since 2.4.0
313
- *
314
  * @return string $title Title
315
  */
316
  public function build_title_doingitwrong( $title = '', $sep = '', $seplocation = '', $args = array() ) {
317
 
318
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, true, $debug_key = microtime(true), get_defined_vars() );
319
 
320
  /**
321
  * Empty the title, because most themes think they 'know' how to SEO the front page.
@@ -422,7 +419,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
422
  } else {
423
  $title = " $sep " . trim( ltrim( $title, " $sep_to_replace" ) );
424
  }
425
-
426
  } else {
427
  $title = trim( $title ) . " $sep ";
428
  }
@@ -433,13 +429,15 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
433
  if ( $args['escape'] )
434
  $title = $this->escape_title( $title, false );
435
 
436
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key, array( 'title_output' => $title ) );
437
 
438
  return $title;
439
  }
440
 
441
  /**
442
- * Build the title based on input.
 
 
443
  *
444
  * @param string $title The Title to return
445
  * @param string $seplocation The Title sepeartor location ( accepts 'left' or 'right' )
@@ -451,14 +449,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
451
  * @param bool get_custom_field Do not fetch custom title when false.
452
  * @param bool is_front_page Fetch front page title.
453
  * }
454
- *
455
- * @since 2.4.0
456
- *
457
  * @return string $title Title
458
  */
459
  public function build_title( $title = '', $seplocation = '', $args = array() ) {
460
 
461
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, true, $debug_key = microtime(true), get_defined_vars() );
462
 
463
  $args = $this->reparse_title_args( $args );
464
 
@@ -471,7 +466,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
471
  $title = $this->do_title_pre_filter( '', $args, false );
472
  $blogname = '';
473
 
474
- $is_front_page = $this->is_front_page() || $args['page_on_front'] || $this->is_static_frontpage( $args['term_id'] ) ? true : false;
475
 
476
  $seplocation = $this->get_title_seplocation( $seplocation );
477
 
@@ -511,7 +506,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
511
  * @since 2.4.1
512
  */
513
  if ( ! $args['description_title'] ) {
514
-
515
  $title = $this->add_title_protection( $title, $args['term_id'] );
516
  $title = $this->add_title_pagination( $title );
517
 
@@ -522,7 +516,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
522
  if ( $this->add_title_additions() )
523
  $title = $this->process_title_additions( $title, $blogname, $seplocation );
524
  }
525
-
526
  }
527
 
528
  $title = $this->do_title_pro_filter( $title, $args, false );
@@ -537,7 +530,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
537
  if ( $args['escape'] )
538
  $title = $this->escape_title( $title );
539
 
540
- if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key, array( 'title_output' => $title ) );
541
 
542
  return $title;
543
  }
@@ -568,13 +561,10 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
568
  * Generate the title based on query conditions.
569
  *
570
  * @since 2.3.4
 
571
  *
572
  * @param array $args The Title Args.
573
  * @param bool $escape Parse Title through saninitation calls.
574
- *
575
- * @staticvar array $cache : contains $title strings.
576
- * @since 2.6.0
577
- *
578
  * @return string $title The Generated Title.
579
  */
580
  public function generate_title( $args = array(), $escape = true ) {
@@ -583,17 +573,17 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
583
 
584
  $title = '';
585
  $id = $args['term_id'];
586
- $taxonomny = $args['taxonomy'];
587
 
588
  static $cache = array();
589
 
590
- if ( isset( $cache[$id][$taxonomny] ) )
591
- $title = $cache[$id][$taxonomny];
592
 
593
  if ( empty( $title ) ) {
594
 
595
  if ( $this->is_archive() ) {
596
- if ( ( $id && $taxonomny ) || $this->is_category() || $this->is_tag() || $this->is_tax() ) {
597
  $title = $this->title_for_terms( $args, false );
598
  } else {
599
  $term = get_queried_object();
@@ -603,7 +593,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
603
  */
604
  $title = $this->get_the_real_archive_title( $term, $args );
605
  }
606
-
607
  }
608
 
609
  $title = $this->get_the_404_title( $title );
@@ -636,7 +625,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
636
  * @param string $deprecated Deprecated: The Home Page separator location
637
  * @param bool $escape Parse Title through saninitation calls.
638
  * @param bool $get_option Whether to fetch the SEO Settings option.
639
- *
640
  * @return array {
641
  * 'title' => (string) $title : The Generated Title
642
  * 'blogname' => (string) $blogname : The Generated Blogname
@@ -680,7 +668,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
680
  'title' => $title,
681
  'blogname' => $blogname,
682
  'add_tagline' => $add_tagline,
683
- 'seplocation' => $seplocation
684
  );
685
  }
686
 
@@ -696,7 +684,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
696
  * @param bool $get_custom_field Fetch Title from InPost Custom Fields.
697
  * @param bool $escape Parse Title through saninitation calls.
698
  * @param bool $get_option Whether to fetch the SEO Settings option.
699
- *
700
  * @return string The Title.
701
  */
702
  public function title_for_home( $home_title = '', $get_custom_field = true, $escape = false, $get_option = true ) {
@@ -734,9 +721,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
734
  *
735
  * @param array $args The Title arguments.
736
  * @param bool $escape Parse Title through saninitation calls.
737
- *
738
- * @todo put args in array.
739
- *
740
  * @return string The Title.
741
  */
742
  public function title_for_terms( $args = array(), $escape = false ) {
@@ -749,39 +733,22 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
749
  if ( $args['term_id'] && $args['taxonomy'] )
750
  $term = get_term( $args['term_id'], $args['taxonomy'], OBJECT, 'raw' );
751
 
752
- if ( $this->is_category() || $this->is_tag() ) {
753
-
754
- if ( $args['get_custom_field'] ) {
755
- if ( ! isset( $term ) )
756
- $term = $this->fetch_the_term( $args['term_id'] );
757
-
758
- $title = empty( $term->admeta['doctitle'] ) ? $title : $term->admeta['doctitle'];
759
-
760
- $flag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] ) ? true : false;
761
- if ( false === $flag && empty( $title ) && isset( $term->meta['doctitle'] ) )
762
- $title = empty( $term->meta['doctitle'] ) ? $title : $term->meta['doctitle'];
763
- }
764
-
765
- if ( empty( $title ) )
766
- $title = $this->get_the_real_archive_title( $term, $args );
767
-
768
- } else {
769
  if ( ! isset( $term ) && $this->is_tax() )
770
  $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
771
 
772
- if ( $args['get_custom_field'] && isset( $term ) ) {
773
- $title = empty( $term->admeta['doctitle'] ) ? $title : wp_kses_stripslashes( wp_kses_decode_entities( $term->admeta['doctitle'] ) );
774
 
775
- $flag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] );
776
- if ( false === $flag && empty( $title ) && isset( $term->meta['doctitle'] ) )
777
- $title = empty( $term->meta['doctitle'] ) ? $title : wp_kses_stripslashes( wp_kses_decode_entities( $term->meta['doctitle'] ) );
778
  }
779
-
780
- if ( empty( $title ) )
781
- $title = $this->get_the_real_archive_title( $term, $args );
782
-
783
  }
784
 
 
 
 
785
  if ( $escape )
786
  $title = $this->escape_title( $title, false );
787
 
@@ -797,12 +764,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
797
  * @param bool $escape Parse Title through saninitation calls.
798
  * @param int $id The Post ID.
799
  * @param string $taxonomy The term name.
800
- *
801
  * @return string The Title.
802
  */
803
  public function title_from_custom_field( $title = '', $escape = false, $id = null, $taxonomy = null ) {
804
 
805
- $id = isset( $id ) ? $id : null;
806
 
807
  /**
808
  * Create something special for blog page. Only if it's not the home page.
@@ -811,13 +777,15 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
811
  if ( $this->is_singular() ) {
812
  //* Get title from custom field, empty it if it's not there to override the default title
813
  $title = $this->get_custom_field( '_genesis_title', $id ) ? $this->get_custom_field( '_genesis_title', $id ) : $title;
814
- } else if ( $this->is_blog_page( $id ) ) {
815
  //* Posts page title.
816
  $title = $this->get_custom_field( '_genesis_title', $id ) ? $this->get_custom_field( '_genesis_title', $id ) : get_the_title( $id );
817
- } else if ( $this->is_archive() || ( $id && $taxonomy ) ) {
818
  //* Get the custom title for terms.
819
  $term = get_term( $id, $taxonomy, OBJECT, 'raw' );
820
- $title = isset( $term->admeta['doctitle'] ) ? $term->admeta['doctitle'] : $title;
 
 
821
  }
822
 
823
  if ( $escape )
@@ -830,10 +798,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
830
  * Get the archive Title, including filter. Also works in admin.
831
  * @NOTE Taken from WordPress core. Altered to work in the Admin area.
832
  *
 
 
833
  * @param object $term The Term object.
834
  * @param array $args The Title arguments.
835
- *
836
- * @since 2.6.0
837
  */
838
  public function get_the_real_archive_title( $term = null, $args = array() ) {
839
 
@@ -862,61 +831,61 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
862
  $title = $this->single_term_title( '', false, $term );
863
  /* translators: Front-end output. 1: Taxonomy singular name, 2: Current taxonomy term */
864
  $title = $use_prefix ? sprintf( __( '%1$s: %2$s', 'autodescription' ), $this->get_the_term_name( $term ), $title ) : $title;
865
- } else if ( $this->is_author() ) {
866
  $title = get_the_author();
867
  /* translators: Front-end output. */
868
  $title = $use_prefix ? sprintf( __( 'Author: %s', 'autodescription' ), $title ) : $title;
869
- } else if ( $this->is_date() ) {
870
  if ( $this->is_year() ) {
871
  /* translators: Front-end output. */
872
  $title = get_the_date( _x( 'Y', 'yearly archives date format', 'autodescription' ) );
873
  /* translators: Front-end output. */
874
  $title = $use_prefix ? sprintf( __( 'Year: %s', 'autodescription' ), $title ) : $title;
875
- } else if ( $this->is_month() ) {
876
  /* translators: Front-end output. */
877
  $title = get_the_date( _x( 'F Y', 'monthly archives date format', 'autodescription' ) );
878
  /* translators: Front-end output. */
879
  $title = $use_prefix ? sprintf( __( 'Month: %s', 'autodescription' ), $title ) : $title;
880
- } else if ( $this->is_day() ) {
881
  /* translators: Front-end output. */
882
  $title = get_the_date( _x( 'F j, Y', 'daily archives date format', 'autodescription' ) );
883
  /* translators: Front-end output. */
884
  $title = $use_prefix ? sprintf( __( 'Day: %s', 'autodescription' ), $title ) : $title;
885
  }
886
- } else if ( $this->is_tax( 'post_format' ) ) {
887
  if ( is_tax( 'post_format', 'post-format-aside' ) ) {
888
  /* translators: Front-end output. */
889
  $title = _x( 'Asides', 'post format archive title', 'autodescription' );
890
- } else if ( $this->is_tax( 'post_format', 'post-format-gallery' ) ) {
891
  /* translators: Front-end output. */
892
  $title = _x( 'Galleries', 'post format archive title', 'autodescription' );
893
- } else if ( $this->is_tax( 'post_format', 'post-format-image' ) ) {
894
  /* translators: Front-end output. */
895
  $title = _x( 'Images', 'post format archive title', 'autodescription' );
896
- } else if ( $this->is_tax( 'post_format', 'post-format-video' ) ) {
897
  /* translators: Front-end output. */
898
  $title = _x( 'Videos', 'post format archive title', 'autodescription' );
899
- } else if ( $this->is_tax( 'post_format', 'post-format-quote' ) ) {
900
  /* translators: Front-end output. */
901
  $title = _x( 'Quotes', 'post format archive title', 'autodescription' );
902
- } else if ( $this->is_tax( 'post_format', 'post-format-link' ) ) {
903
  /* translators: Front-end output. */
904
  $title = _x( 'Links', 'post format archive title', 'autodescription' );
905
- } else if ( $this->is_tax( 'post_format', 'post-format-status' ) ) {
906
  /* translators: Front-end output. */
907
  $title = _x( 'Statuses', 'post format archive title', 'autodescription' );
908
- } else if ( $this->is_tax( 'post_format', 'post-format-audio' ) ) {
909
  /* translators: Front-end output. */
910
  $title = _x( 'Audio', 'post format archive title', 'autodescription' );
911
- } else if ( $this->is_tax( 'post_format', 'post-format-chat' ) ) {
912
  /* translators: Front-end output. */
913
  $title = _x( 'Chats', 'post format archive title', 'autodescription' );
914
  }
915
- } else if ( is_post_type_archive() ) {
916
  $title = post_type_archive_title( '', false );
917
  /* translators: Front-end output. */
918
  $title = $use_prefix ? sprintf( __( 'Archives: %s' ), $title ) : $title;
919
- } else if ( isset( $term ) ) {
920
  $title = $this->single_term_title( '', false, $term );
921
 
922
  if ( $use_prefix ) {
@@ -947,8 +916,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
947
  if ( ! $term )
948
  return;
949
 
950
- $term_name = '';
951
-
952
  if ( isset( $term->name ) ) {
953
  if ( $this->is_category() ) {
954
  /**
@@ -959,7 +926,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
959
  * @param string $term_name Category name for archive being displayed.
960
  */
961
  $term_name = apply_filters( 'single_cat_title', $term->name );
962
- } else if ( $this->is_tag() ) {
963
  /**
964
  * Filter the tag archive page title.
965
  *
@@ -968,7 +935,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
968
  * @param string $term_name Tag name for archive being displayed.
969
  */
970
  $term_name = apply_filters( 'single_tag_title', $term->name );
971
- } else if ( $this->is_tax() || $this->is_admin() ) {
972
  /**
973
  * Filter the custom taxonomy archive page title.
974
  *
@@ -982,25 +949,24 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
982
  }
983
  }
984
 
985
- //* Impossible through WordPress interface. Possible through filters.
986
  if ( empty( $term_name ) )
987
  $term_name = $this->untitled();
988
 
989
  if ( $display )
990
- echo $prefix . $term_name;
991
  else
992
  return $prefix . $term_name;
993
  }
994
 
995
  /**
996
- * Return custom field title.
997
  *
998
  * @since 2.6.0
999
  *
1000
  * @param string $title The current title.
1001
  * @param int $id The post or TT ID.
1002
  * @param string $taxonomy The TT name.
1003
- *
1004
  * @return string $title The custom field title.
1005
  */
1006
  public function get_custom_field_title( $title = '', $id = '', $taxonomy = '' ) {
@@ -1021,7 +987,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1021
  }
1022
 
1023
  /**
1024
- * Untitled title.
1025
  *
1026
  * @since 2.6.0
1027
  *
@@ -1033,13 +999,12 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1033
  }
1034
 
1035
  /**
1036
- * Return Post Title from ID.
1037
  *
1038
  * @since 2.6.0
1039
  *
1040
  * @param int $id The Post ID.
1041
- * @param string $title Optional. The current Title.
1042
- *
1043
  * @return string Post Title
1044
  */
1045
  public function post_title_from_ID( $id = 0, $title = '' ) {
@@ -1053,16 +1018,15 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1053
  }
1054
 
1055
  /**
1056
- * Return search title.
1057
  *
1058
  * @since 2.6.0
1059
  *
1060
  * @param string $title the current title.
1061
  * @param bool $escape Whether to escape attributes from query.
1062
- *
1063
  * @return string Search Title
1064
  */
1065
- public function get_the_search_title( $title, $escape = true ) {
1066
 
1067
  if ( $this->is_search() ) {
1068
  /* translators: Front-end output. */
@@ -1075,18 +1039,17 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1075
  }
1076
 
1077
  /**
1078
- * Return 404 title.
1079
  *
1080
  * @since 2.6.0
1081
  *
 
1082
  * Applies filters string the_seo_framework_404_title
1083
- * @since 2.5.2
1084
  *
1085
  * @param string $title The current Title
1086
- *
1087
  * @return string 404 Title
1088
  */
1089
- public function get_the_404_title( $title ) {
1090
 
1091
  if ( $this->is_404() )
1092
  return (string) apply_filters( 'the_seo_framework_404_title', '404' );
@@ -1095,15 +1058,15 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1095
  }
1096
 
1097
  /**
1098
- * Get Title Separator.
1099
  *
1100
  * @since 2.6.0
1101
  * @staticvar string $sep
1102
  *
 
1103
  * Applies filters the_seo_framework_title_separator
1104
- * @since 2.3.9
1105
  *
1106
- * @return string The Separator
1107
  */
1108
  public function get_title_separator() {
1109
 
@@ -1112,50 +1075,48 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1112
  if ( isset( $sep ) )
1113
  return $sep;
1114
 
1115
- return $sep = (string) apply_filters( 'the_seo_framework_title_separator', $this->get_separator( 'title' ) );
1116
  }
1117
 
1118
  /**
1119
- * Get Title Seplocation.
1120
  *
 
1121
  * Applies filters the_seo_framework_title_seplocation : string the title location.
1122
  * Applies filters the_seo_framework_title_seplocation_front : string the home page title location.
1123
- * @since 2.3.9
1124
  *
1125
  * @access private
1126
- * @since 2.6.0
1127
  * @staticvar string $cache
1128
  *
1129
  * @param string $seplocation The current seplocation.
1130
  * @param bool $home The home seplocation.
1131
- *
1132
  * @return string The Seplocation
1133
  */
1134
  public function get_title_seplocation( $seplocation = '', $home = false ) {
1135
 
1136
  static $cache = array();
1137
 
1138
- if ( isset( $cache[$seplocation][$home] ) )
1139
- return $cache[$seplocation][$home];
1140
 
1141
  if ( empty( $seplocation ) || 'right' !== $seplocation || 'left' !== $seplocation ) {
1142
  if ( $home ) {
1143
- return $cache[$seplocation][$home] = (string) apply_filters( 'the_seo_framework_title_seplocation_front', $this->get_option( 'home_title_location' ) );
1144
  } else {
1145
- return $cache[$seplocation][$home] = (string) apply_filters( 'the_seo_framework_title_seplocation', $this->get_option( 'title_location' ) );
1146
  }
1147
  }
1148
 
1149
- return $cache[$seplocation][$home] = $seplocation;
1150
  }
1151
 
1152
  /**
1153
- * Get Title Seplocation for the homepage.
1154
  *
1155
  * @since 2.6.0
1156
  *
1157
  * @param string $seplocation The current seplocation.
1158
- *
1159
  * @return string The Seplocation for the homepage.
1160
  */
1161
  public function get_home_title_seplocation( $seplocation = '' ) {
@@ -1165,10 +1126,10 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1165
  /**
1166
  * Determines whether to add or remove title additions.
1167
  *
1168
- * Applies filters the_seo_framework_add_blogname_to_title : boolean
1169
  * @since 2.4.3
 
1170
  *
1171
- * @since 2.6.0
1172
  * @staticvar bool $add
1173
  *
1174
  * @return bool True when additions are allowed.
@@ -1188,13 +1149,14 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1188
  }
1189
 
1190
  /**
1191
- * Add the title additions to the title.
 
 
1192
  *
1193
  * @param string $title The tite.
1194
  * @param string $blogname The blogname.
1195
  * @param string $seplocation The separator location.
1196
- *
1197
- * @since 2.6.0
1198
  */
1199
  public function process_title_additions( $title = '', $blogname = '', $seplocation = '' ) {
1200
 
@@ -1221,7 +1183,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1221
  *
1222
  * @param $title The current Title.
1223
  * @param $id The page ID.
1224
- *
1225
  * @return string $title with possible affixes.
1226
  */
1227
  public function add_title_protection( $title, $id ) {
@@ -1235,18 +1196,18 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1235
  *
1236
  * @since 2.4.1
1237
  *
1238
- * @applies filters core : protected_title_format
1239
- * @applies filters core : private_title_format
1240
  */
1241
  $post = get_post( $id, OBJECT );
1242
 
1243
  if ( isset( $post->post_password ) && '' !== $post->post_password ) {
1244
  /* translators: Front-end output */
1245
- $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s', 'autodescription' ), $post );
1246
  $title = sprintf( $protected_title_format, $title );
1247
- } else if ( isset( $post->post_status ) && 'private' === $post->post_status ) {
1248
  /* translators: Front-end output */
1249
- $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s', 'autodescription' ), $post );
1250
  $title = sprintf( $private_title_format, $title );
1251
  }
1252
 
@@ -1259,12 +1220,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1259
  * @since 2.6.0
1260
  *
1261
  * @param string $title The current Title.
1262
- *
1263
  * @return string Title with maybe pagination added.
1264
  */
1265
  public function add_title_pagination( $title ) {
1266
 
1267
- if ( $this->is_404() || $this->is_admin() )
1268
  return $title;
1269
 
1270
  $page = $this->page();
@@ -1287,14 +1247,13 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1287
  }
1288
 
1289
  /**
1290
- * Whether to use a title prefix or not.
1291
  *
1292
  * @since 2.6.0
1293
  * @staticvar bool $cache
1294
  *
1295
  * @param object $term The Term object.
1296
  * @param array $args The title arguments.
1297
- *
1298
  * @return bool
1299
  */
1300
  public function use_archive_prefix( $term = null, $args = array() ) {
@@ -1319,11 +1278,11 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1319
  $filter = (bool) apply_filters( 'the_seo_framework_use_archive_title_prefix', true, $term );
1320
  $option = ! $this->get_option( 'title_rem_prefixes' );
1321
 
1322
- return $cache = $option && $filter ? true : false;
1323
  }
1324
 
1325
  /**
1326
- * Filter the title prior to output.
1327
  *
1328
  * @since 2.6.0
1329
  * @access private
@@ -1331,7 +1290,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1331
  * @param string $title The current title.
1332
  * @param array $args The title args.
1333
  * @param bool $escape Whether to escape the title.
1334
- *
1335
  * @return string $title
1336
  */
1337
  public function do_title_pre_filter( $title, $args, $escape = true ) {
@@ -1352,7 +1310,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1352
  }
1353
 
1354
  /**
1355
- * Filter the title prior to output.
1356
  *
1357
  * @since 2.6.0
1358
  * @access private
@@ -1360,7 +1318,6 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1360
  * @param string $title The current title.
1361
  * @param array $args The title args.
1362
  * @param bool $escape Whether to escape the title.
1363
- *
1364
  * @return string $title
1365
  */
1366
  public function do_title_pro_filter( $title, $args, $escape = true ) {
@@ -1381,7 +1338,7 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1381
  }
1382
 
1383
  /**
1384
- * Whether to add home page tagline.
1385
  *
1386
  * @since 2.6.0
1387
  *
@@ -1390,5 +1347,4 @@ class AutoDescription_Generate_Title extends AutoDescription_Generate_Descriptio
1390
  public function home_page_add_title_tagline() {
1391
  return $this->is_option_checked( 'homepage_tagline' );
1392
  }
1393
-
1394
  }
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_Generate_Title
23
  *
27
  */
28
  class AutoDescription_Generate_Title extends AutoDescription_Generate_Description {
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
  */
47
  }
48
 
49
  /**
50
+ * Gets the title. Main function.
51
  * Always use this function for the title unless you're absolutely sure what you're doing.
52
  *
53
  * This function is used for all these: Taxonomies and Terms, Posts, Pages, Blog, front page, front-end, back-end.
71
  * @param bool description_title Fetch title for description.
72
  * @param bool is_front_page Fetch front page title.
73
  * }
 
74
  * @return string $title Title
75
  */
76
  public function title( $title = '', $sep = '', $seplocation = '', $args = array() ) {
95
  */
96
  if ( false === $args['meta'] && false === $this->is_admin() ) {
97
  if ( false === $this->current_theme_supports_title_tag() && doing_filter( 'wp_title' ) ) {
98
+ if ( $seplocation || $sep ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  //* Set doing it wrong parameters.
100
+ $this->set_tell_title_doing_it_wrong( $title, $sep, $seplocation, false );
101
  //* And echo them.
102
  add_action( 'wp_footer', array( $this, 'tell_title_doing_it_wrong' ), 20 );
103
 
108
  $this->set_theme_dir_transient( false );
109
 
110
  //* Title is empty.
111
+ if ( empty( $seplocation ) && $sep )
112
+ $args['empty_title'] = true;
113
 
114
  return $this->build_title_doingitwrong( $title, $sep, $seplocation, $args );
115
  }
131
  /**
132
  * Escapes and beautifies title.
133
  *
 
 
 
134
  * @since 2.5.2
135
  *
136
+ * @param string $title The title to escape and beautify.
137
+ * @param bool $trim Whether to trim the title from whitespaces.
138
  * @return string Escaped and beautified title.
139
  */
140
  public function escape_title( $title = '', $trim = true ) {
151
  /**
152
  * Parse and sanitize title args.
153
  *
154
+ * @since 2.4.0
 
 
155
  *
156
+ * @since 2.5.0:
157
+ * Applies filters the_seo_framework_title_args : {
158
  * @param int term_id The Taxonomy Term ID when taxonomy is also filled in. Else post ID.
159
  * @param string taxonomy The Taxonomy name.
160
  * @param bool page_on_front Page on front condition for example generation.
165
  * @param bool is_front_page Fetch front page title.
166
  * }
167
  *
168
+ * @param array $args required The passed arguments.
169
+ * @param array $defaults The default arguments.
170
+ * @param bool $get_defaults Return the default arguments. Ignoring $args.
171
  * @return array $args parsed args.
172
  */
173
  public function parse_title_args( $args = array(), $defaults = array(), $get_defaults = false ) {
186
  'escape' => true,
187
  );
188
 
 
189
  $defaults = (array) apply_filters( 'the_seo_framework_title_args', $defaults, $args );
190
  }
191
 
208
  }
209
 
210
  /**
211
+ * Reparses title args.
 
 
212
  *
213
  * @since 2.6.0
214
+ *
215
+ * @param array $args required The passed arguments.
216
  * @return array $args parsed args.
217
  */
218
  public function reparse_title_args( $args = array() ) {
227
  }
228
  } else {
229
  //* Old style parameters are used. Doing it wrong.
230
+ $this->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.5.0' );
231
  $args = $default_args;
232
  }
233
 
235
  }
236
 
237
  /**
238
+ * Builds the title based on input, without tagline.
239
+ *
240
+ * @since 2.4.0
241
  *
242
  * @param array $args : accepted args : {
243
  * @param int term_id The Taxonomy Term ID
244
  * @param bool placeholder Generate placeholder, ignoring options.
245
  * @param bool page_on_front Page on front condition for example generation
246
  * }
 
 
 
247
  * @return string Title without tagline.
248
  */
249
  protected function build_title_notagline( $args = array() ) {
268
  * Build the title based on input, without tagline.
269
  * Note: Not escaped.
270
  *
271
+ * @since 2.6.0
272
+ *
273
  * @param array $args : accepted args : {
274
  * @param int term_id The Taxonomy Term ID
275
  * @param bool placeholder Generate placeholder, ignoring options.
276
  * @param bool page_on_front Page on front condition for example generation
277
  * }
 
 
 
278
  * @return string Title without tagline.
279
  */
280
  protected function get_notagline_title( $args = array() ) {
293
  }
294
 
295
  /**
296
+ * Builds the title based on input and query status for themes that are doing it wrong.
297
+ * Pretty much a duplicate of build_title but contains different variables.
298
  * Keep this in mind.
299
  *
300
+ * @since 2.4.0
301
+ *
302
  * @param string $title The Title to return
303
  * @param string $sep The Title sepeartor
304
  * @param string $seplocation The Title sepeartor location ( accepts 'left' or 'right' )
308
  * @param bool placeholder Generate placeholder, ignoring options.
309
  * @param bool get_custom_field Do not fetch custom title when false.
310
  * }
 
 
 
311
  * @return string $title Title
312
  */
313
  public function build_title_doingitwrong( $title = '', $sep = '', $seplocation = '', $args = array() ) {
314
 
315
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, true, $debug_key = microtime( true ), get_defined_vars() );
316
 
317
  /**
318
  * Empty the title, because most themes think they 'know' how to SEO the front page.
419
  } else {
420
  $title = " $sep " . trim( ltrim( $title, " $sep_to_replace" ) );
421
  }
 
422
  } else {
423
  $title = trim( $title ) . " $sep ";
424
  }
429
  if ( $args['escape'] )
430
  $title = $this->escape_title( $title, false );
431
 
432
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, false, $debug_key, array( 'title_output' => $title ) );
433
 
434
  return $title;
435
  }
436
 
437
  /**
438
+ * Builds the title based on input and query status.
439
+ *
440
+ * @since 2.4.0
441
  *
442
  * @param string $title The Title to return
443
  * @param string $seplocation The Title sepeartor location ( accepts 'left' or 'right' )
449
  * @param bool get_custom_field Do not fetch custom title when false.
450
  * @param bool is_front_page Fetch front page title.
451
  * }
 
 
 
452
  * @return string $title Title
453
  */
454
  public function build_title( $title = '', $seplocation = '', $args = array() ) {
455
 
456
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, true, $debug_key = microtime( true ), get_defined_vars() );
457
 
458
  $args = $this->reparse_title_args( $args );
459
 
466
  $title = $this->do_title_pre_filter( '', $args, false );
467
  $blogname = '';
468
 
469
+ $is_front_page = $this->is_front_page() || $args['page_on_front'] || $this->is_static_frontpage( $args['term_id'] );
470
 
471
  $seplocation = $this->get_title_seplocation( $seplocation );
472
 
506
  * @since 2.4.1
507
  */
508
  if ( ! $args['description_title'] ) {
 
509
  $title = $this->add_title_protection( $title, $args['term_id'] );
510
  $title = $this->add_title_pagination( $title );
511
 
516
  if ( $this->add_title_additions() )
517
  $title = $this->process_title_additions( $title, $blogname, $seplocation );
518
  }
 
519
  }
520
 
521
  $title = $this->do_title_pro_filter( $title, $args, false );
530
  if ( $args['escape'] )
531
  $title = $this->escape_title( $title );
532
 
533
+ if ( $this->the_seo_framework_debug ) $this->debug_init( __METHOD__, false, $debug_key, array( 'title_output' => $title ) );
534
 
535
  return $title;
536
  }
561
  * Generate the title based on query conditions.
562
  *
563
  * @since 2.3.4
564
+ * @staticvar array $cache : contains $title strings.
565
  *
566
  * @param array $args The Title Args.
567
  * @param bool $escape Parse Title through saninitation calls.
 
 
 
 
568
  * @return string $title The Generated Title.
569
  */
570
  public function generate_title( $args = array(), $escape = true ) {
573
 
574
  $title = '';
575
  $id = $args['term_id'];
576
+ $taxonomy = $args['taxonomy'];
577
 
578
  static $cache = array();
579
 
580
+ if ( isset( $cache[ $id ][ $taxonomy ] ) )
581
+ $title = $cache[ $id ][ $taxonomy ];
582
 
583
  if ( empty( $title ) ) {
584
 
585
  if ( $this->is_archive() ) {
586
+ if ( ( $id && $taxonomy ) || $this->is_category() || $this->is_tag() || $this->is_tax() ) {
587
  $title = $this->title_for_terms( $args, false );
588
  } else {
589
  $term = get_queried_object();
593
  */
594
  $title = $this->get_the_real_archive_title( $term, $args );
595
  }
 
596
  }
597
 
598
  $title = $this->get_the_404_title( $title );
625
  * @param string $deprecated Deprecated: The Home Page separator location
626
  * @param bool $escape Parse Title through saninitation calls.
627
  * @param bool $get_option Whether to fetch the SEO Settings option.
 
628
  * @return array {
629
  * 'title' => (string) $title : The Generated Title
630
  * 'blogname' => (string) $blogname : The Generated Blogname
668
  'title' => $title,
669
  'blogname' => $blogname,
670
  'add_tagline' => $add_tagline,
671
+ 'seplocation' => $seplocation,
672
  );
673
  }
674
 
684
  * @param bool $get_custom_field Fetch Title from InPost Custom Fields.
685
  * @param bool $escape Parse Title through saninitation calls.
686
  * @param bool $get_option Whether to fetch the SEO Settings option.
 
687
  * @return string The Title.
688
  */
689
  public function title_for_home( $home_title = '', $get_custom_field = true, $escape = false, $get_option = true ) {
721
  *
722
  * @param array $args The Title arguments.
723
  * @param bool $escape Parse Title through saninitation calls.
 
 
 
724
  * @return string The Title.
725
  */
726
  public function title_for_terms( $args = array(), $escape = false ) {
733
  if ( $args['term_id'] && $args['taxonomy'] )
734
  $term = get_term( $args['term_id'], $args['taxonomy'], OBJECT, 'raw' );
735
 
736
+ if ( $this->is_category() || $this->is_tag() || $this->is_tax() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  if ( ! isset( $term ) && $this->is_tax() )
738
  $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
739
 
740
+ if ( ! isset( $term ) )
741
+ $term = $this->fetch_the_term( $args['term_id'] );
742
 
743
+ if ( $args['get_custom_field'] ) {
744
+ $data = $this->get_term_data( $term, $args['term_id'] );
745
+ $title = empty( $data['doctitle'] ) ? $title : $data['doctitle'];
746
  }
 
 
 
 
747
  }
748
 
749
+ if ( empty( $title ) )
750
+ $title = $this->get_the_real_archive_title( $term, $args );
751
+
752
  if ( $escape )
753
  $title = $this->escape_title( $title, false );
754
 
764
  * @param bool $escape Parse Title through saninitation calls.
765
  * @param int $id The Post ID.
766
  * @param string $taxonomy The term name.
 
767
  * @return string The Title.
768
  */
769
  public function title_from_custom_field( $title = '', $escape = false, $id = null, $taxonomy = null ) {
770
 
771
+ $id = isset( $id ) ? $id : $this->get_the_real_ID();
772
 
773
  /**
774
  * Create something special for blog page. Only if it's not the home page.
777
  if ( $this->is_singular() ) {
778
  //* Get title from custom field, empty it if it's not there to override the default title
779
  $title = $this->get_custom_field( '_genesis_title', $id ) ? $this->get_custom_field( '_genesis_title', $id ) : $title;
780
+ } elseif ( $this->is_blog_page( $id ) ) {
781
  //* Posts page title.
782
  $title = $this->get_custom_field( '_genesis_title', $id ) ? $this->get_custom_field( '_genesis_title', $id ) : get_the_title( $id );
783
+ } elseif ( $this->is_archive() || ( $id && $taxonomy ) ) {
784
  //* Get the custom title for terms.
785
  $term = get_term( $id, $taxonomy, OBJECT, 'raw' );
786
+ $data = $this->get_term_data( $term, $id );
787
+
788
+ $title = empty( $data['doctitle'] ) ? $title : $data['doctitle'];
789
  }
790
 
791
  if ( $escape )
798
  * Get the archive Title, including filter. Also works in admin.
799
  * @NOTE Taken from WordPress core. Altered to work in the Admin area.
800
  *
801
+ * @since 2.6.0
802
+ *
803
  * @param object $term The Term object.
804
  * @param array $args The Title arguments.
805
+ * @return string The Archive Title.
 
806
  */
807
  public function get_the_real_archive_title( $term = null, $args = array() ) {
808
 
831
  $title = $this->single_term_title( '', false, $term );
832
  /* translators: Front-end output. 1: Taxonomy singular name, 2: Current taxonomy term */
833
  $title = $use_prefix ? sprintf( __( '%1$s: %2$s', 'autodescription' ), $this->get_the_term_name( $term ), $title ) : $title;
834
+ } elseif ( $this->is_author() ) {
835
  $title = get_the_author();
836
  /* translators: Front-end output. */
837
  $title = $use_prefix ? sprintf( __( 'Author: %s', 'autodescription' ), $title ) : $title;
838
+ } elseif ( $this->is_date() ) {
839
  if ( $this->is_year() ) {
840
  /* translators: Front-end output. */
841
  $title = get_the_date( _x( 'Y', 'yearly archives date format', 'autodescription' ) );
842
  /* translators: Front-end output. */
843
  $title = $use_prefix ? sprintf( __( 'Year: %s', 'autodescription' ), $title ) : $title;
844
+ } elseif ( $this->is_month() ) {
845
  /* translators: Front-end output. */
846
  $title = get_the_date( _x( 'F Y', 'monthly archives date format', 'autodescription' ) );
847
  /* translators: Front-end output. */
848
  $title = $use_prefix ? sprintf( __( 'Month: %s', 'autodescription' ), $title ) : $title;
849
+ } elseif ( $this->is_day() ) {
850
  /* translators: Front-end output. */
851
  $title = get_the_date( _x( 'F j, Y', 'daily archives date format', 'autodescription' ) );
852
  /* translators: Front-end output. */
853
  $title = $use_prefix ? sprintf( __( 'Day: %s', 'autodescription' ), $title ) : $title;
854
  }
855
+ } elseif ( $this->is_tax( 'post_format' ) ) {
856
  if ( is_tax( 'post_format', 'post-format-aside' ) ) {
857
  /* translators: Front-end output. */
858
  $title = _x( 'Asides', 'post format archive title', 'autodescription' );
859
+ } elseif ( $this->is_tax( 'post_format', 'post-format-gallery' ) ) {
860
  /* translators: Front-end output. */
861
  $title = _x( 'Galleries', 'post format archive title', 'autodescription' );
862
+ } elseif ( $this->is_tax( 'post_format', 'post-format-image' ) ) {
863
  /* translators: Front-end output. */
864
  $title = _x( 'Images', 'post format archive title', 'autodescription' );
865
+ } elseif ( $this->is_tax( 'post_format', 'post-format-video' ) ) {
866
  /* translators: Front-end output. */
867
  $title = _x( 'Videos', 'post format archive title', 'autodescription' );
868
+ } elseif ( $this->is_tax( 'post_format', 'post-format-quote' ) ) {
869
  /* translators: Front-end output. */
870
  $title = _x( 'Quotes', 'post format archive title', 'autodescription' );
871
+ } elseif ( $this->is_tax( 'post_format', 'post-format-link' ) ) {
872
  /* translators: Front-end output. */
873
  $title = _x( 'Links', 'post format archive title', 'autodescription' );
874
+ } elseif ( $this->is_tax( 'post_format', 'post-format-status' ) ) {
875
  /* translators: Front-end output. */
876
  $title = _x( 'Statuses', 'post format archive title', 'autodescription' );
877
+ } elseif ( $this->is_tax( 'post_format', 'post-format-audio' ) ) {
878
  /* translators: Front-end output. */
879
  $title = _x( 'Audio', 'post format archive title', 'autodescription' );
880
+ } elseif ( $this->is_tax( 'post_format', 'post-format-chat' ) ) {
881
  /* translators: Front-end output. */
882
  $title = _x( 'Chats', 'post format archive title', 'autodescription' );
883
  }
884
+ } elseif ( is_post_type_archive() ) {
885
  $title = post_type_archive_title( '', false );
886
  /* translators: Front-end output. */
887
  $title = $use_prefix ? sprintf( __( 'Archives: %s' ), $title ) : $title;
888
+ } elseif ( isset( $term ) ) {
889
  $title = $this->single_term_title( '', false, $term );
890
 
891
  if ( $use_prefix ) {
916
  if ( ! $term )
917
  return;
918
 
 
 
919
  if ( isset( $term->name ) ) {
920
  if ( $this->is_category() ) {
921
  /**
926
  * @param string $term_name Category name for archive being displayed.
927
  */
928
  $term_name = apply_filters( 'single_cat_title', $term->name );
929
+ } elseif ( $this->is_tag() ) {
930
  /**
931
  * Filter the tag archive page title.
932
  *
935
  * @param string $term_name Tag name for archive being displayed.
936
  */
937
  $term_name = apply_filters( 'single_tag_title', $term->name );
938
+ } elseif ( $this->is_tax() || $this->is_admin() ) {
939
  /**
940
  * Filter the custom taxonomy archive page title.
941
  *
949
  }
950
  }
951
 
952
+ //* Might be empty through filters.
953
  if ( empty( $term_name ) )
954
  $term_name = $this->untitled();
955
 
956
  if ( $display )
957
+ echo esc_attr( $prefix . $term_name );
958
  else
959
  return $prefix . $term_name;
960
  }
961
 
962
  /**
963
+ * Returns custom field title.
964
  *
965
  * @since 2.6.0
966
  *
967
  * @param string $title The current title.
968
  * @param int $id The post or TT ID.
969
  * @param string $taxonomy The TT name.
 
970
  * @return string $title The custom field title.
971
  */
972
  public function get_custom_field_title( $title = '', $id = '', $taxonomy = '' ) {
987
  }
988
 
989
  /**
990
+ * Returns untitled title.
991
  *
992
  * @since 2.6.0
993
  *
999
  }
1000
 
1001
  /**
1002
+ * Returns Post Title from ID.
1003
  *
1004
  * @since 2.6.0
1005
  *
1006
  * @param int $id The Post ID.
1007
+ * @param string $title Optional. The current/fallback Title.
 
1008
  * @return string Post Title
1009
  */
1010
  public function post_title_from_ID( $id = 0, $title = '' ) {
1018
  }
1019
 
1020
  /**
1021
+ * Returns search title.
1022
  *
1023
  * @since 2.6.0
1024
  *
1025
  * @param string $title the current title.
1026
  * @param bool $escape Whether to escape attributes from query.
 
1027
  * @return string Search Title
1028
  */
1029
+ public function get_the_search_title( $title = '', $escape = true ) {
1030
 
1031
  if ( $this->is_search() ) {
1032
  /* translators: Front-end output. */
1039
  }
1040
 
1041
  /**
1042
+ * Returns 404 title.
1043
  *
1044
  * @since 2.6.0
1045
  *
1046
+ * @since 2.5.2:
1047
  * Applies filters string the_seo_framework_404_title
 
1048
  *
1049
  * @param string $title The current Title
 
1050
  * @return string 404 Title
1051
  */
1052
+ public function get_the_404_title( $title = '' ) {
1053
 
1054
  if ( $this->is_404() )
1055
  return (string) apply_filters( 'the_seo_framework_404_title', '404' );
1058
  }
1059
 
1060
  /**
1061
+ * Gets Title Separator.
1062
  *
1063
  * @since 2.6.0
1064
  * @staticvar string $sep
1065
  *
1066
+ * @since 2.3.9:
1067
  * Applies filters the_seo_framework_title_separator
 
1068
  *
1069
+ * @return string The Separator, unescaped.
1070
  */
1071
  public function get_title_separator() {
1072
 
1075
  if ( isset( $sep ) )
1076
  return $sep;
1077
 
1078
+ return $sep = (string) apply_filters( 'the_seo_framework_title_separator', $this->get_separator( 'title', false ) );
1079
  }
1080
 
1081
  /**
1082
+ * Gets Title Seplocation.
1083
  *
1084
+ * @since 2.3.9
1085
  * Applies filters the_seo_framework_title_seplocation : string the title location.
1086
  * Applies filters the_seo_framework_title_seplocation_front : string the home page title location.
 
1087
  *
1088
  * @access private
1089
+ * @since 2.6.0:
1090
  * @staticvar string $cache
1091
  *
1092
  * @param string $seplocation The current seplocation.
1093
  * @param bool $home The home seplocation.
 
1094
  * @return string The Seplocation
1095
  */
1096
  public function get_title_seplocation( $seplocation = '', $home = false ) {
1097
 
1098
  static $cache = array();
1099
 
1100
+ if ( isset( $cache[ $seplocation ][ $home ] ) )
1101
+ return $cache[ $seplocation ][ $home ];
1102
 
1103
  if ( empty( $seplocation ) || 'right' !== $seplocation || 'left' !== $seplocation ) {
1104
  if ( $home ) {
1105
+ return $cache[ $seplocation ][ $home ] = (string) apply_filters( 'the_seo_framework_title_seplocation_front', $this->get_option( 'home_title_location' ) );
1106
  } else {
1107
+ return $cache[ $seplocation ][ $home ] = (string) apply_filters( 'the_seo_framework_title_seplocation', $this->get_option( 'title_location' ) );
1108
  }
1109
  }
1110
 
1111
+ return $cache[ $seplocation ][ $home ] = $seplocation;
1112
  }
1113
 
1114
  /**
1115
+ * Gets Title Seplocation for the homepage.
1116
  *
1117
  * @since 2.6.0
1118
  *
1119
  * @param string $seplocation The current seplocation.
 
1120
  * @return string The Seplocation for the homepage.
1121
  */
1122
  public function get_home_title_seplocation( $seplocation = '' ) {
1126
  /**
1127
  * Determines whether to add or remove title additions.
1128
  *
 
1129
  * @since 2.4.3
1130
+ * Applies filters the_seo_framework_add_blogname_to_title : boolean
1131
  *
1132
+ * @since 2.6.0:
1133
  * @staticvar bool $add
1134
  *
1135
  * @return bool True when additions are allowed.
1149
  }
1150
 
1151
  /**
1152
+ * Adds the title additions to the title.
1153
+ *
1154
+ * @since 2.6.0
1155
  *
1156
  * @param string $title The tite.
1157
  * @param string $blogname The blogname.
1158
  * @param string $seplocation The separator location.
1159
+ * @return string Title with possible additions.
 
1160
  */
1161
  public function process_title_additions( $title = '', $blogname = '', $seplocation = '' ) {
1162
 
1183
  *
1184
  * @param $title The current Title.
1185
  * @param $id The page ID.
 
1186
  * @return string $title with possible affixes.
1187
  */
1188
  public function add_title_protection( $title, $id ) {
1196
  *
1197
  * @since 2.4.1
1198
  *
1199
+ * @applies filters WordPress core 'protected_title_format' : string
1200
+ * @applies filters WordPress core 'private_title_format' : string
1201
  */
1202
  $post = get_post( $id, OBJECT );
1203
 
1204
  if ( isset( $post->post_password ) && '' !== $post->post_password ) {
1205
  /* translators: Front-end output */
1206
+ $protected_title_format = (string) apply_filters( 'protected_title_format', __( 'Protected: %s', 'autodescription' ), $post );
1207
  $title = sprintf( $protected_title_format, $title );
1208
+ } elseif ( isset( $post->post_status ) && 'private' === $post->post_status ) {
1209
  /* translators: Front-end output */
1210
+ $private_title_format = (string) apply_filters( 'private_title_format', __( 'Private: %s', 'autodescription' ), $post );
1211
  $title = sprintf( $private_title_format, $title );
1212
  }
1213
 
1220
  * @since 2.6.0
1221
  *
1222
  * @param string $title The current Title.
 
1223
  * @return string Title with maybe pagination added.
1224
  */
1225
  public function add_title_pagination( $title ) {
1226
 
1227
+ if ( $this->is_404() || $this->is_admin() || $this->is_preview() )
1228
  return $title;
1229
 
1230
  $page = $this->page();
1247
  }
1248
 
1249
  /**
1250
+ * Determines whether to use a title prefix or not.
1251
  *
1252
  * @since 2.6.0
1253
  * @staticvar bool $cache
1254
  *
1255
  * @param object $term The Term object.
1256
  * @param array $args The title arguments.
 
1257
  * @return bool
1258
  */
1259
  public function use_archive_prefix( $term = null, $args = array() ) {
1278
  $filter = (bool) apply_filters( 'the_seo_framework_use_archive_title_prefix', true, $term );
1279
  $option = ! $this->get_option( 'title_rem_prefixes' );
1280
 
1281
+ return $cache = $option && $filter;
1282
  }
1283
 
1284
  /**
1285
+ * Filters the title prior to output.
1286
  *
1287
  * @since 2.6.0
1288
  * @access private
1290
  * @param string $title The current title.
1291
  * @param array $args The title args.
1292
  * @param bool $escape Whether to escape the title.
 
1293
  * @return string $title
1294
  */
1295
  public function do_title_pre_filter( $title, $args, $escape = true ) {
1310
  }
1311
 
1312
  /**
1313
+ * Filters the title prior to output.
1314
  *
1315
  * @since 2.6.0
1316
  * @access private
1318
  * @param string $title The current title.
1319
  * @param array $args The title args.
1320
  * @param bool $escape Whether to escape the title.
 
1321
  * @return string $title
1322
  */
1323
  public function do_title_pro_filter( $title, $args, $escape = true ) {
1338
  }
1339
 
1340
  /**
1341
+ * Determines whether to add home page tagline.
1342
  *
1343
  * @since 2.6.0
1344
  *
1347
  public function home_page_add_title_tagline() {
1348
  return $this->is_option_checked( 'homepage_tagline' );
1349
  }
 
1350
  }
inc/classes/generate-url.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_Generate_Url
21
  *
@@ -34,15 +36,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
34
  */
35
  protected $url_slashit;
36
 
37
- /**
38
- * Whether to add a subdomain to the url if set.
39
- *
40
- * @since 2.6.0
41
- *
42
- * @var string The subdomain.
43
- */
44
- protected $add_subdomain;
45
-
46
  /**
47
  * Holds current HTTP host.
48
  *
@@ -53,21 +46,22 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
53
  protected $current_host;
54
 
55
  /**
56
- * Holds home HTTP host.
57
- *
58
- * @since 2.6.5
59
- *
60
- * @var string The home HTTP host.
61
  */
62
- protected $home_host;
 
 
 
 
 
 
 
63
 
64
  /**
65
  * Constructor, load parent constructor and set up variables.
66
  */
67
  public function __construct() {
68
  parent::__construct();
69
-
70
- $this->home_host = parse_url( get_option( 'home' ), PHP_URL_HOST );
71
  }
72
 
73
  /**
@@ -95,7 +89,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
95
  */
96
  public function the_url( $url = '', $args = array() ) {
97
 
98
- if ( $this->the_seo_framework_debug && false === $this->doing_sitemap ) $this->debug_init( __CLASS__, __FUNCTION__, true, $debug_key = microtime(true), get_defined_vars() );
99
 
100
  $args = $this->reparse_url_args( $args );
101
 
@@ -108,7 +102,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
108
 
109
  //* Reset cache.
110
  $this->url_slashit = true;
111
- $this->add_subdomain = '';
112
  $this->current_host = '';
113
 
114
  $path = '';
@@ -131,7 +125,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
131
  if ( $custom_url ) {
132
  $url = $custom_url;
133
  $this->url_slashit = false;
134
- $scheme = parse_url( $custom_url, PHP_URL_SCHEME );
 
135
  }
136
  }
137
 
@@ -162,10 +157,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
162
 
163
  //* Non-domainmap URL
164
  if ( empty( $url ) ) {
165
- if ( $args['home'] ) {
166
- $this->current_lang = '';
167
- $this->add_subdomain = '';
168
- }
169
 
170
  $url = $this->add_url_host( $path );
171
  $scheme = is_ssl() ? 'https' : 'http';
@@ -199,7 +192,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
199
  $url = esc_url_raw( $url );
200
  }
201
 
202
- if ( $this->the_seo_framework_debug && false === $this->doing_sitemap ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key, array( 'url_output' => $url ) );
203
 
204
  return $url;
205
  }
@@ -207,10 +200,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
207
  /**
208
  * Parse and sanitize url args.
209
  *
210
- * @param array $args required The passed arguments.
211
- * @param array $defaults The default arguments.
212
- * @param bool $get_defaults Return the default arguments. Ignoring $args.
213
- *
214
  * @applies filters the_seo_framework_url_args : {
215
  * @param bool $paged Return current page URL without pagination if false
216
  * @param bool $paged_plural Whether to add pagination for the second or later page.
@@ -224,7 +215,9 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
224
  * @param int $id The Page or Term ID.
225
  * }
226
  *
227
- * @since 2.4.2
 
 
228
  * @return array $args parsed args.
229
  */
230
  public function parse_url_args( $args = array(), $defaults = array(), $get_defaults = false ) {
@@ -241,10 +234,9 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
241
  'term' => null,
242
  'home' => false,
243
  'forceslash' => false,
244
- 'id' => $this->get_the_real_ID()
245
  );
246
 
247
- //* @since 2.5.0
248
  $defaults = (array) apply_filters( 'the_seo_framework_url_args', $defaults, $args );
249
  }
250
 
@@ -281,14 +273,14 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
281
  $default_args = $this->parse_url_args( '', '', true );
282
 
283
  if ( is_array( $args ) ) {
284
- if ( empty( $args ) ) {
285
  $args = $default_args;
286
  } else {
287
  $args = $this->parse_url_args( $args, $default_args );
288
  }
289
  } else {
290
  //* Old style parameters are used. Doing it wrong.
291
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.4.2' );
292
  $args = $default_args;
293
  }
294
 
@@ -299,8 +291,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
299
  * Generate URL from arguments.
300
  *
301
  * @since 2.6.0
302
- *
303
  * @global object $wp
 
304
  *
305
  * @param array $args the URL args.
306
  * @return string $path
@@ -309,7 +301,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
309
 
310
  $args = $this->reparse_url_args( $args );
311
 
312
- if ( $args['is_term'] || $this->is_archive() ) {
 
313
  $term = $args['term'];
314
 
315
  //* Term or Taxonomy.
@@ -319,7 +312,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
319
  if ( isset( $term->taxonomy ) ) {
320
  //* Registered Terms and Taxonomies.
321
  $path = $this->get_relative_term_url( $term, $args );
322
- } else if ( ! $args['external'] ) {
323
  //* Everything else.
324
  global $wp;
325
  $path = trailingslashit( get_option( 'home' ) ) . $wp->request;
@@ -328,7 +321,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
328
  //* Nothing to see here...
329
  $path = '';
330
  }
331
-
332
  } else {
333
 
334
  /**
@@ -358,8 +350,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
358
  * Generates relative URL for the Homepage and Singular Posts.
359
  *
360
  * @since 2.6.5
361
- *
362
  * @global object $wp
 
363
  *
364
  * @param int $post_id The ID.
365
  * @param array $args The URL arguments.
@@ -368,46 +360,46 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
368
  public function build_singular_relative_url( $post_id = null, $args = array() ) {
369
 
370
  if ( ! isset( $post_id ) ) {
371
- if ( ! $args['external'] )
372
- $post_id = $this->get_the_real_ID();
373
- else
374
  return '';
 
 
375
  }
376
 
377
  $args = $this->reparse_url_args( $args );
378
 
379
  if ( $args['external'] || ! $this->is_front_page() ) {
380
  $url = get_permalink( $post_id );
381
- } else if ( $this->is_front_page() ) {
382
  $url = get_home_url();
383
- } else if ( ! $args['external'] ) {
384
  global $wp;
385
 
386
  if ( isset( $wp->request ) )
387
  $url = trailingslashit( get_option( 'home' ) ) . $wp->request;
388
-
389
  }
390
 
391
  //* No permalink found.
392
  if ( ! isset( $url ) )
393
  return '';
394
 
395
- if ( $this->is_singular() )
396
- $paged = $this->maybe_get_paged( $this->page(), $args['paged'], $args['paged_plural'] );
397
- else
398
- $paged = $this->maybe_get_paged( $this->paged(), $args['paged'], $args['paged_plural'] );
399
 
400
  if ( $paged ) {
401
  if ( $this->pretty_permalinks ) {
402
- if ( $this->is_singular() )
403
  $url = trailingslashit( $url ) . $paged;
404
- else
405
  $url = trailingslashit( $url ) . 'page/' . $paged;
 
406
  } else {
407
- if ( $this->is_singular() )
408
  $url = add_query_arg( 'page', $paged, $url );
409
- else
410
  $url = add_query_arg( 'paged', $paged, $url );
 
411
  }
412
  }
413
 
@@ -420,6 +412,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
420
  * Create full valid URL with parsed host.
421
  * Don't forget to use set_url_scheme() afterwards.
422
  *
 
 
423
  * @since 2.6.5
424
  *
425
  * @param string $path Current path.
@@ -427,22 +421,23 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
427
  */
428
  public function add_url_host( $path = '' ) {
429
 
430
- $host = $this->current_host ? $this->current_host : $this->home_host;
431
 
432
- return $url = 'http://' . trailingslashit( $host ) . ltrim( $path, ' \\/' );
 
 
433
  }
434
 
435
  /**
436
  * Generates relative URL for current post_ID for translation plugins.
437
  *
438
- * @param string $path the current URL path.
439
- * @param int $post_id The post ID.
440
- * @param bool $external Whether to fetch the WP Request or get the permalink by Post Object.
441
- *
442
  * @since 2.6.0
443
- *
444
  * @global object $post
 
445
  *
 
 
 
446
  * @return relative Post or Page url.
447
  */
448
  public function get_translation_path( $path = '', $post_id = null, $external = false ) {
@@ -450,7 +445,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
450
  if ( is_object( $post_id ) )
451
  $post_id = isset( $post_id->ID ) ? $post_id->ID : $this->get_the_real_ID();
452
 
453
- if ( ! isset( $post_id ) )
454
  $post_id = $this->get_the_real_ID();
455
 
456
  //* WPML support.
@@ -467,20 +462,19 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
467
  /**
468
  * Generates qtranslate URL.
469
  *
470
- * @param string $path The current path.
471
- * @param int $post_id The Post ID. Unused.
472
- *
473
- * @global array $q_config
474
- *
475
  * @staticvar int $q_config_mode
 
 
476
  *
477
- * @since 2.6.0
 
478
  */
479
  public function get_relative_qtranslate_url( $path = '', $post_id = '' ) {
480
 
481
  //* Reset cache.
482
  $this->url_slashit = true;
483
- $this->add_subdomain = '';
484
 
485
  static $q_config_mode = null;
486
 
@@ -500,7 +494,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
500
  return $path;
501
 
502
  switch ( $q_config_mode ) {
503
-
504
  case '1' :
505
  //* Negotiation type query var.
506
 
@@ -527,12 +520,15 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
527
 
528
  case '3' :
529
  //* Notify cache of subdomain addition.
530
- $this->add_subdomain = $current_lang;
531
 
532
  //* No need to alter the path.
533
  return $path;
534
  break;
535
 
 
 
 
536
  }
537
 
538
  return $path;
@@ -544,8 +540,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
544
  * @since 2.4.3
545
  * @staticvar bool $gli_exists
546
  * @staticvar string $default_lang
547
- *
548
  * @global object $sitepress
 
549
  *
550
  * @param string $path The current path.
551
  * @param int $post_id The Post ID.
@@ -556,7 +552,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
556
 
557
  //* Reset cache.
558
  $this->url_slashit = true;
559
- $this->add_subdomain = '';
560
 
561
  if ( ! isset( $sitepress ) )
562
  return $path;
@@ -583,7 +579,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
583
  * This should be put inside a callable function.
584
  * @since 2.6.0
585
  */
586
- $lang_info = apply_filters( 'wpml_post_language_details', NULL, $post_id );
587
 
588
  if ( is_wp_error( $lang_info ) ) {
589
  //* Terms and Taxonomies.
@@ -623,10 +619,11 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
623
  * @priority OMG WTF BBQ
624
  */
625
  $contains_path = strpos( $path, '/' . $current_lang . '/' );
626
- if ( false !== $contains_path && 0 === $contains_path )
627
  return $path;
628
- else
629
  return $path = trailingslashit( $current_lang ) . ltrim( $path, ' \\/' );
 
630
  break;
631
 
632
  case '2' :
@@ -639,7 +636,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
639
  return $path;
640
 
641
  $current_lang_setting = $this->make_fully_qualified_url( $current_lang_setting );
642
- $parsed = parse_url( $current_lang_setting );
643
 
644
  $this->current_host = isset( $parsed['host'] ) ? $parsed['host'] : '';
645
  $current_path = isset( $parsed['path'] ) ? trailingslashit( $parsed['path'] ) : '';
@@ -671,7 +668,10 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
671
  /**
672
  * Generates relative URL for current term.
673
  *
674
- * @global WP_Rewrite object $wp_rewrite
 
 
 
675
  *
676
  * @param object $term The term object.
677
  * @param array|bool $args {
@@ -679,9 +679,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
679
  * 'paged' : Whether to add pagination for all types.
680
  * 'paged_plural' : Whether to add pagination for the second or later page.
681
  * }
682
- *
683
- * @since 2.4.2
684
- *
685
  * @return Relative term or taxonomy URL.
686
  */
687
  public function get_relative_term_url( $term = null, $args = array() ) {
@@ -692,7 +689,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
692
  * @since 2.6.0
693
  * '$args = array()' replaced '$no_request = false'.
694
  */
695
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.6.0' );
696
 
697
  $no_request = (bool) $args;
698
  $args = $this->parse_url_args( '', '', true );
@@ -719,7 +716,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
719
 
720
  if ( 'category' === $taxonomy ) {
721
  $path = '?cat=' . $term->term_id;
722
- } else if ( isset( $t->query_var ) && '' !== $t->query_var ) {
723
  $path = '?' . $t->query_var . '=' . $slug;
724
  } else {
725
  $path = '?taxonomy=' . $taxonomy . '&term=' . $slug;
@@ -755,8 +752,9 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
755
  $path = user_trailingslashit( $path, 'category' );
756
  }
757
 
758
- //* Leading Slash it..
759
- $path = '/' . ltrim( $path, ' \\/' );
 
760
 
761
  return $path;
762
  }
@@ -774,15 +772,11 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
774
  */
775
  public function set_url_scheme( $url, $scheme = null, $use_filter = true ) {
776
 
777
- /**
778
- * Core should uphold the coding standards (Yoda code). Open issue @link Github.com?
779
- * @todo yoda-fy
780
- */
781
  if ( ! isset( $scheme ) ) {
782
  $scheme = is_ssl() ? 'https' : 'http';
783
- } else if ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) {
784
  $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
785
- } else if ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) {
786
  $scheme = is_ssl() ? 'https' : 'http';
787
  }
788
 
@@ -790,9 +784,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
790
 
791
  if ( 'relative' === $scheme ) {
792
  $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
793
- if ( $url !== '' && $url[0] === '/' )
794
  $url = '/' . ltrim( $url , "/ \t\n\r\0\x0B" );
795
-
796
  } else {
797
  //* This will break if $scheme is set to false.
798
  $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
@@ -811,7 +804,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
811
  *
812
  * @param string $url The url with scheme.
813
  * @param string $scheme The current scheme.
814
- *
815
  * @return $url with applied filters.
816
  */
817
  public function set_url_scheme_filter( $url, $current_scheme ) {
@@ -820,12 +812,12 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
820
  * Applies filters the_seo_framework_canonical_force_scheme : Changes scheme.
821
  *
822
  * Accepted variables:
823
- * (string) 'https' : Force https
824
- * (bool) true : Force https
825
- * (bool) false : Force http
826
- * (string) 'http' : Force http
827
- * (string) 'relative' : Scheme relative
828
- * (void) null : Do nothing
829
  *
830
  * @param string $current_scheme the current used scheme.
831
  *
@@ -841,9 +833,9 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
841
  if ( isset( $scheme_settings ) ) {
842
  if ( 'https' === $scheme_settings || 'http' === $scheme_settings || 'relative' === $scheme_settings ) {
843
  $url = $this->set_url_scheme( $url, $scheme_settings, false );
844
- } else if ( ! $scheme_settings ) {
845
  $url = $this->set_url_scheme( $url, 'http', false );
846
- } else if ( $scheme_setting ) {
847
  $url = $this->set_url_scheme( $url, 'https', false );
848
  }
849
  }
@@ -852,15 +844,13 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
852
  }
853
 
854
  /**
855
- * Try to get an canonical URL when WPMUdev Domain Mapping is active.
856
  *
857
  * @since 2.3.0
 
858
  *
859
  * @param string $path The post relative path.
860
- *
861
  * @param bool $get_scheme Output array with scheme.
862
- * @since 2.4.0
863
- *
864
  * @return string|array|void The unescaped URL, the scheme
865
  */
866
  public function the_url_wpmudev_domainmap( $path, $get_scheme = false ) {
@@ -878,7 +868,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
878
 
879
  $cache_key = 'wpmudev_mapped_domain_' . $revision . '_' . $blog_id;
880
 
881
- //* Check if the domain is mapped
882
  $mapped_domain = $this->object_cache_get( $cache_key );
883
  if ( false === $mapped_domain ) {
884
 
@@ -886,6 +876,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
886
 
887
  $primary_key = 0;
888
  $domain_ids = array();
 
889
  foreach ( $mapped_domains as $key => $domain ) {
890
  if ( isset( $domain->is_primary ) && '1' === $domain->is_primary ) {
891
  $primary_key = $key;
@@ -895,7 +886,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
895
  } else {
896
  //* Save IDs.
897
  if ( isset( $domain->id ) && $domain->id )
898
- $domain_ids[$key] = $domain->id;
899
  }
900
  }
901
 
@@ -906,7 +897,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
906
  }
907
 
908
  //* Set 0, as we check for false to begin with.
909
- $mapped_domain = isset( $mapped_domains[$primary_key] ) ? $mapped_domains[$primary_key] : 0;
910
 
911
  $this->object_cache_set( $cache_key, $mapped_domain, 3600 );
912
  }
@@ -931,11 +922,10 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
931
  //* Put it all together.
932
  $url = trailingslashit( $scheme_full . $domain ) . ltrim( $path, ' \\/' );
933
 
934
- if ( ! $get_scheme ) {
935
- return $url;
936
- } else {
937
  return array( $url, $scheme );
938
- }
 
939
  }
940
 
941
  return '';
@@ -944,11 +934,10 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
944
  /**
945
  * Try to get an canonical URL when Donncha Domain Mapping is active.
946
  *
947
- * @param string $path The post relative path.
948
- * @param bool $get_scheme Output array with scheme.
949
- *
950
  * @since 2.4.0
951
  *
 
 
952
  * @return string|array|void The unescaped URL, the scheme
953
  */
954
  public function the_url_donncha_domainmap( $path, $get_scheme = false ) {
@@ -963,10 +952,9 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
963
 
964
  $request_uri = '';
965
 
966
- if ( $url && $url !== untrailingslashit( $scheme . '://' . $current_blog->domain . $current_blog->path ) ) {
967
- if ( ( defined( 'VHOST' ) && 'yes' !== VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && false === SUBDOMAIN_INSTALL ) ) {
968
  $request_uri = str_replace( $current_blog->path, '/', $_SERVER['REQUEST_URI'] );
969
- }
970
 
971
  $url = trailingslashit( $url . $request_uri ) . ltrim( $path, '\\/ ' );
972
 
@@ -986,9 +974,8 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
986
  * @since 2.2.2
987
  * @global object $wp_query
988
  *
989
- * @param int $post_id The post ID
990
- *
991
- * @return string|null Escaped site Shortlink URL
992
  */
993
  public function get_shortlink( $post_id = 0 ) {
994
 
@@ -998,7 +985,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
998
 
999
  if ( false === $this->is_front_page() ) {
1000
  if ( $this->is_singular( $post_id ) ) {
1001
-
1002
  if ( 0 === $post_id )
1003
  $post_id = $this->get_the_real_ID();
1004
 
@@ -1010,16 +996,14 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1010
  $path = '?page_id=' . $post_id;
1011
  }
1012
  }
1013
- } else if ( $this->is_archive() ) {
1014
-
1015
  if ( $this->is_category() ) {
1016
  $id = get_queried_object_id();
1017
  $path = '?cat=' . $id;
1018
- } else if ( $this->is_tag() ) {
1019
  $id = get_queried_object_id();
1020
  $path = '?post_tag=' . $id;
1021
- } else if ( $this->is_date() ) {
1022
- // This isn't exactly "short" for a shortlink...
1023
  global $wp_query;
1024
 
1025
  $query = $wp_query->query;
@@ -1033,10 +1017,10 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1033
  }
1034
 
1035
  $path = $var;
1036
- } else if ( $this->is_author() ) {
1037
  $id = get_queried_object_id();
1038
  $path = '?author=' . $id;
1039
- } else if ( $this->is_tax() ) {
1040
  //* Generate shortlink for object type and slug.
1041
  $object = get_queried_object();
1042
 
@@ -1049,7 +1033,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1049
  $path = '?' . $t . '=' . $slug;
1050
  }
1051
  }
1052
-
1053
  }
1054
  }
1055
 
@@ -1064,10 +1047,11 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1064
 
1065
  $additions = '';
1066
  if ( isset( $query ) ) {
1067
- if ( false !== strpos( $query, '&' ) )
1068
  $query = explode( '&', $query );
1069
- else
1070
  $query = array( $query );
 
1071
 
1072
  foreach ( $query as $arg ) {
1073
  if ( false === strpos( $path, $arg ) )
@@ -1099,13 +1083,12 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1099
  }
1100
 
1101
  /**
1102
- * Generates Previous and Next links
1103
  *
1104
  * @since 2.2.4
1105
  *
1106
- * @param string $prev_next Previous or next page link
1107
- * @param int $post_id The post ID
1108
- *
1109
  * @return string|null Escaped site Pagination URL
1110
  */
1111
  public function get_paged_url( $prev_next = 'next', $post_id = 0 ) {
@@ -1130,12 +1113,11 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1130
 
1131
  if ( 'prev' === $prev_next ) {
1132
  $prev = $page > 1 ? $this->get_paged_post_url( $page - 1, $post_id, 'prev' ) : '';
1133
- } else if ( 'next' === $prev_next ) {
1134
  $next = $page < $numpages ? $this->get_paged_post_url( $page + 1, $post_id, 'next' ) : '';
1135
  }
1136
-
1137
  }
1138
- } else if ( $this->is_archive() || $this->is_home() ) {
1139
 
1140
  $output_archive_paged = false;
1141
  if ( $this->is_front_page() ) {
@@ -1156,7 +1138,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1156
  $paged = 1;
1157
 
1158
  $prev = get_pagenum_link( $paged, false );
1159
- } else if ( 'next' === $prev_next && $paged < $GLOBALS["wp_query"]->max_num_pages ) {
1160
 
1161
  if ( ! $paged )
1162
  $paged = 1;
@@ -1188,7 +1170,6 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1188
  * @param int $i The page number to generate the URL from.
1189
  * @param int $post_id The post ID
1190
  * @param string $pos Which url to get, accepts next|prev
1191
- *
1192
  * @return string Unescaped URL
1193
  */
1194
  public function get_paged_post_url( $i, $post_id = 0, $pos = 'prev' ) {
@@ -1198,7 +1179,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1198
  if ( empty( $post_id ) )
1199
  $post_id = $this->get_the_real_ID();
1200
 
1201
- if ( $i === 1 ) {
1202
  $url = $this->the_url_from_cache( '', $post_id, false, $from_option, false );
1203
  } else {
1204
  $post = get_post( $post_id );
@@ -1222,22 +1203,22 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1222
  //* We're adding a page.
1223
  $last_occurence = strrpos( $urlfromcache, '/' . $current . '/' );
1224
 
1225
- if ( $last_occurence !== false )
1226
  $urlfromcache = substr_replace( $urlfromcache, '/', $last_occurence, strlen( '/' . $current . '/' ) );
1227
  }
1228
  }
1229
 
1230
- if ( ! $this->pretty_permalinks || in_array( $post->post_status, array( 'draft', 'auto-draft', 'pending' ) ) ) {
1231
 
1232
  //* Put removed query arg back prior to adding pagination.
1233
  if ( isset( $query_arg ) )
1234
  $urlfromcache = $urlfromcache . '?' . $query_arg;
1235
 
1236
  $url = add_query_arg( 'page', $i, $urlfromcache );
1237
- } else if ( $this->is_static_frontpage( $post_id ) ) {
1238
  global $wp_rewrite;
1239
 
1240
- $url = trailingslashit( $urlfromcache ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $i, 'single_paged' );
1241
 
1242
  //* Add back query arg if removed.
1243
  if ( isset( $query_arg ) )
@@ -1255,7 +1236,7 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1255
  }
1256
 
1257
  /**
1258
- * Adds subdomain to URL.
1259
  *
1260
  * @since 2.6.5
1261
  *
@@ -1267,17 +1248,65 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1267
  $url = $this->make_fully_qualified_url( $url );
1268
 
1269
  //* Add subdomain, if set.
1270
- if ( $this->add_subdomain ) {
1271
- $scheme = parse_url( $url, PHP_URL_SCHEME );
 
1272
  $url = str_replace( $scheme . '://', '', $url );
1273
 
1274
  //* Put it together.
1275
- $url = $scheme . '://' . $this->add_subdomain . '.' . $url;
1276
  }
1277
 
1278
  return $url;
1279
  }
1280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1281
  /**
1282
  * Cached WordPress permalink structure settings.
1283
  *
@@ -1331,13 +1360,59 @@ class AutoDescription_Generate_Url extends AutoDescription_Generate_Title {
1331
  */
1332
  public function make_fully_qualified_url( $url ) {
1333
 
1334
- if ( '//' === substr( $url, 0, 2 ) ) {
1335
  $url = 'http:' . $url;
1336
- } else if ( 'http' !== substr( $url, 0, 4 ) ) {
1337
  $url = 'http://' . $url;
1338
- }
1339
 
1340
  return $url;
1341
  }
1342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1343
  }
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_Generate_Url
23
  *
36
  */
37
  protected $url_slashit;
38
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Holds current HTTP host.
41
  *
46
  protected $current_host;
47
 
48
  /**
49
+ * Unserializing instances of this class is forbidden.
 
 
 
 
50
  */
51
+ private function __wakeup() { }
52
+
53
+ /**
54
+ * Handle unapproachable invoked methods.
55
+ */
56
+ public function __call( $name, $arguments ) {
57
+ parent::__call( $name, $arguments );
58
+ }
59
 
60
  /**
61
  * Constructor, load parent constructor and set up variables.
62
  */
63
  public function __construct() {
64
  parent::__construct();
 
 
65
  }
66
 
67
  /**
89
  */
90
  public function the_url( $url = '', $args = array() ) {
91
 
92
+ if ( $this->the_seo_framework_debug && false === $this->doing_sitemap ) $this->debug_init( __METHOD__, true, $debug_key = microtime( true ), get_defined_vars() );
93
 
94
  $args = $this->reparse_url_args( $args );
95
 
102
 
103
  //* Reset cache.
104
  $this->url_slashit = true;
105
+ $this->unset_current_subdomain();
106
  $this->current_host = '';
107
 
108
  $path = '';
125
  if ( $custom_url ) {
126
  $url = $custom_url;
127
  $this->url_slashit = false;
128
+ $parsed_url = wp_parse_url( $custom_url );
129
+ $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] : 'http';
130
  }
131
  }
132
 
157
 
158
  //* Non-domainmap URL
159
  if ( empty( $url ) ) {
160
+ if ( $args['home'] )
161
+ $this->unset_current_subdomain();
 
 
162
 
163
  $url = $this->add_url_host( $path );
164
  $scheme = is_ssl() ? 'https' : 'http';
192
  $url = esc_url_raw( $url );
193
  }
194
 
195
+ if ( $this->the_seo_framework_debug && false === $this->doing_sitemap ) $this->debug_init( __METHOD__, false, $debug_key, array( 'url_output' => $url ) );
196
 
197
  return $url;
198
  }
200
  /**
201
  * Parse and sanitize url args.
202
  *
203
+ * @since 2.4.2
204
+ * @since 2.5.0:
 
 
205
  * @applies filters the_seo_framework_url_args : {
206
  * @param bool $paged Return current page URL without pagination if false
207
  * @param bool $paged_plural Whether to add pagination for the second or later page.
215
  * @param int $id The Page or Term ID.
216
  * }
217
  *
218
+ * @param array $args required The passed arguments.
219
+ * @param array $defaults The default arguments.
220
+ * @param bool $get_defaults Return the default arguments. Ignoring $args.
221
  * @return array $args parsed args.
222
  */
223
  public function parse_url_args( $args = array(), $defaults = array(), $get_defaults = false ) {
234
  'term' => null,
235
  'home' => false,
236
  'forceslash' => false,
237
+ 'id' => $this->get_the_real_ID(),
238
  );
239
 
 
240
  $defaults = (array) apply_filters( 'the_seo_framework_url_args', $defaults, $args );
241
  }
242
 
273
  $default_args = $this->parse_url_args( '', '', true );
274
 
275
  if ( is_array( $args ) ) {
276
+ if ( empty( $args ) ) {
277
  $args = $default_args;
278
  } else {
279
  $args = $this->parse_url_args( $args, $default_args );
280
  }
281
  } else {
282
  //* Old style parameters are used. Doing it wrong.
283
+ $this->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.4.2' );
284
  $args = $default_args;
285
  }
286
 
291
  * Generate URL from arguments.
292
  *
293
  * @since 2.6.0
 
294
  * @global object $wp
295
+ * @NOTE: Handles full path, including home directory.
296
  *
297
  * @param array $args the URL args.
298
  * @return string $path
301
 
302
  $args = $this->reparse_url_args( $args );
303
 
304
+ if ( $this->is_archive() || $args['is_term'] ) {
305
+
306
  $term = $args['term'];
307
 
308
  //* Term or Taxonomy.
312
  if ( isset( $term->taxonomy ) ) {
313
  //* Registered Terms and Taxonomies.
314
  $path = $this->get_relative_term_url( $term, $args );
315
+ } elseif ( ! $args['external'] ) {
316
  //* Everything else.
317
  global $wp;
318
  $path = trailingslashit( get_option( 'home' ) ) . $wp->request;
321
  //* Nothing to see here...
322
  $path = '';
323
  }
 
324
  } else {
325
 
326
  /**
350
  * Generates relative URL for the Homepage and Singular Posts.
351
  *
352
  * @since 2.6.5
 
353
  * @global object $wp
354
+ * @NOTE: Handles full path, including home directory.
355
  *
356
  * @param int $post_id The ID.
357
  * @param array $args The URL arguments.
360
  public function build_singular_relative_url( $post_id = null, $args = array() ) {
361
 
362
  if ( ! isset( $post_id ) ) {
363
+ //* We can't fetch the post ID when there's an external request.
364
+ if ( $args['external'] )
 
365
  return '';
366
+
367
+ $post_id = $this->get_the_real_ID();
368
  }
369
 
370
  $args = $this->reparse_url_args( $args );
371
 
372
  if ( $args['external'] || ! $this->is_front_page() ) {
373
  $url = get_permalink( $post_id );
374
+ } elseif ( $this->is_front_page() ) {
375
  $url = get_home_url();
376
+ } elseif ( ! $args['external'] ) {
377
  global $wp;
378
 
379
  if ( isset( $wp->request ) )
380
  $url = trailingslashit( get_option( 'home' ) ) . $wp->request;
 
381
  }
382
 
383
  //* No permalink found.
384
  if ( ! isset( $url ) )
385
  return '';
386
 
387
+ $paged = $this->is_singular() ? $this->page() : $this->paged();
388
+ $paged = $this->maybe_get_paged( $paged, $args['paged'], $args['paged_plural'] );
 
 
389
 
390
  if ( $paged ) {
391
  if ( $this->pretty_permalinks ) {
392
+ if ( $this->is_singular() ) {
393
  $url = trailingslashit( $url ) . $paged;
394
+ } else {
395
  $url = trailingslashit( $url ) . 'page/' . $paged;
396
+ }
397
  } else {
398
+ if ( $this->is_singular() ) {
399
  $url = add_query_arg( 'page', $paged, $url );
400
+ } else {
401
  $url = add_query_arg( 'paged', $paged, $url );
402
+ }
403
  }
404
  }
405
 
412
  * Create full valid URL with parsed host.
413
  * Don't forget to use set_url_scheme() afterwards.
414
  *
415
+ * Note: will return $path if no host can be found.
416
+ *
417
  * @since 2.6.5
418
  *
419
  * @param string $path Current path.
421
  */
422
  public function add_url_host( $path = '' ) {
423
 
424
+ $host = $this->current_host ? $this->current_host : $this->get_home_host();
425
 
426
+ $scheme = $host ? 'http://' : '';
427
+
428
+ return $url = $scheme . trailingslashit( $host ) . ltrim( $path, ' \\/' );
429
  }
430
 
431
  /**
432
  * Generates relative URL for current post_ID for translation plugins.
433
  *
 
 
 
 
434
  * @since 2.6.0
 
435
  * @global object $post
436
+ * @NOTE: Handles full path, including home directory.
437
  *
438
+ * @param string $path the current URL path.
439
+ * @param int $post_id The post ID.
440
+ * @param bool $external Whether the request for URL generation is external.
441
  * @return relative Post or Page url.
442
  */
443
  public function get_translation_path( $path = '', $post_id = null, $external = false ) {
445
  if ( is_object( $post_id ) )
446
  $post_id = isset( $post_id->ID ) ? $post_id->ID : $this->get_the_real_ID();
447
 
448
+ if ( is_null( $post_id ) )
449
  $post_id = $this->get_the_real_ID();
450
 
451
  //* WPML support.
462
  /**
463
  * Generates qtranslate URL.
464
  *
465
+ * @since 2.6.0
 
 
 
 
466
  * @staticvar int $q_config_mode
467
+ * @global array $q_config
468
+ * @NOTE: Handles full path, including home directory.
469
  *
470
+ * @param string $path The current path.
471
+ * @param int $post_id The Post ID. Unused until qTranslate provides external URL forgery.
472
  */
473
  public function get_relative_qtranslate_url( $path = '', $post_id = '' ) {
474
 
475
  //* Reset cache.
476
  $this->url_slashit = true;
477
+ $this->unset_current_subdomain();
478
 
479
  static $q_config_mode = null;
480
 
494
  return $path;
495
 
496
  switch ( $q_config_mode ) {
 
497
  case '1' :
498
  //* Negotiation type query var.
499
 
520
 
521
  case '3' :
522
  //* Notify cache of subdomain addition.
523
+ $this->set_current_subdomain( $current_lang );
524
 
525
  //* No need to alter the path.
526
  return $path;
527
  break;
528
 
529
+ default :
530
+ return $path;
531
+ break;
532
  }
533
 
534
  return $path;
540
  * @since 2.4.3
541
  * @staticvar bool $gli_exists
542
  * @staticvar string $default_lang
 
543
  * @global object $sitepress
544
+ * @NOTE: Handles full path, including home directory.
545
  *
546
  * @param string $path The current path.
547
  * @param int $post_id The Post ID.
552
 
553
  //* Reset cache.
554
  $this->url_slashit = true;
555
+ $this->unset_current_subdomain();
556
 
557
  if ( ! isset( $sitepress ) )
558
  return $path;
579
  * This should be put inside a callable function.
580
  * @since 2.6.0
581
  */
582
+ $lang_info = apply_filters( 'wpml_post_language_details', null, $post_id );
583
 
584
  if ( is_wp_error( $lang_info ) ) {
585
  //* Terms and Taxonomies.
619
  * @priority OMG WTF BBQ
620
  */
621
  $contains_path = strpos( $path, '/' . $current_lang . '/' );
622
+ if ( false !== $contains_path && 0 === $contains_path ) {
623
  return $path;
624
+ } else {
625
  return $path = trailingslashit( $current_lang ) . ltrim( $path, ' \\/' );
626
+ }
627
  break;
628
 
629
  case '2' :
636
  return $path;
637
 
638
  $current_lang_setting = $this->make_fully_qualified_url( $current_lang_setting );
639
+ $parsed = wp_parse_url( $current_lang_setting );
640
 
641
  $this->current_host = isset( $parsed['host'] ) ? $parsed['host'] : '';
642
  $current_path = isset( $parsed['path'] ) ? trailingslashit( $parsed['path'] ) : '';
668
  /**
669
  * Generates relative URL for current term.
670
  *
671
+ * @since 2.4.2
672
+ * @since 2.7.0 Added home directory to output.
673
+ * @global object $wp_rewrite
674
+ * @NOTE: Handles full path, including home directory.
675
  *
676
  * @param object $term The term object.
677
  * @param array|bool $args {
679
  * 'paged' : Whether to add pagination for all types.
680
  * 'paged_plural' : Whether to add pagination for the second or later page.
681
  * }
 
 
 
682
  * @return Relative term or taxonomy URL.
683
  */
684
  public function get_relative_term_url( $term = null, $args = array() ) {
689
  * @since 2.6.0
690
  * '$args = array()' replaced '$no_request = false'.
691
  */
692
+ $this->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.6.0' );
693
 
694
  $no_request = (bool) $args;
695
  $args = $this->parse_url_args( '', '', true );
716
 
717
  if ( 'category' === $taxonomy ) {
718
  $path = '?cat=' . $term->term_id;
719
+ } elseif ( isset( $t->query_var ) && '' !== $t->query_var ) {
720
  $path = '?' . $t->query_var . '=' . $slug;
721
  } else {
722
  $path = '?taxonomy=' . $taxonomy . '&term=' . $slug;
752
  $path = user_trailingslashit( $path, 'category' );
753
  }
754
 
755
+ //* Add plausible domain subdirectories.
756
+ $url = trailingslashit( get_option( 'home' ) ) . ltrim( $path, ' \\/' );
757
+ $path = $this->set_url_scheme( $url, 'relative' );
758
 
759
  return $path;
760
  }
772
  */
773
  public function set_url_scheme( $url, $scheme = null, $use_filter = true ) {
774
 
 
 
 
 
775
  if ( ! isset( $scheme ) ) {
776
  $scheme = is_ssl() ? 'https' : 'http';
777
+ } elseif ( 'admin' === $scheme || 'login' === $scheme || 'login_post' === $scheme || 'rpc' === $scheme ) {
778
  $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
779
+ } elseif ( 'http' !== $scheme && 'https' !== $scheme && 'relative' !== $scheme ) {
780
  $scheme = is_ssl() ? 'https' : 'http';
781
  }
782
 
784
 
785
  if ( 'relative' === $scheme ) {
786
  $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
787
+ if ( '' !== $url && '/' === $url[0] )
788
  $url = '/' . ltrim( $url , "/ \t\n\r\0\x0B" );
 
789
  } else {
790
  //* This will break if $scheme is set to false.
791
  $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
804
  *
805
  * @param string $url The url with scheme.
806
  * @param string $scheme The current scheme.
 
807
  * @return $url with applied filters.
808
  */
809
  public function set_url_scheme_filter( $url, $current_scheme ) {
812
  * Applies filters the_seo_framework_canonical_force_scheme : Changes scheme.
813
  *
814
  * Accepted variables:
815
+ * (string) 'https' : Force https
816
+ * (bool) true : Force https
817
+ * (bool) false : Force http
818
+ * (string) 'http' : Force http
819
+ * (string) 'relative' : Scheme relative
820
+ * (void) null : Do nothing
821
  *
822
  * @param string $current_scheme the current used scheme.
823
  *
833
  if ( isset( $scheme_settings ) ) {
834
  if ( 'https' === $scheme_settings || 'http' === $scheme_settings || 'relative' === $scheme_settings ) {
835
  $url = $this->set_url_scheme( $url, $scheme_settings, false );
836
+ } elseif ( ! $scheme_settings ) {
837
  $url = $this->set_url_scheme( $url, 'http', false );
838
+ } elseif ( $scheme_setting ) {
839
  $url = $this->set_url_scheme( $url, 'https', false );
840
  }
841
  }
844
  }
845
 
846
  /**
847
+ * Creates a full canonical URL when WPMUdev Domain Mapping is active from path.
848
  *
849
  * @since 2.3.0
850
+ * @since 2.4.0 Added $get_scheme parameter.
851
  *
852
  * @param string $path The post relative path.
 
853
  * @param bool $get_scheme Output array with scheme.
 
 
854
  * @return string|array|void The unescaped URL, the scheme
855
  */
856
  public function the_url_wpmudev_domainmap( $path, $get_scheme = false ) {
868
 
869
  $cache_key = 'wpmudev_mapped_domain_' . $revision . '_' . $blog_id;
870
 
871
+ //* Check if the domain is mapped. Store in object cache.
872
  $mapped_domain = $this->object_cache_get( $cache_key );
873
  if ( false === $mapped_domain ) {
874
 
876
 
877
  $primary_key = 0;
878
  $domain_ids = array();
879
+
880
  foreach ( $mapped_domains as $key => $domain ) {
881
  if ( isset( $domain->is_primary ) && '1' === $domain->is_primary ) {
882
  $primary_key = $key;
886
  } else {
887
  //* Save IDs.
888
  if ( isset( $domain->id ) && $domain->id )
889
+ $domain_ids[ $key ] = $domain->id;
890
  }
891
  }
892
 
897
  }
898
 
899
  //* Set 0, as we check for false to begin with.
900
+ $mapped_domain = isset( $mapped_domains[ $primary_key ] ) ? $mapped_domains[ $primary_key ] : 0;
901
 
902
  $this->object_cache_set( $cache_key, $mapped_domain, 3600 );
903
  }
922
  //* Put it all together.
923
  $url = trailingslashit( $scheme_full . $domain ) . ltrim( $path, ' \\/' );
924
 
925
+ if ( $get_scheme )
 
 
926
  return array( $url, $scheme );
927
+ else
928
+ return $url;
929
  }
930
 
931
  return '';
934
  /**
935
  * Try to get an canonical URL when Donncha Domain Mapping is active.
936
  *
 
 
 
937
  * @since 2.4.0
938
  *
939
+ * @param string $path The post relative path.
940
+ * @param bool $get_scheme Output array with scheme.
941
  * @return string|array|void The unescaped URL, the scheme
942
  */
943
  public function the_url_donncha_domainmap( $path, $get_scheme = false ) {
952
 
953
  $request_uri = '';
954
 
955
+ if ( $url && untrailingslashit( $scheme . '://' . $current_blog->domain . $current_blog->path ) !== $url ) {
956
+ if ( ( defined( 'VHOST' ) && 'yes' !== VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && false === SUBDOMAIN_INSTALL ) )
957
  $request_uri = str_replace( $current_blog->path, '/', $_SERVER['REQUEST_URI'] );
 
958
 
959
  $url = trailingslashit( $url . $request_uri ) . ltrim( $path, '\\/ ' );
960
 
974
  * @since 2.2.2
975
  * @global object $wp_query
976
  *
977
+ * @param int $post_id The post ID.
978
+ * @return string|null Escaped site Shortlink URL.
 
979
  */
980
  public function get_shortlink( $post_id = 0 ) {
981
 
985
 
986
  if ( false === $this->is_front_page() ) {
987
  if ( $this->is_singular( $post_id ) ) {
 
988
  if ( 0 === $post_id )
989
  $post_id = $this->get_the_real_ID();
990
 
996
  $path = '?page_id=' . $post_id;
997
  }
998
  }
999
+ } elseif ( $this->is_archive() ) {
 
1000
  if ( $this->is_category() ) {
1001
  $id = get_queried_object_id();
1002
  $path = '?cat=' . $id;
1003
+ } elseif ( $this->is_tag() ) {
1004
  $id = get_queried_object_id();
1005
  $path = '?post_tag=' . $id;
1006
+ } elseif ( $this->is_date() ) {
 
1007
  global $wp_query;
1008
 
1009
  $query = $wp_query->query;
1017
  }
1018
 
1019
  $path = $var;
1020
+ } elseif ( $this->is_author() ) {
1021
  $id = get_queried_object_id();
1022
  $path = '?author=' . $id;
1023
+ } elseif ( $this->is_tax() ) {
1024
  //* Generate shortlink for object type and slug.
1025
  $object = get_queried_object();
1026
 
1033
  $path = '?' . $t . '=' . $slug;
1034
  }
1035
  }
 
1036
  }
1037
  }
1038
 
1047
 
1048
  $additions = '';
1049
  if ( isset( $query ) ) {
1050
+ if ( false !== strpos( $query, '&' ) ) {
1051
  $query = explode( '&', $query );
1052
+ } else {
1053
  $query = array( $query );
1054
+ }
1055
 
1056
  foreach ( $query as $arg ) {
1057
  if ( false === strpos( $path, $arg ) )
1083
  }
1084
 
1085
  /**
1086
+ * Generates Previous and Next links.
1087
  *
1088
  * @since 2.2.4
1089
  *
1090
+ * @param string $prev_next Previous or next page link.
1091
+ * @param int $post_id The post ID.
 
1092
  * @return string|null Escaped site Pagination URL
1093
  */
1094
  public function get_paged_url( $prev_next = 'next', $post_id = 0 ) {
1113
 
1114
  if ( 'prev' === $prev_next ) {
1115
  $prev = $page > 1 ? $this->get_paged_post_url( $page - 1, $post_id, 'prev' ) : '';
1116
+ } elseif ( 'next' === $prev_next ) {
1117
  $next = $page < $numpages ? $this->get_paged_post_url( $page + 1, $post_id, 'next' ) : '';
1118
  }
 
1119
  }
1120
+ } elseif ( $this->is_archive() || $this->is_home() ) {
1121
 
1122
  $output_archive_paged = false;
1123
  if ( $this->is_front_page() ) {
1138
  $paged = 1;
1139
 
1140
  $prev = get_pagenum_link( $paged, false );
1141
+ } elseif ( 'next' === $prev_next && $paged < $GLOBALS['wp_query']->max_num_pages ) {
1142
 
1143
  if ( ! $paged )
1144
  $paged = 1;
1170
  * @param int $i The page number to generate the URL from.
1171
  * @param int $post_id The post ID
1172
  * @param string $pos Which url to get, accepts next|prev
 
1173
  * @return string Unescaped URL
1174
  */
1175
  public function get_paged_post_url( $i, $post_id = 0, $pos = 'prev' ) {
1179
  if ( empty( $post_id ) )
1180
  $post_id = $this->get_the_real_ID();
1181
 
1182
+ if ( 1 === $i ) {
1183
  $url = $this->the_url_from_cache( '', $post_id, false, $from_option, false );
1184
  } else {
1185
  $post = get_post( $post_id );
1203
  //* We're adding a page.
1204
  $last_occurence = strrpos( $urlfromcache, '/' . $current . '/' );
1205
 
1206
+ if ( false !== $last_occurence )
1207
  $urlfromcache = substr_replace( $urlfromcache, '/', $last_occurence, strlen( '/' . $current . '/' ) );
1208
  }
1209
  }
1210
 
1211
+ if ( ! $this->pretty_permalinks || in_array( $post->post_status, array( 'draft', 'auto-draft', 'pending' ), true ) ) {
1212
 
1213
  //* Put removed query arg back prior to adding pagination.
1214
  if ( isset( $query_arg ) )
1215
  $urlfromcache = $urlfromcache . '?' . $query_arg;
1216
 
1217
  $url = add_query_arg( 'page', $i, $urlfromcache );
1218
+ } elseif ( $this->is_static_frontpage( $post_id ) ) {
1219
  global $wp_rewrite;
1220
 
1221
+ $url = trailingslashit( $urlfromcache ) . user_trailingslashit( $wp_rewrite->pagination_base . '/' . $i, 'single_paged' );
1222
 
1223
  //* Add back query arg if removed.
1224
  if ( isset( $query_arg ) )
1236
  }
1237
 
1238
  /**
1239
+ * Adds subdomain to input URL.
1240
  *
1241
  * @since 2.6.5
1242
  *
1248
  $url = $this->make_fully_qualified_url( $url );
1249
 
1250
  //* Add subdomain, if set.
1251
+ if ( $subdomain = $this->get_current_subdomain() ) {
1252
+ $parsed_url = wp_parse_url( $url );
1253
+ $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] : 'http';
1254
  $url = str_replace( $scheme . '://', '', $url );
1255
 
1256
  //* Put it together.
1257
+ $url = $scheme . '://' . $subdomain . '.' . $url;
1258
  }
1259
 
1260
  return $url;
1261
  }
1262
 
1263
+ /**
1264
+ * Fetches current subdomain set by $this->set_current_subdomain();
1265
+ *
1266
+ * @since 2.7.0
1267
+ * @staticvar string $subdomain
1268
+ *
1269
+ * @param null|string $set Whether to set a new subdomain.
1270
+ * @param bool $unset Whether to remove subdomain from cache.
1271
+ * @return string|bool The set subdomain, false if none is set.
1272
+ */
1273
+ public function get_current_subdomain( $set = null, $unset = false ) {
1274
+
1275
+ static $subdomain = null;
1276
+
1277
+ if ( isset( $set ) )
1278
+ $subdomain = esc_html( $set );
1279
+
1280
+ if ( $unset )
1281
+ unset( $subdomain );
1282
+
1283
+ if ( isset( $subdomain ) )
1284
+ return $subdomain;
1285
+
1286
+ return false;
1287
+ }
1288
+
1289
+ /**
1290
+ * Sets current working subdomain.
1291
+ *
1292
+ * @since 2.7.0
1293
+ *
1294
+ * @param string $subdomain The current subdomain.
1295
+ * @return string The set subdomain.
1296
+ */
1297
+ public function set_current_subdomain( $subdomain = '' ) {
1298
+ return $this->get_current_subdomain( $subdomain );
1299
+ }
1300
+
1301
+ /**
1302
+ * Unsets current working subdomain.
1303
+ *
1304
+ * @since 2.7.0
1305
+ */
1306
+ public function unset_current_subdomain() {
1307
+ $this->get_current_subdomain( null, true );
1308
+ }
1309
+
1310
  /**
1311
  * Cached WordPress permalink structure settings.
1312
  *
1360
  */
1361
  public function make_fully_qualified_url( $url ) {
1362
 
1363
+ if ( '//' === substr( $url, 0, 2 ) )
1364
  $url = 'http:' . $url;
1365
+ elseif ( 'http' !== substr( $url, 0, 4 ) )
1366
  $url = 'http://' . $url;
 
1367
 
1368
  return $url;
1369
  }
1370
 
1371
+ /**
1372
+ * Fetches home URL host. Like "wordpress.org".
1373
+ * If this fails, you're going to have a bad time.
1374
+ *
1375
+ * @since 2.7.0
1376
+ * @staticvar string $cache
1377
+ *
1378
+ * @return string The home URL host.
1379
+ */
1380
+ public function get_home_host() {
1381
+
1382
+ static $cache = null;
1383
+
1384
+ if ( isset( $cache ) )
1385
+ return $cache;
1386
+
1387
+ $parsed_url = wp_parse_url( get_option( 'home' ) );
1388
+
1389
+ $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
1390
+
1391
+ return $cache = $host;
1392
+ }
1393
+
1394
+ /**
1395
+ * Fetches home URL subdirectory path. Like "wordpress.org/plugins/".
1396
+ *
1397
+ * @since 2.7.0
1398
+ * @staticvar string $cache
1399
+ *
1400
+ * @return string The home URL path.
1401
+ */
1402
+ public function get_home_path() {
1403
+
1404
+ static $cache = null;
1405
+
1406
+ if ( isset( $cache ) )
1407
+ return $cache;
1408
+
1409
+ $path = '';
1410
+
1411
+ $parsed_url = wp_parse_url( get_option( 'home' ) );
1412
+
1413
+ if ( ! empty( $parsed_url['path'] ) && $path = ltrim( $parsed_url['path'], ' \\/' ) )
1414
+ $path = '/' . $path;
1415
+
1416
+ return $cache = $path;
1417
+ }
1418
  }
inc/classes/generate.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_Generate
21
  *
@@ -25,6 +27,18 @@
25
  */
26
  class AutoDescription_Generate extends AutoDescription_TermData {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor
30
  */
@@ -84,53 +98,27 @@ class AutoDescription_Generate extends AutoDescription_TermData {
84
  $meta['noindex'] = 'noindex';
85
  }
86
 
87
- if ( $this->is_category() || $this->is_tag() ) {
88
- $term = get_queried_object();
 
89
 
90
- $meta['noindex'] = empty( $meta['noindex'] ) && $term->admeta['noindex'] ? 'noindex' : $meta['noindex'];
91
- $meta['nofollow'] = empty( $meta['nofollow'] ) && $term->admeta['nofollow'] ? 'nofollow' : $meta['nofollow'];
92
- $meta['noarchive'] = empty( $meta['noarchive'] ) && $term->admeta['noarchive'] ? 'noarchive' : $meta['noarchive'];
93
 
 
94
  if ( $this->is_category() ) {
95
  $meta['noindex'] = empty( $meta['noindex'] ) && $this->is_option_checked( 'category_noindex' ) ? 'noindex' : $meta['noindex'];
96
  $meta['nofollow'] = empty( $meta['nofollow'] ) && $this->is_option_checked( 'category_nofollow' ) ? 'nofollow' : $meta['nofollow'];
97
  $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'category_noindex' ) ? 'noarchive' : $meta['noarchive'];
98
- } else if ( $this->is_tag() ) {
99
  $meta['noindex'] = empty( $meta['noindex'] ) && $this->is_option_checked( 'tag_noindex' ) ? 'noindex' : $meta['noindex'];
100
  $meta['nofollow'] = empty( $meta['nofollow'] ) && $this->is_option_checked( 'tag_nofollow' ) ? 'nofollow' : $meta['nofollow'];
101
  $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'tag_noindex' ) ? 'noarchive' : $meta['noarchive'];
102
  }
103
-
104
- $flag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] );
105
-
106
- if ( false === $flag && isset( $term->meta ) ) {
107
- //* Genesis support.
108
- $meta['noindex'] = empty( $meta['noindex'] ) && $term->meta['noindex'] ? 'noindex' : $meta['noindex'];
109
- $meta['nofollow'] = empty( $meta['nofollow'] ) && $term->meta['nofollow'] ? 'nofollow' : $meta['nofollow'];
110
- $meta['noarchive'] = empty( $meta['noarchive'] ) && $term->meta['noarchive'] ? 'noarchive' : $meta['noarchive'];
111
- }
112
- }
113
-
114
- // Is custom Taxonomy page. But not a category or tag. Should've recieved specific term SEO settings.
115
- if ( $this->is_tax() ) {
116
- $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
117
-
118
- $meta['noindex'] = empty( $meta['noindex'] ) && $term->admeta['noindex'] ? 'noindex' : $meta['noindex'];
119
- $meta['nofollow'] = empty( $meta['nofollow'] ) && $term->admeta['nofollow'] ? 'nofollow' : $meta['nofollow'];
120
- $meta['noarchive'] = empty( $meta['noarchive'] ) && $term->admeta['noarchive'] ? 'noarchive' : $meta['noarchive'];
121
  }
122
 
123
  if ( $this->is_author() ) {
124
- // $author_id = (int) get_query_var( 'author' );
125
-
126
- /**
127
- * @todo
128
- * @priority high 2.6.x
129
- */
130
- // $meta['noindex'] = empty( $meta['noindex'] ) && get_the_author_meta( 'noindex', $author_id ) ? 'noindex' : $meta['noindex'];
131
- // $meta['nofollow'] = empty( $meta['nofollow'] ) && get_the_author_meta( 'nofollow', $author_id ) ? 'nofollow' : $meta['nofollow'];
132
- // $meta['noarchive'] = empty( $meta['noarchive'] ) && get_the_author_meta( 'noarchive', $author_id ) ? 'noarchive' : $meta['noarchive'];
133
-
134
  $meta['noindex'] = empty( $meta['noindex'] ) && $this->is_option_checked( 'author_noindex' ) ? 'noindex' : $meta['noindex'];
135
  $meta['nofollow'] = empty( $meta['nofollow'] ) && $this->is_option_checked( 'author_nofollow' ) ? 'nofollow' : $meta['nofollow'];
136
  $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'author_noarchive' ) ? 'noarchive' : $meta['noarchive'];
@@ -183,15 +171,16 @@ class AutoDescription_Generate extends AutoDescription_TermData {
183
  *
184
  * @since 2.3.9
185
  */
186
- public function get_separator( $type = 'title', $escape = false ) {
187
 
188
- static $sepcache = array();
189
  static $sep_esc = array();
190
 
191
- if ( isset( $sep_esc[$type][$escape] ) )
192
- return $sep_esc[$type][$escape];
193
 
194
- if ( ! isset( $sepcache[$type] ) ) {
 
 
195
  if ( 'title' === $type ) {
196
  $sep_option = $this->get_option( 'title_seperator' ); // Note: typo.
197
  } else {
@@ -200,9 +189,9 @@ class AutoDescription_Generate extends AutoDescription_TermData {
200
 
201
  if ( 'pipe' === $sep_option ) {
202
  $sep = '|';
203
- } else if ( 'dash' === $sep_option ) {
204
  $sep = '-';
205
- } else if ( '' !== $sep_option ) {
206
  //* Encapsulate within html entities.
207
  $sep = '&' . $sep_option . ';';
208
  } else {
@@ -210,23 +199,23 @@ class AutoDescription_Generate extends AutoDescription_TermData {
210
  $sep = '|';
211
  }
212
 
213
- $sepcache[$type] = $sep;
214
  }
215
 
216
  if ( $escape ) {
217
- return $sep_esc[$type][$escape] = esc_html( $sepcache[$type] );
218
  } else {
219
- return $sep_esc[$type][$escape] = $sepcache[$type];
220
  }
221
  }
222
 
223
  /**
224
- * Fetch blogname
225
  *
226
  * @staticvar string $blogname
227
  *
228
  * @since 2.5.2
229
- * @return string $blogname The trimmed and sanitized blogname
230
  */
231
  public function get_blogname() {
232
 
@@ -287,7 +276,7 @@ class AutoDescription_Generate extends AutoDescription_TermData {
287
  //* Full locale is used.
288
 
289
  //* Return the match if found.
290
- if ( in_array( $match, $valid_locales ) )
291
  return $match;
292
 
293
  //* Convert to only language portion.
@@ -303,11 +292,46 @@ class AutoDescription_Generate extends AutoDescription_TermData {
303
  //* No need to do for each loop. Just match the keys.
304
  if ( $key = array_search( $match, $locale_keys ) ) {
305
  //* Fetch the corresponding value from key within the language array.
306
- return $valid_locales[$key];
307
  }
308
  }
309
 
310
  return $default;
311
  }
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  }
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_Generate
23
  *
27
  */
28
  class AutoDescription_Generate extends AutoDescription_TermData {
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
  */
98
  $meta['noindex'] = 'noindex';
99
  }
100
 
101
+ if ( $this->is_category() || $this->is_tag() || $this->is_tax() ) {
102
+
103
+ $data = $this->get_term_data();
104
 
105
+ $meta['noindex'] = empty( $meta['noindex'] ) && ! empty( $data['noindex'] ) ? 'noindex' : $meta['noindex'];
106
+ $meta['nofollow'] = empty( $meta['nofollow'] ) && ! empty( $data['nofollow'] ) ? 'nofollow' : $meta['nofollow'];
107
+ $meta['noarchive'] = empty( $meta['noarchive'] ) && ! empty( $data['noarchive'] ) ? 'noarchive' : $meta['noarchive'];
108
 
109
+ //* If on custom Taxonomy page, but not a category or tag, then should've received specific term SEO settings.
110
  if ( $this->is_category() ) {
111
  $meta['noindex'] = empty( $meta['noindex'] ) && $this->is_option_checked( 'category_noindex' ) ? 'noindex' : $meta['noindex'];
112
  $meta['nofollow'] = empty( $meta['nofollow'] ) && $this->is_option_checked( 'category_nofollow' ) ? 'nofollow' : $meta['nofollow'];
113
  $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'category_noindex' ) ? 'noarchive' : $meta['noarchive'];
114
+ } elseif ( $this->is_tag() ) {
115
  $meta['noindex'] = empty( $meta['noindex'] ) && $this->is_option_checked( 'tag_noindex' ) ? 'noindex' : $meta['noindex'];
116
  $meta['nofollow'] = empty( $meta['nofollow'] ) && $this->is_option_checked( 'tag_nofollow' ) ? 'nofollow' : $meta['nofollow'];
117
  $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'tag_noindex' ) ? 'noarchive' : $meta['noarchive'];
118
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
  if ( $this->is_author() ) {
 
 
 
 
 
 
 
 
 
 
122
  $meta['noindex'] = empty( $meta['noindex'] ) && $this->is_option_checked( 'author_noindex' ) ? 'noindex' : $meta['noindex'];
123
  $meta['nofollow'] = empty( $meta['nofollow'] ) && $this->is_option_checked( 'author_nofollow' ) ? 'nofollow' : $meta['nofollow'];
124
  $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'author_noarchive' ) ? 'noarchive' : $meta['noarchive'];
171
  *
172
  * @since 2.3.9
173
  */
174
+ public function get_separator( $type = 'title', $escape = true ) {
175
 
 
176
  static $sep_esc = array();
177
 
178
+ if ( isset( $sep_esc[ $type ][ $escape ] ) )
179
+ return $sep_esc[ $type ][ $escape ];
180
 
181
+ static $sepcache = array();
182
+
183
+ if ( ! isset( $sepcache[ $type ] ) ) {
184
  if ( 'title' === $type ) {
185
  $sep_option = $this->get_option( 'title_seperator' ); // Note: typo.
186
  } else {
189
 
190
  if ( 'pipe' === $sep_option ) {
191
  $sep = '|';
192
+ } elseif ( 'dash' === $sep_option ) {
193
  $sep = '-';
194
+ } elseif ( '' !== $sep_option ) {
195
  //* Encapsulate within html entities.
196
  $sep = '&' . $sep_option . ';';
197
  } else {
199
  $sep = '|';
200
  }
201
 
202
+ $sepcache[ $type ] = $sep;
203
  }
204
 
205
  if ( $escape ) {
206
+ return $sep_esc[ $type ][ $escape ] = esc_html( $sepcache[ $type ] );
207
  } else {
208
+ return $sep_esc[ $type ][ $escape ] = $sepcache[ $type ];
209
  }
210
  }
211
 
212
  /**
213
+ * Fetches blogname.
214
  *
215
  * @staticvar string $blogname
216
  *
217
  * @since 2.5.2
218
+ * @return string $blogname The trimmed and sanitized blogname.
219
  */
220
  public function get_blogname() {
221
 
276
  //* Full locale is used.
277
 
278
  //* Return the match if found.
279
+ if ( in_array( $match, $valid_locales, true ) )
280
  return $match;
281
 
282
  //* Convert to only language portion.
292
  //* No need to do for each loop. Just match the keys.
293
  if ( $key = array_search( $match, $locale_keys ) ) {
294
  //* Fetch the corresponding value from key within the language array.
295
+ return $valid_locales[ $key ];
296
  }
297
  }
298
 
299
  return $default;
300
  }
301
 
302
+ /**
303
+ * Generates the Open Graph type based on query status.
304
+ *
305
+ * @since 2.7.0
306
+ *
307
+ * @return string The Open Graph type.
308
+ */
309
+ public function generate_og_type() {
310
+
311
+ if ( $this->is_wc_product() ) {
312
+ $type = 'product';
313
+ } elseif ( $this->is_single() && $this->get_image_from_cache() ) {
314
+ $type = 'article';
315
+ } elseif ( $this->is_author() ) {
316
+ $type = 'profile';
317
+ } elseif ( $this->is_blog_page() || ( $this->is_front_page() && ! $this->has_page_on_front() ) ) {
318
+ $type = 'blog';
319
+ } else {
320
+ $type = 'website';
321
+ }
322
+
323
+ return $type;
324
+ }
325
+
326
+ /**
327
+ * Generates the Twitter Card type. When there's an image found, it will
328
+ * take the said option. Otherwise, it will fall back to 'summary'.
329
+ *
330
+ * @since 2.7.0
331
+ *
332
+ * @return string The Twitter Card type.
333
+ */
334
+ public function generate_twitter_card_type() {
335
+ return $this->get_image_from_cache() ? $this->get_option( 'twitter_card' ) : 'summary';
336
+ }
337
  }
inc/classes/init.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_Init
21
  *
@@ -34,6 +36,18 @@ class AutoDescription_Init extends AutoDescription_Query {
34
  */
35
  protected $use_object_cache = true;
36
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * Constructor. Initializes actions and loads parent constructor.
39
  */
@@ -44,8 +58,7 @@ class AutoDescription_Init extends AutoDescription_Query {
44
  add_action( 'template_redirect', array( $this, 'custom_field_redirect' ) );
45
 
46
  /**
47
- * Applies filters : the_seo_framework_use_object_cache
48
- *
49
  * @since 2.4.3
50
  */
51
  $this->use_object_cache = (bool) apply_filters( 'the_seo_framework_use_object_cache', true );
@@ -88,12 +101,11 @@ class AutoDescription_Init extends AutoDescription_Query {
88
  //* Earlier removal of the generator tag. Doesn't require filter.
89
  remove_action( 'wp_head', 'wp_generator' );
90
 
91
- if ( $this->is_theme( 'genesis', false ) ) {
92
  add_action( 'genesis_meta', array( $this, 'html_output' ), 5 );
93
  } else {
94
  add_action( 'wp_head', array( $this, 'html_output' ), 1 );
95
  }
96
-
97
  }
98
 
99
  /**
@@ -113,7 +125,7 @@ class AutoDescription_Init extends AutoDescription_Query {
113
  //* Override bbPress title
114
  add_filter( 'bbp_title', array( $this, 'title_from_cache' ), 99, 3 );
115
  //* Override Woo Themes Title
116
- add_filter( 'woo_title', array( $this, 'title_from_cache'), 99 );
117
 
118
  /**
119
  * Applies filters 'the_seo_framework_manipulate_title' : boolean
@@ -311,9 +323,9 @@ class AutoDescription_Init extends AutoDescription_Query {
311
  */
312
  $sybre = (bool) apply_filters( 'sybre_waaijer_<3', true );
313
 
314
- $start = __( 'Start The Seo Framework', 'autodescription' );
315
- $end = __( 'End The Seo Framework', 'autodescription' );
316
- $me = $sybre ? ' ' . __( 'by Sybre Waaijer', 'autodescription' ) : '';
317
 
318
  $indicatorbefore = '<!-- ' . $start . $me . ' -->' . "\r\n";
319
 
@@ -333,7 +345,9 @@ class AutoDescription_Init extends AutoDescription_Query {
333
 
334
  do_action( 'the_seo_framework_do_after_output' );
335
 
 
336
  echo $output;
 
337
  }
338
 
339
  /**
@@ -346,7 +360,7 @@ class AutoDescription_Init extends AutoDescription_Query {
346
  public function custom_field_redirect() {
347
 
348
  //* Prevent redirect from options on uneditable pages.
349
- if ( ! $this->is_singular() || $this->is_admin() )
350
  return;
351
 
352
  $url = $this->get_custom_field( 'redirect' );
@@ -360,45 +374,14 @@ class AutoDescription_Init extends AutoDescription_Query {
360
  $url = $this->set_url_scheme( $url, 'relative' );
361
  $url = $this->add_url_host( $url );
362
  $scheme = is_ssl() ? 'https' : 'http';
 
 
 
363
  }
364
 
365
- wp_redirect( esc_url_raw( $url, $scheme ), 301 );
 
366
  exit;
367
  }
368
-
369
  }
370
-
371
- /**
372
- * Well, this is annoying.
373
- *
374
- * @since 2.4.2
375
- * @return something that will make your head explode.
376
- */
377
- public function explode() {
378
- add_action( 'wp_head', array( $this, 'roll' ) );
379
-
380
- /* the code to run this :
381
- add_action( 'init', 'tsf_explode' );
382
- function tsf_explode() {
383
- if ( function_exists( 'the_seo_framework' ) ) {
384
- $the_seo_framework = the_seo_framework();
385
- if ( isset( $the_seo_framework ) )
386
- $the_seo_framework->explode();
387
- }
388
- }
389
- */
390
- }
391
-
392
- /**
393
- * After using explosions, you tend to roll away.
394
- *
395
- * @since 2.5.2
396
- */
397
- public function roll() {
398
- ?>
399
- <style>div:hover>div{-webkit-animation:troll 5s infinite cubic-bezier(0,1.5,.5,1)1s;animation:troll 5s infinite cubic-bezier(0,1.5,.5,1)1s}@-webkit-keyframes troll{100%{-webkit-transform:rotate(0)}75%{-webkit-transform:rotate(30deg)}25%{-webkit-transorm:rotate(0)}0%{-webkit-transorm:rotate(30deg)}}@keyframes troll{100%,25%{transform:rotate(0)}0%,75%{transform:rotate(30deg)}}#container:hover,.site-container:hover{-webkit-animation:none;animation:none}</style>
400
- <?php
401
- echo "\r\n";
402
- }
403
-
404
  }
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_Init
23
  *
36
  */
37
  protected $use_object_cache = true;
38
 
39
+ /**
40
+ * Unserializing instances of this class is forbidden.
41
+ */
42
+ private function __wakeup() { }
43
+
44
+ /**
45
+ * Handle unapproachable invoked methods.
46
+ */
47
+ public function __call( $name, $arguments ) {
48
+ parent::__call( $name, $arguments );
49
+ }
50
+
51
  /**
52
  * Constructor. Initializes actions and loads parent constructor.
53
  */
58
  add_action( 'template_redirect', array( $this, 'custom_field_redirect' ) );
59
 
60
  /**
61
+ * Applies filters 'the_seo_framework_use_object_cache' : bool
 
62
  * @since 2.4.3
63
  */
64
  $this->use_object_cache = (bool) apply_filters( 'the_seo_framework_use_object_cache', true );
101
  //* Earlier removal of the generator tag. Doesn't require filter.
102
  remove_action( 'wp_head', 'wp_generator' );
103
 
104
+ if ( $this->is_theme( 'genesis' ) ) {
105
  add_action( 'genesis_meta', array( $this, 'html_output' ), 5 );
106
  } else {
107
  add_action( 'wp_head', array( $this, 'html_output' ), 1 );
108
  }
 
109
  }
110
 
111
  /**
125
  //* Override bbPress title
126
  add_filter( 'bbp_title', array( $this, 'title_from_cache' ), 99, 3 );
127
  //* Override Woo Themes Title
128
+ add_filter( 'woo_title', array( $this, 'title_from_cache' ), 99 );
129
 
130
  /**
131
  * Applies filters 'the_seo_framework_manipulate_title' : boolean
323
  */
324
  $sybre = (bool) apply_filters( 'sybre_waaijer_<3', true );
325
 
326
+ $start = esc_html__( 'Start The Seo Framework', 'autodescription' );
327
+ $end = esc_html__( 'End The Seo Framework', 'autodescription' );
328
+ $me = $sybre ? ' ' . esc_html__( 'by Sybre Waaijer', 'autodescription' ) : '';
329
 
330
  $indicatorbefore = '<!-- ' . $start . $me . ' -->' . "\r\n";
331
 
345
 
346
  do_action( 'the_seo_framework_do_after_output' );
347
 
348
+ //* Already escaped.
349
  echo $output;
350
+
351
  }
352
 
353
  /**
360
  public function custom_field_redirect() {
361
 
362
  //* Prevent redirect from options on uneditable pages.
363
+ if ( false === $this->is_singular() || $this->is_admin() )
364
  return;
365
 
366
  $url = $this->get_custom_field( 'redirect' );
374
  $url = $this->set_url_scheme( $url, 'relative' );
375
  $url = $this->add_url_host( $url );
376
  $scheme = is_ssl() ? 'https' : 'http';
377
+
378
+ wp_safe_redirect( esc_url_raw( $url, array( $scheme ) ), 301 );
379
+ exit;
380
  }
381
 
382
+ //* @TODO set scheme filter, adjustable through (multisite) extensions?
383
+ wp_redirect( esc_url_raw( $url ), 301 );
384
  exit;
385
  }
 
386
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  }
inc/classes/inpost.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_Inpost
21
  *
@@ -34,12 +36,45 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
34
  */
35
  protected $inpost_seo_bar = false;
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * Constructor, load parent constructor
39
  */
40
  public function __construct() {
41
  parent::__construct();
42
 
 
 
 
43
  //* Enqueue Inpost meta boxes.
44
  add_action( 'add_meta_boxes', array( $this, 'add_inpost_seo_box_init' ), 5 );
45
 
@@ -59,11 +94,7 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
59
  }
60
 
61
  /**
62
- * Render the SEO meta box
63
- *
64
- * Called outside autodescription_run
65
- *
66
- * Applies filters the_seo_framework_seobox_output : bool
67
  *
68
  * @since 2.0.0
69
  */
@@ -72,6 +103,10 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
72
  if ( $this->detect_seo_plugins() )
73
  return;
74
 
 
 
 
 
75
  $show_seobox = (bool) apply_filters( 'the_seo_framework_seobox_output', true );
76
 
77
  if ( $show_seobox )
@@ -83,29 +118,25 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
83
  * Adds SEO Meta boxes within Taxonomy screens.
84
  *
85
  * @since 2.1.8
 
 
86
  */
87
  public function add_taxonomy_seo_box_init() {
88
 
89
- //* @since 2.6.0
90
- if ( $this->detect_seo_plugins() )
91
  return;
92
 
93
- //* @since 2.6.0
94
- if ( $this->is_term_edit() ) {
95
-
96
- /**
97
- * High priority, this box is seen right below the post/page edit screen.
98
- * Applies filters 'the_seo_framework_term_metabox_priority' : int
99
- *
100
- * @since 2.6.0
101
- */
102
- $priority = (int) apply_filters( 'the_seo_framework_term_metabox_priority', 0 );
103
-
104
- //* Add taxonomy meta boxes
105
- foreach ( get_taxonomies( array( 'public' => true ) ) as $tax_name )
106
- add_action( $tax_name . '_edit_form', array( $this, 'pre_seo_box' ), $priority, 2 );
107
 
108
- }
 
 
109
 
110
  }
111
 
@@ -141,7 +172,7 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
141
  * @TODO solve note.
142
  * @priority medium 2.7.0
143
  */
144
- $id = (string) apply_filters( 'the_seo_framework_metabox_id', 'theseoframework-inpost-box' );
145
  $context = 'normal';
146
 
147
  /**
@@ -223,12 +254,12 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
223
 
224
  // Only add nonce on post/page edit screen
225
  if ( 'is_post_page' === $page ) {
226
- wp_nonce_field( 'inpost_seo_save', 'hmpl_ad_inpost_seo_nonce' );
227
  } else {
228
  // This shouldn't happen.
229
  return;
230
  }
231
- } else if ( is_object( $object ) ) {
232
 
233
  //* Singular name.
234
  $type = $this->get_the_term_name( $object, true, false );
@@ -270,18 +301,18 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
270
  //* Get the language the Google page should assume.
271
  $language = $this->google_language();
272
 
273
- $data = $this->get_term_data( $object );
 
 
 
 
274
 
275
- $title = isset( $data['title'] ) ? $data['title'] : '';
276
  $description = isset( $data['description'] ) ? $data['description'] : '';
277
  $noindex = isset( $data['noindex'] ) ? $data['noindex'] : '';
278
  $nofollow = isset( $data['nofollow'] ) ? $data['nofollow'] : '';
279
  $noarchive = isset( $data['noarchive'] ) ? $data['noarchive'] : '';
280
 
281
- //* Fetch Term ID and taxonomy.
282
- $term_id = $object->term_id;
283
- $taxonomy = $object->taxonomy;
284
-
285
  $generated_doctitle_args = array(
286
  'term_id' => $term_id,
287
  'taxonomy' => $taxonomy,
@@ -308,7 +339,7 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
308
  *
309
  * @since 2.3.4
310
  */
311
- $doc_pre_rem = $add_additions ? $title . " | " . $blog_name : $title;
312
  $title_len = $title ? $doc_pre_rem : $generated_doctitle;
313
  $description_len = $description ? $description : $generated_description;
314
 
@@ -330,14 +361,14 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
330
  $description_placeholder = $generated_description;
331
 
332
  ?>
333
- <h3><?php printf( __( '%s SEO Settings', 'autodescription' ), $type ); ?></h3>
334
 
335
  <table class="form-table">
336
  <tbody>
337
 
338
  <?php if ( 'above' === $this->inpost_seo_bar ) : ?>
339
  <tr>
340
- <th scope="row" valign="top"><?php _e( 'Doing it Right', 'autodescription' ); ?></th>
341
  <td>
342
  <?php echo $this->post_status( $term_id, $taxonomy, true ); ?>
343
  </td>
@@ -347,52 +378,58 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
347
  <tr class="form-field">
348
  <th scope="row" valign="top">
349
  <label for="autodescription-meta[doctitle]">
350
- <strong><?php printf( __( '%s Title', 'autodescription' ), $type ); ?></strong>
351
- <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#3" target="_blank" title="<?php _e( 'Recommended Length: 50 to 55 characters', 'autodescription' ) ?>">[?]</a>
352
  </label>
353
  </th>
354
  <td>
355
- <div id="autodescription-title-wrap">
356
  <input name="autodescription-meta[doctitle]" id="autodescription-meta[doctitle]" type="text" placeholder="<?php echo $title_placeholder ?>" value="<?php echo esc_attr( $title ); ?>" size="40" />
357
- <span id="autodescription-title-offset" class="hide-if-no-js"></span><span id="autodescription-title-placeholder" class="hide-if-no-js"></span>
358
  </div>
359
- <p class="description theseoframework-counter"><?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription-meta[doctitle]_chars">'. mb_strlen( $tit_len_parsed ) .'</span>' ); ?></p>
 
 
 
360
  </td>
361
  </tr>
362
 
363
  <tr class="form-field">
364
  <th scope="row" valign="top">
365
  <label for="autodescription-meta[description]">
366
- <strong><?php printf( __( '%s Meta Description', 'autodescription' ), $type ); ?></strong>
367
- <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#1" target="_blank" title="<?php _e( 'Recommended Length: 145 to 155 characters', 'autodescription' ) ?>">[?]</a>
368
  </label>
369
  </th>
370
  <td>
371
  <textarea name="autodescription-meta[description]" id="autodescription-meta[description]" placeholder="<?php echo $description_placeholder ?>" rows="5" cols="50" class="large-text"><?php echo esc_html( $description ); ?></textarea>
372
- <p class="description theseoframework-counter"><?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription-meta[description]_chars">'. mb_strlen( $desc_len_parsed ) .'</span>' ); ?></p>
 
 
 
373
  </td>
374
  </tr>
375
 
376
  <tr>
377
- <th scope="row" valign="top"><?php _e( 'Robots Meta Settings', 'autodescription' ); ?></th>
378
  <td>
379
  <label for="autodescription-meta[noindex]"><input name="autodescription-meta[noindex]" id="autodescription-meta[noindex]" type="checkbox" value="1" <?php checked( $noindex ); ?> />
380
- <?php printf( __( 'Apply %s to this term', 'autodescription' ), $this->code_wrap( 'noindex' ) ); ?>
381
- <a href="https://support.google.com/webmasters/answer/93710?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to show this page in their search results', 'autodescription' ) ) ?>">[?]</a>
382
  </label>
383
 
384
  <br>
385
 
386
  <label for="autodescription-meta[nofollow]"><input name="autodescription-meta[nofollow]" id="autodescription-meta[nofollow]" type="checkbox" value="1" <?php checked( $nofollow ); ?> />
387
- <?php printf( __( 'Apply %s to this term', 'autodescription' ), $this->code_wrap( 'nofollow' ) ); ?>
388
- <a href="https://support.google.com/webmasters/answer/96569?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to follow links on this page', 'autodescription' ) ) ?>">[?]</a>
389
  </label>
390
 
391
  <br>
392
 
393
  <label for="autodescription-meta[noarchive]"><input name="autodescription-meta[noarchive]" id="autodescription-meta[noarchive]" type="checkbox" value="1" <?php checked( $noarchive ); ?> />
394
- <?php printf( __( 'Apply %s to this term', 'autodescription' ), $this->code_wrap( 'noarchive' ) ); ?>
395
- <a href="https://support.google.com/webmasters/answer/79812?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to save a cached copy of this page', 'autodescription' ) ) ?>">[?]</a>
396
  </label>
397
 
398
  <?php // Saved flag, if set then it won't fetch for Genesis meta anymore ?>
@@ -404,7 +441,7 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
404
 
405
  <?php if ( 'below' === $this->inpost_seo_bar ) : ?>
406
  <tr>
407
- <th scope="row" valign="top"><?php _e( 'Doing it Right', 'autodescription' ); ?></th>
408
  <td>
409
  <?php echo $this->post_status( $term_id, $taxonomy, true ); ?>
410
  </td>
@@ -464,7 +501,7 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
464
  'is_home' => true,
465
  'get_custom_field' => true,
466
  );
467
- } else if ( $this->is_blog_page( $post_id ) ) {
468
  //* Page for posts.
469
  $generated_doctitle_args = array(
470
  'placeholder' => true,
@@ -496,11 +533,10 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
496
  * @since 2.3.4
497
  */
498
  if ( $is_static_frontpage ) {
499
- if ( $this->get_option( 'homepage_tagline' ) ) {
500
  $tit_len_pre = $title ? $title . " | " . $this->get_blogdescription() : $generated_doctitle;
501
- } else {
502
  $tit_len_pre = $title ? $title : $generated_doctitle;
503
- }
504
  } else {
505
  /**
506
  * Separator doesn't matter. Since html_entity_decode is used.
@@ -508,11 +544,10 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
508
  *
509
  * @since 2.3.4
510
  */
511
- if ( $this->add_title_additions() ) {
512
  $tit_len_pre = $title ? $title . " | " . $this->get_blogname() : $generated_doctitle;
513
- } else {
514
  $tit_len_pre = $title ? $title : $generated_doctitle;
515
- }
516
  }
517
 
518
  //* Fetch description from option.
@@ -562,29 +597,35 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
562
  ?>
563
  <?php if ( 'above' === $this->inpost_seo_bar ) : ?>
564
  <p>
565
- <strong><?php _e( 'Doing it Right', 'autodescription' ); ?></strong>
566
  <div><?php echo $this->post_status( $post_id, 'inpost', true ); ?></div>
567
  </p>
568
  <?php endif; ?>
569
 
570
  <p>
571
- <label for="autodescription_title"><strong><?php printf( __( 'Custom %s Title', 'autodescription' ), $type ); ?></strong>
572
- <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#3" target="_blank" title="<?php _e( 'Recommended Length: 50 to 55 characters', 'autodescription' ); ?>">[?]</a>
573
- <span class="description theseoframework-counter"><?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription_title_chars">'. mb_strlen( $tit_len_parsed ) .'</span>' ); ?></span>
 
 
 
574
  </label>
575
  </p>
576
  <p>
577
- <div id="autodescription-title-wrap">
578
  <input class="large-text" type="text" name="autodescription[_genesis_title]" id="autodescription_title" placeholder="<?php echo $doctitle_placeholder ?>" value="<?php echo esc_attr( $this->get_custom_field( '_genesis_title' ) ); ?>" />
579
- <span id="autodescription-title-offset" class="hide-if-no-js"></span><span id="autodescription-title-placeholder" class="hide-if-no-js"></span>
580
  </div>
581
  </p>
582
 
583
  <p>
584
  <label for="autodescription_description">
585
- <strong><?php printf( __( 'Custom %s Description', 'autodescription' ), $type ); ?></strong>
586
- <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#1" target="_blank" title="<?php _e( 'Recommended Length: 145 to 155 characters', 'autodescription' ); ?>">[?]</a>
587
- <span class="description theseoframework-counter"><?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription_description_chars">'. mb_strlen( $desc_len_parsed ) .'</span>' ); ?></span>
 
 
 
588
  </label>
589
  </p>
590
  <p>
@@ -593,22 +634,22 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
593
 
594
  <p>
595
  <label for="autodescription_canonical">
596
- <strong><?php _e( 'Custom Canonical URL', 'autodescription' ); ?></strong>
597
- <a href="https://support.google.com/webmasters/answer/139066?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Preferred %s URL location', 'autodescription' ), $type ); ?>">[?]</a>
598
  </label>
599
  </p>
600
  <p>
601
  <input class="large-text" type="text" name="autodescription[_genesis_canonical_uri]" id="autodescription_canonical" placeholder="<?php echo $canonical_placeholder ?>" value="<?php echo esc_url( $this->get_custom_field( '_genesis_canonical_uri' ) ); ?>" />
602
  </p>
603
 
604
- <p><strong><?php _e( 'Robots Meta Settings', 'autodescription' ); ?></strong></p>
605
  <p>
606
  <label for="autodescription_noindex"><input type="checkbox" name="autodescription[_genesis_noindex]" id="autodescription_noindex" value="1" <?php checked( $this->get_custom_field( '_genesis_noindex' ) ); ?> />
607
  <?php
608
  /* translators: 1: Option, 2: Post or Page */
609
- printf( __( 'Apply %1$s to this %2$s', 'autodescription' ), $this->code_wrap( 'noindex' ), $type );
610
  ?>
611
- <a href="https://support.google.com/webmasters/answer/93710?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to show this %s in their search results', 'autodescription' ), $type ); ?>">[?]</a>
612
  </label>
613
 
614
  <br>
@@ -616,9 +657,9 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
616
  <label for="autodescription_nofollow"><input type="checkbox" name="autodescription[_genesis_nofollow]" id="autodescription_nofollow" value="1" <?php checked( $this->get_custom_field( '_genesis_nofollow' ) ); ?> />
617
  <?php
618
  /* translators: 1: Option, 2: Post or Page */
619
- printf( __( 'Apply %1$s to this %2$s', 'autodescription' ), $this->code_wrap( 'nofollow' ), $type );
620
  ?>
621
- <a href="https://support.google.com/webmasters/answer/96569?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to follow links on this %s', 'autodescription' ), $type ); ?>">[?]</a>
622
  </label>
623
 
624
  <br>
@@ -626,24 +667,24 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
626
  <label for="autodescription_noarchive"><input type="checkbox" name="autodescription[_genesis_noarchive]" id="autodescription_noarchive" value="1" <?php checked( $this->get_custom_field( '_genesis_noarchive' ) ); ?> />
627
  <?php
628
  /* translators: 1: Option, 2: Post or Page */
629
- printf( __( 'Apply %1$s to this %2$s', 'autodescription' ), $this->code_wrap( 'noarchive' ), $type );
630
  ?>
631
- <a href="https://support.google.com/webmasters/answer/79812?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to save a cached copy of this %s', 'autodescription' ), $type ); ?>">[?]</a>
632
  </label>
633
  </p>
634
 
635
- <p><strong><?php _e( 'Local Search Settings', 'autodescription' ); ?></strong></p>
636
  <p>
637
  <label for="autodescription_exclude_local_search"><input type="checkbox" name="autodescription[exclude_local_search]" id="autodescription_exclude_local_search" value="1" <?php checked( $this->get_custom_field( 'exclude_local_search' ) ); ?> />
638
- <?php printf( __( 'Exclude this %s from local search', 'autodescription' ), $type ); ?>
639
- <span title="<?php printf( __( 'This excludes this %s from local on-site search results', 'autodescription' ), $type ); ?>">[?]</span>
640
  </label>
641
  </p>
642
 
643
  <p>
644
  <label for="autodescription_redirect">
645
- <strong><?php _e( 'Custom 301 Redirect URL', 'autodescription' ); ?></strong>
646
- <a href="https://support.google.com/webmasters/answer/93633?hl=<?php echo $language; ?>" target="_blank" title="<?php _e( 'This will force visitors to go to another URL', 'autodescription' ); ?>">[?]</a>
647
  </label>
648
  </p>
649
  <p>
@@ -652,7 +693,7 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
652
 
653
  <?php if ( 'below' === $this->inpost_seo_bar ) : ?>
654
  <p>
655
- <strong><?php _e( 'Doing it Right', 'autodescription' ); ?></strong>
656
  <div><?php echo $this->post_status( $post_id, 'inpost', true ); ?></div>
657
  </p>
658
  <?php endif;
@@ -660,5 +701,4 @@ class AutoDescription_Inpost extends AutoDescription_DoingItRight {
660
  do_action( 'the_seo_framework_pro_page_inpost_box' );
661
 
662
  }
663
-
664
  }
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_Inpost
23
  *
36
  */
37
  protected $inpost_seo_bar = false;
38
 
39
+ /**
40
+ * Defines inpost nonce name.
41
+ *
42
+ * @since 2.7.0
43
+ *
44
+ * @var string The nonce name.
45
+ */
46
+ public $inpost_nonce_name;
47
+
48
+ /**
49
+ * Defines inpost nonce field.
50
+ *
51
+ * @since 2.7.0
52
+ *
53
+ * @var string The nonce field.
54
+ */
55
+ public $inpost_nonce_field;
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, load parent constructor
71
  */
72
  public function __construct() {
73
  parent::__construct();
74
 
75
+ $this->inpost_nonce_name = 'the_seo_framework_inpost_seo_settings';
76
+ $this->inpost_nonce_field = 'the_seo_framework_inpost';
77
+
78
  //* Enqueue Inpost meta boxes.
79
  add_action( 'add_meta_boxes', array( $this, 'add_inpost_seo_box_init' ), 5 );
80
 
94
  }
95
 
96
  /**
97
+ * Adds the SEO meta box to post edit screens.
 
 
 
 
98
  *
99
  * @since 2.0.0
100
  */
103
  if ( $this->detect_seo_plugins() )
104
  return;
105
 
106
+ /**
107
+ * Applies filters the_seo_framework_seobox_output : bool
108
+ * @since 2.0.0
109
+ */
110
  $show_seobox = (bool) apply_filters( 'the_seo_framework_seobox_output', true );
111
 
112
  if ( $show_seobox )
118
  * Adds SEO Meta boxes within Taxonomy screens.
119
  *
120
  * @since 2.1.8
121
+ * @since 2.6.0 Can no longer run outside of the term edit scope.
122
+ * @since 2.6.0 Can no longer run when another SEO plugin is active.
123
  */
124
  public function add_taxonomy_seo_box_init() {
125
 
126
+ if ( $this->detect_seo_plugins() || ! $this->is_term_edit() )
 
127
  return;
128
 
129
+ /**
130
+ * High priority, this box is seen right below the post/page edit screen.
131
+ * Applies filters 'the_seo_framework_term_metabox_priority' : int
132
+ *
133
+ * @since 2.6.0
134
+ */
135
+ $priority = (int) apply_filters( 'the_seo_framework_term_metabox_priority', 0 );
 
 
 
 
 
 
 
136
 
137
+ //* Add taxonomy meta boxes
138
+ foreach ( get_taxonomies( array( 'public' => true ) ) as $tax_name )
139
+ add_action( $tax_name . '_edit_form', array( $this, 'pre_seo_box' ), $priority, 2 );
140
 
141
  }
142
 
172
  * @TODO solve note.
173
  * @priority medium 2.7.0
174
  */
175
+ $id = (string) apply_filters( 'the_seo_framework_metabox_id', 'tsf-inpost-box' );
176
  $context = 'normal';
177
 
178
  /**
254
 
255
  // Only add nonce on post/page edit screen
256
  if ( 'is_post_page' === $page ) {
257
+ wp_nonce_field( $this->inpost_nonce_field, $this->inpost_nonce_name );
258
  } else {
259
  // This shouldn't happen.
260
  return;
261
  }
262
+ } elseif ( is_object( $object ) ) {
263
 
264
  //* Singular name.
265
  $type = $this->get_the_term_name( $object, true, false );
301
  //* Get the language the Google page should assume.
302
  $language = $this->google_language();
303
 
304
+ //* Fetch Term ID and taxonomy.
305
+ $term_id = $object->term_id;
306
+ $taxonomy = $object->taxonomy;
307
+
308
+ $data = $this->get_term_data( $object, $term_id );
309
 
310
+ $title = isset( $data['doctitle'] ) ? $data['doctitle'] : '';
311
  $description = isset( $data['description'] ) ? $data['description'] : '';
312
  $noindex = isset( $data['noindex'] ) ? $data['noindex'] : '';
313
  $nofollow = isset( $data['nofollow'] ) ? $data['nofollow'] : '';
314
  $noarchive = isset( $data['noarchive'] ) ? $data['noarchive'] : '';
315
 
 
 
 
 
316
  $generated_doctitle_args = array(
317
  'term_id' => $term_id,
318
  'taxonomy' => $taxonomy,
339
  *
340
  * @since 2.3.4
341
  */
342
+ $doc_pre_rem = $add_additions ? $title . ' | ' . $blog_name : $title;
343
  $title_len = $title ? $doc_pre_rem : $generated_doctitle;
344
  $description_len = $description ? $description : $generated_description;
345
 
361
  $description_placeholder = $generated_description;
362
 
363
  ?>
364
+ <h3><?php printf( esc_html__( '%s SEO Settings', 'autodescription' ), $type ); ?></h3>
365
 
366
  <table class="form-table">
367
  <tbody>
368
 
369
  <?php if ( 'above' === $this->inpost_seo_bar ) : ?>
370
  <tr>
371
+ <th scope="row" valign="top"><?php esc_html_e( 'Doing it Right', 'autodescription' ); ?></th>
372
  <td>
373
  <?php echo $this->post_status( $term_id, $taxonomy, true ); ?>
374
  </td>
378
  <tr class="form-field">
379
  <th scope="row" valign="top">
380
  <label for="autodescription-meta[doctitle]">
381
+ <strong><?php printf( esc_html__( '%s Title', 'autodescription' ), $type ); ?></strong>
382
+ <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#3" target="_blank" title="<?php esc_html_e( 'Recommended Length: 50 to 55 characters', 'autodescription' ) ?>">[?]</a>
383
  </label>
384
  </th>
385
  <td>
386
+ <div id="tsf-title-wrap">
387
  <input name="autodescription-meta[doctitle]" id="autodescription-meta[doctitle]" type="text" placeholder="<?php echo $title_placeholder ?>" value="<?php echo esc_attr( $title ); ?>" size="40" />
388
+ <span id="tsf-title-offset" class="hide-if-no-js"></span><span id="tsf-title-placeholder" class="hide-if-no-js"></span>
389
  </div>
390
+ <p class="description tsf-counter">
391
+ <?php printf( esc_html__( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription-meta[doctitle]_chars">'. mb_strlen( $tit_len_parsed ) .'</span>' ); ?>
392
+ <span class="hide-if-no-js tsf-ajax"></span>
393
+ </p>
394
  </td>
395
  </tr>
396
 
397
  <tr class="form-field">
398
  <th scope="row" valign="top">
399
  <label for="autodescription-meta[description]">
400
+ <strong><?php printf( esc_html__( '%s Meta Description', 'autodescription' ), $type ); ?></strong>
401
+ <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#1" target="_blank" title="<?php esc_html_e( 'Recommended Length: 145 to 155 characters', 'autodescription' ) ?>">[?]</a>
402
  </label>
403
  </th>
404
  <td>
405
  <textarea name="autodescription-meta[description]" id="autodescription-meta[description]" placeholder="<?php echo $description_placeholder ?>" rows="5" cols="50" class="large-text"><?php echo esc_html( $description ); ?></textarea>
406
+ <p class="description tsf-counter">
407
+ <?php printf( esc_html__( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription-meta[description]_chars">'. mb_strlen( $desc_len_parsed ) .'</span>' ); ?>
408
+ <span class="hide-if-no-js tsf-ajax"></span>
409
+ </p>
410
  </td>
411
  </tr>
412
 
413
  <tr>
414
+ <th scope="row" valign="top"><?php esc_html_e( 'Robots Meta Settings', 'autodescription' ); ?></th>
415
  <td>
416
  <label for="autodescription-meta[noindex]"><input name="autodescription-meta[noindex]" id="autodescription-meta[noindex]" type="checkbox" value="1" <?php checked( $noindex ); ?> />
417
+ <?php printf( esc_html__( 'Apply %s to this term?', 'autodescription' ), $this->code_wrap( 'noindex' ) ); ?>
418
+ <a href="https://support.google.com/webmasters/answer/93710?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Tell Search Engines not to show this page in their search results', 'autodescription' ) ) ?>">[?]</a>
419
  </label>
420
 
421
  <br>
422
 
423
  <label for="autodescription-meta[nofollow]"><input name="autodescription-meta[nofollow]" id="autodescription-meta[nofollow]" type="checkbox" value="1" <?php checked( $nofollow ); ?> />
424
+ <?php printf( esc_html__( 'Apply %s to this term?', 'autodescription' ), $this->code_wrap( 'nofollow' ) ); ?>
425
+ <a href="https://support.google.com/webmasters/answer/96569?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Tell Search Engines not to follow links on this page', 'autodescription' ) ) ?>">[?]</a>
426
  </label>
427
 
428
  <br>
429
 
430
  <label for="autodescription-meta[noarchive]"><input name="autodescription-meta[noarchive]" id="autodescription-meta[noarchive]" type="checkbox" value="1" <?php checked( $noarchive ); ?> />
431
+ <?php printf( esc_html__( 'Apply %s to this term?', 'autodescription' ), $this->code_wrap( 'noarchive' ) ); ?>
432
+ <a href="https://support.google.com/webmasters/answer/79812?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Tell Search Engines not to save a cached copy of this page', 'autodescription' ) ) ?>">[?]</a>
433
  </label>
434
 
435
  <?php // Saved flag, if set then it won't fetch for Genesis meta anymore ?>
441
 
442
  <?php if ( 'below' === $this->inpost_seo_bar ) : ?>
443
  <tr>
444
+ <th scope="row" valign="top"><?php esc_html_e( 'Doing it Right', 'autodescription' ); ?></th>
445
  <td>
446
  <?php echo $this->post_status( $term_id, $taxonomy, true ); ?>
447
  </td>
501
  'is_home' => true,
502
  'get_custom_field' => true,
503
  );
504
+ } elseif ( $this->is_blog_page( $post_id ) ) {
505
  //* Page for posts.
506
  $generated_doctitle_args = array(
507
  'placeholder' => true,
533
  * @since 2.3.4
534
  */
535
  if ( $is_static_frontpage ) {
536
+ if ( $this->get_option( 'homepage_tagline' ) )
537
  $tit_len_pre = $title ? $title . " | " . $this->get_blogdescription() : $generated_doctitle;
538
+ else
539
  $tit_len_pre = $title ? $title : $generated_doctitle;
 
540
  } else {
541
  /**
542
  * Separator doesn't matter. Since html_entity_decode is used.
544
  *
545
  * @since 2.3.4
546
  */
547
+ if ( $this->add_title_additions() )
548
  $tit_len_pre = $title ? $title . " | " . $this->get_blogname() : $generated_doctitle;
549
+ else
550
  $tit_len_pre = $title ? $title : $generated_doctitle;
 
551
  }
552
 
553
  //* Fetch description from option.
597
  ?>
598
  <?php if ( 'above' === $this->inpost_seo_bar ) : ?>
599
  <p>
600
+ <strong><?php esc_html_e( 'Doing it Right', 'autodescription' ); ?></strong>
601
  <div><?php echo $this->post_status( $post_id, 'inpost', true ); ?></div>
602
  </p>
603
  <?php endif; ?>
604
 
605
  <p>
606
+ <label for="autodescription_title"><strong><?php printf( esc_html__( 'Custom %s Title', 'autodescription' ), $type ); ?></strong>
607
+ <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#3" target="_blank" title="<?php esc_html_e( 'Recommended Length: 50 to 55 characters', 'autodescription' ); ?>">[?]</a>
608
+ <span class="description tsf-counter">
609
+ <?php printf( esc_html__( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription_title_chars">'. mb_strlen( $tit_len_parsed ) .'</span>' ); ?>
610
+ <span class="hide-if-no-js tsf-ajax"></span>
611
+ </span>
612
  </label>
613
  </p>
614
  <p>
615
+ <div id="tsf-title-wrap">
616
  <input class="large-text" type="text" name="autodescription[_genesis_title]" id="autodescription_title" placeholder="<?php echo $doctitle_placeholder ?>" value="<?php echo esc_attr( $this->get_custom_field( '_genesis_title' ) ); ?>" />
617
+ <span id="tsf-title-offset" class="hide-if-no-js"></span><span id="tsf-title-placeholder" class="hide-if-no-js"></span>
618
  </div>
619
  </p>
620
 
621
  <p>
622
  <label for="autodescription_description">
623
+ <strong><?php printf( esc_html__( 'Custom %s Description', 'autodescription' ), $type ); ?></strong>
624
+ <a href="https://support.google.com/webmasters/answer/35624?hl=<?php echo $language; ?>#1" target="_blank" title="<?php esc_html_e( 'Recommended Length: 145 to 155 characters', 'autodescription' ); ?>">[?]</a>
625
+ <span class="description tsf-counter">
626
+ <?php printf( esc_html__( 'Characters Used: %s', 'autodescription' ), '<span id="autodescription_description_chars">'. mb_strlen( $desc_len_parsed ) .'</span>' ); ?>
627
+ <span class="hide-if-no-js tsf-ajax"></span>
628
+ </span>
629
  </label>
630
  </p>
631
  <p>
634
 
635
  <p>
636
  <label for="autodescription_canonical">
637
+ <strong><?php esc_html_e( 'Custom Canonical URL', 'autodescription' ); ?></strong>
638
+ <a href="https://support.google.com/webmasters/answer/139066?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Preferred %s URL location', 'autodescription' ), $type ); ?>">[?]</a>
639
  </label>
640
  </p>
641
  <p>
642
  <input class="large-text" type="text" name="autodescription[_genesis_canonical_uri]" id="autodescription_canonical" placeholder="<?php echo $canonical_placeholder ?>" value="<?php echo esc_url( $this->get_custom_field( '_genesis_canonical_uri' ) ); ?>" />
643
  </p>
644
 
645
+ <p><strong><?php esc_html_e( 'Robots Meta Settings', 'autodescription' ); ?></strong></p>
646
  <p>
647
  <label for="autodescription_noindex"><input type="checkbox" name="autodescription[_genesis_noindex]" id="autodescription_noindex" value="1" <?php checked( $this->get_custom_field( '_genesis_noindex' ) ); ?> />
648
  <?php
649
  /* translators: 1: Option, 2: Post or Page */
650
+ printf( esc_html__( 'Apply %1$s to this %2$s', 'autodescription' ), $this->code_wrap( 'noindex' ), $type );
651
  ?>
652
+ <a href="https://support.google.com/webmasters/answer/93710?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Tell Search Engines not to show this %s in their search results', 'autodescription' ), $type ); ?>">[?]</a>
653
  </label>
654
 
655
  <br>
657
  <label for="autodescription_nofollow"><input type="checkbox" name="autodescription[_genesis_nofollow]" id="autodescription_nofollow" value="1" <?php checked( $this->get_custom_field( '_genesis_nofollow' ) ); ?> />
658
  <?php
659
  /* translators: 1: Option, 2: Post or Page */
660
+ printf( esc_html__( 'Apply %1$s to this %2$s', 'autodescription' ), $this->code_wrap( 'nofollow' ), $type );
661
  ?>
662
+ <a href="https://support.google.com/webmasters/answer/96569?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Tell Search Engines not to follow links on this %s', 'autodescription' ), $type ); ?>">[?]</a>
663
  </label>
664
 
665
  <br>
667
  <label for="autodescription_noarchive"><input type="checkbox" name="autodescription[_genesis_noarchive]" id="autodescription_noarchive" value="1" <?php checked( $this->get_custom_field( '_genesis_noarchive' ) ); ?> />
668
  <?php
669
  /* translators: 1: Option, 2: Post or Page */
670
+ printf( esc_html__( 'Apply %1$s to this %2$s', 'autodescription' ), $this->code_wrap( 'noarchive' ), $type );
671
  ?>
672
+ <a href="https://support.google.com/webmasters/answer/79812?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( esc_html__( 'Tell Search Engines not to save a cached copy of this %s', 'autodescription' ), $type ); ?>">[?]</a>
673
  </label>
674
  </p>
675
 
676
+ <p><strong><?php esc_html_e( 'Local Search Settings', 'autodescription' ); ?></strong></p>
677
  <p>
678
  <label for="autodescription_exclude_local_search"><input type="checkbox" name="autodescription[exclude_local_search]" id="autodescription_exclude_local_search" value="1" <?php checked( $this->get_custom_field( 'exclude_local_search' ) ); ?> />
679
+ <?php printf( esc_html__( 'Exclude this %s from local search', 'autodescription' ), $type ); ?>
680
+ <span title="<?php printf( esc_html__( 'This excludes this %s from local on-site search results', 'autodescription' ), $type ); ?>">[?]</span>
681
  </label>
682
  </p>
683
 
684
  <p>
685
  <label for="autodescription_redirect">
686
+ <strong><?php esc_html_e( 'Custom 301 Redirect URL', 'autodescription' ); ?></strong>
687
+ <a href="https://support.google.com/webmasters/answer/93633?hl=<?php echo $language; ?>" target="_blank" title="<?php esc_html_e( 'This will force visitors to go to another URL', 'autodescription' ); ?>">[?]</a>
688
  </label>
689
  </p>
690
  <p>
693
 
694
  <?php if ( 'below' === $this->inpost_seo_bar ) : ?>
695
  <p>
696
+ <strong><?php esc_html_e( 'Doing it Right', 'autodescription' ); ?></strong>
697
  <div><?php echo $this->post_status( $post_id, 'inpost', true ); ?></div>
698
  </p>
699
  <?php endif;
701
  do_action( 'the_seo_framework_pro_page_inpost_box' );
702
 
703
  }
 
704
  }
inc/classes/metaboxes.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_Metaboxes
21
  *
@@ -25,6 +27,18 @@
25
  */
26
  class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor.
30
  */
@@ -37,6 +51,9 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
37
  *
38
  * @since 2.6.0
39
  *
 
 
 
40
  * @return array Title separators.
41
  */
42
  public function get_separator_list() {
@@ -98,7 +115,7 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
98
  public function nav_tab_wrapper( $id, $tabs = array(), $version = '2.3.6', $use_tabs = true ) {
99
 
100
  //* Whether tabs are active.
101
- $use_tabs = $use_tabs && count( $tabs ) > 1 ? true : false;
102
 
103
  /**
104
  * Start navigation.
@@ -106,9 +123,8 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
106
  * Don't output navigation if $use_tabs is false and the amount of tabs is 1 or lower.
107
  */
108
  if ( $use_tabs ) {
109
- ?>
110
- <div class="seoframework-nav-tab-wrapper hide-if-no-js" id="<?php echo $id; ?>-tabs-wrapper">
111
- <?php
112
  $count = 1;
113
  foreach ( $tabs as $tab => $value ) {
114
 
@@ -116,26 +132,24 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
116
  $name = isset( $value['name'] ) ? $value['name'] : '';
117
 
118
  $checked = 1 === $count ? 'checked' : '';
119
- $the_id = $id . '-tab-' . $tab;
120
- $the_name = $id . '-tabs';
121
 
122
- $label_class = $checked ? ' seoframework-active-tab' : ''; // maybe
123
 
124
  ?>
125
- <div class="seoframework-tab">
126
- <input type="radio" class="seoframework-tabs-radio" id="<?php echo $the_id ?>" name="<?php echo $the_name ?>" <?php echo $checked ?>>
127
- <label for="<?php echo $the_id; ?>" class="seoframework-nav-tab">
128
- <?php echo $dashicon ? '<span class="dashicons dashicons-' . esc_attr( $dashicon ) . ' seoframework-dashicons-tabs"></span>' : ''; ?>
129
- <?php echo $name ? '<span class="seoframework-nav-desktop">' . esc_attr( $name ) . '</span>' : ''; ?>
130
  </label>
131
  </div>
132
  <?php
133
 
134
  $count++;
135
  }
136
- ?>
137
- </div>
138
- <?php
139
  }
140
 
141
  /**
@@ -150,12 +164,9 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
150
  $the_name = $id . '-tabs-content';
151
 
152
  //* Current tab for JS.
153
- $current = 1 === $count ? ' seoframework-active-tab-content' : '';
154
-
155
- ?>
156
- <div class="seoframework-tabs-content <?php echo $the_name . $current; ?>" id="<?php echo $the_id; ?>" >
157
- <?php
158
 
 
159
  //* No-JS tabs.
160
  if ( $use_tabs ) {
161
  $dashicon = isset( $value['dashicon'] ) ? $value['dashicon'] : '';
@@ -163,9 +174,9 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
163
 
164
  ?>
165
  <div class="hide-if-js seoframework-content-no-js">
166
- <div class="seoframework-tab seoframework-tab-no-js">
167
- <span class="seoframework-nav-tab seoframework-active-tab">
168
- <?php echo $dashicon ? '<span class="dashicons dashicons-' . esc_attr( $dashicon ) . ' seoframework-dashicons-tabs"></span>' : ''; ?>
169
  <?php echo $name ? '<span>' . esc_attr( $name ) . '</span>' : ''; ?>
170
  </span>
171
  </div>
@@ -180,10 +191,7 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
180
  $output = $this->call_function( $callback, $version, $params );
181
  echo $output;
182
  }
183
-
184
- ?>
185
- </div>
186
- <?php
187
 
188
  $count++;
189
  }
@@ -194,106 +202,14 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
194
  * Title meta box on the Site SEO Settings page.
195
  *
196
  * @since 2.2.2
 
197
  *
 
198
  * @param array $args The metabox arguments.
199
- *
200
- * @see $this->title_metabox() Callback for Title Settings box.
201
  */
202
- public function title_metabox( $args = array() ) {
203
-
204
  do_action( 'the_seo_framework_title_metabox_before' );
205
-
206
- $latest_post_id = $this->get_latest_post_id();
207
-
208
- if ( $latest_post_id ) {
209
- $post = get_post( $latest_post_id, OBJECT );
210
- $title = esc_attr( $post->post_title );
211
- } else {
212
- $title = esc_attr__( 'Example Post Title', 'autodescription' );
213
- }
214
-
215
- $blogname = $this->get_blogname();
216
- $sep = $this->get_separator( 'title', true );
217
-
218
- $additions_left = '<span class="title-additions-js">' . $blogname . '<span class="autodescription-sep-js">' . " $sep " . '</span></span>';
219
- $additions_right = '<span class="title-additions-js"><span class="autodescription-sep-js">' . " $sep " . '</span>' . $blogname . '</span>';
220
-
221
- $example_left = '<em>' . $additions_left . $title . '</em>';
222
- $example_right = '<em>' . $title . $additions_right . '</em>';
223
-
224
- $showleft = 'left' === $this->get_option( 'title_location' ) ? true : false;
225
- //* Check left first, as right is default (and thus fallback).
226
- $example_nojs = $showleft ? $example_left : $example_right;
227
-
228
- ?>
229
- <h4><?php printf( __( 'Automated Title Settings', 'autodescription' ) ); ?></h4>
230
- <p><span class="description"><?php printf( __( "The page title is prominently shown within the browser tab as well as within the Search Engine results pages.", 'autodescription' ) ); ?></span></p>
231
-
232
- <h4><?php _e( 'Example Automated Title Output', 'autodescription' ); ?></h4>
233
- <p>
234
- <span class="title-additions-example-left" style="display:<?php echo $showleft ? 'inline' : 'none'; ?>"><?php echo $this->code_wrap_noesc( $example_left ); ?></span>
235
- <span class="title-additions-example-right" style="display:<?php echo $showleft ? 'none' : 'inline'; ?>"><?php echo $this->code_wrap_noesc( $example_right ); ?></span>
236
- </p>
237
-
238
- <hr>
239
- <?php
240
-
241
- /**
242
- * Parse tabs content
243
- *
244
- * @param array $default_tabs { 'id' = The identifier =>
245
- * array(
246
- * 'name' => The name
247
- * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
248
- * 'dashicon' => Desired dashicon
249
- * )
250
- * }
251
- *
252
- * @since 2.2.2
253
- */
254
- $default_tabs = array(
255
- 'general' => array(
256
- 'name' => __( 'General', 'autodescription' ),
257
- 'callback' => array( $this, 'title_metabox_general_tab' ),
258
- 'dashicon' => 'admin-generic',
259
- ),
260
- 'additions' => array(
261
- 'name' => __( 'Additions', 'autodescription' ),
262
- 'callback' => array( $this, 'title_metabox_additions_tab' ),
263
- 'dashicon' => 'plus',
264
- 'args' => array(
265
- 'examples' => array(
266
- 'left' => $example_left,
267
- 'right' => $example_right,
268
- ),
269
- ),
270
- ),
271
- 'prefixes' => array(
272
- 'name' => __( 'Prefixes', 'autodescription' ),
273
- 'callback' => array( $this, 'title_metabox_prefixes_tab' ),
274
- 'dashicon' => 'plus-alt',
275
- 'args' => array(
276
- 'additions' => array(
277
- 'left' => $additions_left,
278
- 'right' => $additions_right,
279
- ),
280
- 'showleft' => $showleft,
281
- ),
282
- )
283
- );
284
-
285
- /**
286
- * Applies filters the_seo_framework_title_settings_tabs : array see $default_tabs
287
- * @since 2.6.0
288
- *
289
- * Used to extend Description tabs.
290
- */
291
- $defaults = (array) apply_filters( 'the_seo_framework_title_settings_tabs', $default_tabs, $args );
292
-
293
- $tabs = wp_parse_args( $args, $defaults );
294
-
295
- $this->nav_tab_wrapper( 'title', $tabs, '2.6.0' );
296
-
297
  do_action( 'the_seo_framework_title_metabox_after' );
298
  }
299
 
@@ -301,178 +217,41 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
301
  * Title meta box general tab.
302
  *
303
  * @since 2.6.0
304
- *
305
  * @see $this->title_metabox() : Callback for Title Settings box.
306
  */
307
  public function title_metabox_general_tab() {
308
-
309
- $title_separator = $this->get_separator_list();
310
-
311
- $recommended = ' class="recommended" title="' . esc_attr__( 'Recommended', 'autodescription' ) . '"';
312
-
313
- ?>
314
- <fieldset>
315
- <legend><h4><?php _e( 'Document Title Separator', 'autodescription' ); ?></h4></legend>
316
- <p id="title-separator" class="theseoframework-fields">
317
- <?php foreach ( $title_separator as $name => $html ) { ?>
318
- <input type="radio" name="<?php $this->field_name( 'title_seperator' ); ?>" id="<?php $this->field_id( 'title_seperator_' . $name ); ?>" value="<?php echo $name ?>" <?php checked( $this->get_field_value( 'title_seperator' ), $name ); ?> />
319
- <label for="<?php $this->field_id( 'title_seperator_' . $name ); ?>" <?php echo ( $name === 'pipe' || $name === 'dash' ) ? $recommended : ''; ?>><?php echo $html ?></label>
320
- <?php } ?>
321
- </p>
322
- <span class="description"><?php _e( 'If the title consists of two parts (original title and optional addition), then the separator will go in-between them.', 'autodescription' ); ?></span>
323
- </fieldset>
324
- <?php
325
-
326
  }
327
 
328
  /**
329
  * Title meta box general tab.
330
  *
331
  * @since 2.6.0
 
332
  *
333
  * @param array $examples : array {
334
  * 'left' => Left Example
335
  * 'right' => Right Example
336
  * }
337
- *
338
- * @see $this->title_metabox() : Callback for Title Settings box.
339
  */
340
  public function title_metabox_additions_tab( $examples = array() ) {
341
-
342
- $example_left = $examples['left'];
343
- $example_right = $examples['right'];
344
-
345
- $language = $this->google_language();
346
-
347
- $home_page_has_option = __( 'The Home Page has a specific option.', 'autodescription' );
348
-
349
- ?>
350
- <fieldset>
351
- <legend><h4><?php _e( 'Document Title Additions Location', 'autodescription' ); ?></h4></legend>
352
-
353
- <p>
354
- <span class="description"><?php _e( 'Determines which side the added title text will go on.', 'autodescription' ); ?></span>
355
- </p>
356
- <p id="title-location" class="theseoframework-fields">
357
- <span class="toblock">
358
- <input type="radio" name="<?php $this->field_name( 'title_location' ); ?>" id="<?php $this->field_id( 'title_location_left' ); ?>" value="left" <?php checked( $this->get_field_value( 'title_location' ), 'left' ); ?> />
359
- <label for="<?php $this->field_id( 'title_location_left' ); ?>">
360
- <span><?php _e( 'Left:', 'autodescription' ); ?></span>
361
- <?php echo $this->code_wrap_noesc( $example_left ) ?>
362
- </label>
363
- </span>
364
- <span class="toblock">
365
- <input type="radio" name="<?php $this->field_name( 'title_location' ); ?>" id="<?php $this->field_id( 'title_location_right' ); ?>" value="right" <?php checked( $this->get_field_value( 'title_location' ), 'right' ); ?> />
366
- <label for="<?php $this->field_id( 'title_location_right' ); ?>">
367
- <span><?php _e( 'Right:', 'autodescription' ); ?></span>
368
- <?php echo $this->code_wrap_noesc( $example_right ); ?>
369
- </label>
370
- </span>
371
- </p>
372
- <span class="description"><?php echo $home_page_has_option; ?></span>
373
- </fieldset>
374
- <?php
375
-
376
- /**
377
- * @todo use checkbox function
378
- * @priority low 2.6.x
379
- */
380
-
381
- //* Only add this option if the theme is doing it right.
382
- if ( $this->can_manipulate_title() ) : ?>
383
- <hr>
384
-
385
- <h4><?php _e( 'Remove Blogname from Title', 'autodescription' ); ?></h4>
386
- <p id="title-additions-toggle">
387
- <label for="<?php $this->field_id( 'title_rem_additions' ); ?>">
388
- <input type="checkbox" name="<?php $this->field_name( 'title_rem_additions' ); ?>" id="<?php $this->field_id( 'title_rem_additions' ); ?>" <?php $this->is_conditional_checked( 'title_rem_additions' ); ?> value="1" <?php checked( $this->get_field_value( 'title_rem_additions' ) ); ?> />
389
- <?php _e( 'Remove Blogname from title?', 'autodescription' ); ?>
390
- </label>
391
- <a href="<?php echo esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#3' ); ?>" target="_blank" title="<?php _e( 'This might decouple your posts and pages from the rest of the website.', 'autodescription' ); ?>">[?]</a>
392
- </p>
393
- <span class="description"><?php _e( 'Only use this option if you are aware of its SEO effects.', 'autodescription' ); ?></span>
394
- <span class="description"><?php echo $home_page_has_option; ?></span>
395
- <?php endif;
396
-
397
  }
398
 
399
  /**
400
  * Title meta box prefixes tab.
401
  *
402
  * @since 2.6.0
 
403
  *
404
  * @param array $additions : array {
405
  * 'left' => Left Example Addtitions
406
  * 'right' => Right Example Additions
407
  * }
408
  * @param bool $showleft The example location.
409
- *
410
- * @see $this->title_metabox() : Callback for Title Settings box.
411
  */
412
  public function title_metabox_prefixes_tab( $additions = array(), $showleft = false ) {
413
-
414
- $left_additions = $additions['left'];
415
- $right_additions = $additions['right'];
416
-
417
- //* Get translated category label, if it exists. Otherwise, fallback to translation.
418
- $term_labels = $this->get_tax_labels( 'category' );
419
- $label = isset( $term_labels->singular_name ) ? $term_labels->singular_name : __( 'Category', 'autodescription' );
420
-
421
- $cats = get_terms( array( 'taxonomy' => 'category', 'fields' => 'ids', 'hide_empty' => false, 'order' => 'ASC', 'number' => 1 ) );
422
- if ( is_array( $cats ) && ! empty( $cats ) ) {
423
- //* Category should exist.
424
- $cat = reset( $cats );
425
- } else {
426
- //* Default fallback category.
427
- $cat = 1;
428
- }
429
- //* If cat is found, it will return its name. Otherwise it's an empty string.
430
- $cat_name = get_cat_name( $cat );
431
- $cat_name = $cat_name ? $cat_name : __( 'Example Category', 'autodescription' );
432
-
433
- $display_prefix = $this->is_option_checked( 'title_rem_prefixes' ) ? 'none' : 'inline';
434
- $title = '<span class="title-prefix-example" style="display:' . $display_prefix . '">' . $label . ': </span>' . $cat_name;
435
-
436
- $example_left = '<em>' . $left_additions . $title . '</em>';
437
- $example_right = '<em>' . $title . $right_additions . '</em>';
438
-
439
- $example_nojs = $showleft ? $example_left : $example_right;
440
-
441
- $language = $this->google_language();
442
-
443
- /**
444
- * @todo use checkbox function
445
- * @priority low 2.6.x
446
- */
447
-
448
- ?>
449
- <h4><?php _e( 'Title prefix options', 'autodescription' ); ?></h4>
450
- <p><span class="description"><?php _e( "On archives a descriptive prefix may be added to the title.", 'autodescription' ); ?></span></p>
451
-
452
- <h4><?php _e( 'Example Automated Archive Title Output' ); ?></h4>
453
- <p>
454
- <span class="title-additions-example-left" style="display:<?php echo $showleft ? 'inline' : 'none'; ?>"><?php echo $this->code_wrap_noesc( $example_left ); ?></span>
455
- <span class="title-additions-example-right" style="display:<?php echo $showleft ? 'none' : 'inline'; ?>"><?php echo $this->code_wrap_noesc( $example_right ); ?></span>
456
- </p>
457
-
458
- <hr>
459
-
460
- <h4><?php _e( 'Remove Archive Title Prefixes', 'autodescription' ); ?></h4>
461
- <p id="title-prefixes-toggle">
462
- <label for="<?php $this->field_id( 'title_rem_prefixes' ); ?>">
463
- <input type="checkbox" name="<?php $this->field_name( 'title_rem_prefixes' ); ?>" id="<?php $this->field_id( 'title_rem_prefixes' ); ?>" <?php $this->is_conditional_checked( 'title_rem_prefixes' ); ?> value="1" <?php checked( $this->get_field_value( 'title_rem_prefixes' ) ); ?> />
464
- <?php _e( 'Remove Prefixes from title?', 'autodescription' ); ?>
465
- </label>
466
- <?php
467
- $this->make_info(
468
- __( "The prefix helps visitors and Search Engines determine what kind of page they're visiting", 'autodescription' ),
469
- 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#3',
470
- true
471
- );
472
- ?>
473
- </p>
474
- <?php
475
-
476
  }
477
 
478
  /**
@@ -480,1945 +259,323 @@ class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
480
  *
481
  * @since 2.3.4
482
  *
 
483
  * @param array $args The metabox arguments.
484
- *
485
- * @see $this->description_metabox() Callback for Description Settings box.
486
  */
487
- public function description_metabox( $args = array() ) {
488
-
489
  do_action( 'the_seo_framework_description_metabox_before' );
490
-
491
- $blogname = $this->get_blogname();
492
- $sep = $this->get_separator( 'description', true );
493
-
494
- /**
495
- * Generate example.
496
- */
497
- $page_title = __( 'Example Title', 'autodescription' );
498
- $on = _x( 'on', 'Placement. e.g. Post Title "on" Blog Name', 'autodescription' );
499
- $excerpt = __( 'This is an example description...', 'autodescription' );
500
-
501
- $page_title = $this->escape_description( $page_title );
502
- $on = $this->escape_description( $on );
503
- $excerpt = $this->escape_description( $excerpt );
504
-
505
- //* Put it together.
506
- $example = '<span id="description-additions-js">'
507
- . $page_title
508
- . '<span id="on-blogname-js">' . " $on " . $blogname . '</span>'
509
- . '<span id="autodescription-descsep-js">' . " $sep " . '</span>'
510
- . '</span>'
511
- . $excerpt
512
- ;
513
-
514
- $nojs_additions = '';
515
- //* Add or remove additions based on option.
516
- if ( $this->add_description_additions() ) {
517
- $description_blogname_additions = $this->get_option( 'description_blogname' );
518
-
519
- $example_nojs_onblog = $description_blogname_additions ? $page_title . " $on " . $blogname : $page_title;
520
- $nojs_additions = $example_nojs_onblog . " $sep ";
521
- }
522
-
523
- $example_nojs = $nojs_additions . $excerpt;
524
-
525
- ?>
526
- <h4><?php printf( __( 'Automated Description Settings', 'autodescription' ) ); ?></h4>
527
- <p><span class="description"><?php printf( __( "The meta description can be used to determine the text used under the title on Search Engine results pages.", 'autodescription' ) ); ?></span></p>
528
-
529
- <h4><?php _e( 'Example Automated Description Output', 'autodescription' ); ?></h4>
530
- <p class="hide-if-no-js"><?php echo $this->code_wrap_noesc( $example ); ?></p>
531
- <p class="hide-if-js"><?php echo $this->code_wrap( $example_nojs ); ?></p>
532
-
533
- <hr>
534
- <?php
535
-
536
- /**
537
- * Parse tabs content
538
- *
539
- * @param array $default_tabs { 'id' = The identifier =>
540
- * array(
541
- * 'name' => The name
542
- * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
543
- * 'dashicon' => Desired dashicon
544
- * )
545
- * }
546
- *
547
- * @since 2.6.0
548
- */
549
- $default_tabs = array(
550
- 'general' => array(
551
- 'name' => __( 'General', 'autodescription' ),
552
- 'callback' => array( $this, 'description_metabox_general_tab' ),
553
- 'dashicon' => 'admin-generic',
554
- ),
555
- 'additions' => array(
556
- 'name' => __( 'Additions', 'autodescription' ),
557
- 'callback' => array( $this, 'description_metabox_additions_tab' ),
558
- 'dashicon' => 'plus',
559
- ),
560
- );
561
-
562
- /**
563
- * Applies filters the_seo_framework_description_settings_tabs : array see $default_tabs
564
- * @since 2.6.0
565
- *
566
- * Used to extend Description tabs.
567
- */
568
- $defaults = (array) apply_filters( 'the_seo_framework_description_settings_tabs', $default_tabs, $args );
569
-
570
- $tabs = wp_parse_args( $args, $defaults );
571
-
572
- $this->nav_tab_wrapper( 'description', $tabs, '2.6.0' );
573
-
574
  do_action( 'the_seo_framework_description_metabox_after' );
575
-
576
  }
577
 
578
  /**
579
  * Description meta box general tab.
580
  *
581
  * @since 2.6.0
582
- *
583
- * @see $this->description_metabox() Callback for Description Settings box.
584
  */
585
  public function description_metabox_general_tab() {
586
-
587
- //* Let's use the same separators as for the title.
588
- $description_separator = $this->get_separator_list();
589
- $sep_option = $this->get_option( 'description_separator' );
590
- $sep_option = $sep_option ? $sep_option : 'pipe';
591
-
592
- $recommended = ' class="recommended" title="' . __( 'Recommended', 'autodescription' ) . '"';
593
-
594
- ?>
595
- <fieldset>
596
- <legend><h4><?php _e( 'Description Excerpt Separator', 'autodescription' ); ?></h4></legend>
597
- <p id="description-separator" class="theseoframework-fields">
598
- <?php foreach ( $description_separator as $name => $html ) { ?>
599
- <input type="radio" name="<?php $this->field_name( 'description_separator' ); ?>" id="<?php $this->field_id( 'description_separator' . $name ); ?>" value="<?php echo $name ?>" <?php checked( $sep_option, $name ); ?> />
600
- <label for="<?php $this->field_id( 'description_separator' . $name ); ?>" <?php echo ( 'pipe' === $name || 'dash' === $name ) ? $recommended : ''; ?>><?php echo $html ?></label>
601
- <?php } ?>
602
- </p>
603
- <span class="description"><?php _e( 'If the Automated Description consists of two parts (title and excerpt), then the separator will go in-between them.', 'autodescription' ); ?></span>
604
- </fieldset>
605
- <?php
606
-
607
  }
608
 
609
  /**
610
  * Description meta box additions tab.
611
  *
612
  * @since 2.6.0
613
- *
614
- * @see $this->description_metabox() Callback for Description Settings box.
615
  */
616
  public function description_metabox_additions_tab() {
617
-
618
- $language = $this->google_language();
619
- $google_explanation = esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#1' );
620
-
621
- /**
622
- * @todo use checkbox functions.
623
- * @priority low 2.6.x
624
- */
625
- ?>
626
- <h4><?php printf( __( 'Description Additions Settings', 'autodescription' ) ); ?></h4>
627
- <p><span class="description"><?php printf( __( "To create a more organic description, a small introduction can be added before the description.", 'autodescription' ) ); ?></span></p>
628
- <p><span class="description"><?php printf( __( "The introduction consists of the title and optionally the blogname.", 'autodescription' ) ); ?></span></p>
629
-
630
- <hr>
631
-
632
- <h4><?php _e( 'Add descriptive Additions to Description', 'autodescription' ); ?></h4>
633
- <p id="description-additions-toggle">
634
- <label for="<?php $this->field_id( 'description_additions' ); ?>" class="toblock">
635
- <input type="checkbox" name="<?php $this->field_name( 'description_additions' ); ?>" id="<?php $this->field_id( 'description_additions' ); ?>" <?php $this->is_conditional_checked( 'description_additions' ); ?> value="1" <?php checked( $this->get_field_value( 'description_additions' ) ); ?> />
636
- <?php _e( 'Add Additions to automated description?', 'autodescription' ); ?>
637
- <a href="<?php echo esc_url( $google_explanation ); ?>" target="_blank" class="description" title="<?php _e( 'This creates good meta descriptions', 'autodescription' ); ?>">[?]</a>
638
- </label>
639
- </p>
640
-
641
- <h4><?php _e( 'Add Blogname to Additions', 'autodescription' ); ?></h4>
642
- <p id="description-onblogname-toggle">
643
- <label for="<?php $this->field_id( 'description_blogname' ); ?>" class="toblock">
644
- <input type="checkbox" name="<?php $this->field_name( 'description_blogname' ); ?>" id="<?php $this->field_id( 'description_blogname' ); ?>" <?php $this->is_conditional_checked( 'description_blogname' ); ?> value="1" <?php checked( $this->get_field_value( 'description_blogname' ) ); ?> />
645
- <?php _e( 'Add Blogname to automated description additions?', 'autodescription' ); ?>
646
- </label>
647
- </p>
648
- <?php
649
-
650
  }
651
 
652
  /**
653
  * Robots meta box on the Site SEO Settings page.
654
  *
655
  * @since 2.2.2
 
 
 
656
  */
657
- public function robots_metabox( $args = array() ) {
658
-
659
  do_action( 'the_seo_framework_robots_metabox_before' );
660
-
661
- //* Robots types
662
- $types = array(
663
- 'category' => __( 'Category', 'autodescription' ),
664
- 'tag' => __( 'Tag', 'autodescription' ),
665
- 'author' => __( 'Author', 'autodescription' ),
666
- 'date' => __( 'Date', 'autodescription' ),
667
- 'search' => __( 'Search Pages', 'autodescription' ),
668
- 'attachment' => __( 'Attachment Pages', 'autodescription' ),
669
- 'site' => _x( 'the entire site', '...for the entire site', 'autodescription' ),
670
- );
671
-
672
- //* Robots i18n
673
- $robots = array(
674
- 'noindex' => array(
675
- 'value' => 'noindex',
676
- 'name' => __( 'NoIndex', 'autodescription' ),
677
- 'desc' => __( 'These options prevent indexing of the selected archives and pages. If you enable this, the selected archives or pages will be removed from Search Engine results pages.', 'autodescription' ),
678
- ),
679
- 'nofollow' => array(
680
- 'value' => 'nofollow',
681
- 'name' => __( 'NoFollow', 'autodescription' ),
682
- 'desc' => __( 'These options prevent links from being followed on the selected archives and pages. If you enable this, the selected archives or pages in-page links will gain no SEO value, including your own links.', 'autodescription' ),
683
- ),
684
- 'noarchive' => array(
685
- 'value' => 'noarchive',
686
- 'name' => __( 'NoArchive', 'autodescription' ),
687
- 'desc' => __( 'These options prevent caching of the selected archives and pages. If you enable this, Search Engines will not create a cached copy of the selected archives or pages.', 'autodescription' ),
688
- ),
689
- );
690
-
691
- /**
692
- * Parse tabs content
693
- *
694
- * @param array $default_tabs { 'id' = The identifier =>
695
- * array(
696
- * 'name' => The name
697
- * 'callback' => function callback
698
- * 'dashicon' => WordPress Dashicon
699
- * 'args' => function args
700
- * )
701
- * }
702
- *
703
- * @since 2.2.2
704
- */
705
- $default_tabs = array(
706
- 'general' => array(
707
- 'name' => __( 'General', 'autodescription' ),
708
- 'callback' => array( $this, 'robots_metabox_general_tab' ),
709
- 'dashicon' => 'admin-generic',
710
- 'args' => '',
711
- ),
712
- 'index' => array(
713
- 'name' => __( 'Indexing', 'autodescription' ),
714
- 'callback' => array( $this, 'robots_metabox_no_tab' ),
715
- 'dashicon' => 'filter',
716
- 'args' => array( $types, $robots['noindex'] ),
717
- ),
718
- 'follow' => array(
719
- 'name' => __( 'Following', 'autodescription' ),
720
- 'callback' => array( $this, 'robots_metabox_no_tab' ),
721
- 'dashicon' => 'editor-unlink',
722
- 'args' => array( $types, $robots['nofollow'] ),
723
- ),
724
- 'archive' => array(
725
- 'name' => __( 'Archiving', 'autodescription' ),
726
- 'callback' => array( $this, 'robots_metabox_no_tab' ),
727
- 'dashicon' => 'download',
728
- 'args' => array( $types, $robots['noarchive'] ),
729
- ),
730
- );
731
-
732
- /**
733
- * Applies filters 'the_seo_framework_robots_settings_tabs' : array see $default_tabs
734
- *
735
- * Used to extend Social tabs
736
- * @since 2.2.4
737
- */
738
- $defaults = (array) apply_filters( 'the_seo_framework_robots_settings_tabs', $default_tabs, $args );
739
-
740
- $tabs = wp_parse_args( $args, $defaults );
741
-
742
- $this->nav_tab_wrapper( 'robots', $tabs, '2.2.4' );
743
-
744
  do_action( 'the_seo_framework_robots_metabox_after' );
745
-
746
  }
747
 
748
  /**
749
- * Robots Metabox General Tab output
750
  *
751
  * @since 2.2.4
752
- *
753
  * @see $this->robots_metabox() Callback for Robots Settings box.
754
  */
755
  protected function robots_metabox_general_tab() {
756
-
757
- ?>
758
- <h4><?php _e( 'Open Directory Settings', 'autodescription' ); ?></h4>
759
- <p class="description"><?php printf( __( "Sometimes, Search Engines use resources from certain Directories to find titles and descriptions for your content. You generally don't want them to. Turn these options on to prevent them from doing so.", 'autodescription' ), $this->code_wrap( 'noodp' ), $this->code_wrap( 'noydir' ) ); ?></p>
760
- <p class="description"><?php _e( "The Open Directory Project and the Yahoo! Directory may contain outdated SEO values. Therefore, it's best to leave these options checked.", 'autodescription' ); ?></p>
761
- <?php
762
-
763
- $this->wrap_fields(
764
- array(
765
- $this->make_checkbox(
766
- 'noodp',
767
- sprintf( __( 'Apply %s to the entire site?', 'autodescription' ), $this->code_wrap( 'noodp' ) ),
768
- ''
769
- ),
770
- $this->make_checkbox(
771
- 'noydir',
772
- sprintf( __( 'Apply %s to the entire site?', 'autodescription' ), $this->code_wrap( 'noydir' ) ),
773
- ''
774
- ),
775
- ),
776
- true
777
- );
778
-
779
- ?>
780
- <hr>
781
-
782
- <h4><?php _e( 'Paginated Archive Settings', 'autodescription' ); ?></h4>
783
- <p class="description"><?php printf( __( "Indexing the second or later page of any archive might cause duplication errors. Search Engines look down upon them; therefore, it's recommended to disable indexing of those pages.", 'autodescription' ), $this->code_wrap( 'noodp' ), $this->code_wrap( 'noydir' ) ); ?></p>
784
- <?php
785
-
786
- $this->wrap_fields(
787
- $this->make_checkbox(
788
- 'paged_noindex',
789
- sprintf( __( 'Apply %s to every second or later archive page?', 'autodescription' ), $this->code_wrap( 'noindex' ) ),
790
- ''
791
- ),
792
- true
793
- );
794
-
795
  }
796
 
797
  /**
798
- * Robots Metabox
799
- * No-: Index/Follow/Archive
800
- * Tab output
801
  *
802
  * @since 2.2.4
 
 
 
 
 
 
 
 
803
  */
804
  protected function robots_metabox_no_tab( $types, $robots ) {
805
-
806
- $ro_value = $robots['value'];
807
- $ro_name = $robots['name'];
808
- $ro_i18n = $robots['desc'];
809
-
810
- ?>
811
- <h4><?php printf( __( '%s Robots Settings', 'autodescription' ), $ro_name ); ?></h4>
812
- <p><span class="description"><?php echo $ro_i18n ?></span></p>
813
- <p class="theseoframework-fields">
814
- <?php
815
-
816
- $checkboxes = '';
817
-
818
- foreach ( $types as $type => $i18n ) {
819
-
820
- if ( 'site' === $type || 'attachment' === $type || 'search' === $type ) {
821
- //* Singular.
822
- /* translators: 1: Option, 2: Post Type */
823
- $label = sprintf( __( 'Apply %1$s to %2$s?', 'autodescription' ), $this->code_wrap( $ro_name ), $i18n );
824
- } else {
825
- //* Archive.
826
- /* translators: 1: Option, 2: Post Type */
827
- $label = sprintf( __( 'Apply %1$s to %2$s Archives?', 'autodescription' ), $this->code_wrap( $ro_name ), $i18n );
828
- }
829
-
830
- $id = $type . '_' . $ro_value;
831
-
832
- //* Add <hr> if it's 'site'
833
- $checkboxes .= ( 'site' === $type ) ? '<hr class="theseoframework-option-spacer">' : '';
834
-
835
- $checkboxes .= $this->make_checkbox( $id, $label, '' );
836
- }
837
-
838
- //* Echo checkboxes.
839
- echo $this->wrap_fields( $checkboxes );
840
- ?>
841
- </p>
842
- <?php
843
-
844
  }
845
 
846
  /**
847
  * Home Page meta box on the Site SEO Settings page.
848
  *
849
- * @param array $args The navigation tabs args.
850
- *
851
  * @since 2.2.2
 
 
 
852
  */
853
- public function homepage_metabox( $args = array() ) {
854
-
855
  do_action( 'the_seo_framework_homepage_metabox_before' );
856
-
857
- ?>
858
- <p><span class="description"><?php printf( __( 'These settings will take precedence over the settings set within the Home Page edit screen, if any.', 'autodescription' ) ); ?></span></p>
859
-
860
- <hr>
861
- <?php
862
-
863
- /**
864
- * Parse tabs content
865
- *
866
- * @param array $default_tabs { 'id' = The identifier =>
867
- * array(
868
- * 'name' => The name
869
- * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
870
- * 'dashicon' => Desired dashicon
871
- * )
872
- * }
873
- *
874
- * @since 2.6.0
875
- */
876
- $default_tabs = array(
877
- 'general' => array(
878
- 'name' => __( 'General', 'autodescription' ),
879
- 'callback' => array( $this, 'homepage_metabox_general' ),
880
- 'dashicon' => 'admin-generic',
881
- ),
882
- 'additions' => array(
883
- 'name' => __( 'Additions', 'autodescription' ),
884
- 'callback' => array( $this, 'homepage_metabox_additions' ),
885
- 'dashicon' => 'plus',
886
- ),
887
- 'robots' => array(
888
- 'name' => __( 'Robots', 'autodescription' ),
889
- 'callback' => array( $this, 'homepage_metabox_robots' ),
890
- 'dashicon' => 'visibility',
891
- ),
892
- );
893
-
894
- /**
895
- * Applies filters the_seo_framework_homepage_settings_tabs : array see $default_tabs
896
- * @since 2.6.0
897
- *
898
- * Used to extend HomePage tabs.
899
- */
900
- $defaults = (array) apply_filters( 'the_seo_framework_homepage_settings_tabs', $default_tabs, $args );
901
-
902
- $tabs = wp_parse_args( $args, $defaults );
903
-
904
- $this->nav_tab_wrapper( 'homepage', $tabs, '2.6.0' );
905
-
906
  do_action( 'the_seo_framework_homepage_metabox_after' );
 
907
 
 
 
 
 
 
 
 
 
908
  }
909
 
910
  /**
911
- * HomePage Metabox General Tab Output
912
  *
913
- * @since 2.6.0
 
 
 
 
 
 
 
 
914
  *
 
915
  * @see $this->homepage_metabox() Callback for HomePage Settings box.
916
  */
917
- public function homepage_metabox_general() {
 
 
918
 
919
- /**
920
- * @param string $language The language for help pages. See $this->google_language();
921
- */
922
- $language = $this->google_language();
 
 
 
 
 
 
 
 
 
923
 
924
- /**
925
- * @param bool $page_on_front False if homepage is blog, true if single page/post
926
- * @param bool $home_description_frompost True if home inpost title is filled in. False if not.
927
- */
928
- $page_on_front = $this->has_page_on_front();
929
- $home_description_frompost = false;
 
 
 
930
 
931
- /**
932
- * Notify the user that the data is pulled from the post.
933
- */
934
- $description_from_post_message = '';
935
- $title_from_post_message = '';
 
 
 
 
 
936
 
937
- // Setting up often used Translations
938
- $title_i18n = __( 'Title', 'autodescription' );
939
- $description_i18n = __( 'Description', 'autodescription' );
940
- $home_page_i18n = __( 'Home Page', 'autodescription' );
 
 
 
 
 
941
 
942
- //* Get home page ID. If blog on front, it's 0.
943
- $home_id = $this->get_the_front_page_ID();
 
 
 
 
 
 
 
944
 
945
- $home_title = $this->escape_title( $this->get_option( 'homepage_title' ) );
 
 
 
 
 
 
 
 
946
 
947
- //* Get blog tagline
948
- $blog_description = $this->get_blogdescription();
949
-
950
- /**
951
- * Home Page Tagline settings.
952
- * @since 2.3.8
953
- *
954
- * @param string $home_tagline The tagline option.
955
- * @param string $home_tagline_placeholder The option placeholder. Always defaults to description.
956
- * @param string|void $home_tagline_value The tagline input value.
957
- * @param string $blog_description Override blog description with option if applicable.
958
- */
959
- $home_tagline = $this->get_field_value( 'homepage_title_tagline' );
960
- $home_tagline_placeholder = $blog_description;
961
- $home_tagline_value = $home_tagline ? $home_tagline : '';
962
- $blog_description = $home_tagline_value ? $home_tagline_value : $blog_description;
963
-
964
- /**
965
- * Create a placeholder for when there's no custom HomePage title found.
966
- * @since 2.2.4
967
- */
968
- $home_title_args = $this->generate_home_title( true, '', '', true, false );
969
- if ( $this->home_page_add_title_tagline() ) {
970
- $home_title_placeholder = $this->process_title_additions( $home_title_args['blogname'], $home_title_args['title'], $home_title_args['seplocation'] );
971
- } else {
972
- $home_title_placeholder = $home_title_args['title'];
973
- }
974
-
975
- /**
976
- * If the home title is fetched from the post, notify about that instead.
977
- * @since 2.2.4
978
- *
979
- * Nesting often used translations
980
- */
981
- if ( empty( $home_title ) && $page_on_front && $this->get_custom_field( '_genesis_title', $home_id ) ) {
982
- /* translators: 1: Option, 2: Page SEO Settings, 3: Home Page */
983
- $title_from_post_message = sprintf( __( 'Note: The %1$s is fetched from the %2$s on the %3$s.', 'autodescription' ), $title_i18n, __( 'Page SEO Settings', 'autodescription' ), $home_page_i18n );
984
- }
985
-
986
- /**
987
- * Check for options to calculate title length.
988
- *
989
- * @since 2.3.4
990
- */
991
- if ( $home_title ) {
992
- $home_title_args = $this->generate_home_title();
993
- $tit_len_pre = $this->process_title_additions( $home_title_args['title'], $home_title_args['blogname'], $home_title_args['seplocation'] );
994
- } else {
995
- $tit_len_pre = $home_title_placeholder;
996
- }
997
-
998
- //* Fetch the description from the home page.
999
- $frompost_description = $page_on_front ? $this->get_custom_field( '_genesis_description', $home_id ) : '';
1000
-
1001
- //* Fetch the HomePage Description option.
1002
- $home_description = $this->get_field_value( 'homepage_description' );
1003
-
1004
- /**
1005
- * Create a placeholder if there's no custom HomePage description found.
1006
- * @since 2.2.4
1007
- *
1008
- * Reworked. Always create a placeholder.
1009
- * @since 2.3.4
1010
- */
1011
- if ( $frompost_description ) {
1012
- $description_placeholder = $frompost_description;
1013
- } else {
1014
- $description_args = array(
1015
- 'id' => $home_id,
1016
- 'is_home' => true,
1017
- 'get_custom_field' => false
1018
- );
1019
-
1020
- $description_placeholder = $this->generate_description( '', $description_args );
1021
- }
1022
-
1023
- /**
1024
- * Checks if the home is blog, the Home Page Metabox description and
1025
- * the frompost description.
1026
- * @since 2.3.4
1027
- */
1028
- if ( empty( $home_description ) && $page_on_front && $frompost_description )
1029
- $home_description_frompost = true;
1030
-
1031
- /**
1032
- *
1033
- * If the HomePage Description empty, it will check for the InPost
1034
- * Description set on the Home Page. And it will set the InPost
1035
- * Description as placeholder.
1036
- *
1037
- * Nesting often used translations.
1038
- *
1039
- * Notify that the homepage is a blog.
1040
- * @since 2.2.2
1041
- */
1042
- if ( $home_description_frompost ) {
1043
- /* translators: 1: Option, 2: Page SEO Settings, 3: Home Page */
1044
- $description_from_post_message = sprintf( __( 'Note: The %1$s is fetched from the %2$s on the %3$s.', 'autodescription' ), $description_i18n, __( 'Page SEO Settings', 'autodescription' ), $home_page_i18n );
1045
- }
1046
-
1047
- $desc_len_pre = $home_description ? $home_description : $description_placeholder;
1048
-
1049
- /**
1050
- * Convert to what Google outputs.
1051
- *
1052
- * This will convert e.g. &raquo; to a single length character.
1053
- * @since 2.3.4
1054
- */
1055
- $tit_len = html_entity_decode( $this->escape_title( $tit_len_pre ) );
1056
- $desc_len = html_entity_decode( $this->escape_title( $desc_len_pre ) );
1057
-
1058
- ?>
1059
- <p>
1060
- <label for="<?php $this->field_id( 'homepage_title_tagline' ); ?>" class="toblock">
1061
- <strong><?php printf( __( 'Custom %s Title Tagline', 'autodescription' ), $home_page_i18n ); ?></strong>
1062
- </label>
1063
- </p>
1064
- <p>
1065
- <input type="text" name="<?php $this->field_name( 'homepage_title_tagline' ); ?>" class="large-text" id="<?php $this->field_id( 'homepage_title_tagline' ); ?>" placeholder="<?php echo $home_tagline_placeholder ?>" value="<?php echo esc_attr( $home_tagline_value ); ?>" />
1066
- </p>
1067
-
1068
- <hr>
1069
-
1070
- <p>
1071
- <label for="<?php $this->field_id( 'homepage_title' ); ?>" class="toblock">
1072
- <strong><?php printf( __( 'Custom %s Title', 'autodescription' ), $home_page_i18n ); ?></strong>
1073
- <a href="<?php echo esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#3' ); ?>" target="_blank" title="<?php _e( 'Recommended Length: 50 to 55 characters', 'autodescription' ) ?>">[?]</a>
1074
- <span class="description theseoframework-counter"><?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="' . $this->field_id( 'homepage_title', false ) . '_chars">'. mb_strlen( $tit_len ) .'</span>' ); ?></span>
1075
- </label>
1076
- </p>
1077
- <p id="autodescription-title-wrap">
1078
- <input type="text" name="<?php $this->field_name( 'homepage_title' ); ?>" class="large-text" id="<?php $this->field_id( 'homepage_title' ); ?>" placeholder="<?php echo $home_title_placeholder ?>" value="<?php echo esc_attr( $home_title ); ?>" />
1079
- <span id="autodescription-title-offset" class="hide-if-no-js"></span><span id="autodescription-title-placeholder" class="hide-if-no-js"></span>
1080
- </p>
1081
- <?php
1082
- if ( $title_from_post_message ) {
1083
- echo '<p class="description">' . $title_from_post_message . '</p>';
1084
- }
1085
- ?>
1086
- <hr>
1087
-
1088
- <p>
1089
- <label for="<?php $this->field_id( 'homepage_description' ); ?>" class="toblock">
1090
- <strong><?php printf( __( 'Custom %s Description', 'autodescription' ), $home_page_i18n ); ?></strong>
1091
- <a href="<?php echo esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#1' ); ?>" target="_blank" title="<?php _e( 'Recommended Length: 145 to 155 characters', 'autodescription' ) ?>">[?]</a>
1092
- <span class="description theseoframework-counter"><?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="' . $this->field_id( 'homepage_description', false ) . '_chars">'. mb_strlen( $desc_len ) .'</span>' ); ?></span>
1093
- </label>
1094
- </p>
1095
- <p>
1096
- <textarea name="<?php $this->field_name( 'homepage_description' ); ?>" class="large-text" id="<?php $this->field_id( 'homepage_description' ); ?>" rows="3" cols="70" placeholder="<?php echo $description_placeholder ?>"><?php echo esc_textarea( $home_description ); ?></textarea>
1097
- </p>
1098
- <p class="description">
1099
- <?php _e( 'The meta description can be used to determine the text used under the title on Search Engine results pages.', 'autodescription' ); ?>
1100
- </p>
1101
- <?php
1102
- if ( $description_from_post_message ) {
1103
- echo '<p class="description">' . $description_from_post_message . '</p>';
1104
- }
1105
-
1106
- }
1107
-
1108
- /**
1109
- * HomePage Metabox Additions Tab Output
1110
- *
1111
- * @since 2.6.0
1112
- *
1113
- * @see $this->homepage_metabox() Callback for HomePage Settings box.
1114
- */
1115
- public function homepage_metabox_additions() {
1116
-
1117
- $home_page_i18n = __( 'Home Page', 'autodescription' );
1118
-
1119
- /**
1120
- * Generate example for Title Additions Location.
1121
- */
1122
- $title_args = $this->generate_home_title();
1123
-
1124
- //* I know, brilliant.
1125
- $title = $title_args['title'];
1126
- $blogname = $title_args['blogname'];
1127
-
1128
- // Get title separator
1129
- $sep = $this->get_separator( 'title', true );
1130
-
1131
- /**
1132
- * Generate Examples for both left and right seplocations.
1133
- */
1134
- $example_left = '<em><span class="custom-title-js">' . esc_attr( $title ) . '</span><span class="custom-blogname-js"><span class="autodescription-sep-js"> ' . esc_attr( $sep ) . ' </span><span class="custom-tagline-js">' . esc_attr( $blogname ) . '</span></span></span>' . '</em>';
1135
- $example_right = '<em>' . '<span class="custom-blogname-js"><span class="custom-tagline-js">' . esc_attr( $blogname ) . '</span><span class="autodescription-sep-js"> ' . esc_attr( $sep ) . ' </span></span><span class="custom-title-js">' . esc_attr( $title ) . '</span></em>';
1136
-
1137
- ?>
1138
- <fieldset>
1139
- <legend><h4><?php _e( 'Document Title Additions Location', 'autodescription' ); ?></h4></legend>
1140
- <p>
1141
- <span class="description"><?php _e( 'Determines which side the added title text will go on.', 'autodescription' ); ?></span>
1142
- </p>
1143
-
1144
- <p id="home-title-location" class="theseoframework-fields">
1145
- <span class="toblock">
1146
- <input type="radio" name="<?php $this->field_name( 'home_title_location' ); ?>" id="<?php $this->field_id( 'home_title_location_left' ); ?>" value="left" <?php checked( $this->get_field_value( 'home_title_location' ), 'left' ); ?> />
1147
- <label for="<?php $this->field_id( 'home_title_location_left' ); ?>">
1148
- <span><?php _e( 'Left:', 'autodescription' ); ?></span>
1149
- <?php echo ( $example_left ) ? $this->code_wrap_noesc( $example_left ) : ''; ?>
1150
- </label>
1151
- </span>
1152
- <span class="toblock">
1153
- <input type="radio" name="<?php $this->field_name( 'home_title_location' ); ?>" id="<?php $this->field_id( 'home_title_location_right' ); ?>" value="right" <?php checked( $this->get_field_value( 'home_title_location' ), 'right' ); ?> />
1154
- <label for="<?php $this->field_id( 'home_title_location_right' ); ?>">
1155
- <span><?php _e( 'Right:', 'autodescription' ); ?></span>
1156
- <?php echo ( $example_right ) ? $this->code_wrap_noesc( $example_right ) : ''; ?>
1157
- </label>
1158
- </span>
1159
- </p>
1160
- </fieldset>
1161
-
1162
- <hr>
1163
- <?php
1164
- /**
1165
- * @TODO work on this checkbox.
1166
- * @priority low 2.6.x
1167
- */
1168
- ?>
1169
- <h4><?php printf( __( '%s Tagline', 'autodescription' ), $home_page_i18n ); ?></h4>
1170
- <p id="title-tagline-toggle">
1171
- <label for="<?php $this->field_id( 'homepage_tagline' ); ?>" class="toblock">
1172
- <input type="checkbox" name="<?php $this->field_name( 'homepage_tagline' ); ?>" id="<?php $this->field_id( 'homepage_tagline' ); ?>" <?php $this->is_conditional_checked( 'homepage_tagline' ); ?> value="1" <?php checked( $this->get_field_value( 'homepage_tagline' ) ); ?> />
1173
- <?php printf( __( 'Add site description (tagline) to the Title on the %s?', 'autodescription' ), $home_page_i18n ); ?>
1174
- </label>
1175
- </p>
1176
- <?php
1177
- }
1178
-
1179
- /**
1180
- * HomePage Metabox Robots Tab Output
1181
- *
1182
- * @since 2.6.0
1183
- *
1184
- * @see $this->homepage_metabox() Callback for HomePage Settings box.
1185
- */
1186
- public function homepage_metabox_robots() {
1187
-
1188
- $home_page_i18n = __( 'Home Page', 'autodescription' );
1189
- $language = $this->google_language();
1190
-
1191
- //* Get home page ID. If blog on front, it's 0.
1192
- $home_id = $this->get_the_front_page_ID();
1193
-
1194
- $noindex_post = $this->get_custom_field( '_genesis_noindex', $home_id );
1195
- $nofollow_post = $this->get_custom_field( '_genesis_nofollow', $home_id );
1196
- $noarchive_post = $this->get_custom_field( '_genesis_noarchive', $home_id );
1197
-
1198
- /**
1199
- * Shows user that the setting is checked on the home page.
1200
- * Adds starting - with space to maintain readability.
1201
- *
1202
- * @since 2.2.4
1203
- */
1204
- if ( $noindex_post || $nofollow_post || $noarchive_post ) {
1205
- $checked_home = ' - <a href="' . esc_url( admin_url( 'post.php?post=' . $home_id . '&action=edit#theseoframework-inpost-box' ) ) . '" target="_blank" class="attention" title="' . __( 'View Home Page Settings', 'autodescription' ) . '" >' . __( 'Checked in Page', 'autodescription' ) . '</a>';
1206
- } else {
1207
- $checked_home = '';
1208
- }
1209
-
1210
- ?>
1211
- <h4><?php _e( 'Home Page Robots Meta Settings', 'autodescription' ); ?></h4>
1212
- <?php
1213
-
1214
- $noindex_note = $noindex_post ? $checked_home : '';
1215
- $nofollow_note = $nofollow_post ? $checked_home : '';
1216
- $noarchive_note = $noarchive_post ? $checked_home : '';
1217
-
1218
- /* translators: 1: Option, 2: Location */
1219
- $i_label = sprintf( __( 'Apply %1$s to the %2$s?', 'autodescription' ), $this->code_wrap( 'noindex' ), $home_page_i18n );
1220
- $i_label .= ' ';
1221
- $i_label .= $this->make_info(
1222
- __( 'Tell Search Engines not to show this page in their search results', 'autodescription' ),
1223
- 'https://support.google.com/webmasters/answer/93710?hl=' . $language,
1224
- false
1225
- )
1226
- . $noindex_note;
1227
-
1228
- /* translators: 1: Option, 2: Location */
1229
- $f_label = sprintf( __( 'Apply %1$s to the %2$s?', 'autodescription' ), $this->code_wrap( 'nofollow' ), $home_page_i18n );
1230
- $f_label .= ' ';
1231
- $f_label .= $this->make_info(
1232
- __( 'Tell Search Engines not to follow links on this page', 'autodescription' ),
1233
- 'https://support.google.com/webmasters/answer/96569?hl=' . $language,
1234
- false
1235
- )
1236
- . $nofollow_note;
1237
-
1238
- /* translators: 1: Option, 2: Location */
1239
- $a_label = sprintf( __( 'Apply %1$s to the %2$s?', 'autodescription' ), $this->code_wrap( 'noarchive' ), $home_page_i18n );
1240
- $a_label .= ' ';
1241
- $a_label .= $this->make_info(
1242
- __( 'Tell Search Engines not to save a cached copy of this page', 'autodescription' ),
1243
- 'https://support.google.com/webmasters/answer/79812?hl=' . $language,
1244
- false
1245
- )
1246
- . $noarchive_note;
1247
-
1248
- //* Echo checkboxes.
1249
- $this->wrap_fields(
1250
- array(
1251
- $this->make_checkbox(
1252
- 'homepage_noindex',
1253
- $i_label,
1254
- ''
1255
- ),
1256
- $this->make_checkbox(
1257
- 'homepage_nofollow',
1258
- $f_label,
1259
- ''
1260
- ),
1261
- $this->make_checkbox(
1262
- 'homepage_noarchive',
1263
- $a_label,
1264
- ''
1265
- ),
1266
- ),
1267
- true
1268
- );
1269
-
1270
- // Add notice if any options are checked on the post.
1271
- if ( $noindex_post || $nofollow_post || $noarchive_post ) {
1272
- ?><p class="description"><?php printf( __( 'Note: If any of these options are unchecked, but are checked on the Home Page, they will be outputted regardless.', 'autodescription' ) ); ?></p><?php
1273
- }
1274
- ?>
1275
-
1276
- <hr>
1277
-
1278
- <h4><?php _e( 'Home Page Pagination Robots Settings', 'autodescription' ); ?></h4>
1279
-
1280
- <p class="description"><?php _e( "If your Home Page is paginated and outputs content that's also found elsewhere on the website, enabling this option might prevent duplicate content.", 'autodescription' ); ?></p>
1281
-
1282
- <?php
1283
- //* Echo checkbox.
1284
- $this->wrap_fields(
1285
- $this->make_checkbox(
1286
- 'home_paged_noindex',
1287
- /* translators: 1: Option, 2: Location */
1288
- sprintf( __( 'Apply %1$s to every second or later page on the %2$s?', 'autodescription' ), $this->code_wrap( 'noindex' ), $home_page_i18n ),
1289
- ''
1290
- ),
1291
- true
1292
- );
1293
-
1294
- }
1295
-
1296
- /**
1297
- * Social meta box on the Site SEO Settings page.
1298
- *
1299
- * @since 2.2.2
1300
- *
1301
- * @uses $this->social_metabox_general_tab()
1302
- * @uses $this->social_metabox_facebook_tab()
1303
- * @uses $this->social_metabox_twitter_tab()
1304
- *
1305
- * @applies filter 'social_settings_tabs'
1306
- *
1307
- * @param array $args the social tabs arguments
1308
- */
1309
- public function social_metabox( $args = array() ) {
1310
-
1311
- do_action( 'the_seo_framework_social_metabox_before' );
1312
-
1313
- /**
1314
- * Parse tabs content
1315
- *
1316
- * @param array $default_tabs { 'id' = The identifier =>
1317
- * array(
1318
- * 'name' => The name
1319
- * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
1320
- * 'dashicon' => Desired dashicon
1321
- * )
1322
- * }
1323
- *
1324
- * @since 2.2.2
1325
- */
1326
- $default_tabs = array(
1327
- 'general' => array(
1328
- 'name' => __( 'General', 'autodescription' ),
1329
- 'callback' => array( $this, 'social_metabox_general_tab' ),
1330
- 'dashicon' => 'admin-generic',
1331
- ),
1332
- 'facebook' => array(
1333
- 'name' => 'Facebook',
1334
- 'callback' => array( $this, 'social_metabox_facebook_tab' ),
1335
- 'dashicon' => 'facebook-alt',
1336
- ),
1337
- 'twitter' => array(
1338
- 'name' => 'Twitter',
1339
- 'callback' => array( $this, 'social_metabox_twitter_tab' ),
1340
- 'dashicon' => 'twitter',
1341
- ),
1342
- 'postdates' => array(
1343
- 'name' => __( 'Post Dates', 'autodescription' ),
1344
- 'callback' => array( $this, 'social_metabox_postdates_tab' ),
1345
- 'dashicon' => 'backup',
1346
- ),
1347
- 'relationships' => array(
1348
- 'name' => __( 'Link Relationships', 'autodescription' ),
1349
- 'callback' => array( $this, 'social_metabox_relationships_tab' ),
1350
- 'dashicon' => 'leftright',
1351
- ),
1352
- );
1353
-
1354
- /**
1355
- * Applies filters the_seo_framework_social_settings_tabs : array see $default_tabs
1356
- *
1357
- * Used to extend Social tabs
1358
- */
1359
- $defaults = (array) apply_filters( 'the_seo_framework_social_settings_tabs', $default_tabs, $args );
1360
-
1361
- $tabs = wp_parse_args( $args, $defaults );
1362
-
1363
- $this->nav_tab_wrapper( 'social', $tabs, '2.2.2' );
1364
-
1365
- do_action( 'the_seo_framework_social_metabox_after' );
1366
-
1367
- }
1368
-
1369
- /**
1370
- * Social Metabox General Tab output
1371
- *
1372
- * @since 2.2.2
1373
- *
1374
- * @see $this->social_metabox() Callback for Social Settings box.
1375
- */
1376
- protected function social_metabox_general_tab() {
1377
-
1378
- ?>
1379
- <h4><?php _e( 'Site Shortlink Settings', 'autodescription' ); ?></h4>
1380
- <p class="description"><?php printf( __( 'The shortlink tag might have some use for 3rd party service discoverability, but it has little to no SEO value whatsoever.', 'autodescription' ) ); ?></p>
1381
- <?php
1382
-
1383
- //* Echo checkboxes.
1384
- $this->wrap_fields(
1385
- $this->make_checkbox(
1386
- 'shortlink_tag',
1387
- __( 'Output shortlink tag?', 'autodescription' ),
1388
- ''
1389
- ),
1390
- true
1391
- );
1392
-
1393
- ?>
1394
- <hr>
1395
-
1396
- <h4><?php _e( 'Social Meta Tags Settings', 'autodescription' ); ?></h4>
1397
- <p class="description"><?php _e( 'Output various meta tags for social site integration, among other 3rd party services.', 'autodescription' ); ?></p>
1398
-
1399
- <hr>
1400
- <?php
1401
-
1402
- //* Echo Open Graph Tags checkboxes.
1403
- $this->wrap_fields(
1404
- $this->make_checkbox(
1405
- 'og_tags',
1406
- __( 'Output Open Graph meta tags?', 'autodescription' ),
1407
- __( 'Facebook, Twitter, Pinterest and many other social sites make use of these tags.', 'autodescription' )
1408
- ),
1409
- true
1410
- );
1411
-
1412
- if ( $this->detect_og_plugin() )
1413
- echo '<p class="description">' . __( 'Note: Another Open Graph plugin has been detected.', 'autodescription' ) . '</p>';
1414
-
1415
- ?><hr><?php
1416
-
1417
- //* Echo Facebook Tags checkbox.
1418
- $this->wrap_fields(
1419
- $this->make_checkbox(
1420
- 'facebook_tags',
1421
- __( 'Output Facebook meta tags?', 'autodescription' ),
1422
- sprintf( __( 'Output various tags targetted at %s.', 'autodescription' ), 'Facebook' )
1423
- ),
1424
- true
1425
- );
1426
-
1427
- ?><hr><?php
1428
-
1429
- //* Echo Twitter Tags checkboxes.
1430
- $this->wrap_fields(
1431
- $this->make_checkbox(
1432
- 'twitter_tags',
1433
- __( 'Output Twitter meta tags?', 'autodescription' ),
1434
- sprintf( __( 'Output various tags targetted at %s.', 'autodescription' ), 'Twitter' )
1435
- ),
1436
- true
1437
- );
1438
-
1439
- if ( $this->detect_twitter_card_plugin() )
1440
- echo '<p class="description">' . __( 'Note: Another Twitter Card plugin has been detected.', 'autodescription' ) . '</p>';
1441
-
1442
- }
1443
-
1444
- /**
1445
- * Social Metabox Facebook Tab Output
1446
- *
1447
- * @since 2.2.2
1448
- *
1449
- * @see $this->social_metabox() Callback for Social Settings box.
1450
- */
1451
- protected function social_metabox_facebook_tab() {
1452
-
1453
- $fb_author = $this->get_field_value( 'facebook_author' );
1454
- $fb_author_placeholder = empty( $fb_publisher ) ? _x( 'http://www.facebook.com/YourPersonalProfile', 'Example Facebook Personal URL', 'autodescription' ) : '';
1455
-
1456
- $fb_publisher = $this->get_field_value( 'facebook_publisher' );
1457
- $fb_publisher_placeholder = empty( $fb_publisher ) ? _x( 'http://www.facebook.com/YourVerifiedBusinessProfile', 'Example Verified Facebook Business URL', 'autodescription' ) : '';
1458
-
1459
- $fb_appid = $this->get_field_value( 'facebook_appid' );
1460
- $fb_appid_placeholder = empty( $fb_appid ) ? '123456789012345' : '';
1461
-
1462
- ?>
1463
- <h4><?php _e( 'Default Facebook Integration Settings', 'autodescription' ); ?></h4>
1464
- <p class="description"><?php _e( 'Facebook post sharing works mostly through Open Graph. However, you can also link your Business and Personal Facebook pages, among various other options.', 'autodescription' ); ?></p>
1465
- <p class="description"><?php _e( 'When these options are filled in, Facebook might link your Facebook profile to be followed and liked when your post or page is shared.', 'autodescription' ); ?></p>
1466
-
1467
- <hr>
1468
-
1469
- <p>
1470
- <label for="<?php $this->field_id( 'facebook_author' ); ?>">
1471
- <strong><?php _e( 'Article Author Facebook URL', 'autodescription' ); ?></strong>
1472
- <a href="<?php echo esc_url( 'https://facebook.com/me' ); ?>" class="description" target="_blank" title="<?php _e( 'Your Facebook Profile', 'autodescription' ); ?>">[?]</a>
1473
- </label>
1474
- </p>
1475
- <p>
1476
- <input type="text" name="<?php $this->field_name( 'facebook_author' ); ?>" class="large-text" id="<?php $this->field_id( 'facebook_author' ); ?>" placeholder="<?php echo $fb_author_placeholder ?>" value="<?php echo esc_attr( $fb_author ); ?>" />
1477
- </p>
1478
-
1479
- <p>
1480
- <label for="<?php $this->field_id( 'facebook_publisher' ); ?>">
1481
- <strong><?php _e( 'Article Publisher Facebook URL', 'autodescription' ); ?></strong>
1482
- <a href="<?php echo esc_url( 'https://instantarticles.fb.com/' ); ?>" class="description" target="_blank" title="<?php _e( 'To use this, you need to be a verified business', 'autodescription' ); ?>">[?]</a>
1483
- </label>
1484
- </p>
1485
- <p>
1486
- <input type="text" name="<?php $this->field_name( 'facebook_publisher' ); ?>" class="large-text" id="<?php $this->field_id( 'facebook_publisher' ); ?>" placeholder="<?php echo $fb_publisher_placeholder ?>" value="<?php echo esc_attr( $fb_publisher ); ?>" />
1487
- </p>
1488
-
1489
- <p>
1490
- <label for="<?php $this->field_id( 'facebook_appid' ); ?>">
1491
- <strong><?php _e( 'Facebook App ID', 'autodescription' ); ?></strong>
1492
- <a href="<?php echo esc_url( 'https://developers.facebook.com/apps' ); ?>" target="_blank" class="description" title="<?php _e( 'Get Facebook App ID', 'autodescription' ); ?>">[?]</a>
1493
- </label>
1494
- </p>
1495
- <p>
1496
- <input type="text" name="<?php $this->field_name( 'facebook_appid' ); ?>" class="large-text" id="<?php $this->field_id( 'facebook_appid' ); ?>" placeholder="<?php echo $fb_appid_placeholder ?>" value="<?php echo esc_attr( $fb_appid ); ?>" />
1497
- </p>
1498
- <?php
1499
-
1500
- }
1501
-
1502
- /**
1503
- * Social Metabox Twitter Tab Output
1504
- *
1505
- * @since 2.2.2
1506
- *
1507
- * @see $this->social_metabox() Callback for Social Settings box.
1508
- */
1509
- protected function social_metabox_twitter_tab() {
1510
-
1511
- $tw_site = $this->get_field_value( 'twitter_site' );
1512
- $tw_site_placeholder = empty( $tw_site ) ? _x( '@your-site-username', 'Twitter @username', 'autodescription' ) : '';
1513
-
1514
- $tw_creator = $this->get_field_value( 'twitter_creator' );
1515
- $tw_creator_placeholder = empty( $tw_creator ) ? _x( '@your-personal-username', 'Twitter @username', 'autodescription' ) : '';
1516
-
1517
- $twitter_card = $this->get_twitter_card_types();
1518
-
1519
- ?>
1520
- <h4><?php _e( 'Default Twitter Integration Settings', 'autodescription' ); ?></h4>
1521
- <p class="description"><?php printf( __( 'Twitter post sharing works mostly through Open Graph. However, you can also link your Business and Personal Twitter pages, among various other options.', 'autodescription' ) ); ?></p>
1522
-
1523
- <hr>
1524
-
1525
- <fieldset id="twitter-cards">
1526
- <legend><h4><?php _e( 'Twitter Card Type', 'autodescription' ); ?></h4></legend>
1527
- <p class="description"><?php printf( __( 'What kind of Twitter card would you like to use? It will default to %s if no image is found.', 'autodescription' ), $this->code_wrap( 'Summary' ) ); ?></p>
1528
-
1529
- <p class="theseoframework-fields">
1530
- <?php
1531
- foreach ( $twitter_card as $type => $name ) {
1532
- ?>
1533
- <span class="toblock">
1534
- <input type="radio" name="<?php $this->field_name( 'twitter_card' ); ?>" id="<?php $this->field_id( 'twitter_card_' . $type ); ?>" value="<?php echo $type ?>" <?php checked( $this->get_field_value( 'twitter_card' ), $type ); ?> />
1535
- <label for="<?php $this->field_id( 'twitter_card_' . $type ); ?>">
1536
- <span><?php echo $this->code_wrap( ucfirst( $name ) ); ?></span>
1537
- <a class="description" href="<?php echo esc_url('https://dev.twitter.com/cards/types/' . $name ); ?>" target="_blank" title="Twitter Card <?php echo ucfirst( $name ) . ' ' . __( 'Example', 'autodescription' ); ?>"><?php _e( 'Example', 'autodescription' ); ?></a>
1538
- </label>
1539
- </span>
1540
- <?php
1541
- }
1542
- ?>
1543
- </p>
1544
- </fieldset>
1545
-
1546
- <hr>
1547
-
1548
- <p class="description"><?php printf( __( 'When the following options are filled in, Twitter might link your Twitter Site or Personal Profile when your post or page is shared.', 'autodescription' ) ); ?></p>
1549
- <p>
1550
- <label for="<?php $this->field_id( 'twitter_site' ); ?>" class="toblock">
1551
- <strong><?php _e( "Your Website's Twitter Profile", 'autodescription' ); ?></strong>
1552
- <a href="<?php echo esc_url( 'https://twitter.com/home' ); ?>" target="_blank" class="description" title="<?php _e( 'Find your @username', 'autodescription' ); ?>">[?]</a>
1553
- </label>
1554
- </p>
1555
- <p>
1556
- <input type="text" name="<?php $this->field_name( 'twitter_site' ); ?>" class="large-text" id="<?php $this->field_id( 'twitter_site' ); ?>" placeholder="<?php echo $tw_site_placeholder ?>" value="<?php echo esc_attr( $tw_site ); ?>" />
1557
- </p>
1558
-
1559
- <p>
1560
- <label for="<?php $this->field_id( 'twitter_creator' ); ?>" class="toblock">
1561
- <strong><?php _e( 'Your Personal Twitter Profile', 'autodescription' ); ?></strong>
1562
- <a href="<?php echo esc_url( 'https://twitter.com/home' ); ?>" target="_blank" class="description" title="<?php _e( 'Find your @username', 'autodescription' ); ?>">[?]</a>
1563
- </label>
1564
- </p>
1565
- <p>
1566
- <input type="text" name="<?php $this->field_name( 'twitter_creator' ); ?>" class="large-text" id="<?php $this->field_id( 'twitter_creator' ); ?>" placeholder="<?php echo $tw_creator_placeholder ?>" value="<?php echo esc_attr( $tw_creator ); ?>" />
1567
- </p>
1568
- <?php
1569
-
1570
- }
1571
-
1572
- /**
1573
- * Social Metabox PostDates Tab Output
1574
- *
1575
- * @since 2.2.4
1576
- *
1577
- * @see $this->social_metabox() Callback for Social Settings box.
1578
- */
1579
- public function social_metabox_postdates_tab() {
1580
-
1581
- $pages_i18n = __( 'Pages', 'autodescription' );
1582
- $posts_i18n = __( 'Posts', 'autodescription' );
1583
- $home_i18n = __( 'Home Page', 'autodescription' );
1584
-
1585
- ?>
1586
- <h4><?php _e( 'Post Date Settings', 'autodescription' ); ?></h4>
1587
- <p class="description"><?php _e( "Some Search Engines output the publishing date and modified date next to the search results. These help Search Engines find new content and could impact the SEO value.", 'autodescription' ); ?></p>
1588
- <p class="description"><?php _e( "It's recommended on posts, but it's not recommended on pages unless you modify or create new pages frequently.", 'autodescription' ); ?></p>
1589
-
1590
- <?php
1591
- /* translators: 1: Option, 2: Post Type */
1592
- $post_publish_time_label = sprintf( __( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:published_time' ), $posts_i18n );
1593
- $post_publish_time_checkbox = $this->make_checkbox( 'post_publish_time', $post_publish_time_label, '' );
1594
-
1595
- /* translators: 1: Option, 2: Post Type */
1596
- $page_publish_time_label = sprintf( __( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:published_time' ), $pages_i18n );
1597
- $page_publish_time_checkbox = $this->make_checkbox( 'page_publish_time', $page_publish_time_label, '' );
1598
-
1599
- //* Echo checkboxes.
1600
- echo $this->wrap_fields( $post_publish_time_checkbox . $page_publish_time_checkbox );
1601
-
1602
- /* translators: 1: Option, 2: Post Type */
1603
- $post_modify_time_label = sprintf( __( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:modified_time' ), $posts_i18n );
1604
- $post_modify_time_checkbox = $this->make_checkbox( 'post_modify_time', $post_modify_time_label, '' );
1605
-
1606
- /* translators: 1: Option, 2: Post Type */
1607
- $page_modify_time_label = sprintf( __( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:modified_time' ), $pages_i18n );
1608
- $page_modify_time_checkbox = $this->make_checkbox( 'page_modify_time', $page_modify_time_label, '' );
1609
-
1610
- //* Echo checkboxes.
1611
- echo $this->wrap_fields( $post_modify_time_checkbox . $page_modify_time_checkbox );
1612
- ?>
1613
-
1614
- <hr>
1615
-
1616
- <h4><?php _e( 'Home Page', 'autodescription' ); ?></h4>
1617
- <p class="description"><?php _e( "Because you only publish the Home Page once, Search Engines might think your website is outdated. This can be prevented by disabling the following options.", 'autodescription' ); ?></p>
1618
-
1619
- <?php
1620
- /* translators: 1: Option, 2: Post Type */
1621
- $home_publish_time_label = sprintf( __( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:published_time' ), $home_i18n );
1622
- $home_publish_time_checkbox = $this->make_checkbox( 'home_publish_time', $home_publish_time_label, '' );
1623
-
1624
- /* translators: 1: Option, 2: Post Type */
1625
- $home_modify_time_label = sprintf( __( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:modified_time' ), $home_i18n );
1626
- $home_modify_time_checkbox = $this->make_checkbox( 'home_modify_time', $home_modify_time_label, '' );
1627
-
1628
- //* Echo checkboxes.
1629
- echo $this->wrap_fields( $home_publish_time_checkbox . $home_modify_time_checkbox );
1630
-
1631
- }
1632
-
1633
- /**
1634
- * Social Metabox Relationships Tab Output
1635
- *
1636
- * @since 2.2.4
1637
- *
1638
- * @see $this->social_metabox() Callback for Social Settings box.
1639
- */
1640
- public function social_metabox_relationships_tab() {
1641
-
1642
- ?>
1643
- <h4><?php _e( 'Link Relationship Settings', 'autodescription' ); ?></h4>
1644
- <p class="description"><?php _e( "Some Search Engines look for relations between the content of your pages. If you have multiple pages for a single Post or Page, or have archives indexed, this option will help Search Engines look for the right page to display in the Search Results.", 'autodescription' ); ?></p>
1645
- <p class="description"><?php _e( "It's recommended to turn this option on for better SEO consistency and to prevent duplicate content errors.", 'autodescription' ); ?></p>
1646
-
1647
- <hr>
1648
- <?php
1649
- /* translators: %s = <code>rel</code> */
1650
- $prev_next_posts_label = sprintf( __( 'Add %s link tags to Posts and Pages?', 'autodescription' ), $this->code_wrap( 'rel' ) );
1651
- $prev_next_posts_checkbox = $this->make_checkbox( 'prev_next_posts', $prev_next_posts_label, '' );
1652
-
1653
- /* translators: %s = <code>rel</code> */
1654
- $prev_next_archives_label = sprintf( __( 'Add %s link tags to Archives?', 'autodescription' ), $this->code_wrap( 'rel' ) );
1655
- $prev_next_archives_checkbox = $this->make_checkbox( 'prev_next_archives', $prev_next_archives_label, '' );
1656
-
1657
- /* translators: %s = <code>rel</code> */
1658
- $prev_next_frontpage_label = sprintf( __( 'Add %s link tags to the Home Page?', 'autodescription' ), $this->code_wrap( 'rel' ) );
1659
- $prev_next_frontpage_checkbox = $this->make_checkbox( 'prev_next_frontpage', $prev_next_frontpage_label, '' );
1660
-
1661
- //* Echo checkboxes.
1662
- echo $this->wrap_fields( $prev_next_posts_checkbox . $prev_next_archives_checkbox . $prev_next_frontpage_checkbox );
1663
-
1664
- }
1665
-
1666
- /**
1667
- * Webmaster meta box on the Site SEO Settings page.
1668
- *
1669
- * @since 2.2.4
1670
- */
1671
- public function webmaster_metabox() {
1672
-
1673
- do_action( 'the_seo_framework_webmaster_metabox_before' );
1674
-
1675
- $site_url = $this->the_home_url_from_cache();
1676
- $language = $this->google_language();
1677
-
1678
- $bing_site_url = "https://www.bing.com/webmaster/configure/verify/ownership?url=" . urlencode( $site_url );
1679
- $google_site_url = "https://www.google.com/webmasters/verification/verification?hl=" . $language . "&siteUrl=" . $site_url;
1680
- $pint_site_url = "https://analytics.pinterest.com/";
1681
- $yandex_site_url = "https://webmaster.yandex.com/site/verification.xml";
1682
-
1683
- ?>
1684
- <h4><?php _e( 'Webmaster Integration Settings', 'autodescription' ); ?></h4>
1685
- <p class="description"><?php _e( "When adding your website to Google, Bing and other Webmaster Tools, you'll be asked to add a code or file to your website for verification purposes. These options will help you easily integrate those codes.", 'autodescription' ); ?></p>
1686
- <p class="description"><?php _e( "Verifying your website has no SEO value whatsoever. But you might gain added benefits such as search ranking insights to help you improve your website's content.", 'autodescription' ); ?></p>
1687
-
1688
- <hr>
1689
-
1690
- <p>
1691
- <label for="<?php $this->field_id( 'google_verification' ); ?>" class="toblock">
1692
- <strong><?php _e( "Google Webmaster Verification Code", 'autodescription' ); ?></strong>
1693
- <a href="<?php echo esc_url( $google_site_url ); ?>" target="_blank" class="description" title="<?php _e( 'Get the Google Verification code', 'autodescription' ); ?>">[?]</a>
1694
- </label>
1695
- </p>
1696
- <p>
1697
- <input type="text" name="<?php $this->field_name( 'google_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'google_verification' ); ?>" placeholder="ABC1d2eFg34H5iJ6klmNOp7qRstUvWXyZaBc8dEfG9" value="<?php echo esc_attr( $this->get_field_value( 'google_verification' ) ); ?>" />
1698
- </p>
1699
-
1700
- <p>
1701
- <label for="<?php $this->field_id( 'bing_verification' ); ?>" class="toblock">
1702
- <strong><?php _e( "Bing Webmaster Verification Code", 'autodescription' ); ?></strong>
1703
- <a href="<?php echo esc_url( $bing_site_url ); ?>" target="_blank" class="description" title="<?php _e( 'Get the Bing Verification Code', 'autodescription' ); ?>">[?]</a>
1704
- </label>
1705
- </p>
1706
- <p>
1707
- <input type="text" name="<?php $this->field_name( 'bing_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'bing_verification' ); ?>" placeholder="123A456B78901C2D3456E7890F1A234D" value="<?php echo esc_attr( $this->get_field_value( 'bing_verification' ) ); ?>" />
1708
- </p>
1709
-
1710
- <p>
1711
- <label for="<?php $this->field_id( 'yandex_verification' ); ?>" class="toblock">
1712
- <strong><?php _e( "Yandex Webmaster Verification Code", 'autodescription' ); ?></strong>
1713
- <a href="<?php echo esc_url( $yandex_site_url ); ?>" target="_blank" class="description" title="<?php _e( 'Get the Yandex Verification Code', 'autodescription' ); ?>">[?]</a>
1714
- </label>
1715
- </p>
1716
- <p>
1717
- <input type="text" name="<?php $this->field_name( 'yandex_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'yandex_verification' ); ?>" placeholder="12345abc678901d2" value="<?php echo esc_attr( $this->get_field_value( 'yandex_verification' ) ); ?>" />
1718
- </p>
1719
-
1720
- <p>
1721
- <label for="<?php $this->field_id( 'pint_verification' ); ?>" class="toblock">
1722
- <strong><?php _e( "Pinterest Analytics Verification Code", 'autodescription' ); ?></strong>
1723
- <a href="<?php echo esc_url( $pint_site_url ); ?>" target="_blank" class="description" title="<?php _e( 'Get the Pinterest Verification Code', 'autodescription' ); ?>">[?]</a>
1724
- </label>
1725
- </p>
1726
- <p>
1727
- <input type="text" name="<?php $this->field_name( 'pint_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'pint_verification' ); ?>" placeholder="123456a7b8901de2fa34bcdef5a67b98" value="<?php echo esc_attr( $this->get_field_value( 'pint_verification' ) ); ?>" />
1728
- </p>
1729
- <?php
1730
-
1731
- do_action( 'the_seo_framework_webmaster_metabox_after' );
1732
-
1733
- }
1734
 
1735
  /**
1736
  * Knowlegde Graph metabox on the Site SEO Settings page.
1737
  *
1738
  * @since 2.2.8
1739
  *
1740
- * @see $this->knowledge_metabox() Callback for Social Settings box.
 
1741
  */
1742
- public function knowledge_metabox( $args = array() ) {
1743
-
1744
  do_action( 'the_seo_framework_knowledge_metabox_before' );
1745
-
1746
- /**
1747
- * Parse tabs content
1748
- *
1749
- * @param array $default_tabs { 'id' = The identifier =>
1750
- * array(
1751
- * 'name' => The name
1752
- * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
1753
- * 'dashicon' => Desired dashicon
1754
- * )
1755
- * }
1756
- *
1757
- * @since 2.2.8
1758
- */
1759
- $default_tabs = array(
1760
- 'general' => array(
1761
- 'name' => __( 'General', 'autodescription' ),
1762
- 'callback' => array( $this, 'knowledge_metabox_general_tab' ),
1763
- 'dashicon' => 'admin-generic',
1764
- ),
1765
- 'website' => array(
1766
- 'name' => __( 'Website', 'autodescription' ),
1767
- 'callback' => array( $this, 'knowledge_metabox_about_tab' ),
1768
- 'dashicon' => 'admin-home',
1769
- ),
1770
- 'social' => array(
1771
- 'name' => 'Social Sites',
1772
- 'callback' => array( $this, 'knowledge_metabox_social_tab' ),
1773
- 'dashicon' => 'networking',
1774
- ),
1775
- );
1776
-
1777
- /**
1778
- * Applies filter knowledgegraph_settings_tabs : Array see $default_tabs
1779
- *
1780
- * Used to extend Knowledge Graph tabs
1781
- */
1782
- $defaults = (array) apply_filters( 'the_seo_framework_knowledgegraph_settings_tabs', $default_tabs, $args );
1783
-
1784
- $tabs = wp_parse_args( $args, $defaults );
1785
-
1786
- $this->nav_tab_wrapper( 'knowledge', $tabs, '2.2.8' );
1787
-
1788
  do_action( 'the_seo_framework_knowledge_metabox_after' );
1789
-
1790
  }
1791
 
1792
  /**
1793
- * Knowledge Graph Metabox General Tab Output
1794
  *
1795
  * @since 2.2.8
1796
- *
1797
  * @see $this->knowledge_metabox() Callback for Knowledge Graph Settings box.
1798
  */
1799
  public function knowledge_metabox_general_tab() {
1800
-
1801
- ?>
1802
- <h4><?php _e( 'Knowledge Graph Settings', 'autodescription' ); ?></h4>
1803
- <p><span class="description"><?php printf( __( "The Knowledge Graph lets Google and other Search Engines know where to find you or your organization and its relevant content.", 'autodescription' ) ); ?></span></p>
1804
- <p><span class="description"><?php printf( __( "Google is becoming more of an 'Answer Engine' than a 'Search Engine'. Setting up these options could have a positive impact on the SEO value of your website.", 'autodescription' ) ); ?></span></p>
1805
-
1806
- <?php
1807
- $knowledge_output_label = __( 'Output Knowledge tags?', 'autodescription' );
1808
- $knowledge_output_checkbox = $this->make_checkbox( 'knowledge_output', $knowledge_output_label, '' );
1809
-
1810
- //* Echo checkbox.
1811
- echo $this->wrap_fields( $knowledge_output_checkbox );
1812
-
1813
- if ( $this->wp_version( '4.2.999', '>=' ) ) :
1814
- ?>
1815
- <hr>
1816
-
1817
- <h4><?php printf( _x( "Website logo", 'WordPress Customizer', 'autodescription' ) ); ?></h4>
1818
- <?php
1819
- $knowledge_logo_label = __( 'Use the Favicon from Customizer as the Organization Logo?', 'autodescription' );
1820
- $knowledge_logo_description = __( "This option only has an effect when this site represents an Organization. If left disabled, Search Engines will look elsewhere for a logo, if it exists and is assigned as a logo.", 'autodescription' );
1821
- $knowledge_logo_checkbox = $this->make_checkbox( 'knowledge_logo', $knowledge_logo_label, $knowledge_logo_description );
1822
-
1823
- //* Echo checkbox.
1824
- echo $this->wrap_fields( $knowledge_logo_checkbox );
1825
- endif;
1826
-
1827
  }
1828
 
1829
  /**
1830
- * Knowledge Graph Metabox About Tab Output
1831
  *
1832
  * @since 2.2.8
1833
- *
1834
  * @see $this->knowledge_metabox() Callback for Knowledge Graph Settings box.
1835
  */
1836
  public function knowledge_metabox_about_tab() {
1837
-
1838
- $blogname = $this->get_blogname();
1839
-
1840
- ?>
1841
- <h4><?php _e( 'About this website', 'autodescription' ); ?></h4>
1842
- <p><span class="description"><?php printf( __( 'Who or what is your website about?', 'autodescription' ) ); ?></span></p>
1843
-
1844
- <hr>
1845
-
1846
- <p>
1847
- <label for="<?php $this->field_id( 'knowledge_type' ); ?>"><?php _ex( 'This website represents:', '...Organization or Person.', 'autodescription' ); ?></label>
1848
- <select name="<?php $this->field_name( 'knowledge_type' ); ?>" id="<?php $this->field_id( 'knowledge_type' ); ?>">
1849
- <?php
1850
- $knowledge_type = (array) apply_filters(
1851
- 'the_seo_framework_knowledge_types',
1852
- array(
1853
- 'organization' => __( 'An Organization', 'autodescription' ),
1854
- 'person' => __( 'A Person', 'autodescription' ),
1855
- )
1856
- );
1857
- foreach ( $knowledge_type as $value => $name )
1858
- echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->get_field_value( 'knowledge_type' ), esc_attr( $value ), false ) . '>' . esc_html( $name ) . '</option>' . "\n";
1859
- ?>
1860
- </select>
1861
- </p>
1862
-
1863
- <hr>
1864
-
1865
- <p>
1866
- <label for="<?php $this->field_id( 'knowledge_name' ); ?>">
1867
- <strong><?php _e( "The organization or personal name", 'autodescription' ); ?></strong>
1868
- </label>
1869
- </p>
1870
- <p>
1871
- <input type="text" name="<?php $this->field_name( 'knowledge_name' ); ?>" class="large-text" id="<?php $this->field_id( 'knowledge_name' ); ?>" placeholder="<?php echo esc_attr( $blogname ) ?>" value="<?php echo esc_attr( $this->get_field_value( 'knowledge_name' ) ); ?>" />
1872
- </p>
1873
- <?php
1874
-
1875
  }
1876
 
1877
  /**
1878
- * Knowledge Graph Metabox Social Tab Output
1879
  *
1880
  * @since 2.2.8
1881
- *
1882
  * @see $this->knowledge_metabox() Callback for Knowledge Graph Settings box.
1883
  */
1884
  public function knowledge_metabox_social_tab() {
1885
-
1886
- ?>
1887
- <h4><?php _e( 'Social Pages connected to this website', 'autodescription' ); ?></h4>
1888
- <p><span class="description"><?php _e( "Don't have a page at a site or is the profile only privately accessible? Leave that field empty. Unsure? Fill it in anyway.", 'autodescription' ); ?></span></p>
1889
- <p><span class="description"><?php _e( "Add the link that leads directly to the social page of this website.", 'autodescription' ); ?></span></p>
1890
-
1891
- <hr>
1892
-
1893
- <?php
1894
- $connectedi18n = _x( 'RelatedProfile', 'No spaces. E.g. https://facebook.com/RelatedProfile', 'autodescription' );
1895
- $profile18n = _x( 'Profile', 'Social Profile', 'autodescription' );
1896
-
1897
- /**
1898
- * @todo maybe genericons?
1899
- */
1900
-
1901
- $socialsites = array(
1902
- 'facebook' => array(
1903
- 'option' => 'knowledge_facebook',
1904
- 'dashicon' => 'dashicons-facebook',
1905
- 'desc' => 'Facebook ' . __( 'Page', 'autodescription' ),
1906
- 'placeholder' => 'http://www.facebook.com/' . $connectedi18n,
1907
- 'examplelink' => esc_url( 'https://facebook.com/me' ),
1908
- ),
1909
- 'twitter' => array(
1910
- 'option' => 'knowledge_twitter',
1911
- 'dashicon' => 'dashicons-twitter',
1912
- 'desc' => 'Twitter ' . $profile18n,
1913
- 'placeholder' => 'http://www.twitter.com/' . $connectedi18n,
1914
- 'examplelink' => esc_url( 'https://twitter.com/home' ), // No example link available.
1915
- ),
1916
- 'gplus' => array(
1917
- 'option' => 'knowledge_gplus',
1918
- 'dashicon' => 'dashicons-googleplus',
1919
- 'desc' => 'Google+ ' . $profile18n,
1920
- 'placeholder' => 'https://plus.google.com/' . $connectedi18n,
1921
- 'examplelink' => esc_url( 'https://plus.google.com/me' ),
1922
- ),
1923
- 'instagram' => array(
1924
- 'option' => 'knowledge_instagram',
1925
- 'dashicon' => 'genericon-instagram',
1926
- 'desc' => 'Instagram ' . $profile18n,
1927
- 'placeholder' => 'http://instagram.com/' . $connectedi18n,
1928
- 'examplelink' => esc_url( 'https://instagram.com/' ), // No example link available.
1929
- ),
1930
- 'youtube' => array(
1931
- 'option' => 'knowledge_youtube',
1932
- 'dashicon' => 'genericon-youtube',
1933
- 'desc' => 'Youtube ' . $profile18n,
1934
- 'placeholder' => 'http://www.youtube.com/' . $connectedi18n,
1935
- 'examplelink' => esc_url( 'https://www.youtube.com/user/%2f' ), // Yes a double slash.
1936
- ),
1937
- 'linkedin' => array(
1938
- 'option' => 'knowledge_linkedin',
1939
- 'dashicon' => 'genericon-linkedin-alt',
1940
- 'desc' => 'LinkedIn ' . $profile18n . ' ID',
1941
- 'placeholder' => 'http://www.linkedin.com/profile/view?id=' . $connectedi18n,
1942
- 'examplelink' => esc_url( 'https://www.linkedin.com/profile/view' ), // This generates a query arg. We should allow that.
1943
- ),
1944
- 'pinterest' => array(
1945
- 'option' => 'knowledge_pinterest',
1946
- 'dashicon' => 'genericon-pinterest-alt',
1947
- 'desc' => 'Pinterest ' . $profile18n,
1948
- 'placeholder' => 'https://www.pinterest.com/' . $connectedi18n . '/',
1949
- 'examplelink' => esc_url( 'https://www.pinterest.com/me/' ),
1950
- ),
1951
- 'soundcloud' => array(
1952
- 'option' => 'knowledge_soundcloud',
1953
- 'dashicon' => 'genericon-cloud', // I know, it's not the real one. D:
1954
- 'desc' => 'SoundCloud ' . $profile18n,
1955
- 'placeholder' => 'https://soundcloud.com/' . $connectedi18n,
1956
- 'examplelink' => esc_url( 'https://soundcloud.com/you' ),
1957
- ),
1958
- 'tumblr' => array(
1959
- 'option' => 'knowledge_tumblr',
1960
- 'dashicon' => 'genericon-tumblr',
1961
- 'desc' => 'Tumblr ' . __( 'Blog', 'autodescription' ),
1962
- 'placeholder' => 'https://tumblr.com/blog/' . $connectedi18n,
1963
- 'examplelink' => esc_url( 'https://www.tumblr.com/dashboard' ), // No example link available.
1964
- ),
1965
- );
1966
-
1967
- foreach ( $socialsites as $key => $value ) {
1968
- ?>
1969
- <p>
1970
- <label for="<?php $this->field_id( $value['option'] ); ?>">
1971
- <strong><?php echo $value['desc'] ?></strong>
1972
- <?php
1973
- if ( $value['examplelink'] ) {
1974
- ?><a href="<?php echo esc_url( $value['examplelink'] ); ?>" target="_blank">[?]</a><?php
1975
- }
1976
- ?>
1977
- </label>
1978
- </p>
1979
- <p>
1980
- <input type="text" name="<?php $this->field_name( $value['option'] ); ?>" class="large-text" id="<?php $this->field_id( $value['option'] ); ?>" placeholder="<?php echo esc_attr( $value['placeholder'] ) ?>" value="<?php echo esc_attr( $this->get_field_value( $value['option'] ) ); ?>" />
1981
- </p>
1982
- <?php
1983
- }
1984
-
1985
  }
1986
 
1987
  /**
1988
  * Sitemaps meta box on the Site SEO Settings page.
1989
  *
1990
  * @since 2.2.9
1991
- *
1992
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
 
 
 
1993
  */
1994
- public function sitemaps_metabox( $args = array() ) {
1995
-
1996
  do_action( 'the_seo_framework_sitemaps_metabox_before' );
1997
-
1998
- if ( ! $this->pretty_permalinks ) {
1999
-
2000
- $permalink_settings_url = esc_url( admin_url( 'options-permalink.php' ) );
2001
- $here = '<a href="' . $permalink_settings_url . '" target="_blank" title="' . __( 'Permalink Settings', 'autodescription' ) . '">' . _x( 'here', 'The sitemap can be found %s.', 'autodescription' ) . '</a>';
2002
-
2003
- ?>
2004
- <h4><?php _e( "You're using the plain permalink structure.", 'autodescription' ); ?></h4>
2005
- <p><span class="description"><?php _e( "This means we can't output the sitemap through the WordPress rewrite rules.", 'autodescription' ); ?></span></p>
2006
- <hr>
2007
- <p><span class="description"><?php printf( _x( "Change your Permalink Settings %s (Recommended: 'postname').", '%s = here', 'autodescription' ), $here ); ?></span></p>
2008
- <?php
2009
-
2010
- } else {
2011
-
2012
- /**
2013
- * Parse tabs content
2014
- *
2015
- * @param array $default_tabs { 'id' = The identifier =>
2016
- * array(
2017
- * 'name' => The name
2018
- * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
2019
- * 'dashicon' => Desired dashicon
2020
- * )
2021
- * }
2022
- *
2023
- * @since 2.2.9
2024
- */
2025
- $default_tabs = array(
2026
- 'general' => array(
2027
- 'name' => __( 'General', 'autodescription' ),
2028
- 'callback' => array( $this, 'sitemaps_metabox_general_tab' ),
2029
- 'dashicon' => 'admin-generic',
2030
- ),
2031
- 'robots' => array(
2032
- 'name' => 'Robots.txt',
2033
- 'callback' => array( $this, 'sitemaps_metabox_robots_tab' ),
2034
- 'dashicon' => 'share-alt2',
2035
- ),
2036
- 'timestamps' => array(
2037
- 'name' => __( 'Timestamps', 'autodescription' ),
2038
- 'callback' => array( $this, 'sitemaps_metabox_timestamps_tab' ),
2039
- 'dashicon' => 'backup',
2040
- ),
2041
- 'notify' => array(
2042
- 'name' => _x( 'Ping', 'Ping or notify Search Engine', 'autodescription' ),
2043
- 'callback' => array( $this, 'sitemaps_metabox_notify_tab' ),
2044
- 'dashicon' => 'megaphone',
2045
- ),
2046
- );
2047
-
2048
- /**
2049
- * Applies filters the_seo_framework_sitemaps_settings_tabs : array see $default_tabs
2050
- *
2051
- * Used to extend Knowledge Graph tabs
2052
- */
2053
- $defaults = (array) apply_filters( 'the_seo_framework_sitemaps_settings_tabs', $default_tabs, $args );
2054
-
2055
- $tabs = wp_parse_args( $args, $defaults );
2056
- $use_tabs = true;
2057
-
2058
- $sitemap_plugin = $this->detect_sitemap_plugin();
2059
- $sitemap_detected = $this->has_sitemap_xml();
2060
- $robots_detected = $this->has_robots_txt();
2061
-
2062
- /**
2063
- * Remove the timestamps and notify submenus
2064
- * @since 2.5.2
2065
- */
2066
- if ( $sitemap_plugin || $sitemap_detected ) {
2067
- unset( $tabs['timestamps'] );
2068
- unset( $tabs['notify'] );
2069
- }
2070
-
2071
- /**
2072
- * Remove the robots submenu
2073
- * @since 2.5.2
2074
- */
2075
- if ( $robots_detected ) {
2076
- unset( $tabs['robots'] );
2077
- }
2078
-
2079
- if ( $robots_detected && ( $sitemap_plugin || $sitemap_detected ) )
2080
- $use_tabs = false;
2081
-
2082
- $this->nav_tab_wrapper( 'sitemaps', $tabs, '2.2.8', $use_tabs );
2083
-
2084
- }
2085
-
2086
  do_action( 'the_seo_framework_sitemaps_metabox_after' );
2087
-
2088
  }
2089
 
2090
  /**
2091
- * Sitemaps Metabox General Tab Output
2092
  *
2093
  * @since 2.2.9
2094
- *
2095
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
2096
  */
2097
  public function sitemaps_metabox_general_tab() {
2098
-
2099
- $site_url = $this->the_home_url_from_cache( true );
2100
-
2101
- $sitemap_url = $site_url . 'sitemap.xml';
2102
- $has_sitemap_plugin = $this->detect_sitemap_plugin();
2103
- $sitemap_detected = $this->has_sitemap_xml();
2104
-
2105
- ?>
2106
- <h4><?php _e( 'Sitemap Integration Settings', 'autodescription' ); ?></h4>
2107
- <?php
2108
-
2109
- if ( $has_sitemap_plugin ) {
2110
- ?>
2111
- <p class="description"><?php _e( "Another active sitemap plugin has been detected. This means that the sitemap functionality has been replaced.", 'autodescription' ); ?></p>
2112
- <?php
2113
- } else if ( $sitemap_detected ) {
2114
- ?>
2115
- <p class="description"><?php _e( "A sitemap has been detected in the root folder of your website. This means that the sitemap functionality has no effect.", 'autodescription' ); ?></p>
2116
- <?php
2117
- } else {
2118
- ?>
2119
- <p class="description"><?php _e( "The Sitemap is an XML file that lists pages and posts for your website along with optional metadata about each post or page. This helps Search Engines crawl your website more easily.", 'autodescription' ); ?></p>
2120
- <p class="description"><?php _e( "The optional metadata include the post and page modified time and a page priority indication, which is automated.", 'autodescription' ); ?></p>
2121
-
2122
- <hr>
2123
-
2124
- <h4><?php _e( 'Sitemap Output', 'autodescription' ); ?></h4>
2125
- <?php
2126
- $sitemaps_output_label = __( 'Output Sitemap?', 'autodescription' );
2127
- $sitemaps_output_checkbox = $this->make_checkbox( 'sitemaps_output', $sitemaps_output_label, '' );
2128
-
2129
- //* Echo checkbox.
2130
- echo $this->wrap_fields( $sitemaps_output_checkbox );
2131
- }
2132
-
2133
- if ( ! ( $has_sitemap_plugin || $sitemap_detected ) && $this->get_option( 'sitemaps_output' ) ) {
2134
- $here = '<a href="' . $sitemap_url . '" target="_blank" title="' . __( 'View sitemap', 'autodescription' ) . '">' . _x( 'here', 'The sitemap can be found %s.', 'autodescription' ) . '</a>';
2135
-
2136
- ?><p class="description"><?php printf( _x( 'The sitemap can be found %s.', '%s = here', 'autodescription' ), $here ); ?></p><?php
2137
- }
2138
-
2139
  }
2140
 
2141
  /**
2142
- * Sitemaps Metabox Robots Tab Output
2143
  *
2144
  * @since 2.2.9
2145
- *
2146
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
2147
  */
2148
  public function sitemaps_metabox_robots_tab() {
2149
-
2150
- $site_url = $this->the_home_url_from_cache( true );
2151
-
2152
- $robots_url = trailingslashit( $site_url ) . 'robots.txt';
2153
- $here = '<a href="' . $robots_url . '" target="_blank" title="' . __( 'View robots.txt', 'autodescription' ) . '">' . _x( 'here', 'The sitemap can be found %s.', 'autodescription' ) . '</a>';
2154
-
2155
- ?>
2156
- <h4><?php _e( 'Robots.txt Settings', 'autodescription' ); ?></h4>
2157
- <?php
2158
- if ( $this->can_do_sitemap_robots() ) :
2159
- ?>
2160
- <p class="description"><?php _e( 'The robots.txt file is the first thing Search Engines look for. If you add the sitemap location in the robots.txt file, then Search Engines will look for and index the sitemap.', 'autodescription' ); ?></p>
2161
- <p class="description"><?php _e( 'If you do not add the sitemap location to the robots.txt file, you will need to notify Search Engines manually through the Webmaster Console provided by the Search Engines.', 'autodescription' ); ?></p>
2162
-
2163
- <hr>
2164
-
2165
- <h4><?php _e( 'Add sitemap location in robots.txt', 'autodescription' ); ?></h4>
2166
- <?php
2167
- //* Echo checkbox.
2168
- $this->wrap_fields(
2169
- $this->make_checkbox(
2170
- 'sitemaps_robots',
2171
- __( 'Add sitemap location in robots?', 'autodescription' ),
2172
- ''
2173
- ), true
2174
- );
2175
- else :
2176
- ?>
2177
- <p class="description"><?php _e( 'Another robots.txt sitemap Location addition has been detected.', 'autodescription' ); ?></p>
2178
- <?php
2179
- endif;
2180
-
2181
- ?>
2182
- <p class="description"><?php printf( _x( 'The robots.txt file can be found %s.', '%s = here', 'autodescription' ), $here ); ?></p>
2183
- <?php
2184
-
2185
  }
2186
 
2187
  /**
2188
- * Sitemaps Metabox Timestamps Tab Output
2189
  *
2190
  * @since 2.2.9
2191
- *
2192
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
2193
  */
2194
  public function sitemaps_metabox_timestamps_tab() {
2195
-
2196
- //* Sets timezone according to WordPress settings.
2197
- $this->set_timezone();
2198
-
2199
- $timestamp_0 = date( 'Y-m-d' );
2200
-
2201
- /**
2202
- * @link https://www.w3.org/TR/NOTE-datetime
2203
- * We use the second expression of the time zone offset handling.
2204
- */
2205
- $timestamp_1 = date( 'Y-m-d\TH:iP' );
2206
-
2207
- //* Reset timezone to previous value.
2208
- $this->reset_timezone();
2209
-
2210
- ?>
2211
- <h4><?php _e( 'Timestamps Settings', 'autodescription' ); ?></h4>
2212
- <p><span class="description"><?php _e( 'The modified time suggests to Search Engines where to look for content changes. It has no impact on the SEO value unless you drastically change pages or posts. It then depends on how well your content is constructed.', 'autodescription' ); ?></span></p>
2213
- <p><span class="description"><?php _e( "By default, the sitemap only outputs the modified date if you've enabled them within the Social Metabox. This setting overrides those settings for the Sitemap.", 'autodescription' ); ?></span></p>
2214
-
2215
- <hr>
2216
-
2217
- <h4><?php _e( 'Output Modified Date', 'autodescription' ); ?></h4>
2218
- <?php
2219
- $sitemaps_modified_label = sprintf( __( 'Add %s to the sitemap?', 'autodescription' ), $this->code_wrap( '<lastmod>' ) );
2220
- $sitemaps_modified_checkbox = $this->make_checkbox( 'sitemaps_modified', $sitemaps_modified_label, '' );
2221
-
2222
- //* Echo checkbox.
2223
- echo $this->wrap_fields( $sitemaps_modified_checkbox );
2224
- ?>
2225
-
2226
- <hr>
2227
-
2228
- <fieldset>
2229
- <legend><h4><?php _e( 'Timestamp Format Settings', 'autodescription' ); ?></h4></legend>
2230
- <p>
2231
- <span class="description"><?php _e( 'Determines how specific the modification timestamp is.', 'autodescription' ); ?></span>
2232
- </p>
2233
-
2234
- <p id="sitemaps-timestamp-format" class="theseoframework-fields">
2235
- <span class="toblock">
2236
- <input type="radio" name="<?php $this->field_name( 'sitemap_timestamps' ); ?>" id="<?php $this->field_id( 'sitemap_timestamps_0' ); ?>" value="0" <?php checked( $this->get_field_value( 'sitemap_timestamps' ), '0' ); ?> />
2237
- <label for="<?php $this->field_id( 'sitemap_timestamps_0' ); ?>">
2238
- <span title="<?php _e( 'Complete date', 'autodescription' ); ?>"><?php echo $this->code_wrap( $timestamp_0 ) ?> [?]</span>
2239
- </label>
2240
- </span>
2241
- <span class="toblock">
2242
- <input type="radio" name="<?php $this->field_name( 'sitemap_timestamps' ); ?>" id="<?php $this->field_id( 'sitemap_timestamps_1' ); ?>" value="1" <?php checked( $this->get_field_value( 'sitemap_timestamps' ), '1' ); ?> />
2243
- <label for="<?php $this->field_id( 'sitemap_timestamps_1' ); ?>">
2244
- <span title="<?php _e( 'Complete date plus hours, minutes and timezone', 'autodescription' ); ?>"><?php echo $this->code_wrap( $timestamp_1 ); ?> [?]</span>
2245
- </label>
2246
- </span>
2247
- </p>
2248
- </fieldset>
2249
- <?php
2250
-
2251
  }
2252
 
2253
  /**
2254
- * Sitemaps Metabox Notify Tab Output
2255
  *
2256
  * @since 2.2.9
2257
- *
2258
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
2259
  */
2260
  public function sitemaps_metabox_notify_tab() {
2261
-
2262
- ?>
2263
- <h4><?php _e( 'Ping Settings', 'autodescription' ); ?></h4>
2264
- <p><span class="description"><?php _e( "Notifying Search Engines of a sitemap change is helpful to get your content indexed as soon as possible.", 'autodescription' ); ?></span></p>
2265
- <p><span class="description"><?php _e( "By default this will happen at most once an hour.", 'autodescription' ); ?></span></p>
2266
-
2267
- <hr>
2268
-
2269
- <h4><?php _e( 'Notify Search Engines', 'autodescription' ); ?></h4>
2270
- <?php
2271
- $engines = array(
2272
- 'ping_google' => 'Google',
2273
- 'ping_bing' => 'Bing',
2274
- 'ping_yandex' => 'Yandex'
2275
- );
2276
-
2277
- $ping_checkbox = '';
2278
-
2279
- foreach ( $engines as $option => $engine ) {
2280
- $ping_label = sprintf( __( 'Notify %s about sitemap changes?', 'autodescription' ), $engine );
2281
- $ping_checkbox .= $this->make_checkbox( $option, $ping_label, '' );
2282
- }
2283
-
2284
- //* Echo checkbox.
2285
- $this->wrap_fields( $ping_checkbox, true );
2286
-
2287
  }
2288
 
2289
  /**
2290
- * Feed meta box on the Site SEO Settings page.
2291
  *
2292
  * @since 2.5.2
 
 
 
2293
  */
2294
- public function feed_metabox() {
2295
-
2296
  do_action( 'the_seo_framework_feed_metabox_before' );
2297
-
2298
- ?>
2299
- <h4><?php _e( 'Content Feed Settings', 'autodescription' ); ?></h4>
2300
- <p class="description"><?php _e( "Sometimes, your content can get stolen by robots through the WordPress feeds. This can cause duplicate content issues. To prevent this from happening, it's recommended to convert the feed's content into an excerpt.", 'autodescription' ); ?></p>
2301
- <p class="description"><?php _e( "Adding a backlink below the feed's content will also let the visitors know where the content came from.", 'autodescription' ); ?></p>
2302
-
2303
- <hr>
2304
-
2305
- <h4><?php _e( 'Change Feed Settings', 'autodescription' ); ?></h4>
2306
- <?php
2307
- $excerpt_the_feed_label = __( 'Convert feed content into excerpts?', 'autodescription' );
2308
- $excerpt_the_feed_label .= ' ' . $this->make_info( __( "By default the excerpt will be at most 400 characters long", 'autodescription' ), '', false );
2309
-
2310
- $source_the_feed_label = __( 'Add backlinks below the feed content?', 'autodescription' );
2311
- $source_the_feed_label .= ' ' . $this->make_info( __( "This link will not be followed by Search Engines", 'autodescription' ), '', false );
2312
-
2313
- //* Echo checkboxes.
2314
- $this->wrap_fields(
2315
- array(
2316
- $this->make_checkbox( 'excerpt_the_feed', $excerpt_the_feed_label, '' ),
2317
- $this->make_checkbox( 'source_the_feed', $source_the_feed_label, '' ),
2318
- ), true
2319
- );
2320
-
2321
- if ( $this->rss_uses_excerpt() ) {
2322
- $reading_settings_url = esc_url( admin_url( 'options-reading.php' ) );
2323
- $reading_settings = '<a href="' . $reading_settings_url . '" target="_blank" title="' . __( 'Reading Settings', 'autodescription' ) . '">' . __( 'Reading Settings', 'autodescription' ) . '</a>';
2324
-
2325
- ?><p><span class="description"><?php
2326
- printf( _x( "Note: The feed is already converted into an excerpt through the %s.", '%s = Reading Settings', 'autodescription' ), $reading_settings );
2327
- ?></span></p><?php
2328
- }
2329
-
2330
- $feed_url = esc_url( get_feed_link() );
2331
- $here = '<a href="' . $feed_url . '" target="_blank" title="' . __( 'View feed', 'autodescription' ) . '">' . _x( 'here', 'The feed can be found %s.', 'autodescription' ) . '</a>';
2332
-
2333
- ?><p class="description"><?php printf( _x( 'The feed can be found %s.', '%s = here', 'autodescription' ), $here ); ?></p><?php
2334
-
2335
  do_action( 'the_seo_framework_feed_metabox_after' );
2336
-
2337
  }
2338
 
2339
  /**
2340
- * Schema metabox.
2341
  *
2342
  * @since 2.6.0
 
 
 
2343
  */
2344
- public function schema_metabox() {
2345
-
2346
  do_action( 'the_seo_framework_schema_metabox_before' );
2347
-
2348
- ?>
2349
- <h4><?php _e( 'Schema.org Output Settings', 'autodescription' ); ?></h4>
2350
-
2351
- <?php if ( $this->has_json_ld_plugin() ) : ?>
2352
- <p class="description"><?php _e( 'Another Schema.org plugin has been detected.', 'autodescription' ); ?></p>
2353
- <?php else : ?>
2354
- <p class="description"><?php _e( "The Schema.org markup is a standard way of annotating structured data for Search Engines. This markup is represented within hidden scripts throughout the website.", 'autodescription' ); ?></p>
2355
- <p class="description"><?php _e( "When your web pages include structured data markup, Search Engines can use that data to index your content better, present it more prominently in Search Results, and use it in several different applications.", 'autodescription' ); ?></p>
2356
-
2357
- <hr>
2358
-
2359
- <?php /* translators: https://developers.google.com/search/docs/data-types/sitelinks-searchbox */ ?>
2360
- <h4><?php _ex( 'Sitelinks Searchbox', 'Product name', 'autodescription' ); ?></h4>
2361
- <p class="description"><?php _e( 'When Search users search for your brand name, the following option allows them to search through your website directly from the Search Results.', 'autodescription' ); ?></p>
2362
- <?php
2363
- $info = $this->make_info(
2364
- _x( 'Sitelinks Searchbox', 'Product name', 'autodescription' ),
2365
- 'https://developers.google.com/search/docs/data-types/sitelinks-searchbox',
2366
- false
2367
- );
2368
- $this->wrap_fields(
2369
- $this->make_checkbox(
2370
- 'ld_json_searchbox',
2371
- _x( 'Enable Sitelinks Searchbox?', 'Product name', 'autodescription' ) . ' ' . $info,
2372
- ''
2373
- ),
2374
- true
2375
- );
2376
- ?>
2377
-
2378
- <hr>
2379
-
2380
- <h4><?php _e( 'Site Name', 'autodescription' ); ?></h4>
2381
- <p class="description"><?php _e( "When using breadcrumbs, the first entry is by default your website's address. Using the following option will convert it to the Site Name.", 'autodescription' ); ?></p>
2382
- <?php
2383
- $info = $this->make_info(
2384
- __( 'Include your Site Name in Search Results', 'autodescription' ),
2385
- 'https://developers.google.com/search/docs/data-types/sitename',
2386
- false
2387
- );
2388
- $description = sprintf( __( "The Site Name is: %s", 'autodescription' ), $this->code_wrap( $this->get_blogname() ) );
2389
- $this->wrap_fields(
2390
- $this->make_checkbox(
2391
- 'ld_json_sitename',
2392
- __( 'Convert URL to Site Name?', 'autodescription' ) . ' ' . $info,
2393
- $description
2394
- ),
2395
- true
2396
- );
2397
- ?>
2398
-
2399
- <hr>
2400
-
2401
- <h4><?php _e( 'Breadcrumbs', 'autodescription' ); ?></h4>
2402
- <p class="description"><?php _e( "Breadcrumb trails indicate the page's position in the site hierarchy. Using the following option will show the hierarchy within the Search Results when available.", 'autodescription' ); ?></p>
2403
- <?php
2404
- $info = $this->make_info(
2405
- __( 'About Breadcrumbs', 'autodescription' ),
2406
- 'https://developers.google.com/search/docs/data-types/breadcrumbs',
2407
- false
2408
- );
2409
- $description = __( "Multiple trails can be outputted. The longest trail is prioritized.", 'autodescription' );
2410
- $this->wrap_fields(
2411
- $this->make_checkbox(
2412
- 'ld_json_breadcrumbs',
2413
- __( 'Enable Breadcrumbs?', 'autodescription' ) . ' ' . $info,
2414
- $description
2415
- ),
2416
- true
2417
- );
2418
- endif;
2419
-
2420
  do_action( 'the_seo_framework_schema_metabox_after' );
2421
-
2422
  }
2423
-
2424
  }
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_Metaboxes
23
  *
27
  */
28
  class AutoDescription_Metaboxes extends AutoDescription_Siteoptions {
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
  */
51
  *
52
  * @since 2.6.0
53
  *
54
+ * @todo add filter.
55
+ * @todo check if filter can propagate within all functions.
56
+ *
57
  * @return array Title separators.
58
  */
59
  public function get_separator_list() {
115
  public function nav_tab_wrapper( $id, $tabs = array(), $version = '2.3.6', $use_tabs = true ) {
116
 
117
  //* Whether tabs are active.
118
+ $use_tabs = $use_tabs && count( $tabs ) > 1;
119
 
120
  /**
121
  * Start navigation.
123
  * Don't output navigation if $use_tabs is false and the amount of tabs is 1 or lower.
124
  */
125
  if ( $use_tabs ) {
126
+
127
+ ?><div class="tsf-nav-tab-wrapper hide-if-no-js" id="<?php echo esc_attr( $id . '-tabs-wrapper' ); ?>"><?php
 
128
  $count = 1;
129
  foreach ( $tabs as $tab => $value ) {
130
 
132
  $name = isset( $value['name'] ) ? $value['name'] : '';
133
 
134
  $checked = 1 === $count ? 'checked' : '';
135
+ $the_id = esc_attr( $id . '-tab-' . $tab );
136
+ $the_name = esc_attr( $id . '-tabs' );
137
 
138
+ $label_class = $checked ? ' tsf-active-tab' : ''; // maybe
139
 
140
  ?>
141
+ <div class="tsf-tab">
142
+ <input type="radio" class="tsf-tabs-radio" id="<?php echo $the_id ?>" name="<?php echo $the_name ?>" <?php echo $checked ?>>
143
+ <label for="<?php echo $the_id; ?>" class="tsf-nav-tab">
144
+ <?php echo $dashicon ? '<span class="dashicons dashicons-' . esc_attr( $dashicon ) . ' tsf-dashicons-tabs"></span>' : ''; ?>
145
+ <?php echo $name ? '<span class="tsf-nav-desktop">' . esc_attr( $name ) . '</span>' : ''; ?>
146
  </label>
147
  </div>
148
  <?php
149
 
150
  $count++;
151
  }
152
+ ?></div><?php
 
 
153
  }
154
 
155
  /**
164
  $the_name = $id . '-tabs-content';
165
 
166
  //* Current tab for JS.
167
+ $current = 1 === $count ? ' tsf-active-tab-content' : '';
 
 
 
 
168
 
169
+ ?><div class="tsf-tabs-content <?php echo esc_attr( $the_name . $current ); ?>" id="<?php echo esc_attr( $the_id ); ?>" ><?php
170
  //* No-JS tabs.
171
  if ( $use_tabs ) {
172
  $dashicon = isset( $value['dashicon'] ) ? $value['dashicon'] : '';
174
 
175
  ?>
176
  <div class="hide-if-js seoframework-content-no-js">
177
+ <div class="tsf-tab tsf-tab-no-js">
178
+ <span class="tsf-nav-tab tsf-active-tab">
179
+ <?php echo $dashicon ? '<span class="dashicons dashicons-' . esc_attr( $dashicon ) . ' tsf-dashicons-tabs"></span>' : ''; ?>
180
  <?php echo $name ? '<span>' . esc_attr( $name ) . '</span>' : ''; ?>
181
  </span>
182
  </div>
191
  $output = $this->call_function( $callback, $version, $params );
192
  echo $output;
193
  }
194
+ ?></div><?php
 
 
 
195
 
196
  $count++;
197
  }
202
  * Title meta box on the Site SEO Settings page.
203
  *
204
  * @since 2.2.2
205
+ * @see $this->title_metabox() Callback for Title Settings box.
206
  *
207
+ * @param object|null $post The current post object.
208
  * @param array $args The metabox arguments.
 
 
209
  */
210
+ public function title_metabox( $post = null, $args = array() ) {
 
211
  do_action( 'the_seo_framework_title_metabox_before' );
212
+ $this->get_view( 'metaboxes/title-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  do_action( 'the_seo_framework_title_metabox_after' );
214
  }
215
 
217
  * Title meta box general tab.
218
  *
219
  * @since 2.6.0
 
220
  * @see $this->title_metabox() : Callback for Title Settings box.
221
  */
222
  public function title_metabox_general_tab() {
223
+ $this->get_view( 'metaboxes/title-metabox', array(), 'general' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
 
226
  /**
227
  * Title meta box general tab.
228
  *
229
  * @since 2.6.0
230
+ * @see $this->title_metabox() : Callback for Title Settings box.
231
  *
232
  * @param array $examples : array {
233
  * 'left' => Left Example
234
  * 'right' => Right Example
235
  * }
 
 
236
  */
237
  public function title_metabox_additions_tab( $examples = array() ) {
238
+ $this->get_view( 'metaboxes/title-metabox', get_defined_vars(), 'additions' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
240
 
241
  /**
242
  * Title meta box prefixes tab.
243
  *
244
  * @since 2.6.0
245
+ * @see $this->title_metabox() : Callback for Title Settings box.
246
  *
247
  * @param array $additions : array {
248
  * 'left' => Left Example Addtitions
249
  * 'right' => Right Example Additions
250
  * }
251
  * @param bool $showleft The example location.
 
 
252
  */
253
  public function title_metabox_prefixes_tab( $additions = array(), $showleft = false ) {
254
+ $this->get_view( 'metaboxes/title-metabox', get_defined_vars(), 'prefixes' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  }
256
 
257
  /**
259
  *
260
  * @since 2.3.4
261
  *
262
+ * @param object|null $post The current post object.
263
  * @param array $args The metabox arguments.
 
 
264
  */
265
+ public function description_metabox( $post = null, $args = array() ) {
 
266
  do_action( 'the_seo_framework_description_metabox_before' );
267
+ $this->get_view( 'metaboxes/description-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  do_action( 'the_seo_framework_description_metabox_after' );
 
269
  }
270
 
271
  /**
272
  * Description meta box general tab.
273
  *
274
  * @since 2.6.0
275
+ * @see $this->description_metabox() Callback for Description Settings box.
 
276
  */
277
  public function description_metabox_general_tab() {
278
+ $this->get_view( 'metaboxes/description-metabox', array(), 'general' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  }
280
 
281
  /**
282
  * Description meta box additions tab.
283
  *
284
  * @since 2.6.0
285
+ * @see $this->description_metabox() Callback for Description Settings box.
 
286
  */
287
  public function description_metabox_additions_tab() {
288
+ $this->get_view( 'metaboxes/description-metabox', array(), 'additions' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  }
290
 
291
  /**
292
  * Robots meta box on the Site SEO Settings page.
293
  *
294
  * @since 2.2.2
295
+ *
296
+ * @param object|null $post The current post object.
297
+ * @param array $args The metabox arguments.
298
  */
299
+ public function robots_metabox( $post = null, $args = array() ) {
 
300
  do_action( 'the_seo_framework_robots_metabox_before' );
301
+ $this->get_view( 'metaboxes/robots-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  do_action( 'the_seo_framework_robots_metabox_after' );
 
303
  }
304
 
305
  /**
306
+ * Robots Metabox General Tab output.
307
  *
308
  * @since 2.2.4
 
309
  * @see $this->robots_metabox() Callback for Robots Settings box.
310
  */
311
  protected function robots_metabox_general_tab() {
312
+ $this->get_view( 'metaboxes/robots-metabox', array(), 'general' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  }
314
 
315
  /**
316
+ * Robots Metabox "No-: Index/Follow/Archive" Tab output.
 
 
317
  *
318
  * @since 2.2.4
319
+ * @see $this->robots_metabox() Callback for Robots Settings box.
320
+ *
321
+ * @param array $types The post types
322
+ * @param array $robots The robots option values : {
323
+ * 'value' string The robots option value.
324
+ * 'name' string The robots name.
325
+ * 'desc' string Explains what the robots type does.
326
+ * }
327
  */
328
  protected function robots_metabox_no_tab( $types, $robots ) {
329
+ $this->get_view( 'metaboxes/robots-metabox', get_defined_vars(), 'no' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  }
331
 
332
  /**
333
  * Home Page meta box on the Site SEO Settings page.
334
  *
 
 
335
  * @since 2.2.2
336
+ *
337
+ * @param object|null $post The current post object.
338
+ * @param array $args The navigation tabs args.
339
  */
340
+ public function homepage_metabox( $post = null, $args = array() ) {
 
341
  do_action( 'the_seo_framework_homepage_metabox_before' );
342
+ $this->get_view( 'metaboxes/homepage-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  do_action( 'the_seo_framework_homepage_metabox_after' );
344
+ }
345
 
346
+ /**
347
+ * HomePage Metabox General Tab Output.
348
+ *
349
+ * @since 2.7.0
350
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
351
+ */
352
+ public function homepage_metabox_general_tab() {
353
+ $this->get_view( 'metaboxes/homepage-metabox', array(), 'general' );
354
  }
355
 
356
  /**
357
+ * HomePage Metabox Additions Tab Output.
358
  *
359
+ * @since 2.7.0
360
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
361
+ */
362
+ public function homepage_metabox_additions_tab() {
363
+ $this->get_view( 'metaboxes/homepage-metabox', array(), 'additions' );
364
+ }
365
+
366
+ /**
367
+ * HomePage Metabox Robots Tab Output
368
  *
369
+ * @since 2.7.0
370
  * @see $this->homepage_metabox() Callback for HomePage Settings box.
371
  */
372
+ public function homepage_metabox_robots_tab() {
373
+ $this->get_view( 'metaboxes/homepage-metabox', array(), 'robots' );
374
+ }
375
 
376
+ /**
377
+ * Social meta box on the Site SEO Settings page.
378
+ *
379
+ * @since 2.2.2
380
+ *
381
+ * @param object|null $post The current post object.
382
+ * @param array $args the social tabs arguments.
383
+ */
384
+ public function social_metabox( $post = null, $args = array() ) {
385
+ do_action( 'the_seo_framework_social_metabox_before' );
386
+ $this->get_view( 'metaboxes/social-metabox', $args );
387
+ do_action( 'the_seo_framework_social_metabox_after' );
388
+ }
389
 
390
+ /**
391
+ * Social Metabox General Tab output.
392
+ *
393
+ * @since 2.2.2
394
+ * @see $this->social_metabox() Callback for Social Settings box.
395
+ */
396
+ protected function social_metabox_general_tab() {
397
+ $this->get_view( 'metaboxes/social-metabox', array(), 'general' );
398
+ }
399
 
400
+ /**
401
+ * Social Metabox Facebook Tab output.
402
+ *
403
+ * @since 2.2.2
404
+ *
405
+ * @see $this->social_metabox() Callback for Social Settings box.
406
+ */
407
+ protected function social_metabox_facebook_tab() {
408
+ $this->get_view( 'metaboxes/social-metabox', array(), 'facebook' );
409
+ }
410
 
411
+ /**
412
+ * Social Metabox Twitter Tab output.
413
+ *
414
+ * @since 2.2.2
415
+ * @see $this->social_metabox() Callback for Social Settings box.
416
+ */
417
+ protected function social_metabox_twitter_tab() {
418
+ $this->get_view( 'metaboxes/social-metabox', array(), 'twitter' );
419
+ }
420
 
421
+ /**
422
+ * Social Metabox PostDates Tab output.
423
+ *
424
+ * @since 2.2.4
425
+ * @see $this->social_metabox() Callback for Social Settings box.
426
+ */
427
+ public function social_metabox_postdates_tab() {
428
+ $this->get_view( 'metaboxes/social-metabox', array(), 'postdates' );
429
+ }
430
 
431
+ /**
432
+ * Social Metabox Relationships Tab output.
433
+ *
434
+ * @since 2.2.4
435
+ * @see $this->social_metabox() Callback for Social Settings box.
436
+ */
437
+ public function social_metabox_relationships_tab() {
438
+ $this->get_view( 'metaboxes/social-metabox', array(), 'relationships' );
439
+ }
440
 
441
+ /**
442
+ * Webmaster meta box on the Site SEO Settings page.
443
+ *
444
+ * @since 2.2.4
445
+ *
446
+ * @param object|null $post The current post object.
447
+ * @param array $args the social tabs arguments.
448
+ */
449
+ public function webmaster_metabox( $post = null, $args = array() ) {
450
+ do_action( 'the_seo_framework_webmaster_metabox_before' );
451
+ $this->get_view( 'metaboxes/webmaster-metabox', $args );
452
+ do_action( 'the_seo_framework_webmaster_metabox_after' );
453
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
 
455
  /**
456
  * Knowlegde Graph metabox on the Site SEO Settings page.
457
  *
458
  * @since 2.2.8
459
  *
460
+ * @param object|null $post The current post object.
461
+ * @param array $args the social tabs arguments.
462
  */
463
+ public function knowledge_metabox( $post = null, $args = array() ) {
 
464
  do_action( 'the_seo_framework_knowledge_metabox_before' );
465
+ $this->get_view( 'metaboxes/knowledge-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  do_action( 'the_seo_framework_knowledge_metabox_after' );
 
467
  }
468
 
469
  /**
470
+ * Knowledge Graph Metabox General Tab output.
471
  *
472
  * @since 2.2.8
 
473
  * @see $this->knowledge_metabox() Callback for Knowledge Graph Settings box.
474
  */
475
  public function knowledge_metabox_general_tab() {
476
+ $this->get_view( 'metaboxes/knowledge-metabox', array(), 'general' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  }
478
 
479
  /**
480
+ * Knowledge Graph Metabox About Tab output.
481
  *
482
  * @since 2.2.8
 
483
  * @see $this->knowledge_metabox() Callback for Knowledge Graph Settings box.
484
  */
485
  public function knowledge_metabox_about_tab() {
486
+ $this->get_view( 'metaboxes/knowledge-metabox', array(), 'about' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  }
488
 
489
  /**
490
+ * Knowledge Graph Metabox Social Tab output.
491
  *
492
  * @since 2.2.8
 
493
  * @see $this->knowledge_metabox() Callback for Knowledge Graph Settings box.
494
  */
495
  public function knowledge_metabox_social_tab() {
496
+ $this->get_view( 'metaboxes/knowledge-metabox', array(), 'social' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  }
498
 
499
  /**
500
  * Sitemaps meta box on the Site SEO Settings page.
501
  *
502
  * @since 2.2.9
 
503
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
504
+ *
505
+ * @param object|null $post The current post object.
506
+ * @param array $args the social tabs arguments.
507
  */
508
+ public function sitemaps_metabox( $post = null, $args = array() ) {
 
509
  do_action( 'the_seo_framework_sitemaps_metabox_before' );
510
+ $this->get_view( 'metaboxes/sitemaps-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  do_action( 'the_seo_framework_sitemaps_metabox_after' );
 
512
  }
513
 
514
  /**
515
+ * Sitemaps Metabox General Tab output.
516
  *
517
  * @since 2.2.9
 
518
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
519
  */
520
  public function sitemaps_metabox_general_tab() {
521
+ $this->get_view( 'metaboxes/sitemaps-metabox', array(), 'general' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  }
523
 
524
  /**
525
+ * Sitemaps Metabox Robots Tab output.
526
  *
527
  * @since 2.2.9
 
528
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
529
  */
530
  public function sitemaps_metabox_robots_tab() {
531
+ $this->get_view( 'metaboxes/sitemaps-metabox', array(), 'robots' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
  }
533
 
534
  /**
535
+ * Sitemaps Metabox Timestamps Tab output.
536
  *
537
  * @since 2.2.9
 
538
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
539
  */
540
  public function sitemaps_metabox_timestamps_tab() {
541
+ $this->get_view( 'metaboxes/sitemaps-metabox', array(), 'timestamps' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  }
543
 
544
  /**
545
+ * Sitemaps Metabox Notify Tab output.
546
  *
547
  * @since 2.2.9
 
548
  * @see $this->sitemaps_metabox() Callback for Sitemaps Settings box.
549
  */
550
  public function sitemaps_metabox_notify_tab() {
551
+ $this->get_view( 'metaboxes/sitemaps-metabox', array(), 'notify' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  }
553
 
554
  /**
555
+ * Feed Metabox on the Site SEO Settings page.
556
  *
557
  * @since 2.5.2
558
+ *
559
+ * @param object|null $post The current post object.
560
+ * @param array $args the social tabs arguments.
561
  */
562
+ public function feed_metabox( $post = null, $args = array() ) {
 
563
  do_action( 'the_seo_framework_feed_metabox_before' );
564
+ $this->get_view( 'metaboxes/feed-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
565
  do_action( 'the_seo_framework_feed_metabox_after' );
 
566
  }
567
 
568
  /**
569
+ * Schema Metabox on the Site SEO Settings page.
570
  *
571
  * @since 2.6.0
572
+ *
573
+ * @param object|null $post The current post object.
574
+ * @param array $args the social tabs arguments.
575
  */
576
+ public function schema_metabox( $post = null, $args = array() ) {
 
577
  do_action( 'the_seo_framework_schema_metabox_before' );
578
+ $this->get_view( 'metaboxes/schema-metabox', $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  do_action( 'the_seo_framework_schema_metabox_after' );
 
580
  }
 
581
  }
inc/classes/postdata.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_PostData
21
  *
@@ -25,6 +27,18 @@
25
  */
26
  class AutoDescription_PostData extends AutoDescription_Detect {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor
30
  */
@@ -52,7 +66,10 @@ class AutoDescription_PostData extends AutoDescription_Detect {
52
  if ( ! isset( $_POST['autodescription'] ) )
53
  return;
54
 
55
- //* Merge user submitted options with fallback defaults
 
 
 
56
  $data = wp_parse_args( $_POST['autodescription'], array(
57
  '_genesis_title' => '',
58
  '_genesis_description' => '',
@@ -67,19 +84,19 @@ class AutoDescription_PostData extends AutoDescription_Detect {
67
  foreach ( (array) $data as $key => $value ) {
68
  //* Sanitize the title
69
  if ( '_genesis_title' === $key )
70
- $data[$key] = trim( strip_tags( $value ) );
71
 
72
  //* Sanitize the description
73
  if ( '_genesis_description' === $key )
74
- $data[$key] = $this->s_description( $value );
75
 
76
  //* Sanitize the URL. Make sure it's an absolute URL
77
  if ( 'redirect' === $key )
78
- $data[$key] = $this->s_redirect_url( $value );
79
 
80
  }
81
 
82
- $this->save_custom_fields( $data, 'inpost_seo_save', 'hmpl_ad_inpost_seo_nonce', $post );
83
  }
84
 
85
  /**
@@ -140,23 +157,17 @@ class AutoDescription_PostData extends AutoDescription_Detect {
140
  }
141
 
142
  /**
143
- * Fetches or parses the excerpt of the post
144
  *
145
  * @since 1.0.0
146
  *
147
- * @param string $excerpt the Excerpt
148
  * @param int $the_id The Post ID.
149
- * @param int $tt_id The Taxonomy Term ID
150
- *
151
- * @return string The Excerpt
152
  */
153
  public function get_excerpt_by_id( $excerpt = '', $the_id = '', $tt_id = '' ) {
154
 
155
- static $cache = array();
156
-
157
- if ( isset( $cache[$excerpt][$the_id][$tt_id] ) )
158
- return $cache[$excerpt][$the_id][$tt_id];
159
-
160
  if ( empty( $excerpt ) )
161
  $excerpt = $this->fetch_excerpt( $the_id, $tt_id );
162
 
@@ -164,11 +175,17 @@ class AutoDescription_PostData extends AutoDescription_Detect {
164
  if ( '' === $excerpt )
165
  return '';
166
 
167
- $excerpt = wp_strip_all_tags( strip_shortcodes( $excerpt ) );
168
-
169
- $output = $this->s_description( $excerpt );
 
 
 
 
 
 
170
 
171
- return $output;
172
  }
173
 
174
  /**
@@ -194,9 +211,9 @@ class AutoDescription_PostData extends AutoDescription_Detect {
194
  * Fetch custom excerpt, if not empty, from the post_excerpt field.
195
  * @since 2.5.2
196
  */
197
- if ( isset( $post->post_excerpt ) && $post->post_excerpt ) {
198
  $excerpt = $post->post_excerpt;
199
- } else if ( isset( $post->post_content ) ) {
200
  $uses_builder = $this->uses_page_builder( $post->ID );
201
  $excerpt = $uses_builder ? '' : $post->post_content;
202
  } else {
@@ -249,7 +266,7 @@ class AutoDescription_PostData extends AutoDescription_Detect {
249
  } else {
250
  $post = get_post( $the_id );
251
  }
252
- } else if ( '' !== $tt_id ) {
253
  /**
254
  * @since 2.3.3 Match the descriptions in admin as on the front end.
255
  */
@@ -337,7 +354,9 @@ class AutoDescription_PostData extends AutoDescription_Detect {
337
  AND post_status IN ($post_status_in_string)
338
  ORDER BY post_date DESC
339
  LIMIT %d",
340
- '', 1 );
 
 
341
 
342
  $page_id = (int) $wpdb->get_var( $sql );
343
  $this->object_cache_set( $latest_posts_key, $page_id, DAY_IN_SECONDS );
@@ -417,5 +436,4 @@ class AutoDescription_PostData extends AutoDescription_Detect {
417
 
418
  return false;
419
  }
420
-
421
  }
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_PostData
23
  *
27
  */
28
  class AutoDescription_PostData extends AutoDescription_Detect {
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
  */
66
  if ( ! isset( $_POST['autodescription'] ) )
67
  return;
68
 
69
+ /**
70
+ * Merge user submitted options with fallback defaults
71
+ * Passes through nonce at the end of the function.
72
+ */
73
  $data = wp_parse_args( $_POST['autodescription'], array(
74
  '_genesis_title' => '',
75
  '_genesis_description' => '',
84
  foreach ( (array) $data as $key => $value ) {
85
  //* Sanitize the title
86
  if ( '_genesis_title' === $key )
87
+ $data[ $key ] = trim( strip_tags( $value ) );
88
 
89
  //* Sanitize the description
90
  if ( '_genesis_description' === $key )
91
+ $data[ $key ] = $this->s_description( $value );
92
 
93
  //* Sanitize the URL. Make sure it's an absolute URL
94
  if ( 'redirect' === $key )
95
+ $data[ $key ] = $this->s_redirect_url( $value );
96
 
97
  }
98
 
99
+ $this->save_custom_fields( $data, $this->inpost_nonce_field, $this->inpost_nonce_name, $post );
100
  }
101
 
102
  /**
157
  }
158
 
159
  /**
160
+ * Fetches or parses the excerpt of the post.
161
  *
162
  * @since 1.0.0
163
  *
164
+ * @param string $excerpt the Excerpt.
165
  * @param int $the_id The Post ID.
166
+ * @param int $tt_id The Taxonomy Term ID.
167
+ * @return string The escaped Excerpt.
 
168
  */
169
  public function get_excerpt_by_id( $excerpt = '', $the_id = '', $tt_id = '' ) {
170
 
 
 
 
 
 
171
  if ( empty( $excerpt ) )
172
  $excerpt = $this->fetch_excerpt( $the_id, $tt_id );
173
 
175
  if ( '' === $excerpt )
176
  return '';
177
 
178
+ /**
179
+ * Applies filters 'the_seo_framework_allow_excerpt_shortcode_tags' : boolean
180
+ * @since 2.6.6.1
181
+ */
182
+ if ( apply_filters( 'the_seo_framework_allow_excerpt_shortcode_tags', false ) && false === $this->is_feed() ) {
183
+ $excerpt = wp_strip_all_tags( $excerpt );
184
+ } else {
185
+ $excerpt = wp_strip_all_tags( strip_shortcodes( $excerpt ) );
186
+ }
187
 
188
+ return $this->s_description( $excerpt );
189
  }
190
 
191
  /**
211
  * Fetch custom excerpt, if not empty, from the post_excerpt field.
212
  * @since 2.5.2
213
  */
214
+ if ( ! empty( $post->post_excerpt ) ) {
215
  $excerpt = $post->post_excerpt;
216
+ } elseif ( isset( $post->post_content ) ) {
217
  $uses_builder = $this->uses_page_builder( $post->ID );
218
  $excerpt = $uses_builder ? '' : $post->post_content;
219
  } else {
266
  } else {
267
  $post = get_post( $the_id );
268
  }
269
+ } elseif ( '' !== $tt_id ) {
270
  /**
271
  * @since 2.3.3 Match the descriptions in admin as on the front end.
272
  */
354
  AND post_status IN ($post_status_in_string)
355
  ORDER BY post_date DESC
356
  LIMIT %d",
357
+ '',
358
+ 1
359
+ );
360
 
361
  $page_id = (int) $wpdb->get_var( $sql );
362
  $this->object_cache_set( $latest_posts_key, $page_id, DAY_IN_SECONDS );
436
 
437
  return false;
438
  }
 
439
  }
inc/classes/query.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_Query
21
  *
@@ -28,6 +30,18 @@
28
  */
29
  class AutoDescription_Query extends AutoDescription_Compat {
30
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  /**
32
  * Constructor. Load parent constructor.
33
  */
@@ -61,23 +75,21 @@ class AutoDescription_Query extends AutoDescription_Compat {
61
  }
62
 
63
  /**
64
- * Get the real page ID, also depending on CPT.
65
- *
66
- * @param bool $use_cache Whether to use the cache or not.
67
- *
68
- * @staticvar int $id the ID.
69
  *
70
  * @since 2.5.0
 
71
  *
 
72
  * @return int|false The ID.
73
  */
74
  public function get_the_real_ID( $use_cache = true ) {
75
 
76
- $is_admin = $this->is_admin();
77
- $can_cache = $this->can_cache_query();
78
 
79
- //* Never use cache for this in admin. Only causes bugs.
80
- $use_cache = $is_admin || false === $can_cache ? false : $use_cache;
81
 
82
  if ( $use_cache ) {
83
  static $id = null;
@@ -87,19 +99,11 @@ class AutoDescription_Query extends AutoDescription_Compat {
87
  }
88
 
89
  //* Try to get ID from plugins.
90
- $id = $is_admin || false === $can_cache ? 0 : $this->check_the_real_ID();
91
 
92
  if ( empty( $id ) ) {
93
- //* The Post ID can be this ID as well.
94
  $id = get_queried_object_id();
95
-
96
- //* Never get this when this is an archive. It will always return the wrong value.
97
- if ( empty( $id ) && false === is_archive() && false === is_home() )
98
- $id = get_the_ID();
99
-
100
- //* Determine the Archive ID on term edit.
101
- if ( empty( $id ) && $is_admin && $this->is_archive_admin() )
102
- $id = $this->get_admin_term_id();
103
  }
104
 
105
  /**
@@ -112,46 +116,68 @@ class AutoDescription_Query extends AutoDescription_Compat {
112
  *
113
  * @since 2.6.2
114
  */
115
- $id = (int) apply_filters( 'the_seo_framework_current_object_id', $id, $this->can_cache_query() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- //* Turn ID into 0 if empty.
118
- return $id = empty( $id ) ? 0 : $id;
119
  }
120
 
121
  /**
122
  * Get the real ID from plugins.
123
  *
124
- * Only works in front-end as there's no need to check for inconsistent
125
  * functions for the current ID in the admin.
126
  *
127
  * @since 2.5.0
128
  *
129
- * Applies filters the_seo_framework_real_id : The Real ID for plugins on front-end.
130
- *
131
- * @staticvar int $cached_id The cached ID.
132
- *
133
  * @return int|empty the ID.
134
  */
135
  public function check_the_real_ID() {
136
 
137
- static $cached_id = null;
138
-
139
- if ( isset( $cached_id ) && $this->can_cache_query() )
140
- return $cached_id;
141
 
142
  $id = '';
143
 
144
  if ( $this->is_wc_shop() ) {
145
  //* WooCommerce Shop
146
  $id = get_option( 'woocommerce_shop_page_id' );
147
- } else if ( function_exists( 'get_question_id' ) && did_action( 'template_redirect' ) ) {
148
  //* AnsPress
149
  $id = get_question_id();
150
  }
151
 
152
- $cached_id = (int) apply_filters( 'the_seo_framework_real_id', $id );
 
 
 
 
 
 
 
 
153
 
154
- return $cached_id;
155
  }
156
 
157
  /**
@@ -159,100 +185,90 @@ class AutoDescription_Query extends AutoDescription_Compat {
159
  *
160
  * @since 2.6.0
161
  * @since 2.6.6 Moved from class AutoDescription_TermData.
162
- * @staticvar int $term_id The Term ID.
163
  *
164
  * @return int Term ID.
165
  */
166
  public function get_admin_term_id() {
167
 
168
- static $term_id = null;
 
 
 
 
169
 
170
- if ( isset( $term_id ) )
171
- return $term_id;
172
 
173
- if ( isset( $_REQUEST['tag_ID'] ) && $_REQUEST['tag_ID'] ) {
 
 
 
 
174
  //* WordPress 4.5+
175
- $term_id = $_REQUEST['tag_ID'];
176
- } else if ( isset( $_REQUEST['term_id'] ) && $_REQUEST['term_id'] ) {
177
  //* Older WordPress versions.
178
- $term_id = $_REQUEST['term_id'];
179
  }
180
 
181
- return $term_id = $term_id ? absint( $term_id ) : 0;
 
 
 
 
 
182
  }
183
 
184
  /**
185
  * Detects 404.
186
  *
187
  * @since 2.6.0
188
- * @staticvar bool $cache
189
  *
190
  * @return bool
191
  */
192
  public function is_404() {
193
-
194
- static $cache = null;
195
-
196
- if ( isset( $cache ) && $this->can_cache_query() )
197
- return $cache;
198
-
199
- if ( is_404() )
200
- return $cache = true;
201
-
202
- return $cache = false;
203
  }
204
 
205
  /**
206
  * Detects admin screen.
207
  *
208
  * @since 2.6.0
209
- * @staticvar bool $cache
210
  *
211
  * @return bool
212
  */
213
  public function is_admin() {
214
-
215
- static $cache = null;
216
-
217
- if ( isset( $cache ) && $this->can_cache_query() )
218
- return $cache;
219
-
220
- if ( is_admin() )
221
- return $cache = true;
222
-
223
- return $cache = false;
224
  }
225
 
226
  /**
227
  * Detects attachment page.
228
  *
229
  * @since 2.6.0
230
- * @staticvar bool $cache
231
- * @uses $this->is_singular()
232
- *
233
- * @param int|string|array|object $attachment Attachment ID, title, slug, or array of such.
234
  *
 
235
  * @return bool
236
  */
237
  public function is_attachment( $attachment = '' ) {
238
 
239
- static $cache = array();
 
240
 
241
- if ( isset( $cache[$attachment] ) && $this->can_cache_query() )
242
- return $cache[$attachment];
243
 
244
- if ( $this->is_singular( $attachment ) && is_attachment( $attachment ) )
245
- return $cache[$attachment] = true;
 
 
 
246
 
247
- return $cache[$attachment] = false;
248
  }
249
 
250
  /**
251
  * Detects archive pages. Also in admin.
252
  *
253
  * @since 2.6.0
254
- * @staticvar bool $cache
255
- *
256
  * @global object $wp_query
257
  *
258
  * @return bool
@@ -262,187 +278,171 @@ class AutoDescription_Query extends AutoDescription_Compat {
262
  if ( $this->is_admin() )
263
  return $this->is_archive_admin();
264
 
265
- static $cache = null;
266
-
267
- if ( isset( $cache ) && $this->can_cache_query() )
268
- return $cache;
269
-
270
  if ( is_archive() && false === $this->is_singular() )
271
- return $cache = true;
272
 
273
  if ( $this->can_cache_query() && false === $this->is_singular() ) {
274
  global $wp_query;
275
 
276
  if ( $wp_query->is_post_type_archive || $wp_query->is_date || $wp_query->is_author || $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax )
277
- return $cache = true;
278
  }
279
 
280
- return $cache = false;
281
  }
282
 
283
  /**
284
  * Extends default WordPress is_archive() and determines screen in admin.
285
  *
286
  * @since 2.6.0
287
- * @staticvar bool $cache
288
- *
289
  * @global object $current_screen
290
  *
291
  * @return bool Post Type is archive
292
  */
293
  public function is_archive_admin() {
294
-
295
- static $cache = null;
296
-
297
- if ( isset( $cache ) && $this->can_cache_query() )
298
- return $cache;
299
-
300
  global $current_screen;
301
 
302
  if ( isset( $current_screen->base ) && ( 'edit-tags' === $current_screen->base || 'term' === $current_screen->base ) )
303
- return $cache = true;
304
 
305
- return $cache = false;
306
  }
307
 
308
  /**
309
  * Detects Term edit screen in WP Admin.
310
  *
311
  * @since 2.6.0
312
- * @staticvar bool $cache
313
  * @global object $current_screen
314
  *
315
  * @return bool We're on Term Edit screen.
316
  */
317
  public function is_term_edit() {
318
 
319
- static $cache = null;
320
-
321
- if ( isset( $cache ) && $this->can_cache_query() )
322
  return $cache;
323
 
324
  global $current_screen;
325
 
326
- if ( $this->wp_version( '4.4.9999', '>=' ) ) {
 
 
327
  if ( isset( $current_screen->base ) && ( 'term' === $current_screen->base ) )
328
- return $cache = true;
329
  } else {
330
  if ( isset( $current_screen->base ) && ( 'edit-tags' === $current_screen->base ) )
331
- return $cache = true;
332
  }
333
 
334
- return $cache = false;
 
 
 
 
 
335
  }
336
 
337
  /**
338
  * Detects Post edit screen in WP Admin.
339
  *
340
  * @since 2.6.0
341
- * @staticvar bool $cache
342
  * @global object $current_screen
343
  *
344
  * @return bool We're on Post Edit screen.
345
  */
346
  public function is_post_edit() {
347
-
348
- static $cache = null;
349
-
350
- if ( isset( $cache ) && $this->can_cache_query() )
351
- return $cache;
352
-
353
  global $current_screen;
354
 
355
  if ( isset( $current_screen->base ) && 'post' === $current_screen->base )
356
- return $cache = true;
357
 
358
- return $cache = false;
359
  }
360
 
361
  /**
362
  * Detects Post or Archive Lists in Admin.
363
  *
364
  * @since 2.6.0
365
- * @staticvar bool $cache
366
  * @global object $current_screen
 
367
  *
368
  * @return bool We're on the edit screen.
369
  */
370
  public function is_wp_lists_edit() {
371
-
372
- static $cache = null;
373
-
374
- if ( isset( $cache ) && $this->can_cache_query() )
375
- return $cache;
376
-
377
  global $current_screen;
378
 
379
- //* @NOTE USE WITH CAUTION - WP 4.5 & < 4.5 conflict.
380
  if ( isset( $current_screen->base ) && ( 'edit' === $current_screen->base || 'edit-tags' === $current_screen->base ) )
381
- return $cache = true;
382
 
383
- return $cache = false;
384
  }
385
 
386
  /**
387
  * Detects author archives.
388
  *
389
  * @since 2.6.0
390
- * @staticvar bool $cache
391
  * @uses $this->is_archive()
392
  *
393
  * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
394
- *
395
  * @return bool
396
  */
397
  public function is_author( $author = '' ) {
398
 
399
- static $cache = array();
 
400
 
401
- if ( isset( $cache[$author] ) && $this->can_cache_query() )
402
- return $cache[$author];
403
 
404
- if ( $this->is_archive() && is_author( $author ) )
405
- return $cache[$author] = true;
 
 
 
406
 
407
- return $cache[$author] = false;
408
  }
409
 
410
  /**
411
  * Detect the separated blog page.
412
  *
413
  * @since 2.3.4
414
- * @staticvar bool $is_blog_page
415
  *
416
  * @param int $id the Page ID.
417
  * @return bool true if is blog page. Always false if blog page is homepage.
418
  */
419
- public function is_blog_page( $id = '' ) {
420
 
421
- if ( '' === $id )
422
  $id = $this->get_the_real_ID();
423
 
424
- static $is_blog_page = array();
 
425
 
426
- if ( isset( $is_blog_page[$id] ) && $this->can_cache_query() )
427
- return $is_blog_page[$id];
428
 
429
  $pfp = (int) get_option( 'page_for_posts' );
430
 
431
- if ( $id === $pfp ) {
432
- //* Don't use $this->is_archive (will loop).
433
- if ( $this->has_page_on_front() && false === $this->is_front_page() && false === is_archive() ) {
434
- return $is_blog_page[$id] = true;
435
- }
436
  }
437
 
438
- return $is_blog_page[$id] = false;
 
 
 
 
 
 
439
  }
440
 
441
  /**
442
  * Detects category archives.
443
  *
444
  * @since 2.6.0
445
- * @staticvar bool $cache
446
  * @uses $this->is_archive()
447
  *
448
  * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
@@ -453,154 +453,135 @@ class AutoDescription_Query extends AutoDescription_Compat {
453
  if ( $this->is_admin() )
454
  return $this->is_category_admin();
455
 
456
- static $cache = array();
457
-
458
- if ( isset( $cache[$category] ) && $this->can_cache_query() )
459
- return $cache[$category];
460
 
461
- if ( $this->is_archive() && is_category( $category ) )
462
- return $cache[$category] = true;
 
 
 
463
 
464
- return $cache[$category] = false;
465
  }
466
 
467
  /**
468
  * Extends default WordPress is_category() and determines screen in admin.
469
  *
470
  * @since 2.6.0
471
- * @staticvar bool $cache
472
  * @global object $current_screen
473
  *
474
  * @return bool Post Type is category
475
  */
476
  public function is_category_admin() {
477
 
478
- static $cache = null;
479
-
480
- if ( isset( $cache ) && $this->can_cache_query() )
481
  return $cache;
482
 
483
  global $current_screen;
484
 
 
 
485
  if ( $this->is_archive_admin() && isset( $current_screen->taxonomy ) ) {
486
 
487
  $tax = $current_screen->taxonomy;
488
  $len = strlen( $tax );
489
 
490
  if ( $len >= 8 && false !== strrpos( $tax, 'category', -8 ) )
491
- return $cache = true;
492
-
493
- if ( $len >= 3 && false !== strrpos( $tax, 'cat', -3 ) )
494
- return $cache = true;
495
  }
496
 
497
- return $cache = false;
 
 
 
 
 
498
  }
499
 
500
  /**
501
  * Detects date archives.
502
  *
503
  * @since 2.6.0
504
- * @staticvar bool $cache
505
- * @uses $this->is_archive()
506
  *
507
  * @return bool
508
  */
509
  public function is_date() {
510
-
511
- static $cache = null;
512
-
513
- if ( isset( $cache ) && $this->can_cache_query() )
514
- return $cache;
515
-
516
- if ( $this->is_archive() && is_date() )
517
- return $cache = true;
518
-
519
- return $cache = false;
520
  }
521
 
522
  /**
523
  * Detects day archives.
524
  *
525
- * @staticvar bool $cache
526
  * @since 2.6.0
527
  * @uses $this->is_date()
528
  *
529
  * @return bool
530
  */
531
  public function is_day() {
532
-
533
- static $cache = null;
534
-
535
- if ( isset( $cache ) && $this->can_cache_query() )
536
- return $cache;
537
-
538
- if ( is_day() )
539
- return $cache = true;
540
-
541
- return $cache = false;
542
  }
543
 
544
  /**
545
  * Detects feed.
546
  *
547
  * @since 2.6.0
548
- * @staticvar bool $cache
549
  *
550
  * @param string|array $feeds Optional feed types to check.
551
  * @return bool
552
  */
553
  public function is_feed( $feeds = '' ) {
554
-
555
- static $cache = array();
556
-
557
- if ( is_string( $feeds ) && isset( $cache[$feeds] ) && $this->can_cache_query() )
558
- return $cache[$feeds];
559
-
560
- if ( is_feed( $feeds ) )
561
- return $cache[$feeds] = true;
562
-
563
- return $cache[$feeds] = false;
564
  }
565
 
566
  /**
567
  * Detects front page.
568
  *
569
  * @since 2.6.0
570
- * @staticvar bool $cache
571
  *
572
- * @param int $id The page or Post ID.
573
  * @return bool
574
  */
575
  public function is_front_page( $id = 0 ) {
576
 
577
  static $cache = array();
578
 
579
- if ( isset( $cache[$id] ) && $this->can_cache_query() )
580
- return $cache[$id];
 
 
581
 
582
  if ( is_front_page() && empty( $id ) )
583
- return $cache[$id] = true;
584
 
585
  //* Elegant Themes Support.
586
- if ( empty( $id ) && $this->is_home() ) {
587
  $sof = get_option( 'show_on_front' );
588
 
589
  if ( 'page' !== $sof && 'posts' !== $sof )
590
- return $cache[$id] = true;
591
  }
592
 
593
- if ( $id ) {
 
594
  $sof = get_option( 'show_on_front' );
595
 
596
- if ( 'page' === $sof && $id === (int) get_option( 'page_on_front' ) )
597
- return $cache[$id] = true;
598
 
599
- if ( 'posts' === $sof && $id === (int) get_option( 'page_for_posts' ) )
600
- return $cache[$id] = true;
601
  }
602
 
603
- return $cache[$id] = false;
 
 
 
 
 
 
604
  }
605
 
606
  /**
@@ -612,42 +593,23 @@ class AutoDescription_Query extends AutoDescription_Compat {
612
  * @return bool
613
  */
614
  public function is_home() {
615
-
616
- static $cache = null;
617
-
618
- if ( isset( $cache ) && $this->can_cache_query() )
619
- return $cache;
620
-
621
- if ( is_home() )
622
- return $cache = true;
623
-
624
- return $cache = false;
625
  }
626
 
627
  /**
628
  * Detects month archives.
629
  *
630
  * @since 2.6.0
631
- * @staticvar bool $cache
632
- * @uses $this->is_date()
633
  *
634
  * @return bool
635
  */
636
  public function is_month() {
637
-
638
- static $cache = null;
639
-
640
- if ( isset( $cache ) && $this->can_cache_query() )
641
- return $cache;
642
-
643
- if ( is_month() )
644
- return $cache = true;
645
-
646
- return $cache = false;
647
  }
648
 
649
  /**
650
  * Detects pages.
 
651
  *
652
  * @since 2.6.0
653
  * @staticvar bool $cache
@@ -658,20 +620,22 @@ class AutoDescription_Query extends AutoDescription_Compat {
658
  */
659
  public function is_page( $page = '' ) {
660
 
661
- static $cache = array();
 
662
 
663
- if ( isset( $cache[$page] ) && $this->can_cache_query() )
664
- return $cache[$page];
665
 
666
- if ( $this->is_singular( $page ) ) {
667
- if ( is_page( $page ) )
668
- return $cache[$page] = true;
669
 
670
- if ( $this->is_admin() )
671
- return $cache[$page] = $this->is_page_admin( $page );
672
- }
 
 
673
 
674
- return $cache[$page] = false;
675
  }
676
 
677
  /**
@@ -681,10 +645,9 @@ class AutoDescription_Query extends AutoDescription_Compat {
681
  * @see $this->is_page()
682
  * @global object $current_screen;
683
  *
684
- * @param int|string|array $page Optional. Page ID, title, slug, or array of such. Default empty.
685
  * @return bool
686
  */
687
- public function is_page_admin( $page = '' ) {
688
  global $current_screen;
689
 
690
  if ( isset( $current_screen->post_type ) && 'page' === $current_screen->post_type )
@@ -702,16 +665,7 @@ class AutoDescription_Query extends AutoDescription_Compat {
702
  * @return bool
703
  */
704
  public function is_preview() {
705
-
706
- static $cache = null;
707
-
708
- if ( isset( $cache ) && $this->can_cache_query() )
709
- return $cache;
710
-
711
- if ( is_preview() )
712
- return $cache = true;
713
-
714
- return $cache = false;
715
  }
716
 
717
  /**
@@ -723,44 +677,38 @@ class AutoDescription_Query extends AutoDescription_Compat {
723
  * @return bool
724
  */
725
  public function is_search() {
726
-
727
- static $cache = null;
728
-
729
- if ( isset( $cache ) && $this->can_cache_query() )
730
- return $cache;
731
-
732
- if ( is_search() )
733
- return $cache = true;
734
-
735
- return $cache = false;
736
  }
737
 
738
  /**
739
  * Detects posts.
 
740
  *
741
  * @since 2.6.0
742
  * @staticvar bool $cache
743
- * @uses $this->is_singular()
744
  *
745
  * @param int|string|array $post Optional. Post ID, title, slug, or array of such. Default empty.
746
  * @return bool
747
  */
748
  public function is_single( $post = '' ) {
749
 
750
- static $cache = array();
 
751
 
752
- if ( isset( $cache[$post] ) && $this->can_cache_query() )
753
- return $cache[$post];
754
 
755
- if ( $this->is_singular( $post ) ) {
756
- if ( is_single( $post ) )
757
- return $cache[$post] = true;
758
 
759
- if ( $this->is_admin() )
760
- return $cache[$post] = $this->is_single_admin( $post );
761
- }
 
 
762
 
763
- return $cache[$post] = false;
764
  }
765
 
766
  /**
@@ -768,12 +716,11 @@ class AutoDescription_Query extends AutoDescription_Compat {
768
  *
769
  * @since 2.6.0
770
  * @global object $current_screen
771
- * @see $this->is_single()
772
  *
773
- * @param int|string|array $post Optional. Page ID, title, slug, or array of such. Default empty.
774
  * @return bool
775
  */
776
- public function is_single_admin( $post = '' ) {
777
  global $current_screen;
778
 
779
  if ( isset( $current_screen->post_type ) && 'post' === $current_screen->post_type )
@@ -787,72 +734,67 @@ class AutoDescription_Query extends AutoDescription_Compat {
787
  * Replaces and expands default WordPress is_singular().
788
  *
789
  * @since 2.5.2
790
- * @staticvar bool $cache
791
- * @uses $this->is_blog_page()
792
- * @uses $this->is_wc_shop()
 
793
  *
794
- * @param string|array $post_types Optional. Post type or array of post types. Default empty.
795
  * @return bool Post Type is singular
796
  */
797
  public function is_singular( $post_types = '' ) {
798
 
799
- static $cache = array();
800
-
801
- if ( isset( $cache[$post_types] ) && $this->can_cache_query() )
802
- return $cache[$post_types];
803
-
804
  //* WP_Query functions require loop, do alternative check.
805
  if ( $this->is_admin() )
806
- return $cache[$post_types] = $this->is_singular_admin();
807
 
808
  if ( is_int( $post_types ) ) {
809
- //* Cache ID. Core is_singlar() doesn't accept integers.
810
  $id = $post_types;
811
  $post_types = '';
812
  }
813
 
814
- //* Default check.
815
- if ( is_singular( $post_types ) )
816
- return $cache[$post_types] = true;
 
 
817
 
818
- $id = isset( $id ) ? $id : $this->get_the_real_ID();
 
 
 
819
 
820
- //* Check for somewhat singulars. We need this to adjust Meta data filled in Posts.
821
- if ( $this->is_blog_page( $id ) || $this->is_wc_shop() )
822
- return $cache[$post_types] = true;
 
 
823
 
824
- return $cache[$post_types] = false;
825
  }
826
 
827
  /**
828
  * Determines if the page is singular within the admin screen.
829
  *
830
  * @since 2.5.2
831
- * @staticvar bool $cache
832
  * @global object $current_screen
833
  *
834
  * @return bool Post Type is singular
835
  */
836
  public function is_singular_admin() {
837
-
838
- static $cache = null;
839
-
840
- if ( isset( $cache ) && $this->can_cache_query() )
841
- return $cache;
842
-
843
  global $current_screen;
844
 
845
  if ( isset( $current_screen->base ) && ( 'edit' === $current_screen->base || 'post' === $current_screen->base ) )
846
- return $cache = true;
847
 
848
- return $cache = false;
849
  }
850
 
851
  /**
852
  * Detects the static front page.
853
  *
854
  * @since 2.3.8
855
- * @staticvar array $cache
856
  *
857
  * @param int $id the Page ID to check. If empty, the current ID will be fetched.
858
  * @return bool true if is blog page. Always false if the homepage is a blog.
@@ -862,21 +804,10 @@ class AutoDescription_Query extends AutoDescription_Compat {
862
  if ( empty( $id ) )
863
  $id = $this->get_the_real_ID();
864
 
865
- static $cache = array();
866
-
867
- if ( isset( $cache[$id] ) && $this->can_cache_query() )
868
- return $cache[$id];
869
-
870
- $sof = (string) get_option( 'show_on_front' );
871
 
872
- if ( 'page' === $sof ) {
873
- $pof = (int) get_option( 'page_on_front' );
874
-
875
- if ( $id === $pof )
876
- return $cache[$id] = true;
877
- }
878
-
879
- return $cache[$id] = false;
880
  }
881
 
882
  /**
@@ -891,53 +822,56 @@ class AutoDescription_Query extends AutoDescription_Compat {
891
  */
892
  public function is_tag( $tag = '' ) {
893
 
894
- static $cache = array();
895
-
896
- if ( isset( $cache[$tag] ) && $this->can_cache_query() )
897
- return $cache[$tag];
898
-
899
  //* Admin requires another check.
900
  if ( $this->is_admin() )
901
- return $cache[$tag] = $this->is_tag_admin();
902
 
903
- if ( is_tag( $tag ) )
904
- return $cache[$tag] = true;
905
 
906
- return $cache[$tag] = false;
 
 
 
 
 
 
907
  }
908
 
909
  /**
910
  * Determines if the page is a tag within the admin screen.
911
  *
912
  * @since 2.6.0
913
- * @staticvar bool $cache
914
  * @global object $current_screen
915
  *
916
- * @return bool Post Type is category
917
  */
918
  public function is_tag_admin() {
919
 
920
- static $cache = null;
921
-
922
- if ( isset( $cache ) && $this->can_cache_query() )
923
  return $cache;
924
 
 
 
925
  if ( $this->is_archive_admin() ) {
926
  global $current_screen;
927
 
928
  if ( isset( $current_screen->taxonomy ) && strlen( $current_screen->taxonomy ) >= 3 && false !== strrpos( $current_screen->taxonomy, 'tag', -3 ) )
929
- return $cache = true;
930
  }
931
 
932
- return $cache = false;
 
 
 
 
 
933
  }
934
 
935
  /**
936
  * Detects taxonomy archives.
937
  *
938
  * @since 2.6.0
939
- * @staticvar bool $cache
940
- * @uses $this->is_archive()
941
  *
942
  * @param string|array $taxonomy Optional. Taxonomy slug or slugs.
943
  * @param int|string|array $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
@@ -945,15 +879,16 @@ class AutoDescription_Query extends AutoDescription_Compat {
945
  */
946
  public function is_tax( $taxonomy = '', $term = '' ) {
947
 
948
- static $cache = null;
949
-
950
- if ( isset( $cache[$taxonomy][$term] ) && $this->can_cache_query() )
951
- return $cache[$taxonomy][$term];
952
 
953
- if ( is_tax( $taxonomy, $term ) )
954
- return $cache[$taxonomy][$term] = true;
 
 
 
955
 
956
- return $cache[$taxonomy][$term] = false;
957
  }
958
 
959
  /**
@@ -961,21 +896,21 @@ class AutoDescription_Query extends AutoDescription_Compat {
961
  * Checks for function availability: um_user, um_is_core_page, um_get_requested_user
962
  *
963
  * @since 2.5.2
964
- * @staticvar bool $cache
965
  * @uses $this->can_i_use()
966
  *
967
  * @return bool Whether we're on a Ultimate Member page.
968
  */
969
  public function is_ultimate_member_user_page() {
970
 
971
- static $cache = null;
972
-
973
- if ( isset( $cache ) && $this->can_cache_query() )
974
  return $cache;
975
 
976
- $caniuse = (bool) $this->can_i_use( array( 'functions' => array( 'um_user', 'um_is_core_page', 'um_get_requested_user' ) ), false );
 
 
 
977
 
978
- return $cache = $caniuse;
979
  }
980
 
981
  /**
@@ -988,78 +923,102 @@ class AutoDescription_Query extends AutoDescription_Compat {
988
  */
989
  public function is_wc_shop() {
990
 
991
- static $cache = null;
992
-
993
- if ( isset( $cache ) && $this->can_cache_query() )
994
  return $cache;
995
 
996
- //* Can't check in admin.
997
- if ( false === $this->is_admin() && function_exists( 'is_shop' ) && is_shop() )
998
- return $cache = true;
 
999
 
1000
- return $cache = false;
1001
  }
1002
 
1003
  /**
1004
  * Determines if the page is the WooCommerce plugin Product page.
1005
  *
1006
  * @since 2.5.2
1007
- * @staticvar bool $cache
1008
  *
1009
  * @return bool True if on a WooCommerce Product page.
1010
  */
1011
  public function is_wc_product() {
1012
 
1013
- static $cache = null;
1014
-
1015
- if ( isset( $cache ) && $this->can_cache_query() )
1016
  return $cache;
1017
 
1018
- //* Can't check in admin.
1019
- if ( false === $this->is_admin() && function_exists( 'is_product' ) && is_product() )
1020
- return $cache = true;
 
1021
 
1022
- return $cache = false;
1023
  }
1024
 
1025
  /**
1026
  * Detects year archives.
1027
  *
1028
  * @since 2.6.0
1029
- * @staticvar bool $cache
1030
- * @uses $this->is_date()
1031
  *
1032
  * @return bool
1033
  */
1034
  public function is_year() {
1035
-
1036
- static $cache = null;
1037
-
1038
- if ( isset( $cache ) && $this->can_cache_query() )
1039
- return $cache;
1040
-
1041
- if ( is_year() )
1042
- return $cache = true;
1043
-
1044
- return $cache = false;
1045
  }
1046
 
1047
  /**
1048
  * Determines whether we're on the SEO settings page.
 
1049
  *
1050
  * @since 2.6.0
1051
- * @staticvar bool $cache
1052
  *
 
1053
  * @return bool
1054
  */
1055
- public function is_seo_settings_page() {
1056
-
1057
- static $cache = null;
1058
 
1059
- if ( isset( $cache ) && $this->can_cache_query() )
1060
  return $cache;
1061
 
1062
- return $cache = $this->is_menu_page( $this->page_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
  }
1064
 
1065
  /**
@@ -1067,41 +1026,182 @@ class AutoDescription_Query extends AutoDescription_Compat {
1067
  * Fetches global $page through Query Var to prevent conflicts.
1068
  *
1069
  * @since 2.6.0
1070
- * @staticvar int $page
1071
  *
1072
  * @return int $page Always a positive number.
1073
  */
1074
  public function page() {
1075
 
1076
- static $page = null;
 
1077
 
1078
- if ( isset( $page ) && $this->can_cache_query() )
1079
- return $page;
1080
 
1081
- $page = get_query_var( 'page' );
 
 
 
1082
 
1083
- return $page = $page ? (int) $page : 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1084
  }
1085
 
1086
  /**
1087
  * Fetches the number of the current page.
1088
- * Fetches global $paged through Query Var. Determines
1089
  *
1090
  * @since 2.6.0
1091
- * @staticvar int $paged
1092
  *
1093
  * @return int $paged
1094
  */
1095
  public function paged() {
1096
 
1097
- static $paged = null;
1098
-
1099
- if ( isset( $paged ) && $this->can_cache_query() )
1100
- return $paged;
1101
 
1102
  $paged = get_query_var( 'paged' );
1103
 
1104
- return $paged = $paged ? (int) $paged : 1;
 
 
 
 
 
1105
  }
1106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1107
  }
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_Query
23
  *
30
  */
31
  class AutoDescription_Query extends AutoDescription_Compat {
32
 
33
+ /**
34
+ * Unserializing instances of this class is forbidden.
35
+ */
36
+ private function __wakeup() { }
37
+
38
+ /**
39
+ * Handle unapproachable invoked methods.
40
+ */
41
+ public function __call( $name, $arguments ) {
42
+ parent::__call( $name, $arguments );
43
+ }
44
+
45
  /**
46
  * Constructor. Load parent constructor.
47
  */
75
  }
76
 
77
  /**
78
+ * Get the real page ID, also from CPT, archives, author, blog, etc.
 
 
 
 
79
  *
80
  * @since 2.5.0
81
+ * @staticvar int $id the ID.
82
  *
83
+ * @param bool $use_cache Whether to use the cache or not.
84
  * @return int|false The ID.
85
  */
86
  public function get_the_real_ID( $use_cache = true ) {
87
 
88
+ if ( $this->is_admin() )
89
+ return $this->get_the_real_admin_ID();
90
 
91
+ $can_cache = $this->can_cache_query();
92
+ $use_cache = $can_cache ? $use_cache : false;
93
 
94
  if ( $use_cache ) {
95
  static $id = null;
99
  }
100
 
101
  //* Try to get ID from plugins.
102
+ $id = $can_cache ? $this->check_the_real_ID() : 0;
103
 
104
  if ( empty( $id ) ) {
105
+ //* This catches most ID's. Even Post IDs.
106
  $id = get_queried_object_id();
 
 
 
 
 
 
 
 
107
  }
108
 
109
  /**
116
  *
117
  * @since 2.6.2
118
  */
119
+ return $id = (int) apply_filters( 'the_seo_framework_current_object_id', $id, $can_cache );
120
+ }
121
+
122
+ /**
123
+ * Fetches post or term ID within the admin.
124
+ * Alters while in the loop. Therefore, this can't be cached and must be called within the loop.
125
+ *
126
+ * @since 2.7.0
127
+ */
128
+ public function get_the_real_admin_ID() {
129
+
130
+ /**
131
+ * This is get_the_ID() with WordPress 3.9 compatibility.
132
+ * @todo convert to get_the_ID()
133
+ * @priority OMGWTFBBQ 2.7.x (I warned you.)
134
+ */
135
+ $post = get_post();
136
+ $id = empty( $post ) ? 0 : $post->ID;
137
+
138
+ //* Current term ID (outside loop).
139
+ if ( empty( $id ) && $this->is_archive_admin() )
140
+ $id = $this->get_admin_term_id();
141
 
142
+ return $id;
 
143
  }
144
 
145
  /**
146
  * Get the real ID from plugins.
147
  *
148
+ * Only works on front-end as there's no need to check for inconsistent
149
  * functions for the current ID in the admin.
150
  *
151
  * @since 2.5.0
152
  *
 
 
 
 
153
  * @return int|empty the ID.
154
  */
155
  public function check_the_real_ID() {
156
 
157
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
158
+ return $cache;
 
 
159
 
160
  $id = '';
161
 
162
  if ( $this->is_wc_shop() ) {
163
  //* WooCommerce Shop
164
  $id = get_option( 'woocommerce_shop_page_id' );
165
+ } elseif ( function_exists( 'get_question_id' ) && did_action( 'template_redirect' ) ) {
166
  //* AnsPress
167
  $id = get_question_id();
168
  }
169
 
170
+ /**
171
+ * Applies filters the_seo_framework_real_id : The Real ID for plugins on front-end.
172
+ * @since 2.5.0
173
+ * @TODO add to Filters API.
174
+ */
175
+ $this->set_query_cache(
176
+ __METHOD__,
177
+ $id = (int) apply_filters( 'the_seo_framework_real_id', $id )
178
+ );
179
 
180
+ return $id;
181
  }
182
 
183
  /**
185
  *
186
  * @since 2.6.0
187
  * @since 2.6.6 Moved from class AutoDescription_TermData.
 
188
  *
189
  * @return int Term ID.
190
  */
191
  public function get_admin_term_id() {
192
 
193
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
194
+ return $cache;
195
+
196
+ if ( false === $this->is_archive_admin() )
197
+ return 0;
198
 
199
+ $term_id = 0;
 
200
 
201
+ /**
202
+ * is_archive_admin() determines if admin referer checks have run
203
+ * through global $current_screen. Will output 'Invalid taxonomy' on try.
204
+ */
205
+ if ( ! empty( $_GET['tag_ID'] ) ) {
206
  //* WordPress 4.5+
207
+ $term_id = $_GET['tag_ID'];
208
+ } elseif ( ! empty( $_GET['term_id'] ) ) {
209
  //* Older WordPress versions.
210
+ $term_id = $_GET['term_id'];
211
  }
212
 
213
+ $this->set_query_cache(
214
+ __METHOD__,
215
+ $term_id = intval( $term_id ) ? absint( $term_id ) : 0
216
+ );
217
+
218
+ return $term_id;
219
  }
220
 
221
  /**
222
  * Detects 404.
223
  *
224
  * @since 2.6.0
 
225
  *
226
  * @return bool
227
  */
228
  public function is_404() {
229
+ return is_404();
 
 
 
 
 
 
 
 
 
230
  }
231
 
232
  /**
233
  * Detects admin screen.
234
  *
235
  * @since 2.6.0
 
236
  *
237
  * @return bool
238
  */
239
  public function is_admin() {
240
+ return is_admin();
 
 
 
 
 
 
 
 
 
241
  }
242
 
243
  /**
244
  * Detects attachment page.
245
  *
246
  * @since 2.6.0
 
 
 
 
247
  *
248
+ * @param mixed $attachment Attachment ID, title, slug, or array of such.
249
  * @return bool
250
  */
251
  public function is_attachment( $attachment = '' ) {
252
 
253
+ if ( empty( $attachment ) )
254
+ return is_attachment();
255
 
256
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $attachment ) )
257
+ return $cache;
258
 
259
+ $this->set_query_cache(
260
+ __METHOD__,
261
+ $is_attachment = is_attachment( $attachment ),
262
+ $attachment
263
+ );
264
 
265
+ return $is_attachment;
266
  }
267
 
268
  /**
269
  * Detects archive pages. Also in admin.
270
  *
271
  * @since 2.6.0
 
 
272
  * @global object $wp_query
273
  *
274
  * @return bool
278
  if ( $this->is_admin() )
279
  return $this->is_archive_admin();
280
 
 
 
 
 
 
281
  if ( is_archive() && false === $this->is_singular() )
282
+ return true;
283
 
284
  if ( $this->can_cache_query() && false === $this->is_singular() ) {
285
  global $wp_query;
286
 
287
  if ( $wp_query->is_post_type_archive || $wp_query->is_date || $wp_query->is_author || $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax )
288
+ return true;
289
  }
290
 
291
+ return false;
292
  }
293
 
294
  /**
295
  * Extends default WordPress is_archive() and determines screen in admin.
296
  *
297
  * @since 2.6.0
 
 
298
  * @global object $current_screen
299
  *
300
  * @return bool Post Type is archive
301
  */
302
  public function is_archive_admin() {
 
 
 
 
 
 
303
  global $current_screen;
304
 
305
  if ( isset( $current_screen->base ) && ( 'edit-tags' === $current_screen->base || 'term' === $current_screen->base ) )
306
+ return true;
307
 
308
+ return false;
309
  }
310
 
311
  /**
312
  * Detects Term edit screen in WP Admin.
313
  *
314
  * @since 2.6.0
 
315
  * @global object $current_screen
316
  *
317
  * @return bool We're on Term Edit screen.
318
  */
319
  public function is_term_edit() {
320
 
321
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
 
 
322
  return $cache;
323
 
324
  global $current_screen;
325
 
326
+ $is_term_edit = false;
327
+
328
+ if ( $this->wp_version( '4.4.9999', '>' ) ) {
329
  if ( isset( $current_screen->base ) && ( 'term' === $current_screen->base ) )
330
+ $is_term_edit = true;
331
  } else {
332
  if ( isset( $current_screen->base ) && ( 'edit-tags' === $current_screen->base ) )
333
+ $is_term_edit = true;
334
  }
335
 
336
+ $this->set_query_cache(
337
+ __METHOD__,
338
+ $is_term_edit
339
+ );
340
+
341
+ return $is_term_edit;
342
  }
343
 
344
  /**
345
  * Detects Post edit screen in WP Admin.
346
  *
347
  * @since 2.6.0
 
348
  * @global object $current_screen
349
  *
350
  * @return bool We're on Post Edit screen.
351
  */
352
  public function is_post_edit() {
 
 
 
 
 
 
353
  global $current_screen;
354
 
355
  if ( isset( $current_screen->base ) && 'post' === $current_screen->base )
356
+ return true;
357
 
358
+ return false;
359
  }
360
 
361
  /**
362
  * Detects Post or Archive Lists in Admin.
363
  *
364
  * @since 2.6.0
 
365
  * @global object $current_screen
366
+ * @access private
367
  *
368
  * @return bool We're on the edit screen.
369
  */
370
  public function is_wp_lists_edit() {
 
 
 
 
 
 
371
  global $current_screen;
372
 
373
+ //* @NOTE WP >= 4.5 & WP < 4.5 conflict.
374
  if ( isset( $current_screen->base ) && ( 'edit' === $current_screen->base || 'edit-tags' === $current_screen->base ) )
375
+ return true;
376
 
377
+ return false;
378
  }
379
 
380
  /**
381
  * Detects author archives.
382
  *
383
  * @since 2.6.0
 
384
  * @uses $this->is_archive()
385
  *
386
  * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
 
387
  * @return bool
388
  */
389
  public function is_author( $author = '' ) {
390
 
391
+ if ( empty( $author ) )
392
+ return is_author();
393
 
394
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $author ) )
395
+ return $cache;
396
 
397
+ $this->set_query_cache(
398
+ __METHOD__,
399
+ $is_author = is_author( $author ),
400
+ $author
401
+ );
402
 
403
+ return $is_author;
404
  }
405
 
406
  /**
407
  * Detect the separated blog page.
408
  *
409
  * @since 2.3.4
 
410
  *
411
  * @param int $id the Page ID.
412
  * @return bool true if is blog page. Always false if blog page is homepage.
413
  */
414
+ public function is_blog_page( $id = 0 ) {
415
 
416
+ if ( empty( $id ) )
417
  $id = $this->get_the_real_ID();
418
 
419
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $id ) )
420
+ return $cache;
421
 
422
+ $is_blog_page = false;
 
423
 
424
  $pfp = (int) get_option( 'page_for_posts' );
425
 
426
+ if ( $this->has_page_on_front() ) {
427
+ if ( $id === $pfp && false === is_archive() )
428
+ $is_blog_page = true;
429
+ elseif ( is_home() )
430
+ $is_blog_page = true;
431
  }
432
 
433
+ $this->set_query_cache(
434
+ __METHOD__,
435
+ $is_blog_page,
436
+ $id
437
+ );
438
+
439
+ return $is_blog_page;
440
  }
441
 
442
  /**
443
  * Detects category archives.
444
  *
445
  * @since 2.6.0
 
446
  * @uses $this->is_archive()
447
  *
448
  * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
453
  if ( $this->is_admin() )
454
  return $this->is_category_admin();
455
 
456
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $category ) )
457
+ return $cache;
 
 
458
 
459
+ $this->set_query_cache(
460
+ __METHOD__,
461
+ $is_category = is_category( $category ),
462
+ $category
463
+ );
464
 
465
+ return $is_category;
466
  }
467
 
468
  /**
469
  * Extends default WordPress is_category() and determines screen in admin.
470
  *
471
  * @since 2.6.0
 
472
  * @global object $current_screen
473
  *
474
  * @return bool Post Type is category
475
  */
476
  public function is_category_admin() {
477
 
478
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
 
 
479
  return $cache;
480
 
481
  global $current_screen;
482
 
483
+ $is_category = false;
484
+
485
  if ( $this->is_archive_admin() && isset( $current_screen->taxonomy ) ) {
486
 
487
  $tax = $current_screen->taxonomy;
488
  $len = strlen( $tax );
489
 
490
  if ( $len >= 8 && false !== strrpos( $tax, 'category', -8 ) )
491
+ $is_category = true;
492
+ elseif ( $len >= 3 && false !== strrpos( $tax, 'cat', -3 ) )
493
+ $is_category = true;
 
494
  }
495
 
496
+ $this->set_query_cache(
497
+ __METHOD__,
498
+ $is_category
499
+ );
500
+
501
+ return $is_category;
502
  }
503
 
504
  /**
505
  * Detects date archives.
506
  *
507
  * @since 2.6.0
 
 
508
  *
509
  * @return bool
510
  */
511
  public function is_date() {
512
+ return is_date();
 
 
 
 
 
 
 
 
 
513
  }
514
 
515
  /**
516
  * Detects day archives.
517
  *
 
518
  * @since 2.6.0
519
  * @uses $this->is_date()
520
  *
521
  * @return bool
522
  */
523
  public function is_day() {
524
+ return is_day();
 
 
 
 
 
 
 
 
 
525
  }
526
 
527
  /**
528
  * Detects feed.
529
  *
530
  * @since 2.6.0
 
531
  *
532
  * @param string|array $feeds Optional feed types to check.
533
  * @return bool
534
  */
535
  public function is_feed( $feeds = '' ) {
536
+ return is_feed( $feeds );
 
 
 
 
 
 
 
 
 
537
  }
538
 
539
  /**
540
  * Detects front page.
541
  *
542
  * @since 2.6.0
 
543
  *
544
+ * @param int $id The Page or Post ID.
545
  * @return bool
546
  */
547
  public function is_front_page( $id = 0 ) {
548
 
549
  static $cache = array();
550
 
551
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $id ) )
552
+ return $cache;
553
+
554
+ $is_front_page = false;
555
 
556
  if ( is_front_page() && empty( $id ) )
557
+ $is_front_page = true;
558
 
559
  //* Elegant Themes Support.
560
+ if ( false === $is_front_page && empty( $id ) && $this->is_home() ) {
561
  $sof = get_option( 'show_on_front' );
562
 
563
  if ( 'page' !== $sof && 'posts' !== $sof )
564
+ $is_front_page = true;
565
  }
566
 
567
+ //* Compare against $id
568
+ if ( false === $is_front_page && $id ) {
569
  $sof = get_option( 'show_on_front' );
570
 
571
+ if ( 'page' === $sof && (int) get_option( 'page_on_front' ) === $id )
572
+ $is_front_page = true;
573
 
574
+ if ( 'posts' === $sof && (int) get_option( 'page_for_posts' ) === $id )
575
+ $is_front_page = true;
576
  }
577
 
578
+ $this->set_query_cache(
579
+ __METHOD__,
580
+ $is_front_page,
581
+ $id
582
+ );
583
+
584
+ return $is_front_page;
585
  }
586
 
587
  /**
593
  * @return bool
594
  */
595
  public function is_home() {
596
+ return is_home();
 
 
 
 
 
 
 
 
 
597
  }
598
 
599
  /**
600
  * Detects month archives.
601
  *
602
  * @since 2.6.0
 
 
603
  *
604
  * @return bool
605
  */
606
  public function is_month() {
607
+ return is_month();
 
 
 
 
 
 
 
 
 
608
  }
609
 
610
  /**
611
  * Detects pages.
612
+ * When $page is supplied, it will check against the current object. So it will not work in the admin screens.
613
  *
614
  * @since 2.6.0
615
  * @staticvar bool $cache
620
  */
621
  public function is_page( $page = '' ) {
622
 
623
+ if ( $this->is_admin() )
624
+ return $this->is_page_admin();
625
 
626
+ if ( empty( $page ) )
627
+ return is_page();
628
 
629
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $page ) )
630
+ return $cache;
 
631
 
632
+ $this->set_query_cache(
633
+ __METHOD__,
634
+ $is_page = is_page( $page ),
635
+ $page
636
+ );
637
 
638
+ return $is_page;
639
  }
640
 
641
  /**
645
  * @see $this->is_page()
646
  * @global object $current_screen;
647
  *
 
648
  * @return bool
649
  */
650
+ public function is_page_admin() {
651
  global $current_screen;
652
 
653
  if ( isset( $current_screen->post_type ) && 'page' === $current_screen->post_type )
665
  * @return bool
666
  */
667
  public function is_preview() {
668
+ return is_preview();
 
 
 
 
 
 
 
 
 
669
  }
670
 
671
  /**
677
  * @return bool
678
  */
679
  public function is_search() {
680
+ return is_search();
 
 
 
 
 
 
 
 
 
681
  }
682
 
683
  /**
684
  * Detects posts.
685
+ * When $post is supplied, it will check against the current object. So it will not work in the admin screens.
686
  *
687
  * @since 2.6.0
688
  * @staticvar bool $cache
689
+ * @uses AutoDescription_Query::is_single_admin()
690
  *
691
  * @param int|string|array $post Optional. Post ID, title, slug, or array of such. Default empty.
692
  * @return bool
693
  */
694
  public function is_single( $post = '' ) {
695
 
696
+ if ( $this->is_admin() )
697
+ return $this->is_single_admin();
698
 
699
+ if ( empty( $post ) )
700
+ return is_single();
701
 
702
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $post ) )
703
+ return $cache;
 
704
 
705
+ $this->set_query_cache(
706
+ __METHOD__,
707
+ $is_single = is_single( $post ),
708
+ $post
709
+ );
710
 
711
+ return $is_single;
712
  }
713
 
714
  /**
716
  *
717
  * @since 2.6.0
718
  * @global object $current_screen
719
+ * @see AutoDescription_Query::is_single()
720
  *
 
721
  * @return bool
722
  */
723
+ public function is_single_admin() {
724
  global $current_screen;
725
 
726
  if ( isset( $current_screen->post_type ) && 'post' === $current_screen->post_type )
734
  * Replaces and expands default WordPress is_singular().
735
  *
736
  * @since 2.5.2
737
+ * @uses AutoDescription_Query::is_singular_admin()
738
+ * @uses AutoDescription_Query::is_blog_page()
739
+ * @uses AutoDescription_Query::is_wc_shop()
740
+ * @access private
741
  *
742
+ * @param string|array $post_types Optional. Post type or array of post types. Default empty string.
743
  * @return bool Post Type is singular
744
  */
745
  public function is_singular( $post_types = '' ) {
746
 
 
 
 
 
 
747
  //* WP_Query functions require loop, do alternative check.
748
  if ( $this->is_admin() )
749
+ return $this->is_singular_admin();
750
 
751
  if ( is_int( $post_types ) ) {
752
+ //* Cache ID. Core is_singular() doesn't accept integers.
753
  $id = $post_types;
754
  $post_types = '';
755
  }
756
 
757
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $post_types ) )
758
+ return $cache;
759
+
760
+ if ( ! $is_singular = is_singular( $post_types ) ) {
761
+ $id = isset( $id ) ? $id : $this->get_the_real_ID();
762
 
763
+ //* Check for somewhat singulars. We need this to adjust Meta data filled in Posts.
764
+ if ( $this->is_blog_page( $id ) || $this->is_wc_shop() )
765
+ $is_singular = true;
766
+ }
767
 
768
+ $this->set_query_cache(
769
+ __METHOD__,
770
+ $is_singular,
771
+ $post_types
772
+ );
773
 
774
+ return $is_singular;
775
  }
776
 
777
  /**
778
  * Determines if the page is singular within the admin screen.
779
  *
780
  * @since 2.5.2
 
781
  * @global object $current_screen
782
  *
783
  * @return bool Post Type is singular
784
  */
785
  public function is_singular_admin() {
 
 
 
 
 
 
786
  global $current_screen;
787
 
788
  if ( isset( $current_screen->base ) && ( 'edit' === $current_screen->base || 'post' === $current_screen->base ) )
789
+ return true;
790
 
791
+ return false;
792
  }
793
 
794
  /**
795
  * Detects the static front page.
796
  *
797
  * @since 2.3.8
 
798
  *
799
  * @param int $id the Page ID to check. If empty, the current ID will be fetched.
800
  * @return bool true if is blog page. Always false if the homepage is a blog.
804
  if ( empty( $id ) )
805
  $id = $this->get_the_real_ID();
806
 
807
+ if ( 'page' === get_option( 'show_on_front' ) )
808
+ return (int) get_option( 'page_on_front' ) === $id;
 
 
 
 
809
 
810
+ return false;
 
 
 
 
 
 
 
811
  }
812
 
813
  /**
822
  */
823
  public function is_tag( $tag = '' ) {
824
 
 
 
 
 
 
825
  //* Admin requires another check.
826
  if ( $this->is_admin() )
827
+ return $this->is_tag_admin();
828
 
829
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $tag ) )
830
+ return $cache;
831
 
832
+ $this->set_query_cache(
833
+ __METHOD__,
834
+ $is_tag = is_tag( $tag ),
835
+ $tag
836
+ );
837
+
838
+ return $is_tag;
839
  }
840
 
841
  /**
842
  * Determines if the page is a tag within the admin screen.
843
  *
844
  * @since 2.6.0
 
845
  * @global object $current_screen
846
  *
847
+ * @return bool Post Type is category.
848
  */
849
  public function is_tag_admin() {
850
 
851
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
 
 
852
  return $cache;
853
 
854
+ $is_tag = false;
855
+
856
  if ( $this->is_archive_admin() ) {
857
  global $current_screen;
858
 
859
  if ( isset( $current_screen->taxonomy ) && strlen( $current_screen->taxonomy ) >= 3 && false !== strrpos( $current_screen->taxonomy, 'tag', -3 ) )
860
+ $is_tag = true;
861
  }
862
 
863
+ $this->set_query_cache(
864
+ __METHOD__,
865
+ $is_tag
866
+ );
867
+
868
+ return $is_tag;
869
  }
870
 
871
  /**
872
  * Detects taxonomy archives.
873
  *
874
  * @since 2.6.0
 
 
875
  *
876
  * @param string|array $taxonomy Optional. Taxonomy slug or slugs.
877
  * @param int|string|array $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
879
  */
880
  public function is_tax( $taxonomy = '', $term = '' ) {
881
 
882
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $taxonomy, $term ) )
883
+ return $cache;
 
 
884
 
885
+ $this->set_query_cache(
886
+ __METHOD__,
887
+ $is_tax = is_tax( $taxonomy, $term ),
888
+ $taxonomy, $term
889
+ );
890
 
891
+ return $is_tax;
892
  }
893
 
894
  /**
896
  * Checks for function availability: um_user, um_is_core_page, um_get_requested_user
897
  *
898
  * @since 2.5.2
 
899
  * @uses $this->can_i_use()
900
  *
901
  * @return bool Whether we're on a Ultimate Member page.
902
  */
903
  public function is_ultimate_member_user_page() {
904
 
905
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
 
 
906
  return $cache;
907
 
908
+ $this->set_query_cache(
909
+ __METHOD__,
910
+ $is_um_user_page = $this->can_i_use( array( 'functions' => array( 'um_user', 'um_is_core_page', 'um_get_requested_user' ) ), false )
911
+ );
912
 
913
+ return $is_um_user_page;
914
  }
915
 
916
  /**
923
  */
924
  public function is_wc_shop() {
925
 
926
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
 
 
927
  return $cache;
928
 
929
+ $this->set_query_cache(
930
+ __METHOD__,
931
+ $is_shop = false === $this->is_admin() && function_exists( 'is_shop' ) && is_shop()
932
+ );
933
 
934
+ return $is_shop;
935
  }
936
 
937
  /**
938
  * Determines if the page is the WooCommerce plugin Product page.
939
  *
940
  * @since 2.5.2
 
941
  *
942
  * @return bool True if on a WooCommerce Product page.
943
  */
944
  public function is_wc_product() {
945
 
946
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
 
 
947
  return $cache;
948
 
949
+ $this->set_query_cache(
950
+ __METHOD__,
951
+ $is_product = false === $this->is_admin() && function_exists( 'is_product' ) && is_product()
952
+ );
953
 
954
+ return $is_product;
955
  }
956
 
957
  /**
958
  * Detects year archives.
959
  *
960
  * @since 2.6.0
 
 
961
  *
962
  * @return bool
963
  */
964
  public function is_year() {
965
+ return is_year();
 
 
 
 
 
 
 
 
 
966
  }
967
 
968
  /**
969
  * Determines whether we're on the SEO settings page.
970
+ * WARNING: Do not ever use this as a safety check.
971
  *
972
  * @since 2.6.0
973
+ * @since 2.7.0 Added secure parameter.
974
  *
975
+ * @param bool $secure Whether to ignore the use of the second (insecure) parameter.
976
  * @return bool
977
  */
978
+ public function is_seo_settings_page( $secure = true ) {
 
 
979
 
980
+ if ( null !== $cache = $this->get_query_cache( __METHOD__, null, $secure ) )
981
  return $cache;
982
 
983
+ if ( $secure ) {
984
+ $page = $this->is_menu_page( $this->seo_settings_page_hook );
985
+ } else {
986
+ $page = $this->is_menu_page( $this->seo_settings_page_hook, $this->seo_settings_page_slug );
987
+ }
988
+
989
+ $this->set_query_cache(
990
+ __METHOD__,
991
+ $page,
992
+ $secure
993
+ );
994
+
995
+ return $page;
996
+ }
997
+
998
+ /**
999
+ * Checks the screen base file through global $page_hook or $_GET.
1000
+ *
1001
+ * @since 2.2.2
1002
+ * @since 2.7.0 Added pageslug parameter.
1003
+ * @global string $page_hook the current page hook.
1004
+ * @note Usage of $pageslug might be insecure. Check all variables!
1005
+ *
1006
+ * @param string $pagehook The menu pagehook to compare to.
1007
+ * @param string $pageslug The menu page slug to compare to.
1008
+ * @return bool true if screen match.
1009
+ */
1010
+ public function is_menu_page( $pagehook = '', $pageslug = '' ) {
1011
+ global $page_hook;
1012
+
1013
+ if ( isset( $page_hook ) ) {
1014
+ if ( $page_hook === $pagehook )
1015
+ return true;
1016
+ } elseif ( $this->is_admin() && $pageslug ) {
1017
+ if ( isset( $_GET['page'] ) && $pageslug === $_GET['page'] )
1018
+ return true;
1019
+ }
1020
+
1021
+ return false;
1022
  }
1023
 
1024
  /**
1026
  * Fetches global $page through Query Var to prevent conflicts.
1027
  *
1028
  * @since 2.6.0
 
1029
  *
1030
  * @return int $page Always a positive number.
1031
  */
1032
  public function page() {
1033
 
1034
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
1035
+ return $cache;
1036
 
1037
+ $page = $this->is_multipage() ? get_query_var( 'page' ) : 1;
 
1038
 
1039
+ $this->set_query_cache(
1040
+ __METHOD__,
1041
+ $page = $page ? (int) $page : 1
1042
+ );
1043
 
1044
+ return $page;
1045
+ }
1046
+
1047
+ /**
1048
+ * Determines whether the current loop is a multipage.
1049
+ *
1050
+ * @since 2.7.0
1051
+ * @global int $pages Used as reference.
1052
+ *
1053
+ * @return bool True if multipage.
1054
+ */
1055
+ protected function is_multipage() {
1056
+ global $pages;
1057
+
1058
+ $_pages = $pages;
1059
+
1060
+ $post = $this->is_singular() || $this->is_front_page() ? get_post( $this->get_the_real_ID() ) : null;
1061
+
1062
+ if ( is_object( $post ) ) {
1063
+ $content = $post->post_content;
1064
+ if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
1065
+ $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
1066
+
1067
+ // Ignore nextpage at the beginning of the content.
1068
+ if ( 0 === strpos( $content, '<!--nextpage-->' ) )
1069
+ $content = substr( $content, 15 );
1070
+
1071
+ $_pages = explode( '<!--nextpage-->', $content );
1072
+ } else {
1073
+ $_pages = array( $post->post_content );
1074
+ }
1075
+ } else {
1076
+ return false;
1077
+ }
1078
+
1079
+ /**
1080
+ * Filter the "pages" derived from splitting the post content.
1081
+ *
1082
+ * "Pages" are determined by splitting the post content based on the presence
1083
+ * of `<!-- nextpage -->` tags.
1084
+ *
1085
+ * @since 4.4.0 WordPress core
1086
+ *
1087
+ * @param array $_pages Array of "pages" derived from the post content.
1088
+ * of `<!-- nextpage -->` tags..
1089
+ * @param WP_Post $post Current post object.
1090
+ */
1091
+ $_pages = apply_filters( 'content_pagination', $_pages, $post );
1092
+
1093
+ $numpages = count( $_pages );
1094
+
1095
+ if ( $numpages > 1 ) {
1096
+ $multipage = true;
1097
+ } else {
1098
+ $multipage = false;
1099
+ }
1100
+
1101
+ return $multipage;
1102
  }
1103
 
1104
  /**
1105
  * Fetches the number of the current page.
1106
+ * Fetches global $paged through Query Var to prevent conflicts.
1107
  *
1108
  * @since 2.6.0
 
1109
  *
1110
  * @return int $paged
1111
  */
1112
  public function paged() {
1113
 
1114
+ if ( null !== $cache = $this->get_query_cache( __METHOD__ ) )
1115
+ return $cache;
 
 
1116
 
1117
  $paged = get_query_var( 'paged' );
1118
 
1119
+ $this->set_query_cache(
1120
+ __METHOD__,
1121
+ $paged = $paged ? (int) $paged : 1
1122
+ );
1123
+
1124
+ return $paged;
1125
  }
1126
 
1127
+ /**
1128
+ * Handles object cache for the query class.
1129
+ *
1130
+ * @since 2.7.0
1131
+ * @staticvar bool $can_cache_query : True when this function can run.
1132
+ * @staticvar mixed $cache : The cached query.
1133
+ * @see AutoDescritpion_Query::set_query_cache(); to set query cache.
1134
+ *
1135
+ * @param string $key The key to set or get.
1136
+ * @param mixed $value_to_set The value to set.
1137
+ * @param array|mixed $hash Extra arguments, that will be used to generate an alternative cache key.
1138
+ * Must always be inside a single array when $value_to_set is set. @see AutoDescritpion_Query::set_query_cache()
1139
+ * Must always be separated parameters otherwise.
1140
+ * @return mixed : {
1141
+ * mixed The cached value if set and $value_to_set is null.
1142
+ * null If the query can't be cached yet, or when no value has been set.
1143
+ * If $value_to_set is set : {
1144
+ * true If the value is being set for the first time.
1145
+ * false If the value has been set and $value_to_set is being overwritten.
1146
+ * }
1147
+ * }
1148
+ */
1149
+ public function get_query_cache( $key, $value_to_set = null ) {
1150
+
1151
+ static $can_cache_query = null;
1152
+
1153
+ if ( is_null( $can_cache_query ) ) {
1154
+ if ( $this->can_cache_query() ) {
1155
+ $can_cache_query = true;
1156
+ } else {
1157
+ return null;
1158
+ }
1159
+ }
1160
+
1161
+ static $cache = array();
1162
+
1163
+ if ( func_num_args() > 2 ) {
1164
+ $hash = isset( $value_to_set ) ? serialize( (array) func_get_arg( 2 ) ) : serialize( array_slice( func_get_args(), 2 ) );
1165
+ } else {
1166
+ $hash = false;
1167
+ }
1168
+
1169
+ if ( isset( $value_to_set ) ) {
1170
+ if ( isset( $cache[ $key ][ $hash ] ) ) {
1171
+ $cache[ $key ][ $hash ] = $value_to_set;
1172
+ return false;
1173
+ }
1174
+ $cache[ $key ][ $hash ] = $value_to_set;
1175
+ return true;
1176
+ } else {
1177
+ if ( isset( $cache[ $key ][ $hash ] ) )
1178
+ return $cache[ $key ][ $hash ];
1179
+ }
1180
+
1181
+ return null;
1182
+ }
1183
+
1184
+ /**
1185
+ * Object cache handler for the query class.
1186
+ *
1187
+ * @since 2.7.0
1188
+ * @since 2.7.2: Put func_get_args() in a variable for PHP5.2 support.
1189
+ * @see AutoDescription_Query::get_query_cache()
1190
+ *
1191
+ * @param string $key The key to set.
1192
+ * @param mixed $value_to_set If null, no cache will be set.
1193
+ * @param mixed $hash Extra arguments, that will be used to generate an alternative cache key.
1194
+ * @return bool : {
1195
+ * true If the value is being set for the first time.
1196
+ * false If the value has been set and $value_to_set is being overwritten.
1197
+ * }
1198
+ */
1199
+ public function set_query_cache( $key, $value_to_set ) {
1200
+ if ( func_num_args() > 2 ) {
1201
+ $a = func_get_args();
1202
+ return $this->get_query_cache( $key, $value_to_set, array_slice( $a, 2 ) );
1203
+ } else {
1204
+ return $this->get_query_cache( $key, $value_to_set );
1205
+ }
1206
+ }
1207
  }
inc/classes/render.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_Render
21
  *
@@ -35,6 +37,18 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
35
  */
36
  protected $title_doing_it_wrong = null;
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * Constructor, load parent constructor
40
  */
@@ -55,10 +69,10 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
55
 
56
  static $description_cache = array();
57
 
58
- if ( isset( $description_cache[$social] ) )
59
- return $description_cache[$social];
60
 
61
- return $description_cache[$social] = $this->generate_description( '', array( 'social' => $social ) );
62
  }
63
 
64
  /**
@@ -80,13 +94,13 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
80
 
81
  static $url_cache = array();
82
 
83
- if ( is_null( $post_id ) )
84
  $post_id = $this->get_the_real_ID();
85
 
86
- if ( isset( $url_cache[$url][$post_id][$paged][$from_option][$paged_plural] ) )
87
- return $url_cache[$url][$post_id][$paged][$from_option][$paged_plural];
88
 
89
- return $url_cache[$url][$post_id][$paged][$from_option][$paged_plural] = $this->the_url( $url, array( 'paged' => $paged, 'get_custom_field' => $from_option, 'id' => $post_id, 'paged_plural' => $paged_plural ) );
90
  }
91
 
92
  /**
@@ -103,10 +117,10 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
103
 
104
  static $url_cache = array();
105
 
106
- if ( isset( $url_cache[$force_slash] ) )
107
- return $url_cache[$force_slash];
108
 
109
- return $url_cache[$force_slash] = $this->the_url( '', array( 'home' => true, 'forceslash' => $force_slash ) );
110
  }
111
 
112
  /**
@@ -160,20 +174,22 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
160
 
161
  static $title_cache = array();
162
 
163
- if ( isset( $title_cache[$title][$sep][$seplocation][$meta] ) )
164
- return $title_cache[$title][$sep][$seplocation][$meta];
165
 
166
- return $title_cache[$title][$sep][$seplocation][$meta] = $this->title( $title, $sep, $seplocation, array( 'meta' => $meta ) );
167
  }
168
 
169
  /**
170
- * Cache current Image URL in static variable
171
- * Must be called inside the loop
172
  *
173
  * @staticvar string $image_cache
174
  *
175
  * @since 2.2.2
176
- * @return string The image url
 
 
177
  */
178
  public function get_image_from_cache() {
179
 
@@ -184,36 +200,32 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
184
 
185
  $post_id = $this->get_the_real_ID();
186
 
187
- //* End this madness if there's no ID found (search/404/etc.)
188
- if ( empty( $post_id ) )
189
- return '';
190
-
191
  $image_cache = $this->get_image( $post_id );
192
 
193
  return $image_cache;
194
  }
195
 
196
  /**
197
- * Render the description
198
  *
199
  * @uses $this->description_from_cache()
200
  * @uses $this->detect_seo_plugins()
201
  *
202
  * @since 1.3.0
 
 
203
  */
204
  public function the_description() {
205
 
206
  if ( $this->detect_seo_plugins() )
207
- return;
208
 
209
  /**
210
  * Applies filters 'the_seo_framework_description_output' : string
211
  * @since 2.3.0
 
212
  */
213
- $description = (string) apply_filters( 'the_seo_framework_description_output', '', $this->get_the_real_ID() );
214
-
215
- if ( empty( $description ) )
216
- $description = $this->description_from_cache();
217
 
218
  if ( $description )
219
  return '<meta name="description" content="' . esc_attr( $description ) . '" />' . "\r\n";
@@ -222,173 +234,169 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
222
  }
223
 
224
  /**
225
- * Render og:description
226
  *
227
  * @uses $this->description_from_cache()
228
- *
229
  * @since 1.3.0
 
 
230
  */
231
  public function og_description() {
232
 
233
- if ( $this->use_og_tags() ) {
234
-
235
- /**
236
- * Applies filters 'the_seo_framework_ogdescription_output' : string
237
- * @since 2.3.0
238
- */
239
- $description = (string) apply_filters( 'the_seo_framework_ogdescription_output', '', $this->get_the_real_ID() );
240
 
241
- if ( empty( $description ) )
242
- $description = $this->description_from_cache( true );
 
 
 
 
243
 
 
244
  return '<meta property="og:description" content="' . esc_attr( $description ) . '" />' . "\r\n";
245
- }
246
 
247
  return '';
248
  }
249
 
250
  /**
251
- * Render the OG locale.
252
  *
253
  * @since 1.0.0
 
 
254
  */
255
  public function og_locale() {
256
 
257
- if ( $this->use_og_tags() ) {
258
-
259
- /**
260
- * Applies filters 'the_seo_framework_oglocale_output' : string
261
- * @since 2.3.0
262
- */
263
- $locale = (string) apply_filters( 'the_seo_framework_oglocale_output', '', $this->get_the_real_ID() );
264
 
265
- if ( empty( $locale ) )
266
- $locale = $this->fetch_locale();
 
 
 
 
267
 
 
268
  return '<meta property="og:locale" content="' . esc_attr( $locale ) . '" />' . "\r\n";
269
- }
270
 
271
  return '';
272
  }
273
 
274
  /**
275
- * Process the title to WordPress
276
  *
277
  * @uses $this->title_from_cache()
278
- *
279
  * @since 2.0.3
 
 
280
  */
281
  public function og_title() {
282
 
283
- if ( $this->use_og_tags() ) {
284
-
285
- /**
286
- * Applies filters 'the_seo_framework_ogtitle_output' : string
287
- * @since 2.3.0
288
- */
289
- $title = (string) apply_filters( 'the_seo_framework_ogtitle_output', '', $this->get_the_real_ID() );
290
 
291
- if ( empty( $title ) )
292
- $title = $this->title_from_cache( '', '', '', true );
 
 
 
 
293
 
 
294
  return '<meta property="og:title" content="' . esc_attr( $title ) . '" />' . "\r\n";
295
- }
296
 
297
  return '';
298
  }
299
 
300
  /**
301
- * Get the OG type.
302
  *
303
  * @since 1.1.0
 
 
304
  */
305
  public function og_type() {
306
 
307
- if ( $this->use_og_tags() ) {
 
308
 
309
- /**
310
- * Applies filters 'the_seo_framework_ogtype_output' : string
311
- * @since 2.3.0
312
- */
313
- $type = (string) apply_filters( 'the_seo_framework_ogtype_output', '', $this->get_the_real_ID() );
314
-
315
- if ( empty( $type ) ) {
316
- if ( $this->is_wc_product() ) {
317
- $type = 'product';
318
- } else if ( $this->is_single() && $this->get_image_from_cache() ) {
319
- $type = 'article';
320
- } else if ( $this->is_author() ) {
321
- $type = 'profile';
322
- } else if ( $this->is_blog_page() || ( $this->is_front_page() && ! $this->has_page_on_front() ) ) {
323
- $type = 'blog';
324
- } else {
325
- $type = 'website';
326
- }
327
- }
328
 
 
329
  return '<meta property="og:type" content="' . esc_attr( $type ) . '" />' . "\r\n";
330
- }
331
 
332
  return '';
333
  }
334
 
335
  /**
336
- * Adds og:image
337
  *
338
  * @param string $image url for image
339
  *
340
  * @since 1.3.0
 
 
 
 
341
  */
342
  public function og_image() {
343
 
344
- if ( $this->use_og_tags() ) {
345
-
346
- $id = $this->get_the_real_ID();
347
-
348
- /**
349
- * Applies filters 'the_seo_framework_ogimage_output' : string|bool
350
- * @since 2.3.0
351
- *
352
- * @NOTE: Use of this might cause incorrect meta since other functions
353
- * depend on the image from cache.
354
- *
355
- * @todo Place in listener cache.
356
- * @priority medium 2.8.0+
357
- */
358
- $image = apply_filters( 'the_seo_framework_ogimage_output', '', $id );
359
 
360
- /**
361
- * Now returns empty string on false.
362
- * @since 2.6.0
363
- */
364
- if ( false === $image )
365
- return '';
 
 
 
 
 
 
366
 
367
- if ( empty( $image ) ) {
368
- $image = $this->get_image_from_cache();
369
- } else {
370
- $image = (string) $image;
371
- }
 
372
 
373
- /**
374
- * Always output
375
- * @since 2.1.1
376
- */
377
- $output = '<meta property="og:image" content="' . esc_attr( $image ) . '" />' . "\r\n";
378
 
379
- //* Fetch Product images.
380
- $woocommerce_product_images = $this->render_woocommerce_product_og_image();
 
 
 
381
 
382
- return $output . $woocommerce_product_images;
 
 
 
 
383
  }
384
 
385
- return '';
 
 
 
386
  }
387
 
388
  /**
389
- * Render more OG images to choose from.
390
  *
391
  * @since 2.6.0
 
392
  *
393
  * @return string The rendered OG Image.
394
  */
@@ -405,8 +413,14 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
405
  //* Parse 1500px url.
406
  $img = $this->parse_og_image( $id );
407
 
408
- if ( $img )
409
  $output .= '<meta property="og:image" content="' . esc_attr( $img ) . '" />' . "\r\n";
 
 
 
 
 
 
410
  }
411
  }
412
  }
@@ -415,39 +429,37 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
415
  }
416
 
417
  /**
418
- * Adds og:site_name
419
- *
420
- * @param string output the output
421
  *
422
  * @since 1.3.0
 
 
423
  */
424
  public function og_sitename() {
425
 
426
- if ( $this->use_og_tags() ) {
427
-
428
- /**
429
- * Applies filters 'the_seo_framework_ogsitename_output' : string
430
- * @since 2.3.0
431
- */
432
- $sitename = (string) apply_filters( 'the_seo_framework_ogsitename_output', '', $this->get_the_real_ID() );
433
 
434
- if ( empty( $sitename ) )
435
- $sitename = get_bloginfo( 'name' );
 
 
 
 
436
 
 
437
  return '<meta property="og:site_name" content="' . esc_attr( $sitename ) . '" />' . "\r\n";
438
- }
439
 
440
  return '';
441
  }
442
 
443
  /**
444
- * Adds og:url
445
- *
446
- * @return string og:url the url meta
447
  *
448
  * @since 1.3.0
449
- *
450
  * @uses $this->the_url_from_cache()
 
 
451
  */
452
  public function og_url() {
453
 
@@ -458,297 +470,285 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
458
  }
459
 
460
  /**
461
- * Render twitter:card
462
  *
463
  * @since 2.2.2
 
 
464
  */
465
  public function twitter_card() {
466
 
467
- if ( $this->use_twitter_tags() ) {
 
468
 
469
- /**
470
- * Applies filters 'the_seo_framework_twittercard_output' : string
471
- * @since 2.3.0
472
- */
473
- $card = (string) apply_filters( 'the_seo_framework_twittercard_output', '', $this->get_the_real_ID() );
474
-
475
- if ( empty( $card ) ) {
476
- /**
477
- * Return card type if image is found.
478
- * Return to summary if not.
479
- */
480
- $card = $this->get_image_from_cache() ? $this->get_option( 'twitter_card' ) : 'summary';
481
- }
482
 
 
483
  return '<meta name="twitter:card" content="' . esc_attr( $card ) . '" />' . "\r\n";
484
- }
485
 
486
  return '';
487
  }
488
 
489
  /**
490
- * Render twitter:site
491
  *
492
  * @since 2.2.2
 
 
493
  */
494
  public function twitter_site() {
495
 
496
- if ( $this->use_twitter_tags() ) {
497
-
498
- /**
499
- * Applies filters 'the_seo_framework_twittersite_output' : string
500
- * @since 2.3.0
501
- */
502
- $site = (string) apply_filters( 'the_seo_framework_twittersite_output', '', $this->get_the_real_ID() );
503
 
504
- if ( empty( $site ) )
505
- $site = $this->get_option( 'twitter_site' );
 
 
 
 
506
 
507
- if ( $site )
508
- return '<meta name="twitter:site" content="' . esc_attr( $site ) . '" />' . "\r\n";
509
- }
510
 
511
  return '';
512
  }
513
 
514
  /**
515
- * Render twitter:creator or twitter:site:id
 
516
  *
517
  * @since 2.2.2
 
 
518
  */
519
  public function twitter_creator() {
520
 
521
- if ( $this->use_twitter_tags() ) {
 
 
 
 
 
 
 
 
522
 
 
523
  /**
524
- * Applies filters 'the_seo_framework_twittercreator_output' : string
525
- * @since 2.3.0
526
  */
527
- $creator = (string) apply_filters( 'the_seo_framework_twittercreator_output', '', $this->get_the_real_ID() );
528
-
529
- if ( empty( $creator ) ) {
530
- $site = $this->get_option( 'twitter_site' );
531
- $creator = $this->get_option( 'twitter_creator' );
532
-
533
- /**
534
- * Return site:id instead of creator is no twitter:site is found.
535
- * Per Twitter requirements
536
- */
537
- if ( empty( $site ) && $creator )
538
- return '<meta name="twitter:site:id" content="' . esc_attr( $creator ) . '" />' . "\r\n";
539
- }
540
-
541
- if ( $creator )
542
  return '<meta name="twitter:creator" content="' . esc_attr( $creator ) . '" />' . "\r\n";
 
543
  }
544
 
545
  return '';
546
  }
547
 
548
  /**
549
- * Render twitter:title
550
  *
551
  * @uses $this->title_from_cache()
552
- *
553
  * @since 2.2.2
 
 
554
  */
555
  public function twitter_title() {
556
 
557
- if ( $this->use_twitter_tags() ) {
558
-
559
- /**
560
- * Applies filters 'the_seo_framework_twittertitle_output' : string
561
- * @since 2.3.0
562
- */
563
- $title = (string) apply_filters( 'the_seo_framework_twittertitle_output', '', $this->get_the_real_ID() );
564
 
565
- if ( empty( $title ) )
566
- $title = $this->title_from_cache( '', '', '', true );
 
 
 
 
567
 
 
568
  return '<meta name="twitter:title" content="' . esc_attr( $title ) . '" />' . "\r\n";
569
- }
570
 
571
  return '';
572
  }
573
 
574
  /**
575
- * Render twitter:description
576
  *
577
  * @uses $this->description_from_cache()
578
- *
579
  * @since 2.2.2
 
 
580
  */
581
  public function twitter_description() {
582
 
583
- if ( $this->use_twitter_tags() ) {
584
-
585
- /**
586
- * Applies filters 'the_seo_framework_twitterdescription_output' : string
587
- * @since 2.3.0
588
- */
589
- $description = (string) apply_filters( 'the_seo_framework_twitterdescription_output', '', $this->get_the_real_ID() );
590
 
591
- if ( empty( $description ) )
592
- $description = $this->description_from_cache( true );
 
 
 
 
593
 
 
594
  return '<meta name="twitter:description" content="' . esc_attr( $description ) . '" />' . "\r\n";
595
- }
596
 
597
  return '';
598
  }
599
 
600
  /**
601
- * Render twitter:image:src
602
- *
603
- * @param string $image url for image
604
  *
605
  * @since 2.2.2
606
  *
607
- * @return string|null The twitter image source meta tag
608
  */
609
  public function twitter_image() {
610
 
611
- if ( $this->use_twitter_tags() ) {
 
 
 
 
 
 
 
 
612
 
613
- /**
614
- * Applies filters 'the_seo_framework_twitterimage_output' : string|bool
615
- * @since 2.3.0
616
- */
617
- $image = apply_filters( 'the_seo_framework_twitterimage_output', '', $this->get_the_real_ID() );
618
 
619
- /**
620
- * Now returns empty string on false.
621
- * @since 2.6.0
622
- */
623
- if ( false === $image )
624
- return '';
625
 
626
- if ( empty( $image ) ) {
627
- $image = $this->get_image_from_cache();
628
- } else {
629
- $image = (string) $image;
630
  }
631
-
632
- if ( $image )
633
- return '<meta name="twitter:image:src" content="' . esc_attr( $image ) . '" />' . "\r\n";
634
  }
635
 
636
- return '';
637
  }
638
 
639
  /**
640
- * Render article:author
641
  *
642
  * @since 2.2.2
643
  *
644
- * @return string|null The facebook app id
645
  */
646
  public function facebook_author() {
647
 
648
- if ( $this->use_facebook_tags() ) {
649
-
650
- /**
651
- * Applies filters 'the_seo_framework_facebookauthor_output' : string
652
- * @since 2.3.0
653
- */
654
- $author = (string) apply_filters( 'the_seo_framework_facebookauthor_output', '', $this->get_the_real_ID() );
655
 
656
- if ( empty( $author ) )
657
- $author = $this->get_option( 'facebook_author' );
 
 
 
 
658
 
659
- if ( $author )
660
- return '<meta property="article:author" content="' . esc_attr( esc_url_raw( $author ) ) . '" />' . "\r\n";
661
- }
662
 
663
  return '';
664
  }
665
 
666
  /**
667
- * Render article:author
668
  *
669
  * @since 2.2.2
670
  *
671
- * @return string|null The facebook app id
672
  */
673
  public function facebook_publisher() {
674
 
675
- if ( $this->use_facebook_tags() ) {
676
-
677
- /**
678
- * Applies filters 'the_seo_framework_facebookpublisher_output' : string
679
- * @since 2.3.0
680
- */
681
- $publisher = (string) apply_filters( 'the_seo_framework_facebookpublisher_output', '', $this->get_the_real_ID() );
682
 
683
- if ( empty( $publisher ) )
684
- $publisher = $this->get_option( 'facebook_publisher' );
 
 
 
 
685
 
686
- if ( $publisher )
687
- return '<meta property="article:publisher" content="' . esc_attr( esc_url_raw( $publisher ) ) . '" />' . "\r\n";
688
- }
689
 
690
  return '';
691
  }
692
 
693
  /**
694
- * Render fb:app_id
695
  *
696
  * @since 2.2.2
697
  *
698
- * @return string|null The facebook app id
699
  */
700
  public function facebook_app_id() {
701
 
702
- if ( $this->use_facebook_tags() ) {
703
-
704
- /**
705
- * Applies filters 'the_seo_framework_facebookappid_output' : string
706
- * @since 2.3.0
707
- */
708
- $app_id = (string) apply_filters( 'the_seo_framework_facebookappid_output', '', $this->get_the_real_ID() );
709
 
710
- if ( empty( $app_id ) )
711
- $app_id = $this->get_option( 'facebook_appid' );
 
 
 
 
712
 
713
- if ( $app_id )
714
- return '<meta property="fb:app_id" content="' . esc_attr( $app_id ) . '" />' . "\r\n";
715
- }
716
 
717
  return '';
718
  }
719
 
720
  /**
721
- * Render article:published_time
722
  *
723
  * @since 2.2.2
724
  *
725
- * @return string|null The article:published_time
726
  */
727
  public function article_published_time() {
728
 
729
- // Don't do anything if it's not a page or post.
730
  if ( false === $this->is_singular() )
731
- return;
732
-
733
- $front_page = (bool) is_front_page();
734
-
735
- // If it's a post, but the option is disabled, don't do anyhting.
736
- if ( ! $front_page && $this->is_single() && ! $this->get_option( 'post_publish_time' ) )
737
- return;
738
 
739
- // If it's a page, but the option is disabled, don't do anything.
740
- if ( ! $front_page && $this->is_page() && ! $this->get_option( 'page_publish_time' ) )
741
- return;
 
 
 
 
 
742
 
743
- // If it's the home page, but the option is disabled, don't do anything.
744
- if ( $front_page && ! $this->get_option( 'home_publish_time' ) )
745
- return;
 
746
 
747
- //* @since 2.3.0
748
- $time = (string) apply_filters( 'the_seo_framework_publishedtime_output', '', $this->get_the_real_ID() );
749
 
750
- if ( empty( $time ) )
751
- $time = get_the_date( 'Y-m-d', '' );
 
 
 
 
752
 
753
  if ( $time )
754
  return '<meta property="article:published_time" content="' . esc_attr( $time ) . '" />' . "\r\n";
@@ -757,11 +757,13 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
757
  }
758
 
759
  /**
760
- * Render article:modified_time
 
761
  *
762
  * @since 2.2.2
 
763
  *
764
- * @return string|null The article:modified_time
765
  */
766
  public function article_modified_time() {
767
 
@@ -770,30 +772,33 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
770
  return '';
771
 
772
  if ( $this->is_front_page() ) {
773
- // If it's the frontpage, but the option is disabled, don't do anything.
774
  if ( ! $this->get_option( 'home_modify_time' ) )
775
  return '';
776
  } else {
777
- // If it's a post, but the option is disabled, don't do anyhting.
778
  if ( $this->is_single() && ! $this->get_option( 'post_modify_time' ) )
779
  return '';
780
 
781
- // If it's a page, but the option is disabled, don't do anything.
782
  if ( $this->is_page() && ! $this->get_option( 'page_modify_time' ) )
783
  return '';
784
  }
785
 
786
- //* @since 2.3.0
787
- $time = (string) apply_filters( 'the_seo_framework_modifiedtime_output', '', $this->get_the_real_ID() );
788
 
789
- if ( empty( $time ) )
790
- $time = the_modified_date( 'Y-m-d', '', '', false );
 
 
 
 
791
 
792
  if ( $time ) {
793
  $output = '<meta property="article:modified_time" content="' . esc_attr( $time ) . '" />' . "\r\n";
794
 
795
  if ( $this->use_og_tags() )
796
- $output .= '<meta property="og:updated_time" content="' . esc_attr( $time ) . '" />'. "\r\n";
797
 
798
  return $output;
799
  }
@@ -802,22 +807,26 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
802
  }
803
 
804
  /**
805
- * Outputs canonical url
806
  *
807
  * @since 2.0.6
808
- *
809
  * @uses $this->the_url_from_cache()
810
  *
811
- * @return string canonical url meta
812
  */
813
  public function canonical() {
814
 
815
  /**
816
  * Applies filters the_seo_framework_output_canonical : Don't output canonical if false.
817
  * @since 2.4.2
 
 
 
818
  */
819
- if ( ! apply_filters( 'the_seo_framework_output_canonical', true, $this->get_the_real_ID() ) )
820
- return;
 
 
821
 
822
  /**
823
  * Applies filters 'the_seo_framework_rel_canonical_output' : Change canonical URL output.
@@ -825,22 +834,28 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
825
  */
826
  $url = (string) apply_filters( 'the_seo_framework_rel_canonical_output', $this->the_url_from_cache(), $this->get_the_real_ID() );
827
 
828
- return '<link rel="canonical" href="' . $url . '" />' . "\r\n";
 
 
 
 
 
 
829
  }
830
 
831
  /**
832
- * LD+JSON helper output
833
  *
834
  * @uses $this->render_ld_json_scripts()
835
  *
836
  * @since 1.2.0
837
- * @return string $json LD+json helpers in header on front page.
838
  */
839
  public function ld_json() {
840
 
841
- //* Check for LD+JSON compat
842
- if ( $this->is_search() || $this->is_404() )
843
- return;
844
 
845
  /**
846
  * Applies filters 'the_seo_framework_ldjson_scripts' : string
@@ -852,11 +867,11 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
852
  }
853
 
854
  /**
855
- * Outputs Google Site Verification code
856
  *
857
  * @since 2.2.4
858
  *
859
- * @return string|null google verification code
860
  */
861
  public function google_site_output() {
862
 
@@ -866,18 +881,18 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
866
  */
867
  $code = (string) apply_filters( 'the_seo_framework_googlesite_output', $this->get_option( 'google_verification' ), $this->get_the_real_ID() );
868
 
869
- if ( empty( $code ) )
870
- return '';
871
 
872
- return '<meta name="google-site-verification" content="' . esc_attr( $code ) . '" />' . "\r\n";
873
  }
874
 
875
  /**
876
- * Outputs Bing Site Verification code
877
  *
878
  * @since 2.2.4
879
  *
880
- * @return string|null Bing Webmaster code
881
  */
882
  public function bing_site_output() {
883
 
@@ -887,18 +902,18 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
887
  */
888
  $code = (string) apply_filters( 'the_seo_framework_bingsite_output', $this->get_option( 'bing_verification' ), $this->get_the_real_ID() );
889
 
890
- if ( empty( $code ) )
891
- return '';
892
 
893
- return '<meta name="msvalidate.01" content="' . esc_attr( $code ) . '" />' . "\r\n";
894
  }
895
 
896
  /**
897
- * Outputs Yandex Site Verification code
898
  *
899
  * @since 2.6.0
900
  *
901
- * @return string|null Yandex Webmaster code
902
  */
903
  public function yandex_site_output() {
904
 
@@ -908,18 +923,18 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
908
  */
909
  $code = (string) apply_filters( 'the_seo_framework_yandexsite_output', $this->get_option( 'yandex_verification' ), $this->get_the_real_ID() );
910
 
911
- if ( empty( $code ) )
912
- return '';
913
 
914
- return '<meta name="yandex-verification" content="' . esc_attr( $code ) . '" />' . "\r\n";
915
  }
916
 
917
  /**
918
- * Outputs Bing Site Verification code
919
  *
920
  * @since 2.5.2
921
  *
922
- * @return string|null Bing Webmaster code
923
  */
924
  public function pint_site_output() {
925
 
@@ -929,18 +944,19 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
929
  */
930
  $code = (string) apply_filters( 'the_seo_framework_pintsite_output', $this->get_option( 'pint_verification' ), $this->get_the_real_ID() );
931
 
932
- if ( empty( $code ) )
933
- return '';
934
 
935
- return '<meta name="p:domain_verify" content="' . esc_attr( $code ) . '" />' . "\r\n";
936
  }
937
 
938
  /**
939
- * Output robots meta tags
 
940
  *
941
  * @since 2.0.0
942
  *
943
- * @return null Return early if blog is not public.
944
  */
945
  public function robots() {
946
 
@@ -954,53 +970,24 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
954
  */
955
  $meta = (array) apply_filters( 'the_seo_framework_robots_meta', $this->robots_meta(), $this->get_the_real_ID() );
956
 
957
- //* Add meta if any exist
958
- if ( $meta )
959
- return sprintf( '<meta name="robots" content="%s" />' . "\r\n", implode( ',', $meta ) );
960
-
961
- return '';
962
- }
963
-
964
- /**
965
- * Outputs favicon urls
966
- *
967
- * @since 2.2.1
968
- *
969
- * @uses $this->site_icon()
970
- *
971
- * @return string icon links.
972
- * @TODO Make this work for older wp versions. i.e. add upload area for wp 4.2.99999 and lower
973
- * @TODO Make this work in the first place
974
- * @ignore
975
- * @access private
976
- */
977
- public function favicon() {
978
-
979
- if ( $this->wp_version( '4.2.999', '<=' ) ) {
980
- $output = '<link rel="icon" type="image/x-icon" href="' . esc_url( $this->site_icon( 16 ) ) . '" sizes="16x16" />' . "\r\n";
981
- $output .= '<link rel="icon" type="image/x-icon" href="' . esc_url( $this->site_icon( 192 ) ) . '" sizes="192x192" />' . "\r\n";
982
- $output .= '<link rel="apple-touch-icon-precomposed" href="' . esc_url( $this->site_icon( 180 ) ) . '" />' . "\r\n";
983
- $output .= '<link rel="msapplication-TileImage" href="' . esc_url( $this->site_icon( 270 ) ) . '" />' . "\r\n";
984
-
985
- return $output;
986
- }
987
 
988
- return '';
989
  }
990
 
991
  /**
992
- * Outputs shortlink meta tag
993
  *
994
  * @since 2.2.2
995
- *
996
  * @uses $this->get_shortlink()
997
  *
998
- * @return string|null shortlink url meta
999
  */
1000
  public function shortlink() {
1001
 
1002
  /**
1003
- * Applies filters 'the_seo_framework_shortlink_output' : array
1004
  * @since 2.6.0
1005
  */
1006
  $url = (string) apply_filters( 'the_seo_framework_shortlink_output', $this->get_shortlink(), $this->get_the_real_ID() );
@@ -1012,13 +999,12 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
1012
  }
1013
 
1014
  /**
1015
- * Outputs paged urls meta tag
1016
  *
1017
  * @since 2.2.2
1018
- *
1019
  * @uses $this->get_paged_url()
1020
  *
1021
- * @return string
1022
  */
1023
  public function paged_urls() {
1024
 
@@ -1048,7 +1034,7 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
1048
  }
1049
 
1050
  /**
1051
- * Whether we can use Open Graph tags.
1052
  *
1053
  * @since 2.6.0
1054
  * @staticvar bool $cache
@@ -1066,7 +1052,7 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
1066
  }
1067
 
1068
  /**
1069
- * Whether we can use Facebook tags.
1070
  *
1071
  * @since 2.6.0
1072
  * @staticvar bool $cache
@@ -1084,7 +1070,7 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
1084
  }
1085
 
1086
  /**
1087
- * Whether we can use Twitter tags.
1088
  *
1089
  * @since 2.6.0
1090
  * @staticvar bool $cache
@@ -1098,11 +1084,11 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
1098
  if ( isset( $cache ) )
1099
  return $cache;
1100
 
1101
- return $cache = $this->is_option_checked( 'twitter_tags' ) && false == $this->detect_twitter_card_plugin();
1102
  }
1103
 
1104
  /**
1105
- * Whether we can use Google+ tags.
1106
  *
1107
  * @since 2.6.0
1108
  * @staticvar bool $cache
@@ -1118,5 +1104,4 @@ class AutoDescription_Render extends AutoDescription_Admin_Init {
1118
 
1119
  return $cache = $this->is_option_checked( 'googleplus_tags' );
1120
  }
1121
-
1122
  }
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_Render
23
  *
37
  */
38
  protected $title_doing_it_wrong = null;
39
 
40
+ /**
41
+ * Unserializing instances of this class is forbidden.
42
+ */
43
+ private function __wakeup() { }
44
+
45
+ /**
46
+ * Handle unapproachable invoked methods.
47
+ */
48
+ public function __call( $name, $arguments ) {
49
+ parent::__call( $name, $arguments );
50
+ }
51
+
52
  /**
53
  * Constructor, load parent constructor
54
  */
69
 
70
  static $description_cache = array();
71
 
72
+ if ( isset( $description_cache[ $social ] ) )
73
+ return $description_cache[ $social ];
74
 
75
+ return $description_cache[ $social ] = $this->generate_description( '', array( 'social' => $social ) );
76
  }
77
 
78
  /**
94
 
95
  static $url_cache = array();
96
 
97
+ if ( empty( $post_id ) )
98
  $post_id = $this->get_the_real_ID();
99
 
100
+ if ( isset( $url_cache[ $url ][ $post_id ][ $paged ][ $from_option ][ $paged_plural ] ) )
101
+ return $url_cache[ $url ][ $post_id ][ $paged ][ $from_option ][ $paged_plural ];
102
 
103
+ return $url_cache[ $url ][ $post_id ][ $paged ][ $from_option ][ $paged_plural ] = $this->the_url( $url, array( 'paged' => $paged, 'get_custom_field' => $from_option, 'id' => $post_id, 'paged_plural' => $paged_plural ) );
104
  }
105
 
106
  /**
117
 
118
  static $url_cache = array();
119
 
120
+ if ( isset( $url_cache[ $force_slash ] ) )
121
+ return $url_cache[ $force_slash ];
122
 
123
+ return $url_cache[ $force_slash ] = $this->the_url( '', array( 'home' => true, 'forceslash' => $force_slash ) );
124
  }
125
 
126
  /**
174
 
175
  static $title_cache = array();
176
 
177
+ if ( isset( $title_cache[ $title ][ $sep ][ $seplocation ][ $meta ] ) )
178
+ return $title_cache[ $title ][ $sep ][ $seplocation ][ $meta ];
179
 
180
+ return $title_cache[ $title ][ $sep ][ $seplocation ][ $meta ] = $this->title( $title, $sep, $seplocation, array( 'meta' => $meta ) );
181
  }
182
 
183
  /**
184
+ * Caches current Image URL in static variable.
185
+ * Must be called inside the loop.
186
  *
187
  * @staticvar string $image_cache
188
  *
189
  * @since 2.2.2
190
+ * @since 2.7.0 $get_id parameter has been added.
191
+ *
192
+ * @return string The image URL.
193
  */
194
  public function get_image_from_cache() {
195
 
200
 
201
  $post_id = $this->get_the_real_ID();
202
 
 
 
 
 
203
  $image_cache = $this->get_image( $post_id );
204
 
205
  return $image_cache;
206
  }
207
 
208
  /**
209
+ * Renders the description meta tag.
210
  *
211
  * @uses $this->description_from_cache()
212
  * @uses $this->detect_seo_plugins()
213
  *
214
  * @since 1.3.0
215
+ *
216
+ * @return string The description meta tag.
217
  */
218
  public function the_description() {
219
 
220
  if ( $this->detect_seo_plugins() )
221
+ return '';
222
 
223
  /**
224
  * Applies filters 'the_seo_framework_description_output' : string
225
  * @since 2.3.0
226
+ * @since 2.7.0 Added output within filter.
227
  */
228
+ $description = (string) apply_filters( 'the_seo_framework_description_output', $this->description_from_cache(), $this->get_the_real_ID() );
 
 
 
229
 
230
  if ( $description )
231
  return '<meta name="description" content="' . esc_attr( $description ) . '" />' . "\r\n";
234
  }
235
 
236
  /**
237
+ * Renders og:description meta tag
238
  *
239
  * @uses $this->description_from_cache()
 
240
  * @since 1.3.0
241
+ *
242
+ * @return string The Open Graph description meta tag.
243
  */
244
  public function og_description() {
245
 
246
+ if ( ! $this->use_og_tags() )
247
+ return '';
 
 
 
 
 
248
 
249
+ /**
250
+ * Applies filters 'the_seo_framework_ogdescription_output' : string
251
+ * @since 2.3.0
252
+ * @since 2.7.0 Added output within filter.
253
+ */
254
+ $description = (string) apply_filters( 'the_seo_framework_ogdescription_output', $this->description_from_cache( true ), $this->get_the_real_ID() );
255
 
256
+ if ( $description )
257
  return '<meta property="og:description" content="' . esc_attr( $description ) . '" />' . "\r\n";
 
258
 
259
  return '';
260
  }
261
 
262
  /**
263
+ * Renders the OG locale meta tag.
264
  *
265
  * @since 1.0.0
266
+ *
267
+ * @return string The Open Graph locale meta tag.
268
  */
269
  public function og_locale() {
270
 
271
+ if ( ! $this->use_og_tags() )
272
+ return '';
 
 
 
 
 
273
 
274
+ /**
275
+ * Applies filters 'the_seo_framework_oglocale_output' : string
276
+ * @since 2.3.0
277
+ * @since 2.7.0 Added output within filter.
278
+ */
279
+ $locale = (string) apply_filters( 'the_seo_framework_oglocale_output', $this->fetch_locale(), $this->get_the_real_ID() );
280
 
281
+ if ( $locale )
282
  return '<meta property="og:locale" content="' . esc_attr( $locale ) . '" />' . "\r\n";
 
283
 
284
  return '';
285
  }
286
 
287
  /**
288
+ * Renders the Open Graph title meta tag.
289
  *
290
  * @uses $this->title_from_cache()
 
291
  * @since 2.0.3
292
+ *
293
+ * @return string The Open Graph title meta tag.
294
  */
295
  public function og_title() {
296
 
297
+ if ( ! $this->use_og_tags() )
298
+ return '';
 
 
 
 
 
299
 
300
+ /**
301
+ * Applies filters 'the_seo_framework_ogtitle_output' : string
302
+ * @since 2.3.0
303
+ * @since 2.7.0 Added output within filter.
304
+ */
305
+ $title = (string) apply_filters( 'the_seo_framework_ogtitle_output', $this->title_from_cache( '', '', '', true ), $this->get_the_real_ID() );
306
 
307
+ if ( $title )
308
  return '<meta property="og:title" content="' . esc_attr( $title ) . '" />' . "\r\n";
 
309
 
310
  return '';
311
  }
312
 
313
  /**
314
+ * Renders the Open Graph type meta tag.
315
  *
316
  * @since 1.1.0
317
+ *
318
+ * @return string The Open Graph type meta tag.
319
  */
320
  public function og_type() {
321
 
322
+ if ( ! $this->use_og_tags() )
323
+ return '';
324
 
325
+ /**
326
+ * Applies filters 'the_seo_framework_ogtype_output' : string
327
+ * @since 2.3.0
328
+ * @since 2.7.0 Added output within filter.
329
+ */
330
+ $type = (string) apply_filters( 'the_seo_framework_ogtype_output', $this->generate_og_type(), $this->get_the_real_ID() );
 
 
 
 
 
 
 
 
 
 
 
 
 
331
 
332
+ if ( $type )
333
  return '<meta property="og:type" content="' . esc_attr( $type ) . '" />' . "\r\n";
 
334
 
335
  return '';
336
  }
337
 
338
  /**
339
+ * Renders Open Graph image meta tag.
340
  *
341
  * @param string $image url for image
342
  *
343
  * @since 1.3.0
344
+ * @since 2.6.0 Added WooCommerce gallery images.
345
+ * @since 2.7.0 Added image dimensions if found.
346
+ *
347
+ * @return string The Open Graph image meta tag.
348
  */
349
  public function og_image() {
350
 
351
+ if ( ! $this->use_og_tags() )
352
+ return '';
 
 
 
 
 
 
 
 
 
 
 
 
 
353
 
354
+ /**
355
+ * Applies filters 'the_seo_framework_ogimage_output' : string|bool
356
+ * @since 2.3.0
357
+ * @since 2.7.0 Added output within filter.
358
+ *
359
+ * @NOTE: Use of this might cause incorrect meta since other functions
360
+ * depend on the image from cache.
361
+ *
362
+ * @todo Place in listener cache.
363
+ * @priority medium 2.8.0+
364
+ */
365
+ $image = apply_filters( 'the_seo_framework_ogimage_output', $this->get_image_from_cache(), $id = $this->get_the_real_ID() );
366
 
367
+ /**
368
+ * Now returns empty string on false.
369
+ * @since 2.6.0
370
+ */
371
+ if ( false === $image )
372
+ return '';
373
 
374
+ $image = (string) $image;
 
 
 
 
375
 
376
+ /**
377
+ * Always output
378
+ * @since 2.1.1
379
+ */
380
+ $output = '<meta property="og:image" content="' . esc_attr( $image ) . '" />' . "\r\n";
381
 
382
+ if ( $image ) {
383
+ if ( ! empty( $this->image_dimensions[ $id ]['width'] ) && ! empty( $this->image_dimensions[ $id ]['height'] ) ) {
384
+ $output .= '<meta property="og:image:width" content="' . esc_attr( $this->image_dimensions[ $id ]['width'] ) . '" />' . "\r\n";
385
+ $output .= '<meta property="og:image:height" content="' . esc_attr( $this->image_dimensions[ $id ]['height'] ) . '" />' . "\r\n";
386
+ }
387
  }
388
 
389
+ //* Fetch Product images.
390
+ $woocommerce_product_images = $this->render_woocommerce_product_og_image();
391
+
392
+ return $output . $woocommerce_product_images;
393
  }
394
 
395
  /**
396
+ * Renders WooCommerce Product Gallery OG images.
397
  *
398
  * @since 2.6.0
399
+ * @since 2.7.0 Added image dimensions if found.
400
  *
401
  * @return string The rendered OG Image.
402
  */
413
  //* Parse 1500px url.
414
  $img = $this->parse_og_image( $id );
415
 
416
+ if ( $img ) {
417
  $output .= '<meta property="og:image" content="' . esc_attr( $img ) . '" />' . "\r\n";
418
+
419
+ if ( ! empty( $this->image_dimensions[ $id ]['width'] ) && ! empty( $this->image_dimensions[ $id ]['height'] ) ) {
420
+ $output .= '<meta property="og:image:width" content="' . esc_attr( $this->image_dimensions[ $id ]['width'] ) . '" />' . "\r\n";
421
+ $output .= '<meta property="og:image:height" content="' . esc_attr( $this->image_dimensions[ $id ]['height'] ) . '" />' . "\r\n";
422
+ }
423
+ }
424
  }
425
  }
426
  }
429
  }
430
 
431
  /**
432
+ * Renders Open Graph sitename meta tag.
 
 
433
  *
434
  * @since 1.3.0
435
+ *
436
+ * @return string The Open Graph sitename meta tag.
437
  */
438
  public function og_sitename() {
439
 
440
+ if ( ! $this->use_og_tags() )
441
+ return '';
 
 
 
 
 
442
 
443
+ /**
444
+ * Applies filters 'the_seo_framework_ogsitename_output' : string
445
+ * @since 2.3.0
446
+ * @since 2.7.0 Added output within filter.
447
+ */
448
+ $sitename = (string) apply_filters( 'the_seo_framework_ogsitename_output', get_bloginfo( 'name' ), $this->get_the_real_ID() );
449
 
450
+ if ( $sitename )
451
  return '<meta property="og:site_name" content="' . esc_attr( $sitename ) . '" />' . "\r\n";
 
452
 
453
  return '';
454
  }
455
 
456
  /**
457
+ * Renders Open Graph URL meta tag.
 
 
458
  *
459
  * @since 1.3.0
 
460
  * @uses $this->the_url_from_cache()
461
+ *
462
+ * @return string The Open Graph URL meta tag.
463
  */
464
  public function og_url() {
465
 
470
  }
471
 
472
  /**
473
+ * Renders the Twitter Card type meta tag.
474
  *
475
  * @since 2.2.2
476
+ *
477
+ * @return string The Twitter Card meta tag.
478
  */
479
  public function twitter_card() {
480
 
481
+ if ( ! $this->use_twitter_tags() )
482
+ return '';
483
 
484
+ /**
485
+ * Applies filters 'the_seo_framework_twittercard_output' : string
486
+ * @since 2.3.0
487
+ * @since 2.7.0 Added output within filter.
488
+ */
489
+ $card = (string) apply_filters( 'the_seo_framework_twittercard_output', $this->generate_twitter_card_type(), $this->get_the_real_ID() );
 
 
 
 
 
 
 
490
 
491
+ if ( $card )
492
  return '<meta name="twitter:card" content="' . esc_attr( $card ) . '" />' . "\r\n";
 
493
 
494
  return '';
495
  }
496
 
497
  /**
498
+ * Renders the Twitter Site meta tag.
499
  *
500
  * @since 2.2.2
501
+ *
502
+ * @return string The Twitter Site meta tag.
503
  */
504
  public function twitter_site() {
505
 
506
+ if ( ! $this->use_twitter_tags() )
507
+ return '';
 
 
 
 
 
508
 
509
+ /**
510
+ * Applies filters 'the_seo_framework_twittersite_output' : string
511
+ * @since 2.3.0
512
+ * @since 2.7.0 Added output within filter.
513
+ */
514
+ $site = (string) apply_filters( 'the_seo_framework_twittersite_output', $this->get_option( 'twitter_site' ), $this->get_the_real_ID() );
515
 
516
+ if ( $site )
517
+ return '<meta name="twitter:site" content="' . esc_attr( $site ) . '" />' . "\r\n";
 
518
 
519
  return '';
520
  }
521
 
522
  /**
523
+ * Renders The Twitter Creator meta tag.
524
+ * If no Twitter Site is found, it will render the Twitter Site ID meta tag.
525
  *
526
  * @since 2.2.2
527
+ *
528
+ * @return string The Twitter Creator or Twitter Site ID meta tag.
529
  */
530
  public function twitter_creator() {
531
 
532
+ if ( ! $this->use_twitter_tags() )
533
+ return '';
534
+
535
+ /**
536
+ * Applies filters 'the_seo_framework_twittercreator_output' : string
537
+ * @since 2.3.0
538
+ * @since 2.7.0 Added output within filter.
539
+ */
540
+ $creator = (string) apply_filters( 'the_seo_framework_twittercreator_output', $this->get_option( 'twitter_creator' ), $this->get_the_real_ID() );
541
 
542
+ if ( $creator ) {
543
  /**
544
+ * Return site:id instead of creator is no twitter:site is found.
545
+ * Per Twitter requirements.
546
  */
547
+ if ( $this->get_option( 'twitter_site' ) ) {
548
+ return '<meta name="twitter:site:id" content="' . esc_attr( $creator ) . '" />' . "\r\n";
549
+ } else {
 
 
 
 
 
 
 
 
 
 
 
 
550
  return '<meta name="twitter:creator" content="' . esc_attr( $creator ) . '" />' . "\r\n";
551
+ }
552
  }
553
 
554
  return '';
555
  }
556
 
557
  /**
558
+ * Renders Twitter Title meta tag.
559
  *
560
  * @uses $this->title_from_cache()
 
561
  * @since 2.2.2
562
+ *
563
+ * @return string The Twitter Title meta tag.
564
  */
565
  public function twitter_title() {
566
 
567
+ if ( ! $this->use_twitter_tags() )
568
+ return '';
 
 
 
 
 
569
 
570
+ /**
571
+ * Applies filters 'the_seo_framework_twittertitle_output' : string
572
+ * @since 2.3.0
573
+ * @since 2.7.0 Added output within filter.
574
+ */
575
+ $title = (string) apply_filters( 'the_seo_framework_twittertitle_output', $this->title_from_cache( '', '', '', true ), $this->get_the_real_ID() );
576
 
577
+ if ( $title )
578
  return '<meta name="twitter:title" content="' . esc_attr( $title ) . '" />' . "\r\n";
 
579
 
580
  return '';
581
  }
582
 
583
  /**
584
+ * Renders Twitter Description meta tag.
585
  *
586
  * @uses $this->description_from_cache()
 
587
  * @since 2.2.2
588
+ *
589
+ * @return string The Twitter Descritpion meta tag.
590
  */
591
  public function twitter_description() {
592
 
593
+ if ( ! $this->use_twitter_tags() )
594
+ return '';
 
 
 
 
 
595
 
596
+ /**
597
+ * Applies filters 'the_seo_framework_twitterdescription_output' : string
598
+ * @since 2.3.0
599
+ * @since 2.7.0 Added output within filter.
600
+ */
601
+ $description = (string) apply_filters( 'the_seo_framework_twitterdescription_output', $this->description_from_cache( true ), $this->get_the_real_ID() );
602
 
603
+ if ( $description )
604
  return '<meta name="twitter:description" content="' . esc_attr( $description ) . '" />' . "\r\n";
 
605
 
606
  return '';
607
  }
608
 
609
  /**
610
+ * Renders Twitter Image meta tag.
 
 
611
  *
612
  * @since 2.2.2
613
  *
614
+ * @return string The Twitter Image meta tag.
615
  */
616
  public function twitter_image() {
617
 
618
+ if ( ! $this->use_twitter_tags() )
619
+ return '';
620
+
621
+ /**
622
+ * Applies filters 'the_seo_framework_twitterimage_output' : string|bool
623
+ * @since 2.3.0
624
+ * @since 2.7.0 Added output within filter.
625
+ */
626
+ $image = (string) apply_filters( 'the_seo_framework_twitterimage_output', $this->get_image_from_cache(), $id = $this->get_the_real_ID() );
627
 
628
+ $output = '';
 
 
 
 
629
 
630
+ if ( $image ) {
631
+ $output = '<meta name="twitter:image" content="' . esc_attr( $image ) . '" />' . "\r\n";
 
 
 
 
632
 
633
+ if ( ! empty( $this->image_dimensions[ $id ]['width'] ) && ! empty( $this->image_dimensions[ $id ]['height'] ) ) {
634
+ $output .= '<meta name="twitter:image:width" content="' . esc_attr( $this->image_dimensions[ $id ]['width'] ) . '" />' . "\r\n";
635
+ $output .= '<meta name="twitter:image:height" content="' . esc_attr( $this->image_dimensions[ $id ]['height'] ) . '" />' . "\r\n";
 
636
  }
 
 
 
637
  }
638
 
639
+ return $output;
640
  }
641
 
642
  /**
643
+ * Renders Facebook Author meta tag.
644
  *
645
  * @since 2.2.2
646
  *
647
+ * @return string The Facebook Author meta tag.
648
  */
649
  public function facebook_author() {
650
 
651
+ if ( ! $this->use_facebook_tags() )
652
+ return '';
 
 
 
 
 
653
 
654
+ /**
655
+ * Applies filters 'the_seo_framework_facebookauthor_output' : string
656
+ * @since 2.3.0
657
+ * @since 2.7.0 Added output within filter.
658
+ */
659
+ $author = (string) apply_filters( 'the_seo_framework_facebookauthor_output', $this->get_option( 'facebook_author' ), $this->get_the_real_ID() );
660
 
661
+ if ( $author )
662
+ return '<meta property="article:author" content="' . esc_attr( esc_url_raw( $author ) ) . '" />' . "\r\n";
 
663
 
664
  return '';
665
  }
666
 
667
  /**
668
+ * Renders Facebook Publisher meta tag.
669
  *
670
  * @since 2.2.2
671
  *
672
+ * @return string The Facebook Publisher meta tag.
673
  */
674
  public function facebook_publisher() {
675
 
676
+ if ( ! $this->use_facebook_tags() )
677
+ return '';
 
 
 
 
 
678
 
679
+ /**
680
+ * Applies filters 'the_seo_framework_facebookpublisher_output' : string
681
+ * @since 2.3.0
682
+ * @since 2.7.0 Added output within filter.
683
+ */
684
+ $publisher = (string) apply_filters( 'the_seo_framework_facebookpublisher_output', $this->get_option( 'facebook_publisher' ), $this->get_the_real_ID() );
685
 
686
+ if ( $publisher )
687
+ return '<meta property="article:publisher" content="' . esc_attr( esc_url_raw( $publisher ) ) . '" />' . "\r\n";
 
688
 
689
  return '';
690
  }
691
 
692
  /**
693
+ * Renders Facebook App ID meta tag.
694
  *
695
  * @since 2.2.2
696
  *
697
+ * @return string The Facebook App ID meta tag.
698
  */
699
  public function facebook_app_id() {
700
 
701
+ if ( ! $this->use_facebook_tags() )
702
+ return '';
 
 
 
 
 
703
 
704
+ /**
705
+ * Applies filters 'the_seo_framework_facebookappid_output' : string
706
+ * @since 2.3.0
707
+ * @since 2.7.0 Added output within filter.
708
+ */
709
+ $app_id = (string) apply_filters( 'the_seo_framework_facebookappid_output', $this->get_option( 'facebook_appid' ), $this->get_the_real_ID() );
710
 
711
+ if ( $app_id )
712
+ return '<meta property="fb:app_id" content="' . esc_attr( $app_id ) . '" />' . "\r\n";
 
713
 
714
  return '';
715
  }
716
 
717
  /**
718
+ * Renders Article Publishing Time meta tag.
719
  *
720
  * @since 2.2.2
721
  *
722
+ * @return string The Article Publishing Time meta tag.
723
  */
724
  public function article_published_time() {
725
 
726
+ //* Don't do anything if it's not a page or post.
727
  if ( false === $this->is_singular() )
728
+ return '';
 
 
 
 
 
 
729
 
730
+ if ( $this->is_front_page() ) {
731
+ //* If it's the frontpage, but the option is disabled, don't do anything.
732
+ if ( ! $this->get_option( 'home_publish_time' ) )
733
+ return '';
734
+ } else {
735
+ //* If it's a post, but the option is disabled, don't do anything.
736
+ if ( $this->is_single() && ! $this->get_option( 'post_publish_time' ) )
737
+ return '';
738
 
739
+ //* If it's a page, but the option is disabled, don't do anything.
740
+ if ( $this->is_page() && ! $this->get_option( 'page_publish_time' ) )
741
+ return '';
742
+ }
743
 
744
+ $id = $this->get_the_real_ID();
 
745
 
746
+ /**
747
+ * Applies filters 'the_seo_framework_publishedtime_output' : string
748
+ * @since 2.3.0
749
+ * @since 2.7.0 Added output within filter.
750
+ */
751
+ $time = (string) apply_filters( 'the_seo_framework_publishedtime_output', get_the_date( 'Y-m-d', $id ), $id );
752
 
753
  if ( $time )
754
  return '<meta property="article:published_time" content="' . esc_attr( $time ) . '" />' . "\r\n";
757
  }
758
 
759
  /**
760
+ * Renders Article Modified Time meta tag.
761
+ * Also renders the Open Graph Updated Time meta tag if Open Graph tags are enabled.
762
  *
763
  * @since 2.2.2
764
+ * @since 2.7.0 Listens to $this->get_the_real_ID() instead of WordPress Core ID determination.
765
  *
766
+ * @return string The Article Modified Time meta tag, and optionally the Open Graph Updated Time.
767
  */
768
  public function article_modified_time() {
769
 
772
  return '';
773
 
774
  if ( $this->is_front_page() ) {
775
+ //* If it's the frontpage, but the option is disabled, don't do anything.
776
  if ( ! $this->get_option( 'home_modify_time' ) )
777
  return '';
778
  } else {
779
+ //* If it's a post, but the option is disabled, don't do anyhting.
780
  if ( $this->is_single() && ! $this->get_option( 'post_modify_time' ) )
781
  return '';
782
 
783
+ //* If it's a page, but the option is disabled, don't do anything.
784
  if ( $this->is_page() && ! $this->get_option( 'page_modify_time' ) )
785
  return '';
786
  }
787
 
788
+ $id = $this->get_the_real_ID();
 
789
 
790
+ /**
791
+ * Applies filters 'the_seo_framework_modifiedtime_output' : string
792
+ * @since 2.3.0
793
+ * @since 2.7.0 Added output within filter.
794
+ */
795
+ $time = (string) apply_filters( 'the_seo_framework_modifiedtime_output', get_post_modified_time( 'Y-m-d', false, $id, false ), $id );
796
 
797
  if ( $time ) {
798
  $output = '<meta property="article:modified_time" content="' . esc_attr( $time ) . '" />' . "\r\n";
799
 
800
  if ( $this->use_og_tags() )
801
+ $output .= '<meta property="og:updated_time" content="' . esc_attr( $time ) . '" />' . "\r\n";
802
 
803
  return $output;
804
  }
807
  }
808
 
809
  /**
810
+ * Renders Canonical URL meta tag.
811
  *
812
  * @since 2.0.6
 
813
  * @uses $this->the_url_from_cache()
814
  *
815
+ * @return string The Canonical URL meta tag.
816
  */
817
  public function canonical() {
818
 
819
  /**
820
  * Applies filters the_seo_framework_output_canonical : Don't output canonical if false.
821
  * @since 2.4.2
822
+ *
823
+ * @deprecated
824
+ * @since 2.7.0
825
  */
826
+ if ( ! apply_filters( 'the_seo_framework_output_canonical', true, $this->get_the_real_ID() ) ) {
827
+ $this->_deprecated_function( 'filter the_seo_framework_output_canonical', '2.7.0', "add_filter( 'the_seo_framework_rel_canonical_output', '__return_empty_string' );" );
828
+ return '';
829
+ }
830
 
831
  /**
832
  * Applies filters 'the_seo_framework_rel_canonical_output' : Change canonical URL output.
834
  */
835
  $url = (string) apply_filters( 'the_seo_framework_rel_canonical_output', $this->the_url_from_cache(), $this->get_the_real_ID() );
836
 
837
+ /**
838
+ * @since 2.7.0 Listens to the second filter.
839
+ */
840
+ if ( $url )
841
+ return '<link rel="canonical" href="' . $url . '" />' . "\r\n";
842
+
843
+ return '';
844
  }
845
 
846
  /**
847
+ * Renders LD+JSON Schema.org scripts.
848
  *
849
  * @uses $this->render_ld_json_scripts()
850
  *
851
  * @since 1.2.0
852
+ * @return string The LD+json Schema.org scripts.
853
  */
854
  public function ld_json() {
855
 
856
+ //* Don't output on Search, 404 or preview.
857
+ if ( $this->is_search() || $this->is_404() || $this->is_preview() )
858
+ return '';
859
 
860
  /**
861
  * Applies filters 'the_seo_framework_ldjson_scripts' : string
867
  }
868
 
869
  /**
870
+ * Renders Google Site Verification Code meta tag.
871
  *
872
  * @since 2.2.4
873
  *
874
+ * @return string The Google Site Verification code meta tag.
875
  */
876
  public function google_site_output() {
877
 
881
  */
882
  $code = (string) apply_filters( 'the_seo_framework_googlesite_output', $this->get_option( 'google_verification' ), $this->get_the_real_ID() );
883
 
884
+ if ( $code )
885
+ return '<meta name="google-site-verification" content="' . esc_attr( $code ) . '" />' . "\r\n";
886
 
887
+ return '';
888
  }
889
 
890
  /**
891
+ * Renders Bing Site Verification Code meta tag.
892
  *
893
  * @since 2.2.4
894
  *
895
+ * @return string The Bing Site Verification Code meta tag.
896
  */
897
  public function bing_site_output() {
898
 
902
  */
903
  $code = (string) apply_filters( 'the_seo_framework_bingsite_output', $this->get_option( 'bing_verification' ), $this->get_the_real_ID() );
904
 
905
+ if ( $code )
906
+ return '<meta name="msvalidate.01" content="' . esc_attr( $code ) . '" />' . "\r\n";
907
 
908
+ return '';
909
  }
910
 
911
  /**
912
+ * Renders Yandex Site Verification code meta tag.
913
  *
914
  * @since 2.6.0
915
  *
916
+ * @return string The Yandex Site Verification code meta tag.
917
  */
918
  public function yandex_site_output() {
919
 
923
  */
924
  $code = (string) apply_filters( 'the_seo_framework_yandexsite_output', $this->get_option( 'yandex_verification' ), $this->get_the_real_ID() );
925
 
926
+ if ( $code )
927
+ return '<meta name="yandex-verification" content="' . esc_attr( $code ) . '" />' . "\r\n";
928
 
929
+ return '';
930
  }
931
 
932
  /**
933
+ * Renders Pinterest Site Verification code meta tag.
934
  *
935
  * @since 2.5.2
936
  *
937
+ * @return string The Pinterest Site Verification code meta tag.
938
  */
939
  public function pint_site_output() {
940
 
944
  */
945
  $code = (string) apply_filters( 'the_seo_framework_pintsite_output', $this->get_option( 'pint_verification' ), $this->get_the_real_ID() );
946
 
947
+ if ( $code )
948
+ return '<meta name="p:domain_verify" content="' . esc_attr( $code ) . '" />' . "\r\n";
949
 
950
+ return '';
951
  }
952
 
953
  /**
954
+ * Renders Robots meta tags.
955
+ * Returns early if blog isn't public. WordPress Core will then output the meta tags.
956
  *
957
  * @since 2.0.0
958
  *
959
+ * @return string The Robots meta tags.
960
  */
961
  public function robots() {
962
 
970
  */
971
  $meta = (array) apply_filters( 'the_seo_framework_robots_meta', $this->robots_meta(), $this->get_the_real_ID() );
972
 
973
+ if ( empty( $meta ) )
974
+ return '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
975
 
976
+ return sprintf( '<meta name="robots" content="%s" />' . "\r\n", implode( ',', $meta ) );
977
  }
978
 
979
  /**
980
+ * Renders Shortlink meta tag
981
  *
982
  * @since 2.2.2
 
983
  * @uses $this->get_shortlink()
984
  *
985
+ * @return string The Shortlink meta tag.
986
  */
987
  public function shortlink() {
988
 
989
  /**
990
+ * Applies filters 'the_seo_framework_shortlink_output' : string
991
  * @since 2.6.0
992
  */
993
  $url = (string) apply_filters( 'the_seo_framework_shortlink_output', $this->get_shortlink(), $this->get_the_real_ID() );
999
  }
1000
 
1001
  /**
1002
+ * Renders Prev/Next Paged URL meta tags.
1003
  *
1004
  * @since 2.2.2
 
1005
  * @uses $this->get_paged_url()
1006
  *
1007
+ * @return string The Prev/Next Paged URL meta tags.
1008
  */
1009
  public function paged_urls() {
1010
 
1034
  }
1035
 
1036
  /**
1037
+ * Determines whether we can use Open Graph tags.
1038
  *
1039
  * @since 2.6.0
1040
  * @staticvar bool $cache
1052
  }
1053
 
1054
  /**
1055
+ * Determines whether we can use Facebook tags.
1056
  *
1057
  * @since 2.6.0
1058
  * @staticvar bool $cache
1070
  }
1071
 
1072
  /**
1073
+ * Determines whether we can use Twitter tags.
1074
  *
1075
  * @since 2.6.0
1076
  * @staticvar bool $cache
1084
  if ( isset( $cache ) )
1085
  return $cache;
1086
 
1087
+ return $cache = $this->is_option_checked( 'twitter_tags' ) && false === $this->detect_twitter_card_plugin();
1088
  }
1089
 
1090
  /**
1091
+ * Determines whether we can use Google+ tags.
1092
  *
1093
  * @since 2.6.0
1094
  * @staticvar bool $cache
1104
 
1105
  return $cache = $this->is_option_checked( 'googleplus_tags' );
1106
  }
 
1107
  }
inc/classes/sanitize.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_Sanitize
21
  *
@@ -25,6 +27,18 @@
25
  */
26
  class AutoDescription_Sanitize extends AutoDescription_Adminpages {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor
30
  */
@@ -39,33 +53,59 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
39
  }
40
 
41
  /**
42
- * Register each of the settings with a sanitization filter type.
 
43
  *
44
- * @since 2.2.2
45
  *
46
- * @uses autodescription_add_option_filter() Assign filter to array of settings.
 
47
  *
48
- * @see AutoDescription_Sanitize::add_filter() Add sanitization filters to options.
49
  */
50
- public function sanitizer_filters() {
 
 
 
 
 
51
 
52
  //* If this page doesn't store settings, no need to sanitize them
53
  if ( ! $this->settings_field )
54
- return;
55
 
56
  /**
57
  * If this page doesn't parse the site options,
58
  * There's no need to filter them on each request.
 
59
  *
60
  * @since 2.2.9
61
  */
62
- if ( ! isset( $_POST ) || empty( $_POST ) || ! isset( $_POST[THE_SEO_FRAMEWORK_SITE_OPTIONS] ) || ! is_array( $_POST[THE_SEO_FRAMEWORK_SITE_OPTIONS] ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  return;
64
 
65
  //* Update hidden options.
66
  $this->update_hidden_options_to_default();
67
 
68
- $this->autodescription_add_option_filter(
69
  's_title_separator',
70
  $this->settings_field,
71
  array(
@@ -73,7 +113,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
73
  )
74
  );
75
 
76
- $this->autodescription_add_option_filter(
77
  's_description_separator',
78
  $this->settings_field,
79
  array(
@@ -81,7 +121,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
81
  )
82
  );
83
 
84
- $this->autodescription_add_option_filter(
85
  's_description',
86
  $this->settings_field,
87
  array(
@@ -90,7 +130,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
90
  )
91
  );
92
 
93
- $this->autodescription_add_option_filter(
94
  's_title',
95
  $this->settings_field,
96
  array(
@@ -101,7 +141,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
101
  )
102
  );
103
 
104
- $this->autodescription_add_option_filter(
105
  's_knowledge_type',
106
  $this->settings_field,
107
  array(
@@ -109,7 +149,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
109
  )
110
  );
111
 
112
- $this->autodescription_add_option_filter(
113
  's_left_right',
114
  $this->settings_field,
115
  array(
@@ -117,7 +157,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
117
  )
118
  );
119
 
120
- $this->autodescription_add_option_filter(
121
  's_left_right_home',
122
  $this->settings_field,
123
  array(
@@ -125,7 +165,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
125
  )
126
  );
127
 
128
- $this->autodescription_add_option_filter(
129
  's_one_zero',
130
  $this->settings_field,
131
  array(
@@ -212,7 +252,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
212
  )
213
  );
214
 
215
- $this->autodescription_add_option_filter(
216
  's_absint',
217
  $this->settings_field,
218
  array(
@@ -220,7 +260,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
220
  )
221
  );
222
 
223
- $this->autodescription_add_option_filter(
224
  's_no_html',
225
  $this->settings_field,
226
  array(
@@ -231,7 +271,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
231
  * @todo create content="code" stripper
232
  * @priority low 2.9.0+
233
  */
234
- $this->autodescription_add_option_filter(
235
  's_no_html_space',
236
  $this->settings_field,
237
  array(
@@ -244,7 +284,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
244
  )
245
  );
246
 
247
- $this->autodescription_add_option_filter(
248
  's_url',
249
  $this->settings_field,
250
  array(
@@ -263,7 +303,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
263
  )
264
  );
265
 
266
- $this->autodescription_add_option_filter(
267
  's_url_query',
268
  $this->settings_field,
269
  array(
@@ -271,7 +311,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
271
  )
272
  );
273
 
274
- $this->autodescription_add_option_filter(
275
  's_twitter_name',
276
  $this->settings_field,
277
  array(
@@ -280,7 +320,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
280
  )
281
  );
282
 
283
- $this->autodescription_add_option_filter(
284
  's_twitter_card',
285
  $this->settings_field,
286
  array(
@@ -289,7 +329,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
289
  );
290
 
291
  //* Special action filter.
292
- $this->autodescription_add_option_filter(
293
  's_one_zero_flush_rewrite',
294
  $this->settings_field,
295
  array(
@@ -298,7 +338,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
298
  );
299
 
300
  //* Special action filter.
301
- $this->autodescription_add_option_filter(
302
  's_one_zero_flush_sitemap',
303
  $this->settings_field,
304
  array(
@@ -313,6 +353,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
313
  * Registers option sanitation filter
314
  *
315
  * @since 2.2.2
 
316
  *
317
  * @param string $filter The filter to call (see AutoDescription_Siteoptions::$available_filters for options)
318
  * @param string $option The WordPress option name
@@ -332,8 +373,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
332
  * sanitizer at the right time.
333
  *
334
  * @since 2.2.2
335
- *
336
- * @thanks StudioPress (http://www.studiopress.com/) for some code.
337
  *
338
  * @param string $filter Sanitization filter type
339
  * @param string $option Option key
@@ -342,19 +382,56 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
342
  */
343
  public function add_filter( $filter, $option, $suboption = null ) {
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  if ( is_array( $suboption ) ) {
346
  foreach ( $suboption as $so ) {
347
- $this->options[$option][$so] = $filter;
348
  }
349
- } else if ( is_null( $suboption ) ) {
350
- $this->options[$option] = $filter;
351
  } else {
352
- $this->options[$option][$suboption] = $filter;
353
  }
 
354
 
355
- add_filter( 'sanitize_option_' . $option, array( $this, 'sanitize' ), 10, 2 );
356
-
357
- return true;
 
 
 
 
 
 
358
  }
359
 
360
  /**
@@ -370,19 +447,21 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
370
  */
371
  public function sanitize( $new_value, $option ) {
372
 
373
- if ( ! isset( $this->options[$option] ) ) {
 
 
374
  //* We are not filtering this option at all
375
  return $new_value;
376
- } else if ( is_string( $this->options[$option] ) ) {
377
  //* Single option value
378
- return $this->do_filter( $this->options[$option], $new_value, get_option( $option ) );
379
- } else if ( is_array( $this->options[$option] ) ) {
380
  //* Array of suboption values to loop through
381
  $old_value = get_option( $option );
382
- foreach ( $this->options[$option] as $suboption => $filter ) {
383
- $old_value[$suboption] = isset( $old_value[$suboption] ) ? $old_value[$suboption] : '';
384
- $new_value[$suboption] = isset( $new_value[$suboption] ) ? $new_value[$suboption] : '';
385
- $new_value[$suboption] = $this->do_filter( $filter, $new_value[$suboption], $old_value[$suboption] );
386
  }
387
  return $new_value;
388
  }
@@ -408,10 +487,10 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
408
 
409
  $available_filters = $this->get_available_filters();
410
 
411
- if ( ! in_array( $filter, array_keys( $available_filters ) ) )
412
  return $new_value;
413
 
414
- return call_user_func( $available_filters[$filter], $new_value, $old_value );
415
  }
416
 
417
  /**
@@ -662,7 +741,7 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
662
  *
663
  * @since 2.3.0
664
  */
665
- if ( (int) (bool) $new_value ) {
666
  $this->enqueue_rewrite_activate( true );
667
  } else {
668
  $this->enqueue_rewrite_deactivate( true );
@@ -808,7 +887,8 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
808
  $profile = trim( strip_tags( $new_value ) );
809
 
810
  if ( 'http' === substr( $profile, 0, 4 ) ) {
811
- $path = str_replace( '/', '', parse_url( $profile, PHP_URL_PATH ) );
 
812
  $profile = $path ? '@' . $path : '';
813
 
814
  return (string) $profile;
@@ -889,24 +969,19 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
889
  //* Find a path.
890
  if ( _wp_can_use_pcre_u() ) {
891
  //* URL pattern excluding path.
892
- $pattern = '/'
893
- . '((((http)(s)?)?)\:)?' // 1: maybe http: https:
894
- . '(\/\/)?' // 2: maybe slash slash
895
- . '((www.)?)' // 3: maybe www.
896
- . '(.*\.[a-zA-Z0-9]*)' // 4: any legal domain with tld
897
- . '(?:\/)?' // 5: trailing slash
898
- . '/'
899
  ;
900
 
901
  $is_path = ! preg_match( $pattern, $url );
902
  } else {
903
- $parsed_url = parse_url( $url );
904
-
905
- if ( ! isset( $parsed_url['host'] ) && isset( $parsed_url['path'] ) ) {
906
- $is_path = true;
907
- } else {
908
- $is_path = false;
909
- }
910
  }
911
 
912
  //* If link is relative, make it full again
@@ -974,5 +1049,4 @@ class AutoDescription_Sanitize extends AutoDescription_Adminpages {
974
  //* Save url
975
  return $new_value;
976
  }
977
-
978
  }
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_Sanitize
23
  *
27
  */
28
  class AutoDescription_Sanitize extends AutoDescription_Adminpages {
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
  */
53
  }
54
 
55
  /**
56
+ * Checks the SEO Settings page nonce. Returns false if nonce can't be found.
57
+ * Performs wp_die() when nonce verification fails.
58
  *
59
+ * Never run a sensitive function when it's returning false. This means no nonce can be verified.
60
  *
61
+ * @since 2.7.0
62
+ * @staticvar bool $verified.
63
  *
64
+ * @return bool True if verified and matches. False if can't verify.
65
  */
66
+ public function verify_seo_settings_nonce() {
67
+
68
+ static $validated = null;
69
+
70
+ if ( isset( $validated ) )
71
+ return $validated;
72
 
73
  //* If this page doesn't store settings, no need to sanitize them
74
  if ( ! $this->settings_field )
75
+ return $validated = false;
76
 
77
  /**
78
  * If this page doesn't parse the site options,
79
  * There's no need to filter them on each request.
80
+ * Nonce is handled elsewhere. This function merely injects filters to the $_POST data.
81
  *
82
  * @since 2.2.9
83
  */
84
+ if ( empty( $_POST ) || ! isset( $_POST[ THE_SEO_FRAMEWORK_SITE_OPTIONS ] ) || ! is_array( $_POST[ THE_SEO_FRAMEWORK_SITE_OPTIONS ] ) )
85
+ return $validated = false;
86
+
87
+ check_admin_referer( $this->settings_field . '-options' );
88
+
89
+ return $validated = true;
90
+ }
91
+
92
+ /**
93
+ * Register each of the settings with a sanitization filter type.
94
+ *
95
+ * @since 2.2.2
96
+ * @uses autodescription_add_option_filter() Assign filter to array of settings.
97
+ * @see AutoDescription_Sanitize::add_filter() Add sanitization filters to options.
98
+ */
99
+ public function sanitizer_filters() {
100
+
101
+ //* Verify update nonce.
102
+ if ( false === $this->verify_seo_settings_nonce() )
103
  return;
104
 
105
  //* Update hidden options.
106
  $this->update_hidden_options_to_default();
107
 
108
+ $this->add_filter(
109
  's_title_separator',
110
  $this->settings_field,
111
  array(
113
  )
114
  );
115
 
116
+ $this->add_filter(
117
  's_description_separator',
118
  $this->settings_field,
119
  array(
121
  )
122
  );
123
 
124
+ $this->add_filter(
125
  's_description',
126
  $this->settings_field,
127
  array(
130
  )
131
  );
132
 
133
+ $this->add_filter(
134
  's_title',
135
  $this->settings_field,
136
  array(
141
  )
142
  );
143
 
144
+ $this->add_filter(
145
  's_knowledge_type',
146
  $this->settings_field,
147
  array(
149
  )
150
  );
151
 
152
+ $this->add_filter(
153
  's_left_right',
154
  $this->settings_field,
155
  array(
157
  )
158
  );
159
 
160
+ $this->add_filter(
161
  's_left_right_home',
162
  $this->settings_field,
163
  array(
165
  )
166
  );
167
 
168
+ $this->add_filter(
169
  's_one_zero',
170
  $this->settings_field,
171
  array(
252
  )
253
  );
254
 
255
+ $this->add_filter(
256
  's_absint',
257
  $this->settings_field,
258
  array(
260
  )
261
  );
262
 
263
+ $this->add_filter(
264
  's_no_html',
265
  $this->settings_field,
266
  array(
271
  * @todo create content="code" stripper
272
  * @priority low 2.9.0+
273
  */
274
+ $this->add_filter(
275
  's_no_html_space',
276
  $this->settings_field,
277
  array(
284
  )
285
  );
286
 
287
+ $this->add_filter(
288
  's_url',
289
  $this->settings_field,
290
  array(
303
  )
304
  );
305
 
306
+ $this->add_filter(
307
  's_url_query',
308
  $this->settings_field,
309
  array(
311
  )
312
  );
313
 
314
+ $this->add_filter(
315
  's_twitter_name',
316
  $this->settings_field,
317
  array(
320
  )
321
  );
322
 
323
+ $this->add_filter(
324
  's_twitter_card',
325
  $this->settings_field,
326
  array(
329
  );
330
 
331
  //* Special action filter.
332
+ $this->add_filter(
333
  's_one_zero_flush_rewrite',
334
  $this->settings_field,
335
  array(
338
  );
339
 
340
  //* Special action filter.
341
+ $this->add_filter(
342
  's_one_zero_flush_sitemap',
343
  $this->settings_field,
344
  array(
353
  * Registers option sanitation filter
354
  *
355
  * @since 2.2.2
356
+ * @since 2.7.0 : No longer used internally.
357
  *
358
  * @param string $filter The filter to call (see AutoDescription_Siteoptions::$available_filters for options)
359
  * @param string $option The WordPress option name
373
  * sanitizer at the right time.
374
  *
375
  * @since 2.2.2
376
+ * @since 2.7.0: Uses external caching function.
 
377
  *
378
  * @param string $filter Sanitization filter type
379
  * @param string $option Option key
382
  */
383
  public function add_filter( $filter, $option, $suboption = null ) {
384
 
385
+ $this->set_option_filter( $filter, $option, $suboption );
386
+
387
+ add_filter( 'sanitize_option_' . $option, array( $this, 'sanitize' ), 10, 2 );
388
+
389
+ return true;
390
+ }
391
+
392
+ /**
393
+ * Sets sanitation filters cache.
394
+ *
395
+ * Associates a sanitization filter to each option (or sub options if they
396
+ * exist) before adding a reference to run the option through that
397
+ * sanitizer at the right time.
398
+ *
399
+ * @since 2.7.0
400
+ * @staticvar $options The options filter cache.
401
+ *
402
+ * @param string $filter Sanitization filter type
403
+ * @param string $option Option key
404
+ * @param array|string $suboption Optional. Suboption key
405
+ * @param bool $get Whether to retrieve cache.
406
+ * @return boolean Returns true when complete
407
+ */
408
+ protected function set_option_filter( $filter, $option, $suboption = null, $get = false ) {
409
+
410
+ static $options = array();
411
+
412
+ if ( $get )
413
+ return $options;
414
+
415
  if ( is_array( $suboption ) ) {
416
  foreach ( $suboption as $so ) {
417
+ $options[ $option ][ $so ] = $filter;
418
  }
419
+ } elseif ( is_null( $suboption ) ) {
420
+ $options[ $option ] = $filter;
421
  } else {
422
+ $options[ $option ][ $suboption ] = $filter;
423
  }
424
+ }
425
 
426
+ /**
427
+ * Returns sanitation filters from cache.
428
+ *
429
+ * @since 2.7.0
430
+ *
431
+ * @return array Filters with their associated (sub)options.
432
+ */
433
+ protected function get_option_filters() {
434
+ return $this->set_option_filter( '', '', '', true );
435
  }
436
 
437
  /**
447
  */
448
  public function sanitize( $new_value, $option ) {
449
 
450
+ $filters = $this->get_option_filters();
451
+
452
+ if ( ! isset( $filters[ $option ] ) ) {
453
  //* We are not filtering this option at all
454
  return $new_value;
455
+ } elseif ( is_string( $filters[ $option ] ) ) {
456
  //* Single option value
457
+ return $this->do_filter( $filters[ $option ], $new_value, get_option( $option ) );
458
+ } elseif ( is_array( $filters[ $option ] ) ) {
459
  //* Array of suboption values to loop through
460
  $old_value = get_option( $option );
461
+ foreach ( $filters[ $option ] as $suboption => $filter ) {
462
+ $old_value[ $suboption ] = isset( $old_value[ $suboption ] ) ? $old_value[ $suboption ] : '';
463
+ $new_value[ $suboption ] = isset( $new_value[ $suboption ] ) ? $new_value[ $suboption ] : '';
464
+ $new_value[ $suboption ] = $this->do_filter( $filter, $new_value[ $suboption ], $old_value[ $suboption ] );
465
  }
466
  return $new_value;
467
  }
487
 
488
  $available_filters = $this->get_available_filters();
489
 
490
+ if ( ! in_array( $filter, array_keys( $available_filters ), true ) )
491
  return $new_value;
492
 
493
+ return call_user_func( $available_filters[ $filter ], $new_value, $old_value );
494
  }
495
 
496
  /**
741
  *
742
  * @since 2.3.0
743
  */
744
+ if ( $new_value ) {
745
  $this->enqueue_rewrite_activate( true );
746
  } else {
747
  $this->enqueue_rewrite_deactivate( true );
887
  $profile = trim( strip_tags( $new_value ) );
888
 
889
  if ( 'http' === substr( $profile, 0, 4 ) ) {
890
+ $parsed_url = wp_parse_url( $profile );
891
+ $path = isset( $parsed_url['path'] ) ? str_replace( '/', '', $parsed_url['path'] ) : '';
892
  $profile = $path ? '@' . $path : '';
893
 
894
  return (string) $profile;
969
  //* Find a path.
970
  if ( _wp_can_use_pcre_u() ) {
971
  //* URL pattern excluding path.
972
+ $pattern = '/'
973
+ . '((((http)(s)?)?)\:)?' // 1: maybe http: https:
974
+ . '(\/\/)?' // 2: maybe slash slash
975
+ . '((www.)?)' // 3: maybe www.
976
+ . '(.*\.[a-zA-Z0-9]*)' // 4: any legal domain with tld
977
+ . '(?:\/)?' // 5: trailing slash
978
+ . '/'
979
  ;
980
 
981
  $is_path = ! preg_match( $pattern, $url );
982
  } else {
983
+ $parsed_url = wp_parse_url( $url );
984
+ $is_path = ! isset( $parsed_url['host'] ) && isset( $parsed_url['path'] );
 
 
 
 
 
985
  }
986
 
987
  //* If link is relative, make it full again
1049
  //* Save url
1050
  return $new_value;
1051
  }
 
1052
  }
inc/classes/search.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_Search
21
  *
@@ -26,47 +28,105 @@
26
  class AutoDescription_Search extends AutoDescription_Generate_Ldjson {
27
 
28
  /**
29
- * Constructor, load parent constructor
30
- *
31
- * Initalizes options
 
 
 
 
 
 
 
 
 
 
32
  */
33
  public function __construct() {
34
  parent::__construct();
35
 
36
- add_action( 'pre_get_posts', array( $this, 'search_filter' ), 999, 1 );
 
 
 
 
 
37
  }
38
 
39
  /**
40
- * Fetches posts with exclude_local_search option on
 
 
41
  *
42
- * @param array $query The search query
43
  *
44
- * @uses $this->exclude_search_ids()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  *
46
  * @since 2.1.7
 
 
47
  *
48
- * @todo run this only when one post triggers this option?
49
- * @todo priority low 2.7.0+
50
  */
51
  public function search_filter( $query ) {
52
 
53
- // Don't exclude pages in wp-admin
54
  if ( $query->is_search && false === $this->is_admin() ) {
55
 
56
  $q = $query->query;
57
  //* Only interact with an actual Search Query.
58
- if ( ! isset( $q['s'] ) || ! $q['s'] )
59
  return;
60
 
61
- /**
62
- * @param array $protected_posts : Posts array with excluded key
63
- */
64
- $protected_posts = $this->exclude_search_ids();
65
  if ( $protected_posts ) {
66
  $get = $query->get( 'post__not_in' );
67
 
68
  //* Merge user defined query.
69
- if ( $get )
70
  $protected_posts = array_merge( $protected_posts, $get );
71
 
72
  $query->set( 'post__not_in', $protected_posts );
@@ -74,45 +134,45 @@ class AutoDescription_Search extends AutoDescription_Generate_Ldjson {
74
 
75
  // Parse all ID's, even beyond the first page.
76
  $query->set( 'no_found_rows', false );
77
-
78
  }
79
-
80
  }
81
 
82
  /**
83
  * Fetches posts with exclude_local_search option on
84
  *
85
- * @param array $post_ids The post id's which are excluded
86
- * @param array $args Posts search arguments
87
- * @param array $protected_posts Posts array with excluded key
88
- *
89
  * @global int $blog_id
90
  *
91
- * @since 2.1.7
92
- *
93
  * @return array Excluded Post IDs
94
  */
95
- public function exclude_search_ids() {
96
  global $blog_id;
97
 
98
- $cache_key = 'exclude_search_ids_' . $blog_id;
99
 
100
  $post_ids = $this->object_cache_get( $cache_key );
101
  if ( false === $post_ids ) {
102
  $post_ids = array();
103
 
104
  $args = array(
105
- 'post_type' => 'any',
106
- 'meta_key' => 'exclude_local_search',
107
- 'meta_value' => 1,
108
- 'posts_per_page' => 99999, // get them all! Fast enough! :D
109
- 'meta_compare' => '=',
110
- /* 'post_status' => array('publish','private'),*/
 
 
 
 
111
  );
 
 
 
112
 
113
- $protected_posts = get_posts( $args );
114
- if ( $protected_posts )
115
- $post_ids = wp_list_pluck( $protected_posts, 'ID' );
116
 
117
  $this->object_cache_set( $cache_key, $post_ids, 86400 );
118
  }
@@ -120,5 +180,4 @@ class AutoDescription_Search extends AutoDescription_Generate_Ldjson {
120
  // return an array of exclude post IDs
121
  return $post_ids;
122
  }
123
-
124
  }
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_Search
23
  *
28
  class AutoDescription_Search extends AutoDescription_Generate_Ldjson {
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, loads parent constructor and adds filters.
44
  */
45
  public function __construct() {
46
  parent::__construct();
47
 
48
+ /**
49
+ * @since 2.1.7
50
+ * @since 2.7.0 Changed priority from 999 to 9999.
51
+ * Now uses another method. Was: 'search_filter'.
52
+ */
53
+ add_action( 'pre_get_posts', array( $this, 'adjust_search_filter' ), 9999, 1 );
54
  }
55
 
56
  /**
57
+ * Excludes posts from search with certain metadata.
58
+ * For now, it only looks at 'exclude_local_search'. If it exists, the post or
59
+ * page will be excluded from the local Search Results.
60
  *
61
+ * @since 2.7.0
62
  *
63
+ * @param array $query The possible search query.
64
+ * @return void Early if no search query is found.
65
+ */
66
+ public function adjust_search_filter( $query ) {
67
+
68
+ // Don't exclude pages in wp-admin.
69
+ if ( $query->is_search && false === $this->is_admin() ) {
70
+
71
+ $q = $query->query;
72
+ //* Only interact with an actual Search Query.
73
+ if ( false === isset( $q['s'] ) )
74
+ return;
75
+
76
+ $meta_query = $query->get( 'meta_query' );
77
+
78
+ //* Convert to array. Unset it if it's empty.
79
+ if ( false === is_array( $meta_query ) )
80
+ $meta_query = $meta_query ? (array) $meta_query : array();
81
+
82
+ /**
83
+ * Exclude posts with exclude_local_search option on.
84
+ *
85
+ * Query is faster when the global relation is not set. Defaults to AND.
86
+ * Query is faster when secondary relation is set. Defaults to AND.
87
+ * Looks for CHAR value, while it's an integer/char in when unserialized.
88
+ */
89
+ $meta_query[] = array(
90
+ array(
91
+ 'key' => 'exclude_local_search',
92
+ 'value' => '1',
93
+ 'type' => 'CHAR',
94
+ 'compare' => 'NOT EXISTS',
95
+ 'relation' => 'AND',
96
+ ),
97
+ );
98
+
99
+ $query->set( 'meta_query', $meta_query );
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Fetches posts with exclude_local_search option on.
105
  *
106
  * @since 2.1.7
107
+ * @since 2.7.0 No longer used for performance reasons.
108
+ * @uses $this->exclude_search_ids()
109
  *
110
+ * @param array $query The possible search query.
111
+ * @return void Early if no search query is found.
112
  */
113
  public function search_filter( $query ) {
114
 
115
+ // Don't exclude pages in wp-admin.
116
  if ( $query->is_search && false === $this->is_admin() ) {
117
 
118
  $q = $query->query;
119
  //* Only interact with an actual Search Query.
120
+ if ( false === isset( $q['s'] ) )
121
  return;
122
 
123
+ //* Get excluded IDs.
124
+ $protected_posts = $this->get_excluded_search_ids();
 
 
125
  if ( $protected_posts ) {
126
  $get = $query->get( 'post__not_in' );
127
 
128
  //* Merge user defined query.
129
+ if ( is_array( $get ) && ! empty( $get ) )
130
  $protected_posts = array_merge( $protected_posts, $get );
131
 
132
  $query->set( 'post__not_in', $protected_posts );
134
 
135
  // Parse all ID's, even beyond the first page.
136
  $query->set( 'no_found_rows', false );
 
137
  }
 
138
  }
139
 
140
  /**
141
  * Fetches posts with exclude_local_search option on
142
  *
143
+ * @since 2.7.0
144
+ * @since 2.7.0 No longer used.
 
 
145
  * @global int $blog_id
146
  *
 
 
147
  * @return array Excluded Post IDs
148
  */
149
+ public function get_excluded_search_ids() {
150
  global $blog_id;
151
 
152
+ $cache_key = 'exclude_search_ids_' . $blog_id . '_' . get_locale();
153
 
154
  $post_ids = $this->object_cache_get( $cache_key );
155
  if ( false === $post_ids ) {
156
  $post_ids = array();
157
 
158
  $args = array(
159
+ 'post_type' => 'any',
160
+ 'numberposts' => -1,
161
+ 'posts_per_page' => -1,
162
+ 'order' => 'DESC',
163
+ 'post_status' => 'publish',
164
+ 'meta_key' => 'exclude_local_search',
165
+ 'meta_value' => 1,
166
+ 'meta_compare' => '=',
167
+ 'cache_results' => true,
168
+ 'suppress_filters' => false,
169
  );
170
+ $get_posts = new WP_Query;
171
+ $excluded_posts = $get_posts->query( $args );
172
+ unset( $get_posts );
173
 
174
+ if ( $excluded_posts )
175
+ $post_ids = wp_list_pluck( $excluded_posts, 'ID' );
 
176
 
177
  $this->object_cache_set( $cache_key, $post_ids, 86400 );
178
  }
180
  // return an array of exclude post IDs
181
  return $post_ids;
182
  }
 
183
  }
inc/classes/sitemaps.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_Search
21
  *
@@ -52,14 +54,26 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
52
  */
53
  protected $doing_sitemap = false;
54
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Constructor, load parent constructor and set up caches.
57
  */
58
  public function __construct() {
59
  parent::__construct();
60
 
61
- // I'm not going to initialize my own rewrite engine. Causes too many problems.
62
- $this->pretty_permalinks = ( '' !== $this->permalink_structure() ) ? true : false;
63
 
64
  /**
65
  * Add query strings to rewrite
@@ -99,21 +113,21 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
99
  * Don't do anything on a deleted or spam blog.
100
  * There's nothing to find anyway. Multisite Only.
101
  */
102
- return $cache = $this->pretty_permalinks && $this->is_option_checked( 'sitemaps_output' ) && false === $this->current_blog_is_spam_or_deleted() ? true : false;
103
  }
104
 
105
  /**
106
  * Adds rewrite rule to WordPress
107
  * This rule defines the sitemap.xml output
108
  *
109
- * @param bool $override add the rule anyway, regardless of setting.
110
- *
111
  * @since 2.2.9
 
 
112
  */
113
- public function rewrite_rule_sitemap( $run = false ) {
114
 
115
  //* Adding rewrite rules only has effect when permalink structures are active.
116
- if ( $this->can_run_sitemap() || $run ) {
117
 
118
  /**
119
  * Don't do anything if a sitemap plugin is active.
@@ -125,7 +139,6 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
125
 
126
  add_rewrite_rule( 'sitemap\.xml$', 'index.php?the_seo_framework_sitemap=xml', 'top' );
127
  }
128
-
129
  }
130
 
131
  /**
@@ -183,10 +196,9 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
183
  /**
184
  * Destroy unused $GLOBALS.
185
  *
186
- * @param bool $get_freed_memory Whether to return the freed memory in bytes.
187
- *
188
  * @since 2.6.0
189
  *
 
190
  * @return int $freed_memory
191
  */
192
  protected function clean_up_globals( $get_freed_memory = false ) {
@@ -220,9 +232,9 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
220
  foreach ( $remove as $key => $value ) {
221
  if ( is_array( $value ) ) {
222
  foreach ( $value as $v )
223
- unset( $GLOBALS[$key][$v] );
224
  } else {
225
- unset( $GLOBALS[$value] );
226
  }
227
  }
228
 
@@ -246,11 +258,8 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
246
  ob_clean();
247
  }
248
 
249
- //* Fetch sitemap content.
250
- $xml_content = $this->get_sitemap_content();
251
-
252
- //* Echo and add trailing line.
253
- echo $xml_content . "\r\n";
254
 
255
  // We're done now.
256
  die();
@@ -274,9 +283,9 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
274
  $sitemap_content = $this->get_transient( $this->sitemap_transient );
275
 
276
  if ( false === $sitemap_content ) {
277
- $cached_content = "\r\n<!-- " . __( 'Sitemap is generated for this view', 'autodescription' ) . " -->";
278
  } else {
279
- $cached_content = "\r\n<!-- " . __( 'Sitemap is served from cache', 'autodescription' ) . " -->";
280
  }
281
 
282
  $content = '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n";
@@ -291,10 +300,10 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
291
  * @since 2.3.7
292
  */
293
  if ( $this->the_seo_framework_debug ) {
294
- $content .= "\r\n<!-- Site estimated peak usage: " . ( memory_get_peak_usage() / 1024 / 1024 ) . " MB -->";
295
- $content .= "\r\n<!-- System estimated peak usage: " . ( memory_get_peak_usage( true ) / 1024 / 1024 ) . " MB -->";
296
- $content .= "\r\n<!-- Freed memory prior to generation: " . $this->clean_up_globals( true ) / 1024 . " kB -->";
297
- $content .= "\r\n<!-- Sitemap generation time: " . ( number_format( microtime( true ) - $timer_start, 6 ) ) . " seconds -->";
298
  }
299
 
300
  return $content;
@@ -394,7 +403,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
394
  $timestamp = (bool) apply_filters( 'the_seo_framework_sitemap_timestamp', true );
395
 
396
  if ( $timestamp )
397
- $content .= '<!-- ' . __( 'Sitemap is generated on', 'autodescription' ) . ' ' . current_time( "Y-m-d H:i:s" ) . ' -->' . "\r\n";
398
 
399
  if ( $totalpages ) {
400
  //* Ascend by the date for normal pages. Older pages get to the top of the list.
@@ -406,8 +415,11 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
406
  'order' => 'ASC',
407
  'post_status' => 'publish',
408
  'cache_results' => false,
 
409
  );
410
- $latest_pages = get_posts( $args );
 
 
411
  }
412
  $latest_pages_amount = (int) count( $latest_pages );
413
 
@@ -422,35 +434,36 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
422
  if ( isset( $page->ID ) ) {
423
  $page_id = $page->ID;
424
 
425
- if ( '' === $excluded || ! isset( $excluded[$post_id] ) ) {
426
- //* Is this the front page?
427
- $page_is_front = ( $page_id === $id_on_front ) ? true : false;
428
 
429
  //* Fetch the noindex option, per page.
430
- $noindex = (bool) $this->get_custom_field( '_genesis_noindex', $page_id );
431
 
432
  //* Continue if indexed.
433
- if ( false === $noindex ) {
434
- $content .= " <url>\r\n";
 
 
 
435
  if ( $page_is_front ) {
436
- $content .= ' <loc>' . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'home' => true ) ) . "</loc>\r\n";
437
  } else {
438
- $content .= ' <loc>' . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'post' => $page, 'id' => $page_id ) ) . "</loc>\r\n";
439
  }
440
 
441
  // Keep it consistent. Only parse if page_lastmod is true.
442
  if ( $page_lastmod || ( $page_is_front && $home_lastmod ) ) {
443
  $page_modified_gmt = $page->post_modified_gmt;
444
 
445
- if ( $page_modified_gmt !== '0000-00-00 00:00:00' )
446
- $content .= ' <lastmod>' . mysql2date( $timestamp_format, $page_modified_gmt, false ) . "</lastmod>\r\n";
447
  }
448
 
449
  // Give higher priority to the home page.
450
  $priority_page = $page_is_front ? 1 : 0.9;
451
 
452
- $content .= ' <priority>' . number_format( $priority_page, 1 ) . "</priority>\r\n";
453
- $content .= " </url>\r\n";
454
  }
455
  }
456
  }
@@ -470,8 +483,11 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
470
  'order' => 'DESC',
471
  'post_status' => 'publish',
472
  'cache_results' => false,
 
473
  );
474
- $latest_posts = get_posts( $args );
 
 
475
  }
476
  $latest_posts_amount = (int) count( $latest_posts );
477
 
@@ -508,28 +524,28 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
508
  if ( isset( $post->ID ) ) {
509
  $post_id = $post->ID;
510
 
511
- if ( '' === $excluded || ! isset( $excluded[$post_id] ) ) {
512
 
513
  //* Fetch the noindex option, per page.
514
- $noindex = (bool) $this->get_custom_field( '_genesis_noindex', $post_id );
515
 
516
  //* Continue if indexed
517
- if ( ! $noindex ) {
518
 
519
- $content .= " <url>\r\n";
520
  // No need to use static vars
521
- $content .= ' <loc>' . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'post' => $post, 'id' => $post_id ) ) . "</loc>\r\n";
522
 
523
  // Keep it consistent. Only parse if page_lastmod is true.
524
  if ( $post_lastmod ) {
525
  $post_modified_gmt = $post->post_modified_gmt;
526
 
527
- if ( $post_modified_gmt !== '0000-00-00 00:00:00' )
528
- $content .= ' <lastmod>' . mysql2date( $timestamp_format, $post_modified_gmt, false ) . "</lastmod>\r\n";
529
  }
530
 
531
- $content .= ' <priority>' . number_format( $priority, 1 ) . "</priority>\r\n";
532
- $content .= " </url>\r\n";
533
 
534
  // Lower the priority for the next pass.
535
  $priority = $priority - $prioritydiff;
@@ -557,8 +573,8 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
557
  $not_cpt = array( 'post', 'page', 'attachment' );
558
 
559
  foreach ( $post_page as $post_type ) {
560
- if ( false === in_array( $post_type, $not_cpt ) ) {
561
- if ( empty( $excluded_cpt ) || false === in_array( $post_type, $excluded_cpt ) ) {
562
  if ( $this->post_type_supports_custom_seo( $post_type ) ) {
563
  $cpt[] = $post_type;
564
  }
@@ -576,8 +592,11 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
576
  'order' => 'DESC',
577
  'post_status' => 'publish',
578
  'cache_results' => false,
 
579
  );
580
- $latest_cpt_posts = get_posts( $args );
 
 
581
  }
582
  }
583
  $latest_cpt_posts_amount = (int) count( $latest_cpt_posts );
@@ -606,31 +625,31 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
606
  */
607
  foreach ( $latest_cpt_posts as $ctp_post ) {
608
  if ( isset( $ctp_post->ID ) ) {
609
- $post_id = $ctp_post->ID;
610
 
611
- if ( '' === $excluded || ! isset( $excluded[$post_id] ) ) {
612
 
613
  //* Fetch the noindex option, per page.
614
- $noindex = (bool) $this->get_custom_field( '_genesis_noindex', $post_id );
615
 
616
  //* Continue if indexed
617
- if ( ! $noindex ) {
618
 
619
- $content .= " <url>\r\n";
620
  //* No need to use static vars
621
- $content .= ' <loc>' . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'post' => $ctp_post, 'id' => $post_id ) ) . "</loc>\r\n";
622
 
623
  //* Keep it consistent. Only parse if page_lastmod is true.
624
  if ( $post_lastmod ) {
625
- $post_modified_gmt = $ctp_post->post_modified_gmt;
626
 
627
  //* Some CPT don't set modified time.
628
- if ( $post_modified_gmt !== '0000-00-00 00:00:00' )
629
- $content .= ' <lastmod>' . mysql2date( $timestamp_format, $post_modified_gmt, false ) . "</lastmod>\r\n";
630
  }
631
 
632
- $content .= ' <priority>' . number_format( $priority_cpt, 1 ) . "</priority>\r\n";
633
- $content .= " </url>\r\n";
634
 
635
  // Lower the priority for the next pass.
636
  $priority_cpt = $priority_cpt - $prioritydiff_cpt;
@@ -659,6 +678,10 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
659
  $custom_urls = (array) apply_filters( 'the_seo_framework_sitemap_additional_urls', array() );
660
 
661
  if ( $custom_urls ) {
 
 
 
 
662
  foreach ( $custom_urls as $url => $args ) {
663
 
664
  if ( ! is_array( $args ) ) {
@@ -666,12 +689,12 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
666
  $url = $args;
667
  }
668
 
669
- $content .= " <url>\r\n";
670
  //* No need to use static vars
671
- $content .= ' <loc>' . esc_url_raw( $url ) . "</loc>\r\n";
672
 
673
  if ( isset( $args['lastmod'] ) && $args['lastmod'] ) {
674
- $content .= ' <lastmod>' . mysql2date( $timestamp_format, $args['lastmod'], false ) . "</lastmod>\r\n";
675
  }
676
 
677
  if ( isset( $args['priority'] ) && $args['priority'] ) {
@@ -680,8 +703,8 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
680
  $priority = 0.9;
681
  }
682
 
683
- $content .= ' <priority>' . number_format( $priority, 1 ) . "</priority>\r\n";
684
- $content .= " </url>\r\n";
685
  }
686
  }
687
 
@@ -709,7 +732,6 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
709
 
710
  /**
711
  * Don't ping if the blog isn't public.
712
- *
713
  * @since 2.3.1
714
  */
715
  if ( false === $this->is_option_checked( 'site_noindex' ) && $this->is_blog_public() ) {
@@ -732,7 +754,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
732
  if ( $this->is_option_checked( 'ping_yandex' ) )
733
  $this->ping_yandex();
734
 
735
- // Sorry I couldn't help myself.
736
  $throttle = 'Bert and Ernie are weird.';
737
 
738
  /**
@@ -759,7 +781,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
759
  public function ping_google() {
760
 
761
  $pingurl = 'http://www.google.com/webmasters/sitemaps/ping?sitemap=' . urlencode( $this->the_home_url_from_cache( true ) . 'sitemap.xml' );
762
- wp_remote_get( $pingurl, array( 'timeout' => 3 ) );
763
 
764
  }
765
 
@@ -771,7 +793,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
771
  public function ping_bing() {
772
 
773
  $pingurl = 'http://www.bing.com/webmaster/ping.aspx?siteMap=' . urlencode( $this->the_home_url_from_cache( true ) . 'sitemap.xml' );
774
- wp_remote_get( $pingurl, array( 'timeout' => 3 ) );
775
 
776
  }
777
 
@@ -783,7 +805,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
783
  public function ping_yandex() {
784
 
785
  $pingurl = 'http://blogs.yandex.ru/pings/?status=success&url=' . urlencode( $this->the_home_url_from_cache( true ) . 'sitemap.xml' );
786
- wp_remote_get( $pingurl, array( 'timeout' => 3 ) );
787
 
788
  }
789
 
@@ -827,7 +849,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
827
  $pre = (string) apply_filters( 'the_seo_framework_robots_txt_pre', '' );
828
  $pro = (string) apply_filters( 'the_seo_framework_robots_txt_pro', '' );
829
 
830
- $site_url = parse_url( site_url() );
831
  $path = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : '';
832
 
833
  $output .= $pre;
@@ -844,7 +866,7 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
844
  * @since 2.5.0
845
  */
846
  if ( apply_filters( 'the_seo_framework_robots_disallow_queries', false ) ) {
847
- $home_url = parse_url( rtrim( $this->the_home_url_from_cache(), ' /\\' ) );
848
  $home_path = ( ! empty( $home_url['path'] ) ) ? $home_url['path'] : '';
849
  $output .= "Disallow: $home_path/*?*\r\n";
850
  }
@@ -977,4 +999,37 @@ class AutoDescription_Sitemaps extends AutoDescription_Metaboxes {
977
 
978
  }
979
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980
  }
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_Search
23
  *
54
  */
55
  protected $doing_sitemap = false;
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, load parent constructor and set up caches.
71
  */
72
  public function __construct() {
73
  parent::__construct();
74
 
75
+ //* Whether we're using pretty permalinks.
76
+ $this->pretty_permalinks = '' !== $this->permalink_structure();
77
 
78
  /**
79
  * Add query strings to rewrite
113
  * Don't do anything on a deleted or spam blog.
114
  * There's nothing to find anyway. Multisite Only.
115
  */
116
+ return $cache = $this->pretty_permalinks && $this->is_option_checked( 'sitemaps_output' ) && false === $this->current_blog_is_spam_or_deleted();
117
  }
118
 
119
  /**
120
  * Adds rewrite rule to WordPress
121
  * This rule defines the sitemap.xml output
122
  *
 
 
123
  * @since 2.2.9
124
+ *
125
+ * @param bool $force add the rule anyway, regardless of detected environment.
126
  */
127
+ public function rewrite_rule_sitemap( $force = false ) {
128
 
129
  //* Adding rewrite rules only has effect when permalink structures are active.
130
+ if ( $this->can_run_sitemap() || $force ) {
131
 
132
  /**
133
  * Don't do anything if a sitemap plugin is active.
139
 
140
  add_rewrite_rule( 'sitemap\.xml$', 'index.php?the_seo_framework_sitemap=xml', 'top' );
141
  }
 
142
  }
143
 
144
  /**
196
  /**
197
  * Destroy unused $GLOBALS.
198
  *
 
 
199
  * @since 2.6.0
200
  *
201
+ * @param bool $get_freed_memory Whether to return the freed memory in bytes.
202
  * @return int $freed_memory
203
  */
204
  protected function clean_up_globals( $get_freed_memory = false ) {
232
  foreach ( $remove as $key => $value ) {
233
  if ( is_array( $value ) ) {
234
  foreach ( $value as $v )
235
+ unset( $GLOBALS[ $key ][ $v ] );
236
  } else {
237
+ unset( $GLOBALS[ $value ] );
238
  }
239
  }
240
 
258
  ob_clean();
259
  }
260
 
261
+ //* Fetch sitemap content and add trailing line. Already escaped internally.
262
+ echo $this->get_sitemap_content() . "\r\n";
 
 
 
263
 
264
  // We're done now.
265
  die();
283
  $sitemap_content = $this->get_transient( $this->sitemap_transient );
284
 
285
  if ( false === $sitemap_content ) {
286
+ $cached_content = "\r\n<!-- " . __( 'Sitemap is generated for this view', 'autodescription' ) . ' -->';
287
  } else {
288
+ $cached_content = "\r\n<!-- " . __( 'Sitemap is served from cache', 'autodescription' ) . ' -->';
289
  }
290
 
291
  $content = '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n";
300
  * @since 2.3.7
301
  */
302
  if ( $this->the_seo_framework_debug ) {
303
+ $content .= "\r\n<!-- Site estimated peak usage: " . ( memory_get_peak_usage() / 1024 / 1024 ) . ' MB -->';
304
+ $content .= "\r\n<!-- System estimated peak usage: " . ( memory_get_peak_usage( true ) / 1024 / 1024 ) . ' MB -->';
305
+ $content .= "\r\n<!-- Freed memory prior to generation: " . $this->clean_up_globals( true ) / 1024 . ' kB -->';
306
+ $content .= "\r\n<!-- Sitemap generation time: " . ( number_format( microtime( true ) - $timer_start, 6 ) ) . ' seconds -->';
307
  }
308
 
309
  return $content;
403
  $timestamp = (bool) apply_filters( 'the_seo_framework_sitemap_timestamp', true );
404
 
405
  if ( $timestamp )
406
+ $content .= '<!-- ' . __( 'Sitemap is generated on', 'autodescription' ) . ' ' . current_time( 'Y-m-d H:i:s' ) . ' -->' . "\r\n";
407
 
408
  if ( $totalpages ) {
409
  //* Ascend by the date for normal pages. Older pages get to the top of the list.
415
  'order' => 'ASC',
416
  'post_status' => 'publish',
417
  'cache_results' => false,
418
+ 'suppress_filters' => true,
419
  );
420
+ $get_posts = new WP_Query;
421
+ $latest_pages = $get_posts->query( $args );
422
+ unset( $get_posts );
423
  }
424
  $latest_pages_amount = (int) count( $latest_pages );
425
 
434
  if ( isset( $page->ID ) ) {
435
  $page_id = $page->ID;
436
 
437
+ if ( '' === $excluded || ! isset( $excluded[ $page_id ] ) ) {
 
 
438
 
439
  //* Fetch the noindex option, per page.
440
+ $indexed = ! $this->get_custom_field( '_genesis_noindex', $page_id );
441
 
442
  //* Continue if indexed.
443
+ if ( $indexed ) {
444
+ //* Is this the front page?
445
+ $page_is_front = $page_id === $id_on_front;
446
+
447
+ $content .= "\t<url>\r\n";
448
  if ( $page_is_front ) {
449
+ $content .= "\t\t<loc>" . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'home' => true ) ) . "</loc>\r\n";
450
  } else {
451
+ $content .= "\t\t<loc>" . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'post' => $page, 'id' => $page_id ) ) . "</loc>\r\n";
452
  }
453
 
454
  // Keep it consistent. Only parse if page_lastmod is true.
455
  if ( $page_lastmod || ( $page_is_front && $home_lastmod ) ) {
456
  $page_modified_gmt = $page->post_modified_gmt;
457
 
458
+ if ( '0000-00-00 00:00:00' !== $page_modified_gmt )
459
+ $content .= "\t\t<lastmod>" . $this->gmt2date( $timestamp_format, $page_modified_gmt ) . "</lastmod>\r\n";
460
  }
461
 
462
  // Give higher priority to the home page.
463
  $priority_page = $page_is_front ? 1 : 0.9;
464
 
465
+ $content .= "\t\t<priority>" . number_format( $priority_page, 1 ) . "</priority>\r\n";
466
+ $content .= "\t</url>\r\n";
467
  }
468
  }
469
  }
483
  'order' => 'DESC',
484
  'post_status' => 'publish',
485
  'cache_results' => false,
486
+ 'suppress_filters' => true,
487
  );
488
+ $get_posts = new WP_Query;
489
+ $latest_posts = $get_posts->query( $args );
490
+ unset( $get_posts );
491
  }
492
  $latest_posts_amount = (int) count( $latest_posts );
493
 
524
  if ( isset( $post->ID ) ) {
525
  $post_id = $post->ID;
526
 
527
+ if ( '' === $excluded || ! isset( $excluded[ $post_id ] ) ) {
528
 
529
  //* Fetch the noindex option, per page.
530
+ $indexed = ! $this->get_custom_field( '_genesis_noindex', $post_id );
531
 
532
  //* Continue if indexed
533
+ if ( $indexed ) {
534
 
535
+ $content .= "\t<url>\r\n";
536
  // No need to use static vars
537
+ $content .= "\t\t<loc>" . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'post' => $post, 'id' => $post_id ) ) . "</loc>\r\n";
538
 
539
  // Keep it consistent. Only parse if page_lastmod is true.
540
  if ( $post_lastmod ) {
541
  $post_modified_gmt = $post->post_modified_gmt;
542
 
543
+ if ( '0000-00-00 00:00:00' !== $post_modified_gmt )
544
+ $content .= "\t\t<lastmod>" . $this->gmt2date( $timestamp_format, $post_modified_gmt ) . "</lastmod>\r\n";
545
  }
546
 
547
+ $content .= "\t\t<priority>" . number_format( $priority, 1 ) . "</priority>\r\n";
548
+ $content .= "\t</url>\r\n";
549
 
550
  // Lower the priority for the next pass.
551
  $priority = $priority - $prioritydiff;
573
  $not_cpt = array( 'post', 'page', 'attachment' );
574
 
575
  foreach ( $post_page as $post_type ) {
576
+ if ( false === in_array( $post_type, $not_cpt, true ) ) {
577
+ if ( empty( $excluded_cpt ) || false === in_array( $post_type, $excluded_cpt, true ) ) {
578
  if ( $this->post_type_supports_custom_seo( $post_type ) ) {
579
  $cpt[] = $post_type;
580
  }
592
  'order' => 'DESC',
593
  'post_status' => 'publish',
594
  'cache_results' => false,
595
+ 'suppress_filters' => true,
596
  );
597
+ $get_posts = new WP_Query;
598
+ $latest_cpt_posts = $get_posts->query( $args );
599
+ unset( $get_posts );
600
  }
601
  }
602
  $latest_cpt_posts_amount = (int) count( $latest_cpt_posts );
625
  */
626
  foreach ( $latest_cpt_posts as $ctp_post ) {
627
  if ( isset( $ctp_post->ID ) ) {
628
+ $cpt_id = $ctp_post->ID;
629
 
630
+ if ( '' === $excluded || ! isset( $excluded[ $cpt_id ] ) ) {
631
 
632
  //* Fetch the noindex option, per page.
633
+ $indexed = ! $this->get_custom_field( '_genesis_noindex', $cpt_id );
634
 
635
  //* Continue if indexed
636
+ if ( $indexed ) {
637
 
638
+ $content .= "\t<url>\r\n";
639
  //* No need to use static vars
640
+ $content .= "\t\t<loc>" . $this->the_url( '', array( 'get_custom_field' => false, 'external' => true, 'post' => $ctp_post, 'id' => $cpt_id ) ) . "</loc>\r\n";
641
 
642
  //* Keep it consistent. Only parse if page_lastmod is true.
643
  if ( $post_lastmod ) {
644
+ $cpt_modified_gmt = $ctp_post->post_modified_gmt;
645
 
646
  //* Some CPT don't set modified time.
647
+ if ( '0000-00-00 00:00:00' !== $cpt_modified_gmt )
648
+ $content .= "\t\t<lastmod>" . $this->gmt2date( $timestamp_format, $cpt_modified_gmt ) . "</lastmod>\r\n";
649
  }
650
 
651
+ $content .= "\t\t<priority>" . number_format( $priority_cpt, 1 ) . "</priority>\r\n";
652
+ $content .= "\t</url>\r\n";
653
 
654
  // Lower the priority for the next pass.
655
  $priority_cpt = $priority_cpt - $prioritydiff_cpt;
678
  $custom_urls = (array) apply_filters( 'the_seo_framework_sitemap_additional_urls', array() );
679
 
680
  if ( $custom_urls ) {
681
+
682
+ //* Force ent2ncr to run, regardless of filters.
683
+ remove_all_filters( 'pre_ent2ncr', false );
684
+
685
  foreach ( $custom_urls as $url => $args ) {
686
 
687
  if ( ! is_array( $args ) ) {
689
  $url = $args;
690
  }
691
 
692
+ $content .= "\t<url>\r\n";
693
  //* No need to use static vars
694
+ $content .= "\t\t<loc>" . ent2ncr( esc_url_raw( $url ) ) . "</loc>\r\n";
695
 
696
  if ( isset( $args['lastmod'] ) && $args['lastmod'] ) {
697
+ $content .= "\t\t<lastmod>" . mysql2date( $timestamp_format, $args['lastmod'], false ) . "</lastmod>\r\n";
698
  }
699
 
700
  if ( isset( $args['priority'] ) && $args['priority'] ) {
703
  $priority = 0.9;
704
  }
705
 
706
+ $content .= "\t\t<priority>" . number_format( $priority, 1 ) . "</priority>\r\n";
707
+ $content .= "\t</url>\r\n";
708
  }
709
  }
710
 
732
 
733
  /**
734
  * Don't ping if the blog isn't public.
 
735
  * @since 2.3.1
736
  */
737
  if ( false === $this->is_option_checked( 'site_noindex' ) && $this->is_blog_public() ) {
754
  if ( $this->is_option_checked( 'ping_yandex' ) )
755
  $this->ping_yandex();
756
 
757
+ // Sorry, I couldn't help myself.
758
  $throttle = 'Bert and Ernie are weird.';
759
 
760
  /**
781
  public function ping_google() {
782
 
783
  $pingurl = 'http://www.google.com/webmasters/sitemaps/ping?sitemap=' . urlencode( $this->the_home_url_from_cache( true ) . 'sitemap.xml' );
784
+ wp_safe_remote_get( $pingurl, array( 'timeout' => 3 ) );
785
 
786
  }
787
 
793
  public function ping_bing() {
794
 
795
  $pingurl = 'http://www.bing.com/webmaster/ping.aspx?siteMap=' . urlencode( $this->the_home_url_from_cache( true ) . 'sitemap.xml' );
796
+ wp_safe_remote_get( $pingurl, array( 'timeout' => 3 ) );
797
 
798
  }
799
 
805
  public function ping_yandex() {
806
 
807
  $pingurl = 'http://blogs.yandex.ru/pings/?status=success&url=' . urlencode( $this->the_home_url_from_cache( true ) . 'sitemap.xml' );
808
+ wp_safe_remote_get( $pingurl, array( 'timeout' => 3 ) );
809
 
810
  }
811
 
849
  $pre = (string) apply_filters( 'the_seo_framework_robots_txt_pre', '' );
850
  $pro = (string) apply_filters( 'the_seo_framework_robots_txt_pro', '' );
851
 
852
+ $site_url = wp_parse_url( site_url() );
853
  $path = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : '';
854
 
855
  $output .= $pre;
866
  * @since 2.5.0
867
  */
868
  if ( apply_filters( 'the_seo_framework_robots_disallow_queries', false ) ) {
869
+ $home_url = wp_parse_url( rtrim( $this->the_home_url_from_cache(), ' /\\' ) );
870
  $home_path = ( ! empty( $home_url['path'] ) ) ? $home_url['path'] : '';
871
  $output .= "Disallow: $home_path/*?*\r\n";
872
  }
999
 
1000
  }
1001
 
1002
+ /**
1003
+ * Add and Flush rewrite rules on plugin settings change.
1004
+ *
1005
+ * @since 2.6.6.1
1006
+ * @access private
1007
+ */
1008
+ public function flush_rewrite_rules_activation() {
1009
+ global $wp_rewrite;
1010
+
1011
+ //* This function is called statically.
1012
+ $this->rewrite_rule_sitemap( true );
1013
+
1014
+ $wp_rewrite->init();
1015
+ $wp_rewrite->flush_rules( true );
1016
+
1017
+ }
1018
+
1019
+ /**
1020
+ * Flush rewrite rules on settings change.
1021
+ *
1022
+ * @since 2.6.6.1
1023
+ * @access private
1024
+ */
1025
+ public function flush_rewrite_rules_deactivation() {
1026
+ global $wp_rewrite;
1027
+
1028
+ $wp_rewrite->init();
1029
+
1030
+ unset( $wp_rewrite->extra_rules_top['sitemap\.xml$'] );
1031
+
1032
+ $wp_rewrite->flush_rules( true );
1033
+
1034
+ }
1035
  }
inc/classes/siteoptions.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
  *
@@ -35,13 +37,14 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
35
  protected $settings_field;
36
 
37
  /**
38
- * Hold the Page ID for this plugin.
39
  *
40
  * @since 2.2.2
 
41
  *
42
  * @var string The page ID
43
  */
44
- protected $page_id;
45
 
46
  /**
47
  * Holds the update option.
@@ -52,6 +55,18 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
52
  */
53
  protected $o_plugin_updated;
54
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Constructor, load parent constructor and set up cachable variables.
57
  */
@@ -59,14 +74,14 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
59
  parent::__construct();
60
 
61
  $this->settings_field = THE_SEO_FRAMEWORK_SITE_OPTIONS;
62
- $this->o_plugin_updated = 'updated_' . str_replace( '.', '', THE_SEO_FRAMEWORK_VERSION );
63
- $this->page_id = 'autodescription-settings';
64
 
65
  //* Set up site settings and save/reset them
66
  add_action( 'admin_init', array( $this, 'register_settings' ), 5 );
67
 
68
  //* Update site options at plugin update.
69
- add_action( 'admin_init', array( $this, 'site_updated_plugin_option' ), 10 );
70
 
71
  }
72
 
@@ -207,7 +222,7 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
207
  'knowledge_logo' => 1, // Fetch logo from WP Favicon
208
  'knowledge_name' => '', // Person or Organization name
209
 
210
- // 'Sameas'
211
  'knowledge_facebook' => '', // Facebook Account
212
  'knowledge_twitter' => '', // Twitter Account
213
  'knowledge_gplus' => '', // Google Plus Account
@@ -237,9 +252,6 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
237
  'ld_json_sitename' => 1, // LD+Json Sitename
238
  'ld_json_breadcrumbs' => 1, // LD+Json Breadcrumbs
239
 
240
- // Misc.
241
- 'counter_type' => 3, // JS counter type.
242
-
243
  // Cache.
244
  $this->o_plugin_updated => 1, // Plugin update cache.
245
  );
@@ -352,9 +364,12 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
352
  */
353
  protected function update_hidden_options_to_default() {
354
 
 
 
 
355
  //* Disables the New SEO Settings Updated notification.
356
  $plugin_updated = $this->o_plugin_updated;
357
- $_POST[THE_SEO_FRAMEWORK_SITE_OPTIONS][$plugin_updated] = 1;
358
 
359
  }
360
 
@@ -399,23 +414,23 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
399
  * Stop this madness from happening again until next update.
400
  * Also prevent $updated to become true on this call.
401
  */
402
- $new_options[$plugin_updated] = 1;
403
- $options[$plugin_updated] = 1;
404
 
405
  //* Merge the options. Add to if it's non-existent.
406
  foreach ( $new_options as $key => $value ) {
407
- if ( ! isset( $options[$key] ) ) {
408
- if ( ! empty( $new_options[$key] ) ) {
409
- $options[$key] = $new_options[$key];
 
410
  $updated = true;
411
- }
412
  }
413
  }
414
 
415
  //* Updated the options. Check for updated flag and see if settings pages are loaded.
416
- if ( update_option( $this->settings_field, $options ) && $updated && $this->load_options ) {
417
  $this->pre_output_site_updated_plugin_notice();
418
- }
419
  }
420
 
421
  /**
@@ -426,10 +441,10 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
426
  */
427
  protected function pre_output_site_updated_plugin_notice() {
428
 
429
- if ( $this->is_seo_settings_page() ) {
430
  //* Redirect to current page if on options page to correct option values. Once.
431
  if ( ! isset( $_REQUEST['seo-updated'] ) || 'true' !== $_REQUEST['seo-updated'] )
432
- $this->admin_redirect( $this->page_id, array( 'seo-updated' => 'true' ) );
433
 
434
  //* Notice has already been sent.
435
  return;
@@ -444,7 +459,7 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
444
  }
445
 
446
  /**
447
- * Echo plugin updated notification.
448
  *
449
  * @since 2.6.0
450
  *
@@ -452,16 +467,14 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
452
  */
453
  public function site_updated_plugin_notice() {
454
 
455
- $notice = $this->page_defaults['plugin_update_text'];
456
-
457
  $settings_url = $this->seo_settings_page_url();
458
- $link = sprintf( '<a href="%s" title="%s" target="_self">%s</a>', $settings_url, __( 'SEO Settings', 'autodescription' ), __( 'here', 'autodescription' ) );
459
-
460
- $go_to_page = sprintf( _x( 'View the new options %s.', '%s = here', 'autodescription' ), $link );
461
 
462
- $notice = $notice . ' ' . $go_to_page;
463
 
464
- echo $this->generate_dismissible_notice( $notice, 'updated' );
 
465
 
466
  }
467
 
@@ -475,7 +488,6 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
475
  *
476
  * @param string $key Option name.
477
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
478
- *
479
  * @return mixed The value of this $key in the database.
480
  */
481
  public function get_option( $key, $use_cache = true ) {
@@ -485,46 +497,44 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
485
  /**
486
  * Return current option array.
487
  *
488
- * Applies filters 'the_seo_framework_get_options' : boolean
489
- *
490
  * @since 2.6.0
491
  * @staticvar array $cache The option cache.
492
  *
 
493
  * @return array Options.
494
  */
495
  public function get_all_options( $setting = null ) {
496
 
497
  static $cache = array();
498
 
499
- if ( isset( $cache[$setting] ) )
500
- return $cache[$setting];
501
 
502
  if ( is_null( $setting ) )
503
  $setting = THE_SEO_FRAMEWORK_SITE_OPTIONS;
504
 
505
- return $cache[$setting] = apply_filters( 'the_seo_framework_get_options', get_option( $setting ), $setting );
 
 
 
 
506
  }
507
 
508
  /**
509
  * Return option from the options table and cache result.
510
  *
511
- * Applies `the_seo_framework_get_options` filters.
512
- * This filter retrieves the (previous) values from Genesis if exists.
513
- *
514
  * Values pulled from the database are cached on each request, so a second request for the same value won't cause a
515
  * second DB interaction.
516
- * @staticvar array $settings_cache
517
- * @staticvar array $options_cache
518
  *
519
  * @since 2.0.0
 
 
 
520
  *
521
  * @param string $key Option name.
522
  * @param string $setting Optional. Settings field name. Eventually defaults to null if not passed as an argument.
523
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Default is true.
524
- *
525
  * @return mixed The value of this $key in the database.
526
- *
527
- * @thanks StudioPress (http://www.studiopress.com/) for some code.
528
  */
529
  public function the_seo_framework_get_option( $key, $setting = null, $use_cache = true ) {
530
 
@@ -535,42 +545,40 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
535
  if ( ! is_array( $options ) || ! array_key_exists( $key, $options ) )
536
  return '';
537
 
538
- return is_array( $options[$key] ) ? stripslashes_deep( $options[$key] ) : stripslashes( wp_kses_decode_entities( $options[$key] ) );
539
  }
540
 
541
  //* Setup caches
542
  static $options_cache = array();
543
 
544
  //* Check options cache
545
- if ( isset( $options_cache[$setting][$key] ) )
546
  //* Option has been cached
547
- return $options_cache[$setting][$key];
548
 
549
  $options = $this->get_all_options( $setting );
550
 
551
  //* Check for non-existent option
552
  if ( ! is_array( $options ) || ! array_key_exists( $key, (array) $options ) ) {
553
  //* Cache non-existent option
554
- $options_cache[$setting][$key] = '';
555
  } else {
556
  //* Option has not been previously been cached, so cache now
557
- $options_cache[$setting][$key] = is_array( $options[$key] ) ? stripslashes_deep( $options[$key] ) : stripslashes( wp_kses_decode_entities( $options[$key] ) );
558
  }
559
 
560
- return $options_cache[$setting][$key];
561
  }
562
 
563
  /**
564
  * Return SEO options from the SEO options database.
565
  *
566
  * @since 2.2.2
567
- *
568
  * @uses $this->the_seo_framework_get_option() Return option from the options table and cache result.
569
  * @uses THE_SEO_FRAMEWORK_NETWORK_OPTIONS
570
  *
571
  * @param string $key Option name.
572
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
573
- *
574
  * @return mixed The value of this $key in the database.
575
  */
576
  public function get_site_option( $key, $use_cache = true ) {
@@ -581,13 +589,11 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
581
  * Return Default SEO options from the SEO options array.
582
  *
583
  * @since 2.2.5
584
- *
585
  * @uses $this->get_default_settings() Return option from the options table and cache result.
586
  * @uses THE_SEO_FRAMEWORK_SITE_OPTIONS
587
  *
588
  * @param string $key Option name.
589
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
590
- *
591
  * @return mixed The value of this $key in the database.
592
  */
593
  public function get_default_option( $key, $use_cache = true ) {
@@ -622,11 +628,9 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
622
  * Return the Warned site options. Options which should be 'avoided' return true.
623
  *
624
  * @since 2.3.4
625
- *
626
- * Applies filters the_seo_framework_warned_site_options The warned site options array.
627
  *
628
  * @param array $args Additional warned options to filter.
629
- *
630
  * @return array The SEO Framework Warned Options
631
  */
632
  protected function warned_site_options( $args = array() ) {
@@ -646,10 +650,9 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
646
  * Register the database settings for storage.
647
  *
648
  * @since 2.2.2
 
649
  *
650
  * @return void
651
- *
652
- * @thanks StudioPress (http://www.studiopress.com/) for some code.
653
  */
654
  public function register_settings() {
655
 
@@ -661,35 +664,53 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
661
  add_option( $this->settings_field, $this->default_site_options() );
662
 
663
  //* If this page isn't the SEO Settings page, there's no need to check for a reset.
664
- if ( false === $this->is_seo_settings_page() )
665
  return;
666
 
667
  if ( $this->get_option( 'reset', $this->settings_field ) ) {
668
- if ( update_option( $this->settings_field, $this->default_site_options() ) )
669
- $this->admin_redirect( $this->page_id, array( 'reset' => 'true' ) );
670
- else
671
- $this->admin_redirect( $this->page_id, array( 'error' => 'true' ) );
672
- exit;
 
 
673
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
 
 
 
 
 
675
  }
676
 
677
  /**
678
  * Get the default of any of the The SEO Framework settings.
679
  *
680
  * @since 2.2.4
681
- *
682
  * @uses $this->settings_field
683
  * @uses $this->default_site_options()
684
  *
685
  * @param string $key required The option name
686
  * @param string $setting optional The settings field
687
  * @param bool $use_cache optional Use the options cache or not. For debugging purposes.
688
- *
689
- * @staticvar array $defaults_cache
690
- *
691
- * @return int|bool|string default option
692
- * int '-1' if option doesn't exist.
693
  */
694
  public function get_default_settings( $key, $setting = '', $use_cache = true ) {
695
 
@@ -707,40 +728,37 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
707
  if ( ! is_array( $defaults ) || ! array_key_exists( $key, $defaults ) )
708
  return -1;
709
 
710
- return is_array( $defaults[$key] ) ? stripslashes_deep( $defaults[$key] ) : stripslashes( wp_kses_decode_entities( $defaults[$key] ) );
711
  }
712
 
713
  static $defaults_cache = array();
714
 
715
  //* Check options cache
716
- if ( isset( $defaults_cache[$key] ) )
717
  //* Option has been cached
718
- return $defaults_cache[$key];
719
 
720
  $defaults_cache = $this->default_site_options();
721
 
722
  if ( ! is_array( $defaults_cache ) || ! array_key_exists( $key, (array) $defaults_cache ) )
723
- $defaults_cache[$key] = -1;
724
 
725
- return $defaults_cache[$key];
726
  }
727
 
728
  /**
729
  * Get the warned setting of any of the The SEO Framework settings.
730
  *
731
  * @since 2.3.4
732
- *
733
  * @uses $this->settings_field
734
  * @uses $this->warned_site_options()
735
  *
736
  * @param string $key required The option name
737
  * @param string $setting optional The settings field
738
  * @param bool $use_cache optional Use the options cache or not. For debugging purposes.
739
- *
740
- * @staticvar array $warned_cache
741
- *
742
- * @return int 0|1 Whether the option is flagged as dangerous for SEO.
743
- * int '-1' if option doesn't exist.
744
  */
745
  public function get_warned_settings( $key, $setting = '', $use_cache = true ) {
746
 
@@ -758,32 +776,137 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
758
  if ( ! is_array( $warned ) || ! array_key_exists( $key, $warned ) )
759
  return -1;
760
 
761
- return $this->s_one_zero( $warned[$key] );
762
  }
763
 
764
  static $warned_cache = array();
765
 
766
  //* Check options cache
767
- if ( isset( $warned_cache[$key] ) )
768
  //* Option has been cached
769
- return $warned_cache[$key];
770
 
771
  $warned_options = $this->warned_site_options();
772
 
773
  if ( ! is_array( $warned_options ) || ! array_key_exists( $key, (array) $warned_options ) )
774
- $warned_cache[$key] = -1;
775
 
776
- $warned_cache[$key] = $this->s_one_zero( $warned_options[$key] );
777
 
778
- return $warned_cache[$key];
779
  }
780
 
781
  /**
782
- * Returns Facebook locales array
 
783
  *
784
- * @see https://www.facebook.com/translations/FacebookLocales.xml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  *
786
  * @since 2.5.2
 
 
787
  * @return array Valid Facebook locales
788
  */
789
  public function fb_locales() {
@@ -936,9 +1059,9 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
936
  * This is apart from the fb_locales array since there are "duplicated" keys.
937
  * Use this to compare the numeric key position.
938
  *
 
939
  * @see https://www.facebook.com/translations/FacebookLocales.xml
940
  *
941
- * @since 2.5.2
942
  * @return array Valid Facebook locales
943
  */
944
  public function language_keys() {
@@ -1084,7 +1207,5 @@ class AutoDescription_Siteoptions extends AutoDescription_Sanitize {
1084
  'zu', // Zulu
1085
  'zz', // Zazaki
1086
  );
1087
-
1088
  }
1089
-
1090
  }
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
  *
37
  protected $settings_field;
38
 
39
  /**
40
+ * Hold the SEO Settings Page ID for this plugin.
41
  *
42
  * @since 2.2.2
43
+ * @since 2.70 Renamed var from page_id and made public.
44
  *
45
  * @var string The page ID
46
  */
47
+ public $seo_settings_page_slug;
48
 
49
  /**
50
  * Holds the update option.
55
  */
56
  protected $o_plugin_updated;
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, load parent constructor and set up cachable variables.
72
  */
74
  parent::__construct();
75
 
76
  $this->settings_field = THE_SEO_FRAMEWORK_SITE_OPTIONS;
77
+ $this->o_plugin_updated = 'updated_' . THE_SEO_FRAMEWORK_DB_VERSION;
78
+ $this->seo_settings_page_slug = 'theseoframework-settings';
79
 
80
  //* Set up site settings and save/reset them
81
  add_action( 'admin_init', array( $this, 'register_settings' ), 5 );
82
 
83
  //* Update site options at plugin update.
84
+ add_action( 'admin_init', array( $this, 'site_updated_plugin_option' ), 30 );
85
 
86
  }
87
 
222
  'knowledge_logo' => 1, // Fetch logo from WP Favicon
223
  'knowledge_name' => '', // Person or Organization name
224
 
225
+ // Knowledge sameas locations
226
  'knowledge_facebook' => '', // Facebook Account
227
  'knowledge_twitter' => '', // Twitter Account
228
  'knowledge_gplus' => '', // Google Plus Account
252
  'ld_json_sitename' => 1, // LD+Json Sitename
253
  'ld_json_breadcrumbs' => 1, // LD+Json Breadcrumbs
254
 
 
 
 
255
  // Cache.
256
  $this->o_plugin_updated => 1, // Plugin update cache.
257
  );
364
  */
365
  protected function update_hidden_options_to_default() {
366
 
367
+ if ( false === $this->verify_seo_settings_nonce() )
368
+ return;
369
+
370
  //* Disables the New SEO Settings Updated notification.
371
  $plugin_updated = $this->o_plugin_updated;
372
+ $_POST[ THE_SEO_FRAMEWORK_SITE_OPTIONS ][ $plugin_updated ] = 1;
373
 
374
  }
375
 
414
  * Stop this madness from happening again until next update.
415
  * Also prevent $updated to become true on this call.
416
  */
417
+ $new_options[ $plugin_updated ] = 1;
418
+ $options[ $plugin_updated ] = 1;
419
 
420
  //* Merge the options. Add to if it's non-existent.
421
  foreach ( $new_options as $key => $value ) {
422
+ if ( ! isset( $options[ $key ] ) ) {
423
+ $options[ $key ] = $value;
424
+
425
+ if ( ! empty( $value ) )
426
  $updated = true;
 
427
  }
428
  }
429
 
430
  //* Updated the options. Check for updated flag and see if settings pages are loaded.
431
+ if ( update_option( $this->settings_field, $options ) && $updated && $this->load_options )
432
  $this->pre_output_site_updated_plugin_notice();
433
+
434
  }
435
 
436
  /**
441
  */
442
  protected function pre_output_site_updated_plugin_notice() {
443
 
444
+ if ( $this->is_seo_settings_page( false ) ) {
445
  //* Redirect to current page if on options page to correct option values. Once.
446
  if ( ! isset( $_REQUEST['seo-updated'] ) || 'true' !== $_REQUEST['seo-updated'] )
447
+ $this->admin_redirect( $this->seo_settings_page_slug, array( 'seo-updated' => 'true' ) );
448
 
449
  //* Notice has already been sent.
450
  return;
459
  }
460
 
461
  /**
462
+ * Echos plugin updated notification.
463
  *
464
  * @since 2.6.0
465
  *
467
  */
468
  public function site_updated_plugin_notice() {
469
 
 
 
470
  $settings_url = $this->seo_settings_page_url();
471
+ $link = sprintf( '<a href="%s" title="%s" target="_self">%s</a>', $settings_url, esc_attr__( 'SEO Settings', 'autodescription' ), esc_html__( 'here', 'autodescription' ) );
472
+ $go_to_page = sprintf( esc_html_x( 'View the new options %s.', '%s = here', 'autodescription' ), $link );
 
473
 
474
+ $notice = $this->page_defaults['plugin_update_text'] . ' ' . $go_to_page;
475
 
476
+ //* Already escaped.
477
+ $this->do_dismissible_notice( $notice, 'updated', true, false );
478
 
479
  }
480
 
488
  *
489
  * @param string $key Option name.
490
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
 
491
  * @return mixed The value of this $key in the database.
492
  */
493
  public function get_option( $key, $use_cache = true ) {
497
  /**
498
  * Return current option array.
499
  *
 
 
500
  * @since 2.6.0
501
  * @staticvar array $cache The option cache.
502
  *
503
+ * @param string $setting The setting key.
504
  * @return array Options.
505
  */
506
  public function get_all_options( $setting = null ) {
507
 
508
  static $cache = array();
509
 
510
+ if ( isset( $cache[ $setting ] ) )
511
+ return $cache[ $setting ];
512
 
513
  if ( is_null( $setting ) )
514
  $setting = THE_SEO_FRAMEWORK_SITE_OPTIONS;
515
 
516
+ /**
517
+ * Applies filters 'the_seo_framework_get_options' : boolean
518
+ * @since 2.0.0
519
+ */
520
+ return $cache[ $setting ] = apply_filters( 'the_seo_framework_get_options', get_option( $setting ), $setting );
521
  }
522
 
523
  /**
524
  * Return option from the options table and cache result.
525
  *
 
 
 
526
  * Values pulled from the database are cached on each request, so a second request for the same value won't cause a
527
  * second DB interaction.
 
 
528
  *
529
  * @since 2.0.0
530
+ * @staticvar array $settings_cache
531
+ * @staticvar array $options_cache
532
+ * @thanks StudioPress (http://www.studiopress.com/) for some code.
533
  *
534
  * @param string $key Option name.
535
  * @param string $setting Optional. Settings field name. Eventually defaults to null if not passed as an argument.
536
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Default is true.
 
537
  * @return mixed The value of this $key in the database.
 
 
538
  */
539
  public function the_seo_framework_get_option( $key, $setting = null, $use_cache = true ) {
540
 
545
  if ( ! is_array( $options ) || ! array_key_exists( $key, $options ) )
546
  return '';
547
 
548
+ return is_array( $options[ $key ] ) ? stripslashes_deep( $options[ $key ] ) : stripslashes( wp_kses_decode_entities( $options[ $key ] ) );
549
  }
550
 
551
  //* Setup caches
552
  static $options_cache = array();
553
 
554
  //* Check options cache
555
+ if ( isset( $options_cache[ $setting ][ $key ] ) )
556
  //* Option has been cached
557
+ return $options_cache[ $setting ][ $key ];
558
 
559
  $options = $this->get_all_options( $setting );
560
 
561
  //* Check for non-existent option
562
  if ( ! is_array( $options ) || ! array_key_exists( $key, (array) $options ) ) {
563
  //* Cache non-existent option
564
+ $options_cache[ $setting ][ $key ] = '';
565
  } else {
566
  //* Option has not been previously been cached, so cache now
567
+ $options_cache[ $setting ][ $key ] = is_array( $options[ $key ] ) ? stripslashes_deep( $options[ $key ] ) : stripslashes( wp_kses_decode_entities( $options[ $key ] ) );
568
  }
569
 
570
+ return $options_cache[ $setting ][ $key ];
571
  }
572
 
573
  /**
574
  * Return SEO options from the SEO options database.
575
  *
576
  * @since 2.2.2
 
577
  * @uses $this->the_seo_framework_get_option() Return option from the options table and cache result.
578
  * @uses THE_SEO_FRAMEWORK_NETWORK_OPTIONS
579
  *
580
  * @param string $key Option name.
581
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
 
582
  * @return mixed The value of this $key in the database.
583
  */
584
  public function get_site_option( $key, $use_cache = true ) {
589
  * Return Default SEO options from the SEO options array.
590
  *
591
  * @since 2.2.5
 
592
  * @uses $this->get_default_settings() Return option from the options table and cache result.
593
  * @uses THE_SEO_FRAMEWORK_SITE_OPTIONS
594
  *
595
  * @param string $key Option name.
596
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
 
597
  * @return mixed The value of this $key in the database.
598
  */
599
  public function get_default_option( $key, $use_cache = true ) {
628
  * Return the Warned site options. Options which should be 'avoided' return true.
629
  *
630
  * @since 2.3.4
631
+ * Applies filters 'the_seo_framework_warned_site_options' : array The warned site options array.
 
632
  *
633
  * @param array $args Additional warned options to filter.
 
634
  * @return array The SEO Framework Warned Options
635
  */
636
  protected function warned_site_options( $args = array() ) {
650
  * Register the database settings for storage.
651
  *
652
  * @since 2.2.2
653
+ * @thanks StudioPress (http://www.studiopress.com/) for some code.
654
  *
655
  * @return void
 
 
656
  */
657
  public function register_settings() {
658
 
664
  add_option( $this->settings_field, $this->default_site_options() );
665
 
666
  //* If this page isn't the SEO Settings page, there's no need to check for a reset.
667
+ if ( false === $this->is_seo_settings_page( false ) )
668
  return;
669
 
670
  if ( $this->get_option( 'reset', $this->settings_field ) ) {
671
+ if ( update_option( $this->settings_field, $this->default_site_options() ) ) {
672
+ $this->admin_redirect( $this->seo_settings_page_slug, array( 'reset' => 'true' ) );
673
+ exit;
674
+ } else {
675
+ $this->admin_redirect( $this->seo_settings_page_slug, array( 'error' => 'true' ) );
676
+ exit;
677
+ }
678
  }
679
+ }
680
+
681
+ /**
682
+ * Allows updating of settings.
683
+ *
684
+ * @since 2.7.0
685
+ *
686
+ * @param string|array $new The new setting(s).
687
+ * @param string $settings_field The Settings Field to update. Defaults
688
+ * to The SEO Framework settings field.
689
+ */
690
+ public function update_settings( $new = '', $settings_field = '' ) {
691
+
692
+ if ( empty( $settings_field ) )
693
+ $settings_field = $this->settings_field;
694
 
695
+ $old = get_option( $settings_field );
696
+ $settings = wp_parse_args( $new, $old );
697
+
698
+ return update_option( $settings_field, $settings );
699
  }
700
 
701
  /**
702
  * Get the default of any of the The SEO Framework settings.
703
  *
704
  * @since 2.2.4
705
+ * @staticvar array $defaults_cache
706
  * @uses $this->settings_field
707
  * @uses $this->default_site_options()
708
  *
709
  * @param string $key required The option name
710
  * @param string $setting optional The settings field
711
  * @param bool $use_cache optional Use the options cache or not. For debugging purposes.
712
+ * @return int|bool|string default option
713
+ * int '-1' if option doesn't exist.
 
 
 
714
  */
715
  public function get_default_settings( $key, $setting = '', $use_cache = true ) {
716
 
728
  if ( ! is_array( $defaults ) || ! array_key_exists( $key, $defaults ) )
729
  return -1;
730
 
731
+ return is_array( $defaults[ $key ] ) ? stripslashes_deep( $defaults[ $key ] ) : stripslashes( wp_kses_decode_entities( $defaults[ $key ] ) );
732
  }
733
 
734
  static $defaults_cache = array();
735
 
736
  //* Check options cache
737
+ if ( isset( $defaults_cache[ $key ] ) )
738
  //* Option has been cached
739
+ return $defaults_cache[ $key ];
740
 
741
  $defaults_cache = $this->default_site_options();
742
 
743
  if ( ! is_array( $defaults_cache ) || ! array_key_exists( $key, (array) $defaults_cache ) )
744
+ $defaults_cache[ $key ] = -1;
745
 
746
+ return $defaults_cache[ $key ];
747
  }
748
 
749
  /**
750
  * Get the warned setting of any of the The SEO Framework settings.
751
  *
752
  * @since 2.3.4
753
+ * @staticvar array $warned_cache
754
  * @uses $this->settings_field
755
  * @uses $this->warned_site_options()
756
  *
757
  * @param string $key required The option name
758
  * @param string $setting optional The settings field
759
  * @param bool $use_cache optional Use the options cache or not. For debugging purposes.
760
+ * @return int 0|1 Whether the option is flagged as dangerous for SEO.
761
+ * int '-1' if option doesn't exist.
 
 
 
762
  */
763
  public function get_warned_settings( $key, $setting = '', $use_cache = true ) {
764
 
776
  if ( ! is_array( $warned ) || ! array_key_exists( $key, $warned ) )
777
  return -1;
778
 
779
+ return $this->s_one_zero( $warned[ $key ] );
780
  }
781
 
782
  static $warned_cache = array();
783
 
784
  //* Check options cache
785
+ if ( isset( $warned_cache[ $key ] ) )
786
  //* Option has been cached
787
+ return $warned_cache[ $key ];
788
 
789
  $warned_options = $this->warned_site_options();
790
 
791
  if ( ! is_array( $warned_options ) || ! array_key_exists( $key, (array) $warned_options ) )
792
+ $warned_cache[ $key ] = -1;
793
 
794
+ $warned_cache[ $key ] = $this->s_one_zero( $warned_options[ $key ] );
795
 
796
+ return $warned_cache[ $key ];
797
  }
798
 
799
  /**
800
+ * Fetches user SEO user meta data by name.
801
+ * Caches all meta data per $user_id.
802
  *
803
+ * @since 2.7.0
804
+ * @staticvar array $options_cache
805
+ *
806
+ * @param int $user_id The user ID. When empty, it will try to fetch the current user.
807
+ * @param string $option The option name.
808
+ * @param mixed $default The default value to return when the data doesn't exist.
809
+ * @return mixed The metadata value.
810
+ */
811
+ public function get_user_option( $user_id = 0, $option, $default = null ) {
812
+
813
+ if ( ! $option )
814
+ return null;
815
+
816
+ if ( empty( $user_id ) )
817
+ $user_id = $this->get_user_id();
818
+
819
+ if ( ! $user_id )
820
+ return null;
821
+
822
+ static $options_cache = array();
823
+
824
+ if ( isset( $options_cache[ $user_id ][ $option ] ) )
825
+ return $options_cache[ $user_id ][ $option ];
826
+
827
+ $usermeta = $this->get_user_meta( $user_id );
828
+
829
+ return $options_cache[ $user_id ][ $option ] = isset( $usermeta[ $option ] ) ? $usermeta[ $option ] : $default;
830
+ }
831
+
832
+ /**
833
+ * Sets up user ID and returns it if user is found.
834
+ * To be used in AJAX, back-end and front-end.
835
+ *
836
+ * @since 2.7.0
837
+ *
838
+ * @return int $user_id : 0 if user is not found.
839
+ */
840
+ public function get_user_id() {
841
+
842
+ static $user_id = null;
843
+
844
+ if ( isset( $user_id ) )
845
+ return $user_id;
846
+
847
+ $user = wp_get_current_user();
848
+
849
+ return $user_id = $user->exists() ? (int) $user->ID : 0;
850
+ }
851
+
852
+ /**
853
+ * Fetches The SEO Framework usermeta.
854
+ *
855
+ * @since 2.7.0
856
+ * @staticvar array $usermeta_cache
857
+ *
858
+ * @param int $user_id The user ID.
859
+ * @param string $key The user metadata key. Leave empty to fetch all data.
860
+ * @param bool $use_cache Whether to store and use options from cache.
861
+ * @return array The user SEO meta data.
862
+ */
863
+ public function get_user_meta( $user_id, $key = THE_SEO_FRAMEWORK_USER_OPTIONS, $use_cache = true ) {
864
+
865
+ if ( false === $use_cache )
866
+ return get_user_meta( $user_id, $key, true );
867
+
868
+ static $usermeta_cache = array();
869
+
870
+ if ( isset( $usermeta_cache[ $user_id ][ $key ] ) )
871
+ return $usermeta_cache[ $user_id ][ $key ];
872
+
873
+ return $usermeta_cache[ $user_id ][ $key ] = get_user_meta( $user_id, $key, true );
874
+ }
875
+
876
+ /**
877
+ * Updates user SEO option.
878
+ *
879
+ * @since 2.7.0
880
+ *
881
+ * @param int $user_id The user ID.
882
+ * @param string $option The user's SEO metadata option.
883
+ * @param mixed $value The escaped option value.
884
+ * @return bool True on success. False on failure.
885
+ */
886
+ public function update_user_option( $user_id = 0, $option, $value ) {
887
+
888
+ if ( ! $option )
889
+ return false;
890
+
891
+ if ( empty( $user_id ) )
892
+ $user_id = $this->get_user_id();
893
+
894
+ if ( empty( $user_id ) )
895
+ return false;
896
+
897
+ $meta = $this->get_user_meta( $user_id, THE_SEO_FRAMEWORK_USER_OPTIONS, false );
898
+
899
+ $meta[ $option ] = $value;
900
+
901
+ return update_user_meta( $user_id, THE_SEO_FRAMEWORK_USER_OPTIONS, $meta );
902
+ }
903
+
904
+ /**
905
+ * Returns Facebook locales array values.
906
  *
907
  * @since 2.5.2
908
+ * @see https://www.facebook.com/translations/FacebookLocales.xml
909
+ *
910
  * @return array Valid Facebook locales
911
  */
912
  public function fb_locales() {
1059
  * This is apart from the fb_locales array since there are "duplicated" keys.
1060
  * Use this to compare the numeric key position.
1061
  *
1062
+ * @since 2.5.2
1063
  * @see https://www.facebook.com/translations/FacebookLocales.xml
1064
  *
 
1065
  * @return array Valid Facebook locales
1066
  */
1067
  public function language_keys() {
1207
  'zu', // Zulu
1208
  'zz', // Zazaki
1209
  );
 
1210
  }
 
1211
  }
inc/classes/termdata.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_TermData
21
  *
@@ -25,250 +27,221 @@
25
  */
26
  class AutoDescription_TermData extends AutoDescription_PostData {
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor, load parent constructor.
30
  */
31
  public function __construct() {
32
  parent::__construct();
33
 
34
- add_action( 'current_screen', array( $this, 'init_term_filters' ), 999 );
35
- add_action( 'get_header', array( $this, 'init_term_filters' ), 999 );
36
-
37
- add_action( 'edit_term', array( $this, 'taxonomy_seo_save' ), 10, 2 );
38
- add_action( 'delete_term', array( $this, 'term_meta_delete' ), 10, 2 );
39
  }
40
 
41
  /**
42
- * Initializes term filters after wp_query or currentscreen has been set.
43
- *
44
- * @since 2.6.6
45
- * @staticvar boolean $run Whether this function has already run.
46
- * @access private
47
  *
48
- * @return void early if already run.
49
  */
50
- public function init_term_filters() {
51
-
52
- static $run = null;
53
 
54
- if ( isset( $run ) )
55
- return;
56
-
57
- add_filter( 'get_term', array( $this, 'get_term_filter' ), 10, 2 );
58
- add_filter( 'get_terms', array( $this, 'get_terms_filter' ), 10, 2 );
 
 
59
 
60
- $run = true;
 
 
61
 
62
  }
63
 
64
  /**
65
- * Add term meta data into options table of the term.
66
- * Adds separated database options for terms, as the terms table doesn't allow for addition.
67
- *
68
- * Applies filters array the_seo_framework_term_meta_defaults : Array of default term SEO options
69
- * Applies filters mixed the_seo_framework_term_meta_{field} : Override filter for specifics.
70
- * Applies filters array the_seo_framework_term_meta : Override output for term or taxonomy.
71
  *
72
- * @since 2.1.8
 
73
  *
74
- * @todo Use WordPress 4.4.0 get_term_meta() / update_term_meta()
75
- * @priority OMG WTF BBQ 2.6.x / Genesis 2.3.0
76
- * @see @link http://www.studiopress.com/important-announcement-for-genesis-plugin-developers/
77
- * @link https://core.trac.wordpress.org/browser/tags/4.5/src/wp-includes/taxonomy.php#L1814
78
- * @todo still use arrays in get_term_meta() / update_term_meta() ?
79
- * @NOTE Keep WP 3.8 compat.
80
- *
81
- * @param object $term Database row object.
82
- * @param string $taxonomy Taxonomy name that $term is part of.
83
- * @return object $term Database row object.
84
  */
85
- public function get_term_filter( $term, $taxonomy ) {
86
-
87
- //* Do nothing, if $term is not an object.
88
- if ( ! is_object( $term ) )
89
- return $term;
90
-
91
- //* We can't set query vars just yet.
92
- if ( false === $this->can_cache_query() )
93
- return $term;
94
-
95
- /**
96
- * No need to process this data outside of the Terms' scope.
97
- * @since 2.6.0
98
- */
99
- if ( false === $this->is_admin() && false === $this->is_archive() )
100
- return $term;
101
-
102
- /**
103
- * No need to process this after the data has already been output.
104
- * @since 2.6.0
105
- */
106
- if ( did_action( 'the_seo_framework_do_after_output' ) )
107
- return $term;
108
-
109
- /**
110
- * Do nothing if called in the context of creating a term via an Ajax call to prevent data conflict.
111
- * @since ???
112
- *
113
- * @since 2.6.0 delay did_action call as it's a heavy array call.
114
- */
115
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX && did_action( 'wp_ajax_add-tag' ) )
116
- return $term;
117
-
118
- $db = get_option( 'autodescription-term-meta' );
119
- $term_meta = isset( $db[$term->term_id] ) ? $db[$term->term_id] : array();
120
-
121
- $args = (array) apply_filters( 'the_seo_framework_term_meta_defaults', array(
122
- 'doctitle' => '',
123
- 'description' => '',
124
- 'noindex' => 0,
125
- 'nofollow' => 0,
126
- 'noarchive' => 0,
127
- 'saved_flag' => 0, // Don't touch, used to prevent data conflict with Genesis.
128
- ) );
129
 
130
- $term->admeta = wp_parse_args( $term_meta, $args );
 
131
 
132
- //* Sanitize term meta
133
- foreach ( $term->admeta as $field => $value ) {
 
 
 
134
 
135
- /**
136
- * Trim and sanitize the title beforehand.
137
- * @since 2.5.0
138
- */
139
- if ( 'doctitle' === $field )
140
- $value = trim( strip_tags( $value ) );
141
 
142
- /**
143
- * Trim and sanitize the description beforehand.
144
- * @since 2.5.0
145
- */
146
- if ( 'description' === $field )
147
- $value = $this->s_description( $value );
148
 
149
- /**
150
- * @param object $term The Term object.
151
- * @param string $taxonomy The Taxonomy name.
152
- */
153
- $term->admeta[$field] = (string) apply_filters( "the_seo_framework_term_meta_{$field}", stripslashes( wp_kses_decode_entities( $value ) ), $term, $taxonomy );
154
- }
 
155
 
156
- /**
157
- * @param object $term The Term object.
158
- * @param array $taxonomy The Taxonomy name.
159
- */
160
- $term->admeta = (array) apply_filters( 'the_seo_framework_term_meta', $term->admeta, $term, $taxonomy );
161
 
162
- return $term;
163
  }
164
 
165
  /**
166
- * Add AutoDescription term-meta data to functions that return multiple terms.
167
  *
168
- * @since 2.0.0
169
  *
170
- * @param array $terms Database row objects.
171
- * @param string $taxonomy Taxonomy name that $terms are part of.
172
- * @return array $terms Database row objects.
 
173
  */
174
- public function get_terms_filter( array $terms, $taxonomy ) {
175
-
176
- foreach( $terms as $term )
177
- $term = $this->get_term_filter( $term, $taxonomy );
178
-
179
- return $terms;
 
 
 
180
  }
181
 
182
  /**
183
- * Save taxonomy meta data.
184
- * Fires when a user edits and saves a taxonomy.
185
  *
186
- * @since 2.1.8
187
  *
188
- * @param integer $term_id Term ID.
189
- * @param integer $tt_id Term Taxonomy ID.
 
190
  * @return void Early on AJAX call.
191
  */
192
- public function taxonomy_seo_save( $term_id, $tt_id ) {
193
 
194
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
195
  return;
196
 
197
- $term_meta = (array) get_option( 'autodescription-term-meta' );
198
-
199
- $term_meta[$term_id] = isset( $_POST['autodescription-meta'] ) ? (array) $_POST['autodescription-meta'] : array();
200
-
201
- //* Pass through wp_kses if not super admin.
202
- if ( ! current_user_can( 'unfiltered_html' ) && isset( $term_meta[$term_id]['archive_description'] ) )
203
- $term_meta[$term_id]['archive_description'] = wp_kses( $term_meta[$term_id]['archive_description'] );
204
 
205
- update_option( 'autodescription-term-meta', $term_meta );
 
206
 
 
 
207
  }
208
 
209
  /**
210
- * Delete term meta data.
211
- * Fires when a user deletes a term.
212
  *
213
- * @since 2.1.8
214
  *
215
- * @param integer $term_id Term ID.
216
- * @param integer $tt_id Taxonomy Term ID.
217
  */
218
- public function term_meta_delete( $term_id, $tt_id ) {
219
 
220
- $term_meta = (array) get_option( 'autodescription-term-meta' );
 
221
 
222
- unset( $term_meta[$term_id] );
 
 
 
 
223
 
224
- update_option( 'autodescription-term-meta', (array) $term_meta );
 
 
 
225
 
226
  }
227
 
228
  /**
229
  * Fetch set Term data.
230
  *
231
- * @param object|null $term The TT object, if it isn't set, one is fetched.
232
- *
233
  * @since 2.6.0
 
234
  *
235
- * @return array $data The SEO Framework TT data.
 
 
 
 
236
  */
237
- public function get_term_data( $term = null ) {
238
 
239
- if ( is_null( $term ) ) {
240
- if ( $this->is_author() ) {
241
- //* Special handling.
242
- return null;
243
- }
244
 
245
- $term = $this->fetch_the_term();
 
 
 
 
246
  }
247
 
248
- if ( $term ) {
249
- $data = array();
250
-
251
- $data['title'] = isset( $term->admeta['doctitle'] ) ? $term->admeta['doctitle'] : '';
252
- $data['description'] = isset( $term->admeta['description'] ) ? $term->admeta['description'] : '';
253
- $data['noindex'] = isset( $term->admeta['noindex'] ) ? $term->admeta['noindex'] : '';
254
- $data['nofollow'] = isset( $term->admeta['nofollow'] ) ? $term->admeta['nofollow'] : '';
255
- $data['noarchive'] = isset( $term->admeta['noarchive'] ) ? $term->admeta['noarchive'] : '';
256
- $flag = isset( $term->admeta['saved_flag'] ) ? (bool) $term->admeta['saved_flag'] : false;
257
-
258
- //* Genesis data fetch. This will override our options with Genesis options on save.
259
- if ( false === $flag && isset( $term->meta ) ) {
260
- $data['title'] = empty( $data['title'] ) && isset( $term->meta['doctitle'] ) ? $term->meta['doctitle'] : $data['noindex'];
261
- $data['description'] = empty( $data['description'] ) && isset( $term->meta['description'] ) ? $term->meta['description'] : $data['description'];
262
- $data['noindex'] = empty( $data['noindex'] ) && isset( $term->meta['noindex'] ) ? $term->meta['noindex'] : $data['noindex'];
263
- $data['nofollow'] = empty( $data['nofollow'] ) && isset( $term->meta['nofollow'] ) ? $term->meta['nofollow'] : $data['nofollow'];
264
- $data['noarchive'] = empty( $data['noarchive'] ) && isset( $term->meta['noarchive'] ) ? $term->meta['noarchive'] : $data['noarchive'];
265
- }
266
 
267
- return $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
 
270
- //* Return null if no term can be set.
271
- return null;
272
  }
273
 
274
  /**
@@ -284,8 +257,8 @@ class AutoDescription_TermData extends AutoDescription_PostData {
284
 
285
  static $term = array();
286
 
287
- if ( isset( $term[$id] ) )
288
- return $term[$id];
289
 
290
  //* Return null if no term can be set.
291
  if ( false === $this->is_archive() )
@@ -296,20 +269,19 @@ class AutoDescription_TermData extends AutoDescription_PostData {
296
 
297
  if ( isset( $current_screen->taxonomy ) ) {
298
  $term_id = $id ? $id : $this->get_admin_term_id();
299
- $term[$id] = get_term_by( 'id', $term_id, $current_screen->taxonomy );
300
  }
301
  } else {
302
- if ( $this->is_category() || $this->is_tag() ) {
303
- $term[$id] = get_queried_object();
304
- } else if ( $this->is_tax() ) {
305
- $term[$id] = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
306
- }
307
  }
308
 
309
- if ( isset( $term[$id] ) )
310
- return $term[$id];
311
 
312
- return $term[$id] = false;
313
  }
314
 
315
  /**
@@ -351,67 +323,44 @@ class AutoDescription_TermData extends AutoDescription_PostData {
351
  */
352
  protected function get_the_term_name( $term, $singular = true, $fallback = true, $use_cache = true ) {
353
 
354
- if ( false === $use_cache ) {
355
- //* No cache. Short circuit.
356
-
357
- if ( $term && is_object( $term ) ) {
358
- $tax_type = $term->taxonomy;
359
- $term_labels = $this->get_tax_labels( $tax_type );
360
-
361
- if ( $singular ) {
362
- if ( isset( $term_labels->singular_name ) )
363
- return $term_labels->singular_name;
364
- } else {
365
- if ( isset( $term_labels->name ) )
366
- return $term_labels->name;
367
- }
368
- }
369
-
370
- if ( $fallback ) {
371
- //* Fallback to Page as it is generic.
372
- if ( $singular )
373
- return __( 'Page', 'autodescription' );
374
 
375
- return __( 'Pages', 'autodescription' );
376
- }
 
 
377
  }
378
 
379
- static $term_name = array();
380
-
381
- if ( isset( $term_name[$singular] ) )
382
- return $term_name[$singular];
383
-
384
- if ( $term && is_object( $term ) ) {
385
  $tax_type = $term->taxonomy;
386
 
387
- static $term_labels = null;
388
 
389
  /**
390
  * Dynamically fetch the term name.
391
- *
392
  * @since 2.3.1
393
  */
394
- if ( is_null( $term_labels ) )
395
- $term_labels = $this->get_tax_labels( $tax_type );
396
 
397
  if ( $singular ) {
398
- if ( isset( $term_labels->singular_name ) )
399
- return $term_name[$singular] = $term_labels->singular_name;
400
  } else {
401
  if ( isset( $term_labels->name ) )
402
- return $term_name[$singular] = $term_labels->name;
403
  }
404
  }
405
 
406
  if ( $fallback ) {
407
  //* Fallback to Page as it is generic.
408
  if ( $singular )
409
- return $term_name[$singular] = __( 'Page', 'autodescription' );
410
 
411
- return $term_name[$singular] = __( 'Pages', 'autodescription' );
412
  }
413
 
414
- return $term_name[$singular] = '';
415
  }
416
-
417
  }
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_TermData
23
  *
27
  */
28
  class AutoDescription_TermData extends AutoDescription_PostData {
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
  */
45
  public function __construct() {
46
  parent::__construct();
47
 
48
+ //* Initialize term meta filters and actions.
49
+ $this->initialize_term_meta();
 
 
 
50
  }
51
 
52
  /**
53
+ * Initializes term meta data filters and functions.
 
 
 
 
54
  *
55
+ * @since 2.7.0
56
  */
57
+ public function initialize_term_meta() {
 
 
58
 
59
+ if ( $this->can_get_term_meta() ) {
60
+ add_action( 'edit_term', array( $this, 'update_term_meta' ), 10, 2 );
61
+ add_action( 'delete_term', array( $this, 'delete_term_meta' ), 10, 2 );
62
+ } else {
63
+ //* Old style term meta data through loop injections.
64
+ add_filter( 'get_term', array( $this, 'get_term_filter' ), 10, 2 );
65
+ add_filter( 'get_terms', array( $this, 'get_terms_filter' ), 10, 2 );
66
 
67
+ add_action( 'edit_term', array( $this, 'taxonomy_seo_save' ), 10, 2 );
68
+ add_action( 'delete_term', array( $this, 'term_meta_delete' ), 10, 2 );
69
+ }
70
 
71
  }
72
 
73
  /**
74
+ * Returns term meta data from ID.
75
+ * Returns Genesis 2.3.0+ data if no term meta data is set.
 
 
 
 
76
  *
77
+ * @since 2.7.0
78
+ * @staticvar array $cache
79
  *
80
+ * @param int $term_id The Term ID.
81
+ * @param bool $use_cache Whether to use caching.
82
+ * @return array The term meta data.
 
 
 
 
 
 
 
83
  */
84
+ public function get_term_meta( $term_id, $use_cache = true ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ if ( $use_cache ) {
87
+ static $cache = array();
88
 
89
+ if ( isset( $cache[ $term_id ] ) )
90
+ return $cache[ $term_id ];
91
+ } else {
92
+ $cache = array();
93
+ }
94
 
95
+ $data = get_term_meta( $term_id, THE_SEO_FRAMEWORK_TERM_OPTIONS, true );
 
 
 
 
 
96
 
97
+ //* Evaluate merely by presence.
98
+ if ( isset( $data['saved_flag'] ) )
99
+ return $cache[ $term_id ] = $data;
 
 
 
100
 
101
+ if ( $this->is_theme( 'genesis' ) ) {
102
+ $data = array();
103
+ $data['doctitle'] = get_term_meta( $term_id, 'doctitle', true );
104
+ $data['description'] = get_term_meta( $term_id, 'description', true );
105
+ $data['noindex'] = get_term_meta( $term_id, 'noindex', true );
106
+ $data['nofollow'] = get_term_meta( $term_id, 'nofollow', true );
107
+ $data['noarchive'] = get_term_meta( $term_id, 'noarchive', true );
108
 
109
+ return $cache[ $term_id ] = $data;
110
+ }
 
 
 
111
 
112
+ return $cache[ $term_id ] = array();
113
  }
114
 
115
  /**
116
+ * Returns an array of default term options.
117
  *
118
+ * @since 2.7.0
119
  *
120
+ * @since 2.1.8:
121
+ * Applies filters array the_seo_framework_term_meta_defaults : Array of default term SEO options
122
+ *
123
+ * @return array The Term Metadata default options.
124
  */
125
+ public function get_term_meta_defaults() {
126
+ return (array) apply_filters( 'the_seo_framework_term_meta_defaults', array(
127
+ 'doctitle' => '',
128
+ 'description' => '',
129
+ 'noindex' => 0,
130
+ 'nofollow' => 0,
131
+ 'noarchive' => 0,
132
+ 'saved_flag' => 0, // Don't touch, used to prevent data conflict with Genesis.
133
+ ) );
134
  }
135
 
136
  /**
137
+ * Sanitizes and saves term meta data when a term is altered.
 
138
  *
139
+ * @since 2.7.0
140
  *
141
+ * @param int $term_id Term ID.
142
+ * @param int $tt_id Term Taxonomy ID.
143
+ * @param string $taxonomy Taxonomy Slug
144
  * @return void Early on AJAX call.
145
  */
146
+ public function update_term_meta( $term_id, $tt_id, $taxonomy = '' ) {
147
 
148
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
149
  return;
150
 
151
+ //* Check again against ambiguous injection.
152
+ if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'update-tag_' . $term_id ) ) {
 
 
 
 
 
153
 
154
+ $data = isset( $_POST['autodescription-meta'] ) ? (array) map_deep( $_POST['autodescription-meta'], 'esc_attr' ) : array();
155
+ $data = wp_parse_args( $data, $this->get_term_meta_defaults() );
156
 
157
+ update_term_meta( $term_id, THE_SEO_FRAMEWORK_TERM_OPTIONS, $data );
158
+ }
159
  }
160
 
161
  /**
162
+ * Delete term meta data when a term is deleted.
163
+ * Delete only the default data keys.
164
  *
165
+ * @since 2.7.0
166
  *
167
+ * @param int $term_id Term ID.
168
+ * @param int $tt_id Term Taxonomy ID.
169
  */
170
+ public function delete_term_meta( $term_id, $tt_id ) {
171
 
172
+ //* If this results in an empty data string, all data has already been removed by WP core.
173
+ $data = get_term_meta( $term_id, THE_SEO_FRAMEWORK_TERM_OPTIONS, true );
174
 
175
+ if ( is_array( $data ) ) {
176
+ foreach ( $this->get_term_meta_defaults() as $key => $value ) {
177
+ unset( $data[ $key ] );
178
+ }
179
+ }
180
 
181
+ if ( empty( $data ) )
182
+ delete_term_meta( $term_id, THE_SEO_FRAMEWORK_TERM_OPTIONS );
183
+ else
184
+ update_term_meta( $term_id, THE_SEO_FRAMEWORK_TERM_OPTIONS, $data );
185
 
186
  }
187
 
188
  /**
189
  * Fetch set Term data.
190
  *
 
 
191
  * @since 2.6.0
192
+ * @since 2.7.0 Handles term object differently for upgraded database.
193
  *
194
+ * @todo @since 2.8.0 Will no longer use $term.
195
+ *
196
+ * @param object|null $term The TT object, if it isn't set, one is fetched.
197
+ * @param object|null $term_id The term object.
198
+ * @return array The SEO Framework TT data.
199
  */
200
+ public function get_term_data( $term = null, $term_id = 0 ) {
201
 
202
+ if ( is_null( $term ) )
203
+ $term = $this->fetch_the_term( $term_id );
 
 
 
204
 
205
+ if ( isset( $term->term_id ) ) {
206
+ if ( $this->can_get_term_meta() )
207
+ return $this->get_term_meta( $term->term_id );
208
+ else
209
+ return $this->get_old_term_data( $term );
210
  }
211
 
212
+ //* Return null if no term can be set.
213
+ return null;
214
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
 
216
+ /**
217
+ * Fetches term metadata array for the inpost term metabox.
218
+ *
219
+ * @since 2.7.0
220
+ *
221
+ * @param object $term The TT object. Must be assigned.
222
+ * @return array The SEO Framework TT data.
223
+ */
224
+ protected function get_old_term_data( $term ) {
225
+
226
+ $data = array();
227
+
228
+ $data['title'] = isset( $term->admeta['doctitle'] ) ? $term->admeta['doctitle'] : '';
229
+ $data['description'] = isset( $term->admeta['description'] ) ? $term->admeta['description'] : '';
230
+ $data['noindex'] = isset( $term->admeta['noindex'] ) ? $term->admeta['noindex'] : '';
231
+ $data['nofollow'] = isset( $term->admeta['nofollow'] ) ? $term->admeta['nofollow'] : '';
232
+ $data['noarchive'] = isset( $term->admeta['noarchive'] ) ? $term->admeta['noarchive'] : '';
233
+ $flag = isset( $term->admeta['saved_flag'] ) ? (bool) $term->admeta['saved_flag'] : false;
234
+
235
+ //* Genesis data fetch. This will override our options with Genesis options on save.
236
+ if ( false === $flag && isset( $term->meta ) ) {
237
+ $data['title'] = empty( $data['title'] ) && isset( $term->meta['doctitle'] ) ? $term->meta['doctitle'] : $data['noindex'];
238
+ $data['description'] = empty( $data['description'] ) && isset( $term->meta['description'] ) ? $term->meta['description'] : $data['description'];
239
+ $data['noindex'] = empty( $data['noindex'] ) && isset( $term->meta['noindex'] ) ? $term->meta['noindex'] : $data['noindex'];
240
+ $data['nofollow'] = empty( $data['nofollow'] ) && isset( $term->meta['nofollow'] ) ? $term->meta['nofollow'] : $data['nofollow'];
241
+ $data['noarchive'] = empty( $data['noarchive'] ) && isset( $term->meta['noarchive'] ) ? $term->meta['noarchive'] : $data['noarchive'];
242
  }
243
 
244
+ return $data;
 
245
  }
246
 
247
  /**
257
 
258
  static $term = array();
259
 
260
+ if ( isset( $term[ $id ] ) )
261
+ return $term[ $id ];
262
 
263
  //* Return null if no term can be set.
264
  if ( false === $this->is_archive() )
269
 
270
  if ( isset( $current_screen->taxonomy ) ) {
271
  $term_id = $id ? $id : $this->get_admin_term_id();
272
+ $term[ $id ] = get_term_by( 'id', $term_id, $current_screen->taxonomy );
273
  }
274
  } else {
275
+ if ( $this->is_category() || $this->is_tag() )
276
+ $term[ $id ] = get_queried_object();
277
+ elseif ( $this->is_tax() )
278
+ $term[ $id ] = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
 
279
  }
280
 
281
+ if ( isset( $term[ $id ] ) )
282
+ return $term[ $id ];
283
 
284
+ return $term[ $id ] = false;
285
  }
286
 
287
  /**
323
  */
324
  protected function get_the_term_name( $term, $singular = true, $fallback = true, $use_cache = true ) {
325
 
326
+ if ( $use_cache ) {
327
+ static $term_name = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
 
329
+ if ( isset( $term_name[ $singular ] ) )
330
+ return $term_name[ $singular ];
331
+ } else {
332
+ $term_name = array();
333
  }
334
 
335
+ if ( isset( $term->taxonomy ) ) {
 
 
 
 
 
336
  $tax_type = $term->taxonomy;
337
 
338
+ static $term_labels = array();
339
 
340
  /**
341
  * Dynamically fetch the term name.
 
342
  * @since 2.3.1
343
  */
344
+ if ( ! isset( $term_labels[ $tax_type ] ) )
345
+ $term_labels[ $tax_type ] = $this->get_tax_labels( $tax_type );
346
 
347
  if ( $singular ) {
348
+ if ( isset( $term_labels[ $tax_type ]->singular_name ) )
349
+ return $term_name[ $singular ] = $term_labels[ $tax_type ]->singular_name;
350
  } else {
351
  if ( isset( $term_labels->name ) )
352
+ return $term_name[ $singular ] = $term_labels[ $tax_type ]->name;
353
  }
354
  }
355
 
356
  if ( $fallback ) {
357
  //* Fallback to Page as it is generic.
358
  if ( $singular )
359
+ return $term_name[ $singular ] = esc_html__( 'Page', 'autodescription' );
360
 
361
+ return $term_name[ $singular ] = esc_html__( 'Pages', 'autodescription' );
362
  }
363
 
364
+ return $term_name[ $singular ] = '';
365
  }
 
366
  }
inc/classes/transients.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_Transients
21
  *
@@ -61,6 +63,18 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
61
  */
62
  protected $theme_doing_it_right_transient;
63
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Constructor, load parent constructor and set up caches.
66
  */
@@ -89,10 +103,12 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
89
  //* Delete Sitemap transient on permalink structure change.
90
  add_action( 'load-options-permalink.php', array( $this, 'delete_sitemap_transient_permalink_updated' ), 20 );
91
 
92
- add_action( 'update_option_blogdescription', array( $this, 'delete_auto_description_blog_transient' ), 10, 1 );
 
93
 
94
  //* Delete doing it wrong transient after theme switch.
95
- add_action( 'after_switch_theme', array( $this, 'delete_theme_dir_transient' ), 10 );
 
96
 
97
  }
98
 
@@ -186,7 +202,6 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
186
  } else {
187
  $this->auto_description_transient = 'tsf_desc_noa_' . $revision . '_' . $cache_key;
188
  }
189
-
190
  }
191
 
192
  /**
@@ -207,7 +222,7 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
207
  *
208
  * Use hex. e.g. 0, 1, 2, 9, a, b
209
  */
210
- $revision = '7';
211
 
212
  /**
213
  * Change key based on options.
@@ -216,7 +231,7 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
216
  $options .= $this->enable_ld_json_sitename() ? '1' : '0';
217
  $options .= $this->enable_ld_json_searchbox() ? '1' : '0';
218
 
219
- $this->ld_json_transient = 'the_seo_f' . $revision . '_' . $options . '_ldjs_' . $cache_key;
220
  }
221
 
222
  /**
@@ -237,45 +252,47 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
237
 
238
  $page_id = $page_id ? $page_id : $this->get_the_real_ID();
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  static $cached_id = array();
241
 
242
- if ( isset( $cached_id[$page_id][$taxonomy][$type] ) )
243
- return $cached_id[$page_id][$taxonomy][$type];
244
 
245
  //* Placeholder ID.
246
  $the_id = '';
247
  $t = $taxonomy;
248
 
249
- if ( isset( $type ) ) {
250
- if ( 'author' === $type ) {
251
- //* Author page.
252
- $the_id = 'author_' . $page_id;
253
- } else if ( 'frontpage' === $type ) {
254
- //* Front/HomePage.
255
- $the_id = $this->generate_front_page_cache_key();
256
- } else {
257
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, __( 'Third parameter must be a known type.', 'autodescription' ), '2.6.5' );
258
- $the_id = esc_sql( $type . '_' . $page_id . '_' . $t );
259
- }
260
- } else if ( $this->is_404() ) {
261
  $the_id = '_404_';
262
- } else if ( ( $this->is_front_page( $page_id ) ) || ( $this->is_admin() && $this->is_menu_page( $this->pagehook ) ) ) {
263
  //* Front/HomePage.
264
  $the_id = $this->generate_front_page_cache_key();
265
- } else if ( $this->is_blog_page( $page_id ) ) {
266
  $the_id = 'blog_' . $page_id;
267
- } else if ( $this->is_singular() ) {
268
  if ( $this->is_page( $page_id ) ) {
269
  $the_id = 'page_' . $page_id;
270
- } else if ( $this->is_single( $page_id ) ) {
271
  $the_id = 'post_' . $page_id;
272
- } else if ( $this->is_attachment( $page_id ) ) {
273
  $the_id = 'attach_' . $page_id;
274
  } else {
275
  //* Other.
276
  $the_id = 'singular_' . $page_id;
277
  }
278
- } else if ( $this->is_search() ) {
279
  $query = '';
280
 
281
  if ( function_exists( 'get_search_query' ) ) {
@@ -292,7 +309,7 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
292
  }
293
 
294
  $the_id = $page_id . '_s_' . $query;
295
- } else if ( $this->is_archive() ) {
296
  if ( $this->is_category() || $this->is_tag() || $this->is_tax() ) {
297
 
298
  if ( empty( $t ) ) {
@@ -307,9 +324,9 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
307
  if ( $this->is_tax() )
308
  $the_id = 'archives_' . $the_id;
309
 
310
- } else if ( $this->is_author() ) {
311
  $the_id = 'author_' . $page_id;
312
- } else if ( $this->is_date() ) {
313
  $post = get_post();
314
 
315
  if ( $post && isset( $post->post_date ) ) {
@@ -317,9 +334,9 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
317
 
318
  if ( $this->is_year() ) {
319
  $the_id .= 'year_' . mysql2date( 'y', $date, false );
320
- } else if ( $this->is_month() ) {
321
  $the_id .= 'month_' . mysql2date( 'm_y', $date, false );
322
- } else if ( $this->is_day() ) {
323
  //* Day. The correct notation.
324
  $the_id .= 'day_' . mysql2date( 'd_m_y', $date, false );
325
  }
@@ -373,16 +390,27 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
373
  if ( empty( $the_id ) )
374
  $the_id = 'noob_' . $page_id . '_' . $t;
375
 
376
- global $blog_id;
377
-
378
- $locale = strtolower( get_locale() );
379
-
380
  /**
381
  * This should be at most 25 chars. Unless the $blog_id is higher than 99,999,999.
382
  * Then some cache keys will conflict on every 10th blog ID from eachother which post something on the same day..
383
  * On the day archive. With the same description setting (short).
384
  */
385
- return $cached_id[$page_id][$taxonomy][$type] = $the_id . '_' . $blog_id . '_' . $locale;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  }
387
 
388
  /**
@@ -395,10 +423,11 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
395
  public function generate_front_page_cache_key( $type = '' ) {
396
 
397
  if ( empty( $type ) ) {
398
- if ( $this->has_page_on_front() )
399
  $type = 'page';
400
- else
401
  $type = 'blog';
 
402
  } else {
403
  $type = esc_sql( $type );
404
  }
@@ -423,12 +452,13 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
423
  if ( false !== strpos( $taxonomy, '_' ) ) {
424
  $taxonomy_name = explode( '_', $taxonomy );
425
  if ( is_array( $taxonomy_name ) ) {
426
- foreach ( $taxonomy_name as $name )
427
  if ( mb_strlen( $name ) >= 3 ) {
428
  $the_id .= mb_substr( $name, 0, 3 ) . '_';
429
  } else {
430
- $the_id = strtolower( $name ) . '_';
431
  }
 
432
  }
433
  }
434
 
@@ -504,13 +534,17 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
504
  * Checks whether the permalink structure is updated.
505
  *
506
  * @since 2.3.0
 
507
  *
508
  * @return bool Whether if sitemap transient is deleted.
509
  */
510
  public function delete_sitemap_transient_permalink_updated() {
511
 
512
- if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) )
 
 
513
  return $this->delete_sitemap_transient();
 
514
 
515
  return false;
516
  }
@@ -541,9 +575,9 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
541
  * @param string $old_option The previous blog description option.
542
  * @return string Previous option.
543
  */
544
- public function delete_auto_description_blog_transient( $old_option ) {
545
 
546
- $this->setup_auto_description_transient( (int) get_option( 'page_for_posts' ) );
547
 
548
  delete_transient( $this->auto_description_transient );
549
 
@@ -600,10 +634,18 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
600
  * Delete transient for the Theme doing it Right bool on special requests.
601
  *
602
  * @since 2.5.2
 
603
  *
604
- * @return bool true
 
 
605
  */
606
- public function delete_theme_dir_transient() {
 
 
 
 
 
607
 
608
  delete_transient( $this->theme_doing_it_right_transient );
609
 
@@ -611,26 +653,23 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
611
  }
612
 
613
  /**
614
- * Sets transient for Theme doing it Right
615
  *
616
  * @since 2.5.2
 
 
 
617
  *
618
  * @param bool $doing_it_right
619
  */
620
- public function set_theme_dir_transient( $dir = '' ) {
621
 
622
- if ( is_bool( $dir ) && false === get_transient( $this->theme_doing_it_right_transient ) ) {
623
 
624
  //* Convert $dir to string 1 or 0 as transients can be false on failure.
625
  $dir = $dir ? '1' : '0';
626
 
627
- /**
628
- * Expiration time, 3 days.
629
- * 60s * 60m * 24d * 3d
630
- */
631
- $expiration = DAY_IN_SECONDS * 3;
632
-
633
- set_transient( $this->theme_doing_it_right_transient, $dir, $expiration );
634
  }
635
 
636
  }
@@ -656,5 +695,4 @@ class AutoDescription_Transients extends AutoDescription_Sitemaps {
656
 
657
  return $flushed = true;
658
  }
659
-
660
  }
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_Transients
23
  *
63
  */
64
  protected $theme_doing_it_right_transient;
65
 
66
+ /**
67
+ * Unserializing instances of this class is forbidden.
68
+ */
69
+ private function __wakeup() { }
70
+
71
+ /**
72
+ * Handle unapproachable invoked methods.
73
+ */
74
+ public function __call( $name, $arguments ) {
75
+ parent::__call( $name, $arguments );
76
+ }
77
+
78
  /**
79
  * Constructor, load parent constructor and set up caches.
80
  */
103
  //* Delete Sitemap transient on permalink structure change.
104
  add_action( 'load-options-permalink.php', array( $this, 'delete_sitemap_transient_permalink_updated' ), 20 );
105
 
106
+ //* Deletes front page description transient on Tagline change.
107
+ add_action( 'update_option_blogdescription', array( $this, 'delete_auto_description_frontpage_transient' ), 10, 1 );
108
 
109
  //* Delete doing it wrong transient after theme switch.
110
+ add_action( 'after_switch_theme', array( $this, 'delete_theme_dir_transient' ), 10, 0 );
111
+ add_action( 'upgrader_process_complete', array( $this, 'delete_theme_dir_transient' ), 10, 2 );
112
 
113
  }
114
 
202
  } else {
203
  $this->auto_description_transient = 'tsf_desc_noa_' . $revision . '_' . $cache_key;
204
  }
 
205
  }
206
 
207
  /**
222
  *
223
  * Use hex. e.g. 0, 1, 2, 9, a, b
224
  */
225
+ $revision = '1';
226
 
227
  /**
228
  * Change key based on options.
231
  $options .= $this->enable_ld_json_sitename() ? '1' : '0';
232
  $options .= $this->enable_ld_json_searchbox() ? '1' : '0';
233
 
234
+ $this->ld_json_transient = 'tsf_' . $revision . '_' . $options . '_ldjs_' . $cache_key;
235
  }
236
 
237
  /**
252
 
253
  $page_id = $page_id ? $page_id : $this->get_the_real_ID();
254
 
255
+ if ( isset( $type ) ) {
256
+ if ( 'author' === $type ) {
257
+ //* Author page.
258
+ return $this->add_cache_key_suffix( 'author_' . $page_id );
259
+ } elseif ( 'frontpage' === $type ) {
260
+ //* Front/HomePage.
261
+ return $this->add_cache_key_suffix( $this->generate_front_page_cache_key() );
262
+ } else {
263
+ $this->_doing_it_wrong( __METHOD__, esc_html__( 'Third parameter must be a known type.', 'autodescription' ), '2.6.5' );
264
+ return $this->add_cache_key_suffix( esc_sql( $type . '_' . $page_id . '_' . $taxonomy ) );
265
+ }
266
+ }
267
+
268
  static $cached_id = array();
269
 
270
+ if ( isset( $cached_id[ $page_id ][ $taxonomy ] ) )
271
+ return $cached_id[ $page_id ][ $taxonomy ];
272
 
273
  //* Placeholder ID.
274
  $the_id = '';
275
  $t = $taxonomy;
276
 
277
+ if ( $this->is_404() ) {
 
 
 
 
 
 
 
 
 
 
 
278
  $the_id = '_404_';
279
+ } elseif ( ( $this->is_front_page( $page_id ) ) || ( $this->is_admin() && $this->is_seo_settings_page( true ) ) ) {
280
  //* Front/HomePage.
281
  $the_id = $this->generate_front_page_cache_key();
282
+ } elseif ( $this->is_blog_page( $page_id ) ) {
283
  $the_id = 'blog_' . $page_id;
284
+ } elseif ( $this->is_singular() ) {
285
  if ( $this->is_page( $page_id ) ) {
286
  $the_id = 'page_' . $page_id;
287
+ } elseif ( $this->is_single( $page_id ) ) {
288
  $the_id = 'post_' . $page_id;
289
+ } elseif ( $this->is_attachment( $page_id ) ) {
290
  $the_id = 'attach_' . $page_id;
291
  } else {
292
  //* Other.
293
  $the_id = 'singular_' . $page_id;
294
  }
295
+ } elseif ( $this->is_search() ) {
296
  $query = '';
297
 
298
  if ( function_exists( 'get_search_query' ) ) {
309
  }
310
 
311
  $the_id = $page_id . '_s_' . $query;
312
+ } elseif ( $this->is_archive() ) {
313
  if ( $this->is_category() || $this->is_tag() || $this->is_tax() ) {
314
 
315
  if ( empty( $t ) ) {
324
  if ( $this->is_tax() )
325
  $the_id = 'archives_' . $the_id;
326
 
327
+ } elseif ( $this->is_author() ) {
328
  $the_id = 'author_' . $page_id;
329
+ } elseif ( $this->is_date() ) {
330
  $post = get_post();
331
 
332
  if ( $post && isset( $post->post_date ) ) {
334
 
335
  if ( $this->is_year() ) {
336
  $the_id .= 'year_' . mysql2date( 'y', $date, false );
337
+ } elseif ( $this->is_month() ) {
338
  $the_id .= 'month_' . mysql2date( 'm_y', $date, false );
339
+ } elseif ( $this->is_day() ) {
340
  //* Day. The correct notation.
341
  $the_id .= 'day_' . mysql2date( 'd_m_y', $date, false );
342
  }
390
  if ( empty( $the_id ) )
391
  $the_id = 'noob_' . $page_id . '_' . $t;
392
 
 
 
 
 
393
  /**
394
  * This should be at most 25 chars. Unless the $blog_id is higher than 99,999,999.
395
  * Then some cache keys will conflict on every 10th blog ID from eachother which post something on the same day..
396
  * On the day archive. With the same description setting (short).
397
  */
398
+ return $cached_id[ $page_id ][ $taxonomy ] = $this->add_cache_key_suffix( $the_id );
399
+ }
400
+
401
+ /**
402
+ * Adds cache key suffix based on blog id and locale.
403
+ *
404
+ * @since 2.7.0
405
+ *
406
+ * @return string the cache key.
407
+ */
408
+ protected function add_cache_key_suffix( $key ) {
409
+ global $blog_id;
410
+
411
+ $locale = strtolower( get_locale() );
412
+
413
+ return $key . '_' . $blog_id . '_' . $locale;
414
  }
415
 
416
  /**
423
  public function generate_front_page_cache_key( $type = '' ) {
424
 
425
  if ( empty( $type ) ) {
426
+ if ( $this->has_page_on_front() ) {
427
  $type = 'page';
428
+ } else {
429
  $type = 'blog';
430
+ }
431
  } else {
432
  $type = esc_sql( $type );
433
  }
452
  if ( false !== strpos( $taxonomy, '_' ) ) {
453
  $taxonomy_name = explode( '_', $taxonomy );
454
  if ( is_array( $taxonomy_name ) ) {
455
+ foreach ( $taxonomy_name as $name ) {
456
  if ( mb_strlen( $name ) >= 3 ) {
457
  $the_id .= mb_substr( $name, 0, 3 ) . '_';
458
  } else {
459
+ $the_id = $name . '_';
460
  }
461
+ }
462
  }
463
  }
464
 
534
  * Checks whether the permalink structure is updated.
535
  *
536
  * @since 2.3.0
537
+ * @since 2.7.0 Added admin referer check.
538
  *
539
  * @return bool Whether if sitemap transient is deleted.
540
  */
541
  public function delete_sitemap_transient_permalink_updated() {
542
 
543
+ if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {
544
+ check_admin_referer( 'update-permalink' );
545
+
546
  return $this->delete_sitemap_transient();
547
+ }
548
 
549
  return false;
550
  }
575
  * @param string $old_option The previous blog description option.
576
  * @return string Previous option.
577
  */
578
+ public function delete_auto_description_frontpage_transient( $old_option ) {
579
 
580
+ $this->setup_auto_description_transient( $this->get_the_front_page_ID(), '', 'frontpage' );
581
 
582
  delete_transient( $this->auto_description_transient );
583
 
634
  * Delete transient for the Theme doing it Right bool on special requests.
635
  *
636
  * @since 2.5.2
637
+ * @since 2.7.0
638
  *
639
+ * @param string|object $value The theme directory stylesheet location, or either WP_Theme/WP_Upgrader instance.
640
+ * @param array|object|null $options If set, the update options array or the Old theme WP_Theme instance.
641
+ * @return bool True on success, false on failure.
642
  */
643
+ public function delete_theme_dir_transient( $value = null, $options = null ) {
644
+
645
+ if ( isset( $options['type'] ) ) {
646
+ if ( 'theme' !== $options['type'] )
647
+ return false;
648
+ }
649
 
650
  delete_transient( $this->theme_doing_it_right_transient );
651
 
653
  }
654
 
655
  /**
656
+ * Sets transient for Theme doing it Right.
657
  *
658
  * @since 2.5.2
659
+ * @since 2.7.0 Will always set "doing it wrong" transient, even if it was "doing it right" earlier.
660
+ *
661
+ * @NOTE: Ignores transient debug constant.
662
  *
663
  * @param bool $doing_it_right
664
  */
665
+ public function set_theme_dir_transient( $dir = null ) {
666
 
667
+ if ( is_bool( $dir ) && ( false === $dir || false === get_transient( $this->theme_doing_it_right_transient ) ) ) {
668
 
669
  //* Convert $dir to string 1 or 0 as transients can be false on failure.
670
  $dir = $dir ? '1' : '0';
671
 
672
+ set_transient( $this->theme_doing_it_right_transient, $dir, 0 );
 
 
 
 
 
 
673
  }
674
 
675
  }
695
 
696
  return $flushed = true;
697
  }
 
698
  }
inc/deprecated/deprecated.class.php CHANGED
@@ -16,6 +16,8 @@
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
 
 
19
  /**
20
  * Deprecation class.
21
  * Contains all deprecated functions. Is autoloaded.
@@ -25,127 +27,22 @@
25
  class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
26
 
27
  /**
28
- * Constructor. Load parent constructor.
29
- */
30
- public function __construct() {
31
- parent::__construct();
32
- }
33
-
34
- /**
35
- * Return option from the options table and cache result.
36
- *
37
- * @since 2.0.0
38
- *
39
- * @deprecated
40
- * @since 2.3.4
41
- */
42
- public function autodescription_get_option( $key, $setting = null, $use_cache = true ) {
43
- $this->_deprecated_function( 'AutoDescription_Adminpages::' . __FUNCTION__, '2.3.4', 'AutoDescription_Adminpages::the_seo_framework_get_option()' );
44
-
45
- return $this->the_seo_framework_get_option( $key, $setting, $use_cache );
46
- }
47
-
48
- /**
49
- * Enqueues JS in the admin footer
50
- *
51
- * @since 2.1.9
52
- *
53
- * @deprecated
54
- * @since 2.3.3
55
- *
56
- * @param $hook the current page
57
- */
58
- public function enqueue_javascript( $hook ) {
59
- $this->_deprecated_function( 'AutoDescription_Admin_Init::' . __FUNCTION__, '2.3.3', 'AutoDescription_Admin_Init::enqueue_admin_scripts()' );
60
-
61
- return $this->enqueue_admin_scripts( $hook );
62
- }
63
-
64
- /**
65
- * Enqueues CSS in the admin header
66
- *
67
- * @since 2.1.9
68
- *
69
- * @deprecated
70
- * @since 2.3.3
71
- *
72
- * @param $hook the current page
73
- */
74
- public function enqueue_css( $hook ) {
75
- $this->_deprecated_function( 'AutoDescription_Admin_Init::' . __FUNCTION__, '2.3.3', 'AutoDescription_Admin_Init::enqueue_admin_scripts()' );
76
-
77
- return $this->enqueue_admin_scripts( $hook );
78
- }
79
-
80
- /**
81
- * Setup var for sitemap transient.
82
- *
83
- * @since 2.2.9
84
- *
85
- * @deprecated
86
- * @since 2.3.3
87
- */
88
- public function fetch_sitemap_transient_name() {
89
- $this->_deprecated_function( 'AutoDescription_Transients::' . __FUNCTION__, '2.3.3', 'AutoDescription_Transients::$sitemap_transient' );
90
-
91
- return $this->sitemap_transient;
92
- }
93
-
94
- /**
95
- * Delete Sitemap transient on post save.
96
- *
97
- * @since 2.2.9
98
- *
99
- * @deprecated
100
- * @since 2.3.3
101
- */
102
- public function delete_sitemap_transient_post( $post_id ) {
103
- $this->_deprecated_function( 'AutoDescription_Transients::' . __FUNCTION__, '2.3.3', 'AutoDescription_Transients::delete_sitemap_transient_post()' );
104
-
105
- return $this->delete_transients_post( $post_id );
106
- }
107
-
108
- /**
109
- * Helper function for Doing it Wrong
110
- *
111
- * @since 2.2.4
112
- *
113
- * @deprecated
114
- * @since 2.3.0
115
  */
116
- public function autodescription_version( $version = '' ) {
117
- $this->_deprecated_function( 'The_SEO_Framework_Load::' . __FUNCTION__, '2.3.0', 'The_SEO_Framework_Load::the_seo_framework_version()' );
118
-
119
- return $this->the_seo_framework_version( $version );
120
- }
121
 
122
  /**
123
- * Include the necessary sortable metabox scripts.
124
- *
125
- * @since 2.2.2
126
- *
127
- * @deprecated
128
- * @since 2.3.5
129
  */
130
- public function scripts() {
131
- $this->_deprecated_function( 'AutoDescription_Adminpages::' . __FUNCTION__, '2.3.5', 'AutoDescription_Adminpages::metabox_scripts()' );
132
-
133
- return $this->metabox_scripts();
134
  }
135
 
136
  /**
137
- * Setup var for sitemap transient on init/admin_init.
138
- *
139
- * @since 2.3.3
140
- * @deprecated
141
- * @since 2.3.3
142
- * Oops.
143
  */
144
- public function setup_transient_names_init() {
145
- $this->_deprecated_function( 'AutoDescription_Transients::' . __FUNCTION__, '2.3.3', 'AutoDescription_Transients::setup_transient_names()' );
146
-
147
- $this->setup_transient_names();
148
- return false;
149
  }
150
 
151
  /**
@@ -386,6 +283,9 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
386
  * @since 2.6.1
387
  * @access private
388
  *
 
 
 
389
  * @return bool
390
  *
391
  * @thanks StudioPress (http://www.studiopress.com/) for some code.
@@ -406,7 +306,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
406
  );
407
 
408
  if ( isset( $plugins_check ) ) {
409
- $this->_deprecated_function( 'the_seo_framework_detect_seo_plugins', 'the_seo_framework_conflicting_plugins', '2.6.1' );
410
  return $this->detect_plugin( $plugins_check );
411
  }
412
 
@@ -427,6 +327,9 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
427
  * @staticvar bool $has_plugin
428
  * @since 2.2.5
429
  *
 
 
 
430
  * @return bool $has_plugin one of the plugins has been found.
431
  */
432
  public function has_og_plugin() {
@@ -446,7 +349,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
446
  );
447
 
448
  if ( isset( $plugins_check ) ) {
449
- $this->_deprecated_function( 'the_seo_framework_detect_og_plugins', 'the_seo_framework_conflicting_plugins', '2.6.1' );
450
  return $this->detect_plugin( $plugins_check );
451
  }
452
 
@@ -465,7 +368,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
465
  * @return bool
466
  */
467
  public function has_sitemap_plugin() {
468
- $this->_deprecated_function( 'AutoDescription_Detect::' . __FUNCTION__, 'AutoDescription_Detect::detect_sitemap_plugin', '2.6.1' );
469
 
470
  return $this->detect_sitemap_plugin();
471
  }
@@ -484,7 +387,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
484
  */
485
  public function get_current_post_type( $public = true ) {
486
 
487
- $this->_deprecated_function( 'AutoDescription_Detect::' . __FUNCTION__, 'AutoDescription_Detect::get_supported_post_type', '2.6.2' );
488
 
489
  static $post_type = null;
490
 
@@ -534,7 +437,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
534
  */
535
  public function wpmudev_domainmap_flush_fix( $options_saved = false, $flush_now = true ) {
536
 
537
- $this->_deprecated_function( 'AutoDescription_Sitemaps::' . __FUNCTION__, '', '2.6.2' );
538
 
539
  if ( $this->pretty_permalinks && $this->is_domainmapping_active() ) {
540
  if ( $options_saved || 'init' === current_action() ) {
@@ -590,7 +493,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
590
  */
591
  public function get_relative_url( $post = null, $external = false, $depr = null ) {
592
 
593
- $this->_deprecated_function( 'AutoDescription_Generate_Url::' . __FUNCTION__, 'AutoDescription_Generate_Url::build_singular_relative_url()', '2.6.5' );
594
 
595
  if ( isset( $depr ) ) {
596
  $post_id = $depr;
@@ -598,7 +501,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
598
  if ( is_object( $post ) ) {
599
  if ( isset( $post->ID ) )
600
  $post_id = $post->ID;
601
- } else if ( is_scalar( $post ) ) {
602
  $post_id = (int) $post;
603
  }
604
  }
@@ -612,7 +515,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
612
 
613
  if ( $external || ! $this->is_home() ) {
614
  $permalink = get_permalink( $post_id );
615
- } else if ( ! $external ) {
616
  global $wp;
617
 
618
  if ( isset( $wp->request ) )
@@ -643,7 +546,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
643
  */
644
  public function the_url_path_default_permalink_structure( $post = null, $paged = false, $paged_plural = true ) {
645
 
646
- $this->_deprecated_function( 'AutoDescription_Generate_Url::' . __FUNCTION__, 'AutoDescription_Generate_Url::build_singular_relative_url()', '2.6.5' );
647
 
648
  //* Don't slash it.
649
  $this->url_slashit = false;
@@ -655,9 +558,9 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
655
  if ( is_object( $object ) ) {
656
  if ( $this->is_category() ) {
657
  $path = '?cat=' . $object->term_id;
658
- } else if ( $this->is_tag() ) {
659
  $path = '?tag=' . $object->name;
660
- } else if ( $this->is_date() ) {
661
  global $wp_query;
662
 
663
  $query = $wp_query->query;
@@ -667,11 +570,11 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
667
  $day = $query->day ? '&day=' . $query->day : '';
668
 
669
  $path = '?year=' . $year . $month . $day;
670
- } else if ( $this->is_author() ) {
671
  $path = '?author=' . $object->author_name;
672
- } else if ( $this->is_tax() ) {
673
  $path = '?taxonomy=' . $object->taxonomy . '&term=' . $object->slug;
674
- } else if ( isset( $object->query_var ) && $object->query_var ) {
675
  $path = '?' . $object->query_var . '=' . $object->slug;
676
  } else {
677
  $path = '?p=' . $object->ID;
@@ -689,7 +592,7 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
689
  if ( isset( $post ) ) {
690
  if ( is_object( $post ) && isset( $post->ID ) ) {
691
  $id = $post->ID;
692
- } else if ( is_scalar( $post ) ) {
693
  $id = $post;
694
  }
695
  }
@@ -713,17 +616,290 @@ class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
713
  * @since 2.3.0
714
  *
715
  * @deprecated
716
- * @since 2.6.5
717
  *
718
  * @return string The SEO Framework version.
719
  */
720
  public function the_seo_framework_version( $version = '' ) {
721
 
722
- $this->_deprecated_function( 'AutoDescription_Load::' . __FUNCTION__, '', '2.6.6' );
723
 
724
  $output = $version ? sprintf( __( '%s of The SEO Framework', 'autodescription' ), esc_attr( $version ) ) : '';
725
 
726
  return $output;
727
  }
728
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
729
  }
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
19
+ defined( 'ABSPATH' ) or die;
20
+
21
  /**
22
  * Deprecation class.
23
  * Contains all deprecated functions. Is autoloaded.
27
  class The_SEO_Framework_Deprecated extends AutoDescription_Feed {
28
 
29
  /**
30
+ * Unserializing instances of this class is forbidden.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  */
32
+ private function __wakeup() { }
 
 
 
 
33
 
34
  /**
35
+ * Handle unapproachable invoked methods.
 
 
 
 
 
36
  */
37
+ public function __call( $name, $arguments ) {
38
+ parent::__call( $name, $arguments );
 
 
39
  }
40
 
41
  /**
42
+ * Constructor. Loads parent constructor.
 
 
 
 
 
43
  */
44
+ public function __construct() {
45
+ parent::__construct();
 
 
 
46
  }
47
 
48
  /**
283
  * @since 2.6.1
284
  * @access private
285
  *
286
+ * @deprecated
287
+ * @since 2.6.1
288
+ *
289
  * @return bool
290
  *
291
  * @thanks StudioPress (http://www.studiopress.com/) for some code.
306
  );
307
 
308
  if ( isset( $plugins_check ) ) {
309
+ $this->_deprecated_function( 'the_seo_framework_detect_seo_plugins', '2.6.1', 'the_seo_framework_conflicting_plugins' );
310
  return $this->detect_plugin( $plugins_check );
311
  }
312
 
327
  * @staticvar bool $has_plugin
328
  * @since 2.2.5
329
  *
330
+ * @deprecated
331
+ * @since 2.6.1
332
+ *
333
  * @return bool $has_plugin one of the plugins has been found.
334
  */
335
  public function has_og_plugin() {
349
  );
350
 
351
  if ( isset( $plugins_check ) ) {
352
+ $this->_deprecated_function( 'the_seo_framework_detect_og_plugins', '2.6.1', 'the_seo_framework_conflicting_plugins' );
353
  return $this->detect_plugin( $plugins_check );
354
  }
355
 
368
  * @return bool
369
  */
370
  public function has_sitemap_plugin() {
371
+ $this->_deprecated_function( 'AutoDescription_Detect::' . __FUNCTION__, '2.6.1', 'AutoDescription_Detect::detect_sitemap_plugin' );
372
 
373
  return $this->detect_sitemap_plugin();
374
  }
387
  */
388
  public function get_current_post_type( $public = true ) {
389
 
390
+ $this->_deprecated_function( 'AutoDescription_Detect::' . __FUNCTION__, '2.6.2', 'AutoDescription_Detect::get_supported_post_type' );
391
 
392
  static $post_type = null;
393
 
437
  */
438
  public function wpmudev_domainmap_flush_fix( $options_saved = false, $flush_now = true ) {
439
 
440
+ $this->_deprecated_function( 'AutoDescription_Sitemaps::' . __FUNCTION__, '2.6.2' );
441
 
442
  if ( $this->pretty_permalinks && $this->is_domainmapping_active() ) {
443
  if ( $options_saved || 'init' === current_action() ) {
493
  */
494
  public function get_relative_url( $post = null, $external = false, $depr = null ) {
495
 
496
+ $this->_deprecated_function( 'AutoDescription_Generate_Url::' . __FUNCTION__, '2.6.5', 'AutoDescription_Generate_Url::build_singular_relative_url()' );
497
 
498
  if ( isset( $depr ) ) {
499
  $post_id = $depr;
501
  if ( is_object( $post ) ) {
502
  if ( isset( $post->ID ) )
503
  $post_id = $post->ID;
504
+ } elseif ( is_scalar( $post ) ) {
505
  $post_id = (int) $post;
506
  }
507
  }
515
 
516
  if ( $external || ! $this->is_home() ) {
517
  $permalink = get_permalink( $post_id );
518
+ } elseif ( ! $external ) {
519
  global $wp;
520
 
521
  if ( isset( $wp->request ) )
546
  */
547
  public function the_url_path_default_permalink_structure( $post = null, $paged = false, $paged_plural = true ) {
548
 
549
+ $this->_deprecated_function( 'AutoDescription_Generate_Url::' . __FUNCTION__, '2.6.5' , 'AutoDescription_Generate_Url::build_singular_relative_url()' );
550
 
551
  //* Don't slash it.
552
  $this->url_slashit = false;
558
  if ( is_object( $object ) ) {
559
  if ( $this->is_category() ) {
560
  $path = '?cat=' . $object->term_id;
561
+ } elseif ( $this->is_tag() ) {
562
  $path = '?tag=' . $object->name;
563
+ } elseif ( $this->is_date() ) {
564
  global $wp_query;
565
 
566
  $query = $wp_query->query;
570
  $day = $query->day ? '&day=' . $query->day : '';
571
 
572
  $path = '?year=' . $year . $month . $day;
573
+ } elseif ( $this->is_author() ) {
574
  $path = '?author=' . $object->author_name;
575
+ } elseif ( $this->is_tax() ) {
576
  $path = '?taxonomy=' . $object->taxonomy . '&term=' . $object->slug;
577
+ } elseif ( isset( $object->query_var ) && $object->query_var ) {
578
  $path = '?' . $object->query_var . '=' . $object->slug;
579
  } else {
580
  $path = '?p=' . $object->ID;
592
  if ( isset( $post ) ) {
593
  if ( is_object( $post ) && isset( $post->ID ) ) {
594
  $id = $post->ID;
595
+ } elseif ( is_scalar( $post ) ) {
596
  $id = $post;
597
  }
598
  }
616
  * @since 2.3.0
617
  *
618
  * @deprecated
619
+ * @since 2.6.6
620
  *
621
  * @return string The SEO Framework version.
622
  */
623
  public function the_seo_framework_version( $version = '' ) {
624
 
625
+ $this->_deprecated_function( 'AutoDescription_Load::' . __FUNCTION__, '2.6.6' );
626
 
627
  $output = $version ? sprintf( __( '%s of The SEO Framework', 'autodescription' ), esc_attr( $version ) ) : '';
628
 
629
  return $output;
630
  }
631
 
632
+
633
+ /**
634
+ * HomePage Metabox General Tab Output.
635
+ *
636
+ * @since 2.6.0
637
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
638
+ *
639
+ * @deprecated
640
+ * @since 2.7.0
641
+ */
642
+ public function homepage_metabox_general() {
643
+ $this->_deprecated_function( 'AutoDescription_Metaboxes::' . __FUNCTION__, '2.7.0', 'AutoDescription_Metaboxes::homepage_metabox_general_tab()' );
644
+ $this->get_view( 'metaboxes/homepage-metabox', array(), 'general' );
645
+ }
646
+
647
+ /**
648
+ * HomePage Metabox Additions Tab Output.
649
+ *
650
+ * @since 2.6.0
651
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
652
+ *
653
+ * @deprecated
654
+ * @since 2.7.0
655
+ */
656
+ public function homepage_metabox_additions() {
657
+ $this->_deprecated_function( 'AutoDescription_Metaboxes::' . __FUNCTION__, '2.7.0', 'AutoDescription_Metaboxes::homepage_metabox_additions_tab()' );
658
+ $this->get_view( 'metaboxes/homepage-metabox', array(), 'additions' );
659
+ }
660
+
661
+ /**
662
+ * HomePage Metabox Robots Tab Output
663
+ *
664
+ * @since 2.6.0
665
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
666
+ *
667
+ * @deprecated
668
+ * @since 2.7.0
669
+ */
670
+ public function homepage_metabox_robots() {
671
+ $this->_deprecated_function( 'AutoDescription_Metaboxes::' . __FUNCTION__, '2.7.0', 'AutoDescription_Metaboxes::homepage_metabox_robots_tab()' );
672
+ $this->get_view( 'metaboxes/homepage-metabox', array(), 'robots' );
673
+ }
674
+
675
+ /**
676
+ * Delete transient for the automatic description for blog on save request.
677
+ * Returns old option, since that's passed for sanitation within WP Core.
678
+ *
679
+ * @since 2.3.3
680
+ *
681
+ * @deprecated
682
+ * @since 2.7.0
683
+ *
684
+ * @param string $old_option The previous blog description option.
685
+ * @return string Previous option.
686
+ */
687
+ public function delete_auto_description_blog_transient( $old_option ) {
688
+
689
+ $this->_deprecated_function( 'AutoDescription_Transients::' . __FUNCTION__, '2.7.0', 'AutoDescription_Transients::delete_auto_description_frontpage_transient()' );
690
+
691
+ $this->setup_auto_description_transient( $this->get_the_front_page_ID(), '', 'frontpage' );
692
+
693
+ delete_transient( $this->auto_description_transient );
694
+
695
+ return $old_option;
696
+ }
697
+
698
+ /**
699
+ * Add term meta data into options table of the term.
700
+ * Adds separated database options for terms, as the terms table doesn't allow for addition.
701
+ *
702
+ * Applies filters array the_seo_framework_term_meta_defaults : Array of default term SEO options
703
+ * Applies filters mixed the_seo_framework_term_meta_{field} : Override filter for specifics.
704
+ * Applies filters array the_seo_framework_term_meta : Override output for term or taxonomy.
705
+ *
706
+ * @since 2.1.8
707
+ *
708
+ * @deprecated silently.
709
+ * @since WordPress 4.4.0
710
+ * @since The SEO Framework 2.7.0
711
+ *
712
+ * @param object $term Database row object.
713
+ * @param string $taxonomy Taxonomy name that $term is part of.
714
+ * @return object $term Database row object.
715
+ */
716
+ public function get_term_filter( $term, $taxonomy ) {
717
+
718
+ //* Do nothing, if $term is not an object.
719
+ if ( ! is_object( $term ) )
720
+ return $term;
721
+
722
+ /**
723
+ * No need to process this data outside of the Terms' scope.
724
+ * @since 2.6.0
725
+ */
726
+ if ( false === is_admin() && false === is_archive() )
727
+ return $term;
728
+
729
+ /**
730
+ * No need to process this after the data has already been output.
731
+ * @since 2.6.0
732
+ */
733
+ if ( did_action( 'the_seo_framework_do_after_output' ) )
734
+ return $term;
735
+
736
+ /**
737
+ * Do nothing if called in the context of creating a term via an Ajax call to prevent data conflict.
738
+ * @since 2.1.8
739
+ *
740
+ * @since 2.6.0 delay did_action call as it's a heavy array call.
741
+ */
742
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX && did_action( 'wp_ajax_add-tag' ) )
743
+ return $term;
744
+
745
+ $db = get_option( 'autodescription-term-meta' );
746
+ $term_meta = isset( $db[$term->term_id] ) ? $db[$term->term_id] : array();
747
+
748
+ $term->admeta = wp_parse_args( $term_meta, $this->get_term_meta_defaults() );
749
+
750
+ //* Sanitize term meta
751
+ foreach ( $term->admeta as $field => $value ) {
752
+
753
+ /**
754
+ * Trim and sanitize the title beforehand.
755
+ * @since 2.5.0
756
+ */
757
+ if ( 'doctitle' === $field )
758
+ $value = trim( strip_tags( $value ) );
759
+
760
+ /**
761
+ * Trim and sanitize the description beforehand.
762
+ * @since 2.5.0
763
+ */
764
+ if ( 'description' === $field )
765
+ $value = $this->s_description( $value );
766
+
767
+ /**
768
+ * @param object $term The Term object.
769
+ * @param string $taxonomy The Taxonomy name.
770
+ */
771
+ $term->admeta[$field] = (string) apply_filters( "the_seo_framework_term_meta_{$field}", stripslashes( wp_kses_decode_entities( $value ) ), $term, $taxonomy );
772
+ }
773
+
774
+ /**
775
+ * @param object $term The Term object.
776
+ * @param array $taxonomy The Taxonomy name.
777
+ */
778
+ $term->admeta = (array) apply_filters( 'the_seo_framework_term_meta', $term->admeta, $term, $taxonomy );
779
+
780
+ return $term;
781
+ }
782
+
783
+ /**
784
+ * Adds The SEO Framework term meta data to functions that return multiple terms.
785
+ *
786
+ * @since 2.0.0
787
+ *
788
+ * @deprecated silently.
789
+ * @since WordPress 4.4.0
790
+ * @since The SEO Framework 2.7.0
791
+ *
792
+ * @param array $terms Database row objects.
793
+ * @param string $taxonomy Taxonomy name that $terms are part of.
794
+ * @return array $terms Database row objects.
795
+ */
796
+ public function get_terms_filter( array $terms, $taxonomy ) {
797
+
798
+ foreach ( $terms as $term )
799
+ $term = $this->get_term_filter( $term, $taxonomy );
800
+
801
+ return $terms;
802
+ }
803
+
804
+ /**
805
+ * Save taxonomy meta data.
806
+ * Fires when a user edits and saves a taxonomy.
807
+ *
808
+ * @since 2.1.8
809
+ *
810
+ * @deprecated silently.
811
+ * @since WordPress 4.4.0
812
+ * @since The SEO Framework 2.7.0
813
+ *
814
+ * @param integer $term_id Term ID.
815
+ * @param integer $tt_id Term Taxonomy ID.
816
+ * @return void Early on AJAX call.
817
+ */
818
+ public function taxonomy_seo_save( $term_id, $tt_id ) {
819
+
820
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
821
+ return;
822
+
823
+ $term_meta = (array) get_option( 'autodescription-term-meta' );
824
+
825
+ $term_meta[$term_id] = isset( $_POST['autodescription-meta'] ) ? (array) $_POST['autodescription-meta'] : array();
826
+
827
+ //* Pass through wp_kses if not super admin.
828
+ if ( ! current_user_can( 'unfiltered_html' ) && isset( $term_meta[$term_id]['archive_description'] ) )
829
+ $term_meta[$term_id]['archive_description'] = wp_kses( $term_meta[$term_id]['archive_description'] );
830
+
831
+ update_option( 'autodescription-term-meta', $term_meta );
832
+
833
+ }
834
+
835
+ /**
836
+ * Delete term meta data.
837
+ * Fires when a user deletes a term.
838
+ *
839
+ * @since 2.1.8
840
+ *
841
+ * @deprecated silently.
842
+ * @since WordPress 4.4.0
843
+ * @since The SEO Framework 2.7.0
844
+ *
845
+ * @param integer $term_id Term ID.
846
+ * @param integer $tt_id Taxonomy Term ID.
847
+ */
848
+ public function term_meta_delete( $term_id, $tt_id ) {
849
+
850
+ $term_meta = (array) get_option( 'autodescription-term-meta' );
851
+
852
+ unset( $term_meta[$term_id] );
853
+
854
+ update_option( 'autodescription-term-meta', (array) $term_meta );
855
+
856
+ }
857
+
858
+ /**
859
+ * Faster way of doing an in_array search compared to default PHP behavior.
860
+ * @NOTE only to show improvement with large arrays. Might slow down with small arrays.
861
+ * @NOTE can't do type checks. Always assume the comparing value is a string.
862
+ *
863
+ * @since 2.5.2
864
+ * @deprecated
865
+ * @since 2.7.0
866
+ *
867
+ * @param string|array $needle The needle(s) to search for
868
+ * @param array $array The single dimensional array to search in.
869
+ * @return bool true if value is in array.
870
+ */
871
+ public function in_array( $needle, $array ) {
872
+
873
+ $this->_deprecated_function( 'AutoDescription_Core::' . __FUNCTION__, '2.7.0', 'in_array()' );
874
+
875
+ $array = array_flip( $array );
876
+
877
+ if ( is_string( $needle ) ) {
878
+ if ( isset( $array[ $needle ] ) )
879
+ return true;
880
+ } elseif ( is_array( $needle ) ) {
881
+ foreach ( $needle as $str ) {
882
+ if ( isset( $array[ $str ] ) )
883
+ return true;
884
+ }
885
+ }
886
+
887
+ return false;
888
+ }
889
+
890
+ /**
891
+ * Fetches posts with exclude_local_search option on
892
+ *
893
+ * @since 2.1.7
894
+ * @since 2.7.0 Deprecated.
895
+ * @deprecated
896
+ *
897
+ * @return array Excluded Post IDs
898
+ */
899
+ public function exclude_search_ids() {
900
+
901
+ $this->_deprecated_function( 'AutoDescription_Search::' . __FUNCTION__, '2.7.0', 'AutoDescription_Search::get_excluded_search_ids()' );
902
+
903
+ return $this->get_excluded_search_ids();
904
+ }
905
  }
inc/deprecated/deprecated.php CHANGED
@@ -16,14 +16,79 @@
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
 
 
19
  /**
20
  * This file contains most functions that have been deprecated.
21
  *
22
  * @since 2.1.6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  *
24
- * Emptied.
25
- * @since 2.3.5 (~2.5 months later )
26
  *
27
- * Emptied.
28
- * @since 2.6.2 (~6 months later)
29
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
19
+ defined( 'ABSPATH' ) or die;
20
+
21
  /**
22
  * This file contains most functions that have been deprecated.
23
  *
24
  * @since 2.1.6
25
+ * @since 2.3.5 Emptied. (~2.5 months later )
26
+ * @since 2.6.2 Emptied. (~6 months later)
27
+ */
28
+
29
+ /**
30
+ * Fetch an option from The SEO Framework.
31
+ *
32
+ * @since 2.2.9
33
+ *
34
+ * @deprecated
35
+ * @since 2.7.0
36
+ *
37
+ * @param string $key Option name.
38
+ * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
39
+ * @return mixed The option value.
40
+ */
41
+ function tsf_get_option( $key, $use_cache = true ) {
42
+
43
+ $theseoframework = the_seo_framework();
44
+
45
+ if ( isset( $theseoframework ) )
46
+ $theseoframework->_deprecated_function( __FUNCTION__, '2.7.0', 'the_seo_framework_get_option()' );
47
+
48
+ return the_seo_framework_get_option( $key, $use_cache );
49
+ }
50
+
51
+ /**
52
+ * Fetch the The SEO Framework Options pagehook.
53
+ *
54
+ * @since 2.2.9
55
  *
56
+ * @deprecated
57
+ * @since 2.7.0
58
  *
59
+ * @return string|null The pagehook.
 
60
  */
61
+ function tsf_options_pagehook() {
62
+
63
+ $theseoframework = the_seo_framework();
64
+
65
+ if ( isset( $theseoframework ) )
66
+ $theseoframework->_deprecated_function( __FUNCTION__, '2.7.0', 'the_seo_framework_options_pagehook()' );
67
+
68
+ return the_seo_framework_options_pagehook();
69
+ }
70
+
71
+
72
+ /**
73
+ * Compare the WordPress version to the input one.
74
+ *
75
+ * @since 2.2.9
76
+ *
77
+ * @deprecated
78
+ * @since 2.7.0
79
+ *
80
+ * @param string $version The 3 point version compare
81
+ * @param string $compare The PHP comparison operator.
82
+ * @return bool true if Version passes comparison.
83
+ */
84
+ function tsf_wp_version( $version = '4.3.0', $compare = '>=' ) {
85
+
86
+ $theseoframework = the_seo_framework();
87
+
88
+ if ( isset( $theseoframework ) ) {
89
+ $theseoframework->_deprecated_function( __FUNCTION__, '2.7.0', 'AutoDescription_Detect::wp_version()' );
90
+ return $theseoframework->wp_version( $version, $compare );
91
+ }
92
+
93
+ return null;
94
+ }
inc/functions/benchmark.php DELETED
@@ -1,369 +0,0 @@
1
- <?php
2
-
3
- add_action( 'wp_head', 'the_seo_framework_php_benchmark', -1 );
4
- //* Benchmark PHP.
5
- function the_seo_framework_php_benchmark() {
6
-
7
- //* Boolean.
8
- $b = true;
9
- $ba = false;
10
-
11
- //* String.
12
- $s = '';
13
-
14
- //* Compare
15
- $c1 = 'thing1';
16
- $c4 = 'thing4';
17
- $c40 = 'thing40';
18
-
19
- //* Array 5
20
- $a5 = array( 'thing1', 'thing2', 'thing3', 'thing4', 'thing5' );
21
-
22
- //* Array 50
23
- $a50 = array( 'thing1','thing2','thing3','thing4','thing5','thing6','thing7','thing8','thing9','thing10','thing11','thing12','thing13','thing14','thing15','thing16','thing17','thing18','thing19','thing20','thing21','thing22','thing23','thing24','thing25','thing26','thing27','thing28','thing29','thing30','thing31','thing32','thing33','thing34','thing35','thing36','thing37','thing38','thing39','thing40','thing41','thing42','thing43','thing44','thing45','thing46','thing47','thing48','thing49','thing50' );
24
-
25
- //* Iterations
26
- $it = 10000000;
27
-
28
- //* Start the engines.
29
- $i = 0;
30
- $t = microtime(true);
31
- while ( $i < 10 ) {
32
- if ( $b ) {
33
- $a = $b;
34
- }
35
- if ( empty( $b ) ) {
36
- $a = $b;
37
- }
38
- if ( ! $b ) {
39
- $a = $b;
40
- }
41
- if ( isset( $b ) ) {
42
- $a = $b;
43
- }
44
- if ( the_seo_framework_is_empty_string( $b ) ) {
45
- $a = $b;
46
- }
47
- if ( in_array( $c1, $a5 ) ) {
48
- $a = $b;
49
- }
50
- if ( the_seo_framework_in_array( $c1, $a5 ) ) {
51
- $a = $b;
52
- }
53
- $i++;
54
- }
55
- $starttime = microtime(true) - $t;
56
-
57
- //* Loose
58
- $i = 0;
59
- $t = microtime(true);
60
- while ( $i < $it ) {
61
- if ( $b ) {
62
- // valuated
63
- }
64
- ++$i;
65
- }
66
- $loosetime = microtime(true) - $t;
67
-
68
- //* Strict
69
- $i = 0;
70
- $t = microtime(true);
71
- while ( $i < $it ) {
72
- if ( true === $b ) {
73
- // valuated
74
- }
75
- ++$i;
76
- }
77
- $stricttime = microtime(true) - $t;
78
-
79
- //* Strict Neg
80
- $i = 0;
81
- $t = microtime(true);
82
- while ( $i < $it ) {
83
- if ( true !== $b ) {
84
- // valuated
85
- }
86
- ++$i;
87
- }
88
- $strictnegtime = microtime(true) - $t;
89
-
90
- //* Empty
91
- $i = 0;
92
- $t = microtime(true);
93
- while ( $i < $it ) {
94
- if ( empty( $b ) ) {
95
- // valuated
96
- }
97
- ++$i;
98
- }
99
- $emptytime = microtime(true) - $t;
100
-
101
- //* Neg Empty
102
- $i = 0;
103
- $t = microtime(true);
104
- while( $i < $it ) {
105
- if ( ! empty( $b ) ) {
106
- // valuated
107
- }
108
- ++$i;
109
- }
110
- $negemptytime = microtime(true) - $t;
111
-
112
- //* False Empty
113
- $i = 0;
114
- $t = microtime(true);
115
- while( $i < $it ) {
116
- if ( false === empty( $b ) ) {
117
- // valuated
118
- }
119
- ++$i;
120
- }
121
- $strictemptytime = microtime(true) - $t;
122
-
123
- //* Isset
124
- $i = 0;
125
- $t = microtime(true);
126
- while( $i < $it ) {
127
- if ( isset( $b ) ) {
128
- // valuated
129
- }
130
- ++$i;
131
- }
132
- $issettime = microtime(true) - $t;
133
-
134
- //* Isset Strict
135
- $i = 0;
136
- $t = microtime(true);
137
- while( $i < $it ) {
138
- if ( true === isset( $b ) ) {
139
- // valuated
140
- }
141
- ++$i;
142
- }
143
- $issetstricttime = microtime(true) - $t;
144
-
145
- //* Loose Empty string
146
- $i = 0;
147
- $t = microtime(true);
148
- while( $i < $it ) {
149
- if ( $s ) {
150
- // valuated
151
- }
152
- ++$i;
153
- }
154
- $looseemptystring = microtime(true) - $t;
155
-
156
- //* Loose Neg Empty string
157
- $i = 0;
158
- $t = microtime(true);
159
- while( $i < $it ) {
160
- if ( ! $s ) {
161
- // valuated
162
- }
163
- ++$i;
164
- }
165
- $loosenegemptystring = microtime(true) - $t;
166
-
167
- //* Empty string
168
- $i = 0;
169
- $t = microtime(true);
170
- while( $i < $it ) {
171
- if ( empty( $s ) ) {
172
- // valuated
173
- }
174
- ++$i;
175
- }
176
- $emptystring = microtime(true) - $t;
177
-
178
- //* Empty string strict
179
- $i = 0;
180
- $t = microtime(true);
181
- while( $i < $it ) {
182
- if ( '' === $s ) {
183
- // valuated
184
- }
185
- ++$i;
186
- }
187
- $emptystrictstring = microtime(true) - $t;
188
-
189
- //* Empty string strict
190
- $i = 0;
191
- $t = microtime(true);
192
- while( $i < $it ) {
193
- if ( the_seo_framework_is_empty_string( $s ) ) {
194
- // valuated
195
- }
196
- ++$i;
197
- }
198
- $emptystrictfunctionstring = microtime(true) - $t;
199
-
200
- //* In array begin 5
201
- $i = 0;
202
- $t = microtime(true);
203
- while( $i < $it ) {
204
- if ( in_array( $c1, $a5 ) ) {
205
- // valuated
206
- }
207
- ++$i;
208
- }
209
- $inarraybegin5 = microtime(true) - $t;
210
-
211
- //* In array begin 5 function
212
- $i = 0;
213
- $t = microtime(true);
214
- while( $i < $it ) {
215
- if ( the_seo_framework_in_array( $c1, $a5 ) ) {
216
- // valuated
217
- }
218
- ++$i;
219
- }
220
- $inarraybegin5function = microtime(true) - $t;
221
-
222
-
223
- //* In array end 5
224
- $i = 0;
225
- $t = microtime(true);
226
- while( $i < $it ) {
227
- if ( in_array( $c4, $a5 ) ) {
228
- // valuated
229
- }
230
- ++$i;
231
- }
232
- $inarrayend5 = microtime(true) - $t;
233
-
234
- //* In array end 5 function
235
- $i = 0;
236
- $t = microtime(true);
237
- while( $i < $it ) {
238
- if ( the_seo_framework_in_array( $c4, $a5 ) ) {
239
- // valuated
240
- }
241
- ++$i;
242
- }
243
- $inarrayend5function = microtime(true) - $t;
244
-
245
- //* In array begin 50
246
- $i = 0;
247
- $t = microtime(true);
248
- while( $i < $it ) {
249
- if ( in_array( $c1, $a50 ) ) {
250
- // valuated
251
- }
252
- ++$i;
253
- }
254
- $inarraybegin50 = microtime(true) - $t;
255
-
256
- //* In array begin 50 function
257
- $i = 0;
258
- $t = microtime(true);
259
- while( $i < $it ) {
260
- if ( the_seo_framework_in_array( $c1, $a50 ) ) {
261
- // valuated
262
- }
263
- ++$i;
264
- }
265
- $inarraybegin50function = microtime(true) - $t;
266
-
267
-
268
- //* In array end 50
269
- $i = 0;
270
- $t = microtime(true);
271
- while( $i < $it ) {
272
- if ( in_array( $c40, $a50 ) ) {
273
- // valuated
274
- }
275
- ++$i;
276
- }
277
- $inarrayend50 = microtime(true) - $t;
278
-
279
- //* In array end 50 function
280
- $i = 0;
281
- $t = microtime(true);
282
- while( $i < $it ) {
283
- if ( the_seo_framework_in_array( $c40, $a5 ) ) {
284
- // valuated
285
- }
286
- ++$i;
287
- }
288
- $inarrayend50function = microtime(true) - $t;
289
-
290
- //* Strict false
291
- $i = 0;
292
- $t = microtime(true);
293
- while ( $i < $it ) {
294
- if ( false === $ba ) {
295
- // valuated
296
- }
297
- ++$i;
298
- }
299
- $strictfalsetime = microtime(true) - $t;
300
-
301
- //* Loose flip false
302
- $i = 0;
303
- $t = microtime(true);
304
- while ( $i < $it ) {
305
- if ( ! $ba ) {
306
- // valuated
307
- }
308
- ++$i;
309
- }
310
- $falsefliptime = microtime(true) - $t;
311
-
312
- //* PHP 7 FCGI results @ 10,000,000 iterations.
313
- echo 'Loose time: ' . $loosetime . " seconds\r\n"; // 0.1115360260009765625 seconds
314
- echo 'Strict time: ' . $stricttime . " seconds\r\n"; // 0.1202042102813720703125 seconds
315
- echo 'Strict Neg time: ' . $strictnegtime . " seconds\r\n"; // 0.1270349025726318359375 seconds
316
- echo 'Empty time: ' . $emptytime . " seconds\r\n"; // 0.1297409534454345703125 seconds
317
- echo 'Neg Empty time: ' . $negemptytime . " seconds\r\n"; // 0.20085906982421875 seconds <- Triple check
318
- echo 'Strict Neg Empty time: ' . $strictemptytime . " seconds\r\n"; // 0.18640804290771484375 seconds <- Double check
319
- echo 'Isset time: ' . $issettime . " seconds\r\n"; // 0.115377902984619140625 seconds
320
- echo 'Strict Isset time: ' . $issetstricttime . " seconds\r\n"; // 0.17035007476806640625 seconds <- Double check
321
-
322
- echo 'Strict False time: ' . $strictfalsetime . " seconds\r\n"; // 0.1211879253387451171875 seconds
323
- echo 'Loose Flip time: ' . $falsefliptime . " seconds\r\n"; // 0.1306369304656982421875 seconds
324
-
325
- echo "\r\n";
326
-
327
- echo 'Loose Empty String time: ' . $looseemptystring . " seconds\r\n"; // 0.1340930461883544921875 seconds
328
- echo 'Loose Neg Empty String time: ' . $loosenegemptystring . " seconds\r\n"; // 0.15882110595703125 seconds
329
- echo 'Empty String time: ' . $emptystring . " seconds\r\n"; // 0.135138034820556640625 seconds
330
- echo 'Strict Empty String time: ' . $emptystrictstring . " seconds\r\n"; // 0.1573431491851806640625 seconds
331
- echo 'Strict Empty Function String time: ' . $emptystrictfunctionstring . " seconds\r\n"; // 0.385016918182373046875 seconds <- Triple check.
332
-
333
- echo "\r\n";
334
-
335
- echo 'In array begin 5: ' . $inarraybegin5 . " seconds\r\n"; // 0.3640620708465576171875 seconds
336
- echo 'In array begin function 5: ' . $inarraybegin5function . " seconds\r\n"; // 2.0675928592681884765625 seconds <- VERY bad (1. function call, 2. array sorting. 3. Triple check)
337
- echo 'In array end 5: ' . $inarrayend5 . " seconds\r\n"; // 0.5424749851226806640625 seconds
338
- echo 'In array end function 5: ' . $inarrayend5function . " seconds\r\n"; // 2.0651528835296630859375 seconds <- VERY bad
339
-
340
- echo "\r\n";
341
-
342
- echo 'In array begin 50: ' . $inarraybegin50 . " seconds\r\n"; // 0.3695099353790283203125 seconds
343
- echo 'In array begin function 50: ' . $inarraybegin50function . " seconds\r\n"; // 8.4975330829620361328125 seconds <- VERY bad.
344
- echo 'In array end 50: ' . $inarrayend50 . " seconds\r\n"; // 2.392652988433837890625 seconds
345
- echo 'In array end function 50: ' . $inarrayend50function . " seconds\r\n"; // 2.004433155059814453125 seconds <- miniscule benefit.
346
-
347
- }
348
-
349
- function the_seo_framework_is_empty_string( $string ) {
350
- if ( '' === $string ) return true;
351
- return false;
352
- }
353
-
354
- function the_seo_framework_in_array( $needle, $array ) {
355
-
356
- $array = array_flip( $array );
357
-
358
- if ( is_string( $needle ) ) {
359
- if ( isset( $array[$needle] ) )
360
- return true;
361
- } else if ( is_array( $needle ) ) {
362
- foreach ( $needle as $str ) {
363
- if ( isset( $array[$str] ) )
364
- return true;
365
- }
366
- }
367
-
368
- return false;
369
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/functions/compat.php CHANGED
@@ -1,4 +1,7 @@
1
  <?php
 
 
 
2
  /**
3
  * Returns whether PCRE/u (PCRE_UTF8 modifier) is available for use.
4
  *
@@ -39,10 +42,9 @@ endif;
39
  * @uses strlen
40
  * @return mb_strlen
41
  *
42
- * @since 1.3.0
 
43
  *
44
- * Rewritten
45
- * @since 2.3.5
46
  */
47
  if ( ! function_exists( 'mb_strlen' ) ) :
48
  function mb_strlen( $str, $encoding = null ) {
@@ -102,74 +104,6 @@ if ( ! function_exists( '_mb_strlen' ) ) :
102
  }
103
  endif;
104
 
105
- /**
106
- * Extended charset support
107
- *
108
- * @uses substr
109
- * @return mb_substr
110
- *
111
- * @since 1.3.0
112
- *
113
- * Rewritten
114
- * @since 2.3.5
115
- */
116
- if ( ! function_exists( 'mb_substr' ) ) :
117
- function mb_substr( $str, $start, $length = null, $encoding = null ) {
118
- return _mb_substr( $str, $start, $length, $encoding );
119
- }
120
- endif;
121
-
122
- /*
123
- * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
124
- * For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
125
- * The behavior of this function for invalid inputs is undefined.
126
- */
127
- if ( ! function_exists( '_mb_substr' ) ) :
128
- function _mb_substr( $str, $start, $length = null, $encoding = null ) {
129
- if ( null === $encoding ) {
130
- $encoding = get_option( 'blog_charset' );
131
- }
132
-
133
- // The solution below works only for UTF-8,
134
- // so in case of a different charset just use built-in substr()
135
- if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
136
- return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length );
137
- }
138
-
139
- if ( _wp_can_use_pcre_u() ) {
140
- // Use the regex unicode support to separate the UTF-8 characters into an array
141
- preg_match_all( '/./us', $str, $match );
142
- $chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
143
- return implode( '', $chars );
144
- }
145
-
146
- $regex = '/(
147
- [\x00-\x7F] # single-byte sequences 0xxxxxxx
148
- | [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
149
- | \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2
150
- | [\xE1-\xEC][\x80-\xBF]{2}
151
- | \xED[\x80-\x9F][\x80-\xBF]
152
- | [\xEE-\xEF][\x80-\xBF]{2}
153
- | \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3
154
- | [\xF1-\xF3][\x80-\xBF]{3}
155
- | \xF4[\x80-\x8F][\x80-\xBF]{2}
156
- )/x';
157
-
158
- $chars = array( '' ); // Start with 1 element instead of 0 since the first thing we do is pop
159
- do {
160
- // We had some string left over from the last round, but we counted it in that last round.
161
- array_pop( $chars );
162
-
163
- // Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
164
- $pieces = preg_split( $regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
165
-
166
- $chars = array_merge( $chars, $pieces );
167
- } while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
168
-
169
- return join( '', array_slice( $chars, $start, $length ) );
170
- }
171
- endif;
172
-
173
  /**
174
  * Extended charset support
175
  *
@@ -196,7 +130,7 @@ endif;
196
  * For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
197
  * The behavior of this function for invalid inputs is PHP compliant.
198
  *
199
- * @since 4.5.0
200
  * @license GLPv2 or later
201
  *
202
  * @param string $haystack The string to search in.
@@ -357,3 +291,52 @@ if ( ! function_exists( '_mb_strpos' ) ) :
357
  }
358
  }
359
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+
3
+ defined( 'ABSPATH' ) or die;
4
+
5
  /**
6
  * Returns whether PCRE/u (PCRE_UTF8 modifier) is available for use.
7
  *
42
  * @uses strlen
43
  * @return mb_strlen
44
  *
45
+ * @since 1.3.0 The SEO Framework
46
+ * @since 4.2.0 WordPress Core
47
  *
 
 
48
  */
49
  if ( ! function_exists( 'mb_strlen' ) ) :
50
  function mb_strlen( $str, $encoding = null ) {
104
  }
105
  endif;
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * Extended charset support
109
  *
130
  * For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
131
  * The behavior of this function for invalid inputs is PHP compliant.
132
  *
133
+ * @since 2.2.0 The SEO Framework
134
  * @license GLPv2 or later
135
  *
136
  * @param string $haystack The string to search in.
291
  }
292
  }
293
  endif;
294
+
295
+ /**
296
+ * A wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7
297
+ *
298
+ * PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute url's, including
299
+ * schemeless and relative url's with :// in the path, this works around those
300
+ * limitations providing a standard output on PHP 5.2~5.4+.
301
+ *
302
+ * Error suppression is used as prior to PHP 5.3.3, an E_WARNING would be generated
303
+ * when URL parsing failed.
304
+ *
305
+ * @since 2.7.0 The SEO Framework
306
+ * @since 4.4.0 WordPress Core
307
+ *
308
+ * @param string $url The URL to parse.
309
+ * @return bool|array False on failure; Array of URL components on success;
310
+ * See parse_url()'s return values.
311
+ */
312
+ if ( ! function_exists( 'wp_parse_url' ) ) :
313
+ function wp_parse_url( $url ) {
314
+ $parts = @parse_url( $url );
315
+ if ( ! $parts ) {
316
+ // < PHP 5.4.7 compat, trouble with relative paths including a scheme break in the path
317
+ if ( '/' === $url[0] && false !== strpos( $url, '://' ) ) {
318
+ // Since we know it's a relative path, prefix with a scheme/host placeholder and try again
319
+ if ( ! $parts = @parse_url( 'placeholder://placeholder' . $url ) ) {
320
+ return $parts;
321
+ }
322
+ // Remove the placeholder values
323
+ unset( $parts['scheme'], $parts['host'] );
324
+ } else {
325
+ return $parts;
326
+ }
327
+ }
328
+
329
+ // < PHP 5.4.7 compat, doesn't detect schemeless URL's host field
330
+ if ( '//' === substr( $url, 0, 2 ) && ! isset( $parts['host'] ) ) {
331
+ $path_parts = explode( '/', substr( $parts['path'], 2 ), 2 );
332
+ $parts['host'] = $path_parts[0];
333
+ if ( isset( $path_parts[1] ) ) {
334
+ $parts['path'] = '/' . $path_parts[1];
335
+ } else {
336
+ unset( $parts['path'] );
337
+ }
338
+ }
339
+
340
+ return $parts;
341
+ }
342
+ endif;
inc/functions/optionsapi.php CHANGED
@@ -16,35 +16,62 @@
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
 
 
19
  /**
20
  * This file holds functions for easily extracting or interacting with data
21
  * from The SEO FrameWork.
22
  *
23
  * @since 2.2.5
24
- *
25
- * We could bombard it with every public function, but that's very time consuming.
26
- * I'll add a bunch of functions on 2nd dot (v.X.v) release. e.g. 2.3.0, 2.4.0, etc.
27
- *
28
- * This will allow version comparing more easily (as you'll know how many users
29
- * use v.X version through the WordPress plugin stats.).
30
- * Therefore reducing work for you.
31
  */
32
 
33
  /**
34
- * Load the class from cache.
35
  * This is recommended using this above using 'new The_SEO_Framework_Load();'
36
  * It also checks if the class is callable in the first place.
37
  *
38
  * @since 2.2.5
 
 
39
  */
40
  function the_seo_framework() {
41
  return the_seo_framework_init();
42
  }
43
 
44
  /**
45
- * The SEO FrameWork version number
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  *
47
- * Useful for version comparing
 
 
 
 
 
 
 
 
48
  *
49
  * @since 2.2.5
50
  *
@@ -59,13 +86,12 @@ function the_seo_framework_version() {
59
  }
60
 
61
  /**
62
- * The SEO Framework dot version compare.
63
- *
64
- * @param string version The two dot version: x.v
65
  *
66
  * @since 2.4.0
67
  *
68
- * @return bool False plugin inactive or version compare fails.
 
69
  */
70
  function the_seo_framework_dot_version( $version = '2.4' ) {
71
 
@@ -82,51 +108,21 @@ function the_seo_framework_dot_version( $version = '2.4' ) {
82
  if ( 3 !== $current_version_len )
83
  $current_version = substr( $current_version, 0, 3 );
84
 
85
- if ( $current_version_len === $verion )
86
  return true;
87
  }
88
 
89
  return false;
90
  }
91
 
92
- /**
93
- * Check if The SEO FrameWork is active based on global filter.
94
- *
95
- * @since 2.2.5
96
- *
97
- * @return bool true if SEO framework is active
98
- */
99
- function the_seo_framework_active() {
100
- return the_seo_framework_load();
101
- }
102
-
103
- /**
104
- * Compare the WordPress version to the input one.
105
- *
106
- * @since 2.2.9
107
- *
108
- * @param string $version The 3 point version compare
109
- * @param string $compare The PHP comparison operator.
110
- *
111
- * @return bool true if Version passes comparison.
112
- */
113
- function tsf_wp_version( $version = '4.3.0', $compare = '>=' ) {
114
- $theseoframework = the_seo_framework();
115
-
116
- if ( isset( $theseoframework ) )
117
- return $theseoframework->wp_version( $version, $compare );
118
-
119
- return null;
120
- }
121
-
122
  /**
123
  * Fetch the The SEO Framework Options pagehook.
124
  *
125
- * @since 2.2.9
126
  *
127
  * @return string|null The pagehook.
128
  */
129
- function tsf_options_pagehook() {
130
 
131
  $theseoframework = the_seo_framework();
132
 
@@ -136,17 +132,17 @@ function tsf_options_pagehook() {
136
  return null;
137
  }
138
 
 
139
  /**
140
  * Fetch an option from The SEO Framework.
141
  *
142
- * @since 2.2.9
143
  *
144
- * @param string $key Option name.
145
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
146
- *
147
  * @return mixed The option value.
148
  */
149
- function tsf_get_option( $key, $use_cache = true ) {
150
 
151
  $theseoframework = the_seo_framework();
152
 
@@ -159,10 +155,9 @@ function tsf_get_option( $key, $use_cache = true ) {
159
  /**
160
  * Fetch title from cache. Only works within Loop.
161
  *
162
- * @param string|null $title the previous title
163
- *
164
  * @since 2.4.2
165
  *
 
166
  * @return string|null The current page title.
167
  */
168
  function the_seo_framework_title_from_cache( $title = null ) {
@@ -178,10 +173,9 @@ function the_seo_framework_title_from_cache( $title = null ) {
178
  /**
179
  * Fetch description from cache. Only works within Loop.
180
  *
181
- * @param bool $social Fetch social description.
182
- *
183
  * @since 2.4.2
184
  *
 
185
  * @return string|null The current page description.
186
  */
187
  function the_seo_framework_description_from_cache( $social = false ) {
@@ -215,6 +209,7 @@ function the_seo_framework_the_url_from_cache() {
215
  * Whether we're on the SEO settings page.
216
  *
217
  * @since 2.6.0
 
218
  *
219
  * @return bool
220
  */
@@ -223,7 +218,41 @@ function the_seo_framework_is_settings_page() {
223
  $theseoframework = the_seo_framework();
224
 
225
  if ( isset( $theseoframework ) )
226
- return $theseoframework->is_seo_settings_page();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
  return false;
229
  }
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
19
+ defined( 'ABSPATH' ) or die;
20
+
21
  /**
22
  * This file holds functions for easily extracting or interacting with data
23
  * from The SEO FrameWork.
24
  *
25
  * @since 2.2.5
 
 
 
 
 
 
 
26
  */
27
 
28
  /**
29
+ * Loads the class from cache.
30
  * This is recommended using this above using 'new The_SEO_Framework_Load();'
31
  * It also checks if the class is callable in the first place.
32
  *
33
  * @since 2.2.5
34
+ *
35
+ * @return object The SEO Framework Facade class.
36
  */
37
  function the_seo_framework() {
38
  return the_seo_framework_init();
39
  }
40
 
41
  /**
42
+ * Returns the facade class name from cache.
43
+ *
44
+ * CAUTION: If this is used before plugins_loaded priority 5, then the plugin
45
+ * will fail to load views.
46
+ *
47
+ * @since 2.7.0
48
+ *
49
+ * @return string The SEO Framework class name.
50
+ */
51
+ function the_seo_framework_class() {
52
+
53
+ static $class = null;
54
+
55
+ if ( isset( $class ) )
56
+ return $class;
57
+
58
+ return $class = get_class( the_seo_framework() );
59
+ }
60
+
61
+ /**
62
+ * Checks if The SEO FrameWork is active based on filter.
63
+ *
64
+ * @since 2.2.5
65
  *
66
+ * @return bool true if SEO framework is active
67
+ */
68
+ function the_seo_framework_active() {
69
+ return the_seo_framework_load();
70
+ }
71
+
72
+ /**
73
+ * Returns The SEO FrameWork version number.
74
+ * Useful for version comparing.
75
  *
76
  * @since 2.2.5
77
  *
86
  }
87
 
88
  /**
89
+ * Compares The SEO Framework dot versions.
 
 
90
  *
91
  * @since 2.4.0
92
  *
93
+ * @param string version The two dot version: x.v
94
+ * @return bool False plugin inactive or version compare yields negative results.
95
  */
96
  function the_seo_framework_dot_version( $version = '2.4' ) {
97
 
108
  if ( 3 !== $current_version_len )
109
  $current_version = substr( $current_version, 0, 3 );
110
 
111
+ if ( $current_version === $version )
112
  return true;
113
  }
114
 
115
  return false;
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  /**
119
  * Fetch the The SEO Framework Options pagehook.
120
  *
121
+ * @since 2.7.0
122
  *
123
  * @return string|null The pagehook.
124
  */
125
+ function the_seo_framework_options_pagehook() {
126
 
127
  $theseoframework = the_seo_framework();
128
 
132
  return null;
133
  }
134
 
135
+
136
  /**
137
  * Fetch an option from The SEO Framework.
138
  *
139
+ * @since 2.7.0
140
  *
141
+ * @param string $key Option name.
142
  * @param boolean $use_cache Optional. Whether to use the cache value or not. Defaults to true.
 
143
  * @return mixed The option value.
144
  */
145
+ function the_seo_framework_get_option() {
146
 
147
  $theseoframework = the_seo_framework();
148
 
155
  /**
156
  * Fetch title from cache. Only works within Loop.
157
  *
 
 
158
  * @since 2.4.2
159
  *
160
+ * @param string|null $title the previous title
161
  * @return string|null The current page title.
162
  */
163
  function the_seo_framework_title_from_cache( $title = null ) {
173
  /**
174
  * Fetch description from cache. Only works within Loop.
175
  *
 
 
176
  * @since 2.4.2
177
  *
178
+ * @param bool $social Fetch social description.
179
  * @return string|null The current page description.
180
  */
181
  function the_seo_framework_description_from_cache( $social = false ) {
209
  * Whether we're on the SEO settings page.
210
  *
211
  * @since 2.6.0
212
+ * @since 2.7.0 No longer checks for $_GET requests. Only uses global $pagehook.
213
  *
214
  * @return bool
215
  */
218
  $theseoframework = the_seo_framework();
219
 
220
  if ( isset( $theseoframework ) )
221
+ return $theseoframework->is_seo_settings_page( true );
222
+
223
+ return false;
224
+ }
225
+
226
+ /**
227
+ * Updates The SEO Framework site options.
228
+ *
229
+ * @since 2.7.0
230
+ *
231
+ * @return bool True on success. False on failure.
232
+ */
233
+ function the_seo_framework_update_option( $new_option ) {
234
+
235
+ $theseoframework = the_seo_framework();
236
+
237
+ if ( isset( $theseoframework ) )
238
+ return $theseoframework->update_settings( $new_option );
239
+
240
+ return false;
241
+ }
242
+
243
+ /**
244
+ * Returns the parent slug name of The SEO Framework plugin.
245
+ *
246
+ * @since 2.7.0
247
+ *
248
+ * @return bool|string False on failure, the slug on success.
249
+ */
250
+ function the_seo_framework_options_page_slug() {
251
+
252
+ $theseoframework = the_seo_framework();
253
+
254
+ if ( isset( $theseoframework ) )
255
+ return $theseoframework->seo_settings_page_slug;
256
 
257
  return false;
258
  }
inc/functions/upgrade.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The SEO Framework plugin
4
+ * Copyright (C) 2015 - 2016 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License version 3 as published
8
+ * by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ defined( 'ABSPATH' ) or die;
20
+
21
+ /**
22
+ * This file holds functions for upgrading the plugin.
23
+ * This file will only be called ONCE if the required version option is lower
24
+ * compared to The SEO Framework version constant.
25
+ *
26
+ * @since 2.7.0
27
+ * @access private
28
+ */
29
+
30
+ add_action( 'admin_init', 'the_seo_framework_do_upgrade', 20 );
31
+ /**
32
+ * Upgrade The SEO Framework to the latest version.
33
+ *
34
+ * Does an iteration of upgrades in order of upgrade appearance.
35
+ * Each called function will upgrade the version by its iteration.
36
+ *
37
+ * Only works on WordPress 4.4 and later to ensure and force maximum compatibility.
38
+ *
39
+ * @since 2.7.0
40
+ * @global int $wp_db_version
41
+ *
42
+ * @thanks StudioPress for some code.
43
+ */
44
+ function the_seo_framework_do_upgrade() {
45
+
46
+ if ( get_option( 'the_seo_framework_upgraded_db_version' ) >= THE_SEO_FRAMEWORK_DB_VERSION )
47
+ return;
48
+
49
+ if ( ! the_seo_framework()->wp_version( '4.4', '>=' ) )
50
+ return;
51
+
52
+ global $wp_db_version;
53
+
54
+ //* If the WordPress Database hasn't been upgraded yet, make the user upgrade first.
55
+ if ( (int) get_option( 'db_version' ) !== $wp_db_version ) {
56
+ wp_safe_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
57
+ exit;
58
+ }
59
+
60
+ if ( get_option( 'the_seo_framework_upgraded_db_version' ) < '2701' )
61
+ the_seo_framework_do_upgrade_2701();
62
+
63
+ do_action( 'the_seo_framework_upgraded' );
64
+ }
65
+
66
+ add_action( 'the_seo_framework_upgraded', 'the_seo_framework_upgrade_to_current' );
67
+ /**
68
+ * Upgrades the Database version to the latest version if all iterations have been
69
+ * executed. This ensure this file will no longer be required.
70
+ * This should run once after every plugin update.
71
+ *
72
+ * @since 2.7.0
73
+ */
74
+ function the_seo_framework_upgrade_to_current() {
75
+ update_option( 'the_seo_framework_upgraded_db_version', THE_SEO_FRAMEWORK_DB_VERSION );
76
+ }
77
+
78
+ /**
79
+ * Upgrades term metadata for version 2701.
80
+ *
81
+ * @since 2.7.0
82
+ */
83
+ function the_seo_framework_do_upgrade_2701() {
84
+
85
+ $term_meta = get_option( 'autodescription-term-meta' );
86
+
87
+ foreach ( (array) $term_meta as $term_id => $meta ) {
88
+ add_term_meta( $term_id, THE_SEO_FRAMEWORK_TERM_OPTIONS, $meta, true );
89
+ }
90
+
91
+ update_option( 'the_seo_framework_upgraded_db_version', '2701' );
92
+ }
93
+
94
+ /**
95
+ * Removes term metadata for version 2800
96
+ *
97
+ * @since 2.8.0
98
+ * @TODO planned.
99
+ */
100
+ function the_seo_framework_do_upgrade_2800() {
101
+
102
+ //* Delete old values from database. Removes backwards compatibility.
103
+ // delete_option( 'autodescription-term-meta' );
104
+
105
+ //* Set this as upgrade notice:
106
+ // = 2.8.0 =
107
+ // This version deletes all old style metadata values. This removes backwards term meta data compatibility with The SEO Framework 2.6.5.2 or lower.
108
+
109
+ // update_option( 'the_seo_framework_upgraded_db_version', '2800' );
110
+ }
inc/views/debug/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ //* We often discover what will do, by finding out what will not do; and probably he who never made a mistake never made a discovery - Samuel Smiles
inc/views/debug/output.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ if ( $this->debug_output ) {
6
+ if ( $this->the_seo_framework_debug_hidden ) {
7
+ echo "\r\n<!--\r\n:: THE SEO FRAMEWORK DEBUG :: \r\n" . $this->debug_output . "\r\n:: / THE SEO FRAMEWORK DEBUG ::\r\n-->\r\n";
8
+ } else {
9
+
10
+ $id = $this->get_the_real_ID();
11
+ $mdash = ' &mdash; ';
12
+ $term = $this->is_archive() ? $this->fetch_the_term( $id ) : '';
13
+ $taxonomy = isset( $term->taxonomy ) ? $term->taxonomy : '';
14
+
15
+ //* This will return 'Page' on all non-archive types (except the home page)
16
+ $type = ! $this->is_archive() && $this->is_front_page( $id ) ? 'Front Page' : $this->get_the_term_name( $term );
17
+ $cache_key = $this->generate_cache_key( $this->get_the_real_ID(), $taxonomy );
18
+
19
+ if ( $this->is_admin() ) {
20
+ ?>
21
+ <div style="color:#444;font-family:Georgio,sans-serif;font-size:14px;clear:both;float:left;position:relative;width:calc( 100% - 200px );min-height:700px;padding:0;margin:20px 20px 40px 180px;overflow:hidden;border:1px solid #ccc;border-radius:3px;line-height:18px">
22
+ <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom:2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">
23
+ SEO Debug Information
24
+ <?php
25
+ if ( $this->is_post_edit() || $this->is_term_edit() ) :
26
+ echo ' :: ';
27
+ echo 'Type: ' . esc_html( $type );
28
+ echo $mdash . 'ID: ' . esc_html( $id );
29
+ echo $mdash . 'Cache key: ' . esc_html( $cache_key );
30
+ endif;
31
+ ?>
32
+ </h3>
33
+ <div style="position:absolute;bottom:0;right:0;left:0;top:39px;margin:0;padding:0;background:#fff;border-radius:3px;overflow-x:hidden;z-index:9001">
34
+ <?php echo $this->debug_header_output(); ?>
35
+ <?php echo $this->debug_query_output(); ?>
36
+ <?php echo $this->debug_output; ?>
37
+ </div>
38
+ </div>
39
+ <?php
40
+ } else {
41
+ ?>
42
+ <style type="text/css">.wp-ui-notification{color:#fff;background-color:#d54e21}.code.highlight{font-family:Consolas,Monaco,monospace;font-size:14px;}.theseoframework-debug h3{font-size:18px;margin:18px 0}</style>
43
+ <div class="theseoframework-debug" style="color:#444;font-family:Georgio,sans-serif;font-size:14px;clear:both;float:left;position:relative;width:calc( 100% - 80px );min-height:700px;padding:0;margin:40px;overflow:hidden;border:1px solid #ccc;border-radius:3px;line-height:18px">
44
+ <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom:2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px">
45
+ SEO Debug Information
46
+ <?php
47
+ echo ' :: ';
48
+ echo 'Type: ' . esc_html( $type );
49
+ echo $mdash . 'ID: ' . esc_html( $id );
50
+ echo $mdash . 'Cache key: ' . esc_html( $cache_key );
51
+ ?>
52
+ </h3>
53
+ <div style="position:absolute;bottom:0;right:0;left:0;top:39px;margin:0;padding:0;background:#fff;border-radius:3px;overflow-x:hidden;z-index:9001">
54
+ <?php echo $this->debug_header_output(); ?>
55
+ <?php echo $this->debug_query_output(); ?>
56
+ <?php echo $this->debug_output; ?>
57
+ </div>
58
+ </div>
59
+ <?php
60
+ }
61
+ }
62
+ }
inc/views/index.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Human nature is like whirling water. If a breach is made to the east, it flows to the east; if a breach is made to the west, it flows west.
4
+ * And just as water does not discern between east and west, so man's nature is indifferent to good or bad.
5
+ * It is true that water will flow indifferently to east and west, but will it flow equally well up and down?
6
+ * Human nature is disposed toward goodness, just as water tends to flow downwards.
7
+ * There is no water but flows downwards, and no man but shows his tendency to be good.
8
+ * Now, by striking water hard, you may splash it higher than your forehead, and by damming it, you may make it go uphill.
9
+ * But, is that the nature of water? It is external force that causes it to do so.
10
+ * Likewise, if a man is made to do what is not good, his nature is being similarly forced.
11
+ *
12
+ * - 孟子
13
+ */
inc/views/metaboxes/description-metabox.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_description_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_description_metabox_main' :
10
+
11
+ $blogname = $this->escape_description( $this->get_blogname() );
12
+ $sep = $this->get_separator( 'description' );
13
+
14
+ /**
15
+ * Generate example.
16
+ */
17
+ $page_title = $this->escape_description( __( 'Example Title', 'autodescription' ) );
18
+ $on = $this->escape_description( _x( 'on', 'Placement. e.g. Post Title "on" Blog Name', 'autodescription' ) );
19
+ $excerpt = $this->escape_description( __( 'This is an example description...', 'autodescription' ) );
20
+
21
+ //* Put it together.
22
+ $example = '<span id="tsf-description-additions-js">'
23
+ . $page_title
24
+ . '<span id="tsf-on-blogname-js">' . " $on " . $blogname . '</span>'
25
+ . '<span id="autodescription-descsep-js">' . " $sep " . '</span>'
26
+ . '</span>'
27
+ . $excerpt
28
+ ;
29
+
30
+ $nojs_additions = '';
31
+ //* Add or remove additions based on option.
32
+ if ( $this->add_description_additions() ) {
33
+ $description_blogname_additions = $this->get_option( 'description_blogname' );
34
+
35
+ $nojs_additions = $description_blogname_additions ? $page_title . " $on " . $blogname : $page_title;
36
+ $nojs_additions = $nojs_additions . " $sep ";
37
+ }
38
+
39
+ $example_nojs = $nojs_additions . $excerpt;
40
+
41
+ ?><h4><?php printf( esc_html__( 'Automated Description Settings', 'autodescription' ) ); ?></h4><?php
42
+ $this->description( __( 'The meta description can be used to determine the text used under the title on Search Engine results pages.', 'autodescription' ) );
43
+
44
+ ?>
45
+ <h4><?php esc_html_e( 'Example Automated Description Output', 'autodescription' ); ?></h4>
46
+ <p class="hide-if-no-js"><?php echo $this->code_wrap_noesc( $example ); ?></p>
47
+ <p class="hide-if-js"><?php echo $this->code_wrap( $example_nojs ); ?></p>
48
+
49
+ <hr>
50
+ <?php
51
+
52
+ /**
53
+ * Parse tabs content.
54
+ *
55
+ * @since 2.6.0
56
+ *
57
+ * @param array $default_tabs { 'id' = The identifier =>
58
+ * array(
59
+ * 'name' => The name
60
+ * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
61
+ * 'dashicon' => Desired dashicon
62
+ * )
63
+ * }
64
+ */
65
+ $default_tabs = array(
66
+ 'general' => array(
67
+ 'name' => esc_html__( 'General', 'autodescription' ),
68
+ 'callback' => array( $this, 'description_metabox_general_tab' ),
69
+ 'dashicon' => 'admin-generic',
70
+ ),
71
+ 'additions' => array(
72
+ 'name' => esc_html__( 'Additions', 'autodescription' ),
73
+ 'callback' => array( $this, 'description_metabox_additions_tab' ),
74
+ 'dashicon' => 'plus',
75
+ ),
76
+ );
77
+
78
+ /**
79
+ * Applies filters the_seo_framework_description_settings_tabs : array see $default_tabs
80
+ * @since 2.6.0
81
+ *
82
+ * Used to extend Description tabs.
83
+ */
84
+ $defaults = (array) apply_filters( 'the_seo_framework_description_settings_tabs', $default_tabs, $args );
85
+
86
+ $tabs = wp_parse_args( $args, $defaults );
87
+
88
+ $this->nav_tab_wrapper( 'description', $tabs, '2.6.0' );
89
+ break;
90
+
91
+ case 'the_seo_framework_description_metabox_general' :
92
+
93
+ //* Let's use the same separators as for the title.
94
+ $description_separator = $this->get_separator_list();
95
+ $sep_option = $this->get_option( 'description_separator' );
96
+ $sep_option = $sep_option ? $sep_option : 'pipe';
97
+
98
+ $recommended = ' class="tsf-recommended" title="' . esc_attr__( 'Recommended', 'autodescription' ) . '"';
99
+
100
+ ?>
101
+ <fieldset>
102
+ <legend><h4><?php esc_html_e( 'Description Excerpt Separator', 'autodescription' ); ?></h4></legend>
103
+ <p id="tsf-description-separator" class="tsf-fields">
104
+ <?php foreach ( $description_separator as $name => $html ) { ?>
105
+ <input type="radio" name="<?php $this->field_name( 'description_separator' ); ?>" id="<?php $this->field_id( 'description_separator' . $name ); ?>" value="<?php echo $name ?>" <?php checked( $sep_option, $name ); ?> />
106
+ <label for="<?php $this->field_id( 'description_separator' . $name ); ?>" <?php echo ( 'pipe' === $name || 'dash' === $name ) ? $recommended : ''; ?>><?php echo $html ?></label>
107
+ <?php } ?>
108
+ </p>
109
+ <span class="description"><?php esc_html_e( 'If the Automated Description consists of two parts (title and excerpt), then the separator will go in-between them.', 'autodescription' ); ?></span>
110
+ </fieldset>
111
+ <?php
112
+ break;
113
+
114
+ case 'the_seo_framework_description_metabox_additions' :
115
+
116
+ $language = $this->google_language();
117
+ $google_explanation = esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#1' );
118
+
119
+ ?>
120
+ <h4><?php esc_html_e( 'Description Additions Settings', 'autodescription' ); ?></h4>
121
+ <?php
122
+ $this->description( __( 'To create a more organic description, a small introduction can be added before the description.', 'autodescription' ) );
123
+ $this->description( __( 'The introduction consists of the title and optionally the blogname.', 'autodescription' ) );
124
+ ?>
125
+
126
+ <hr>
127
+
128
+ <h4><?php esc_html_e( 'Add descriptive Additions to Description', 'autodescription' ); ?></h4>
129
+ <p id="tsf-description-additions-toggle">
130
+ <label for="<?php $this->field_id( 'description_additions' ); ?>" class="tsf-toblock">
131
+ <input type="checkbox" name="<?php $this->field_name( 'description_additions' ); ?>" id="<?php $this->field_id( 'description_additions' ); ?>" <?php $this->is_conditional_checked( 'description_additions' ); ?> value="1" <?php checked( $this->get_field_value( 'description_additions' ) ); ?> />
132
+ <?php esc_html_e( 'Add Additions to automated description?', 'autodescription' ); ?>
133
+ <a href="<?php echo esc_url( $google_explanation ); ?>" target="_blank" class="description" title="<?php esc_attr_e( 'This creates good meta descriptions', 'autodescription' ); ?>">[?]</a>
134
+ </label>
135
+ </p>
136
+
137
+ <h4><?php esc_html_e( 'Add Blogname to Additions', 'autodescription' ); ?></h4>
138
+ <p id="tsf-description-onblogname-toggle">
139
+ <label for="<?php $this->field_id( 'description_blogname' ); ?>" class="tsf-toblock">
140
+ <input type="checkbox" name="<?php $this->field_name( 'description_blogname' ); ?>" id="<?php $this->field_id( 'description_blogname' ); ?>" <?php $this->is_conditional_checked( 'description_blogname' ); ?> value="1" <?php checked( $this->get_field_value( 'description_blogname' ) ); ?> />
141
+ <?php esc_html_e( 'Add Blogname to automated description additions?', 'autodescription' ); ?>
142
+ </label>
143
+ </p>
144
+ <?php
145
+ break;
146
+
147
+ default :
148
+ break;
149
+ endswitch;
inc/views/metaboxes/feed-metabox.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_feed_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_feed_metabox_main' :
10
+ ?><h4><?php esc_html_e( 'Content Feed Settings', 'autodescription' ); ?></h4><?php
11
+ $this->description( __( "Sometimes, your content can get stolen by robots through the WordPress feeds. This can cause duplicate content issues. To prevent this from happening, it's recommended to convert the feed's content into an excerpt.", 'autodescription' ) );
12
+ $this->description( __( "Adding a backlink below the feed's content will also let the visitors know where the content came from.", 'autodescription' ) );
13
+
14
+ ?>
15
+ <hr>
16
+
17
+ <h4><?php esc_html_e( 'Change Feed Settings', 'autodescription' ); ?></h4>
18
+ <?php
19
+ $excerpt_the_feed_label = esc_html__( 'Convert feed content into excerpts?', 'autodescription' );
20
+ $excerpt_the_feed_label .= ' ' . $this->make_info( __( 'By default the excerpt will be at most 400 characters long', 'autodescription' ), '', false );
21
+
22
+ $source_the_feed_label = esc_html__( 'Add backlinks below the feed content?', 'autodescription' );
23
+ $source_the_feed_label .= ' ' . $this->make_info( __( 'This link will not be followed by Search Engines', 'autodescription' ), '', false );
24
+
25
+ //* Echo checkboxes.
26
+ $this->wrap_fields(
27
+ array(
28
+ $this->make_checkbox( 'excerpt_the_feed', $excerpt_the_feed_label, '', false ),
29
+ $this->make_checkbox( 'source_the_feed', $source_the_feed_label, '', false ),
30
+ ), true
31
+ );
32
+
33
+ if ( $this->rss_uses_excerpt() ) {
34
+ $reading_settings_url = admin_url( 'options-reading.php' );
35
+ $reading_settings_title = __( 'Reading Settings', 'autodescription' );
36
+ $reading_settings = '<a href="' . esc_url( $reading_settings_url ) . '" target="_blank" title="' . esc_attr( $reading_settings_title ) . '">' . esc_html( $reading_settings_title ) . '</a>';
37
+
38
+ $this->description_noesc( sprintf( esc_html_x( 'Note: The feed is already converted into an excerpt (summary) through the %s.', '%s = Reading Settings', 'autodescription' ), $reading_settings ) );
39
+ }
40
+
41
+ $feed_url = get_feed_link();
42
+ $here = '<a href="' . esc_url( $feed_url ) . '" target="_blank" title="' . esc_attr__( 'View feed', 'autodescription' ) . '">' . esc_html_x( 'here', 'The feed can be found %s.', 'autodescription' ) . '</a>';
43
+
44
+ $this->description_noesc( sprintf( esc_html_x( 'The feed can be found %s.', '%s = here', 'autodescription' ), $here ) );
45
+ break;
46
+
47
+ default :
48
+ break;
49
+ endswitch;
inc/views/metaboxes/homepage-metabox.php ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_homepage_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_homepage_metabox_main' :
10
+
11
+ $this->description( __( 'These settings will take precedence over the settings set within the Home Page edit screen, if any.', 'autodescription' ) );
12
+
13
+ ?><hr><?php
14
+
15
+ /**
16
+ * Parse tabs content.
17
+ *
18
+ * @since 2.6.0
19
+ *
20
+ * @param array $default_tabs { 'id' = The identifier =>
21
+ * array(
22
+ * 'name' => The name
23
+ * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
24
+ * 'dashicon' => Desired dashicon
25
+ * )
26
+ * }
27
+ */
28
+ $default_tabs = array(
29
+ 'general' => array(
30
+ 'name' => __( 'General', 'autodescription' ),
31
+ 'callback' => array( $this, 'homepage_metabox_general_tab' ),
32
+ 'dashicon' => 'admin-generic',
33
+ ),
34
+ 'additions' => array(
35
+ 'name' => __( 'Additions', 'autodescription' ),
36
+ 'callback' => array( $this, 'homepage_metabox_additions_tab' ),
37
+ 'dashicon' => 'plus',
38
+ ),
39
+ 'robots' => array(
40
+ 'name' => __( 'Robots', 'autodescription' ),
41
+ 'callback' => array( $this, 'homepage_metabox_robots_tab' ),
42
+ 'dashicon' => 'visibility',
43
+ ),
44
+ );
45
+
46
+ /**
47
+ * Applies filters the_seo_framework_homepage_settings_tabs : array see $default_tabs
48
+ * @since 2.6.0
49
+ * Used to extend HomePage tabs.
50
+ */
51
+ $defaults = (array) apply_filters( 'the_seo_framework_homepage_settings_tabs', $default_tabs, $args );
52
+
53
+ $tabs = wp_parse_args( $args, $defaults );
54
+
55
+ $this->nav_tab_wrapper( 'homepage', $tabs, '2.6.0' );
56
+ break;
57
+
58
+ case 'the_seo_framework_homepage_metabox_general' :
59
+
60
+ $language = $this->google_language();
61
+
62
+ $page_on_front = $this->has_page_on_front();
63
+ $home_description_frompost = false;
64
+
65
+ $description_from_post_message = '';
66
+ $title_from_post_message = '';
67
+
68
+ $title_i18n = esc_html__( 'Title', 'autodescription' );
69
+ $description_i18n = esc_html__( 'Description', 'autodescription' );
70
+ $home_page_i18n = esc_html__( 'Home Page', 'autodescription' );
71
+
72
+ $home_id = $this->get_the_front_page_ID();
73
+ $home_title = $this->escape_title( $this->get_option( 'homepage_title' ) );
74
+ $blog_description = $this->get_blogdescription();
75
+
76
+ /**
77
+ * Home Page Tagline settings.
78
+ * @since 2.3.8
79
+ *
80
+ * @param string $home_tagline The tagline option.
81
+ * @param string $home_tagline_placeholder The option placeholder. Always defaults to description.
82
+ * @param string|void $home_tagline_value The tagline input value.
83
+ * @param string $blog_description Override blog description with option if applicable.
84
+ */
85
+ $home_tagline = $this->get_field_value( 'homepage_title_tagline' );
86
+ $home_tagline_placeholder = $blog_description;
87
+ $home_tagline_value = $home_tagline ? $home_tagline : '';
88
+ $blog_description = $home_tagline_value ? $home_tagline_value : $blog_description;
89
+
90
+ /**
91
+ * Create a placeholder for when there's no custom HomePage title found.
92
+ * @since 2.2.4
93
+ */
94
+ $home_title_args = $this->generate_home_title( true, '', '', true, false );
95
+ if ( $this->home_page_add_title_tagline() )
96
+ $home_title_placeholder = $this->process_title_additions( $home_title_args['blogname'], $home_title_args['title'], $home_title_args['seplocation'] );
97
+ else
98
+ $home_title_placeholder = $home_title_args['title'];
99
+
100
+ /**
101
+ * If the home title is fetched from the post, notify about that instead.
102
+ * @since 2.2.4
103
+ *
104
+ * Nesting often used translations
105
+ */
106
+ if ( empty( $home_title ) && $page_on_front && $this->get_custom_field( '_genesis_title', $home_id ) ) {
107
+ /* translators: 1: Option, 2: Page SEO Settings, 3: Home Page */
108
+ $title_from_post_message = sprintf( __( 'Note: The %1$s is fetched from the %2$s on the %3$s.', 'autodescription' ), $title_i18n, __( 'Page SEO Settings', 'autodescription' ), $home_page_i18n );
109
+ }
110
+
111
+ /**
112
+ * Check for options to calculate title length.
113
+ *
114
+ * @since 2.3.4
115
+ */
116
+ if ( $home_title ) {
117
+ $home_title_args = $this->generate_home_title();
118
+ $tit_len_pre = $this->process_title_additions( $home_title_args['title'], $home_title_args['blogname'], $home_title_args['seplocation'] );
119
+ } else {
120
+ $tit_len_pre = $home_title_placeholder;
121
+ }
122
+
123
+ //* Fetch the description from the home page.
124
+ $frompost_description = $page_on_front ? $this->get_custom_field( '_genesis_description', $home_id ) : '';
125
+
126
+ //* Fetch the HomePage Description option.
127
+ $home_description = $this->get_field_value( 'homepage_description' );
128
+
129
+ /**
130
+ * Create a placeholder.
131
+ * @since 2.3.4
132
+ */
133
+ if ( $frompost_description ) {
134
+ $description_placeholder = $frompost_description;
135
+ } else {
136
+ $description_args = array(
137
+ 'id' => $home_id,
138
+ 'is_home' => true,
139
+ 'get_custom_field' => false
140
+ );
141
+
142
+ $description_placeholder = $this->generate_description( '', $description_args );
143
+ }
144
+
145
+ /**
146
+ * Checks if the home is blog, the Home Page Metabox description and
147
+ * the frompost description.
148
+ * @since 2.3.4
149
+ */
150
+ if ( empty( $home_description ) && $page_on_front && $frompost_description )
151
+ $home_description_frompost = true;
152
+
153
+ /**
154
+ *
155
+ * If the HomePage Description empty, it will check for the InPost
156
+ * Description set on the Home Page. And it will set the InPost
157
+ * Description as placeholder.
158
+ *
159
+ * Nesting often used translations.
160
+ *
161
+ * Notify that the homepage is a blog.
162
+ * @since 2.2.2
163
+ */
164
+ if ( $home_description_frompost ) {
165
+ $page_seo_settings_i18n = __( 'Page SEO Settings', 'autodescription' );
166
+ /* translators: 1: Option, 2: Page SEO Settings, 3: Home Page */
167
+ $description_from_post_message = sprintf( __( 'Note: The %1$s is fetched from the %2$s on the %3$s.', 'autodescription' ), $description_i18n, $page_seo_settings_i18n, $home_page_i18n );
168
+ }
169
+
170
+ $desc_len_pre = $home_description ? $home_description : $description_placeholder;
171
+
172
+ /**
173
+ * Convert to what Google outputs.
174
+ *
175
+ * This will convert e.g. &raquo; to a single length character.
176
+ * @since 2.3.4
177
+ */
178
+ $tit_len = html_entity_decode( $this->escape_title( $tit_len_pre ) );
179
+ $desc_len = html_entity_decode( $this->escape_title( $desc_len_pre ) );
180
+
181
+ ?>
182
+ <p>
183
+ <label for="<?php $this->field_id( 'homepage_title_tagline' ); ?>" class="tsf-toblock">
184
+ <strong><?php printf( esc_html__( 'Custom %s Title Tagline', 'autodescription' ), $home_page_i18n ); ?></strong>
185
+ </label>
186
+ </p>
187
+ <p>
188
+ <input type="text" name="<?php $this->field_name( 'homepage_title_tagline' ); ?>" class="large-text" id="<?php $this->field_id( 'homepage_title_tagline' ); ?>" placeholder="<?php echo $home_tagline_placeholder ?>" value="<?php echo esc_attr( $home_tagline_value ); ?>" />
189
+ </p>
190
+
191
+ <hr>
192
+
193
+ <p>
194
+ <label for="<?php $this->field_id( 'homepage_title' ); ?>" class="tsf-toblock">
195
+ <strong><?php printf( esc_html__( 'Custom %s Title', 'autodescription' ), $home_page_i18n ); ?></strong>
196
+ <a href="<?php echo esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#3' ); ?>" target="_blank" title="<?php esc_attr_e( 'Recommended Length: 50 to 55 characters', 'autodescription' ) ?>">[?]</a>
197
+ <span class="description tsf-counter">
198
+ <?php printf( esc_html__( 'Characters Used: %s', 'autodescription' ), '<span id="' . $this->field_id( 'homepage_title', false ) . '_chars">'. mb_strlen( $tit_len ) .'</span>' ); ?>
199
+ <span class="hide-if-no-js tsf-ajax"></span>
200
+ </span>
201
+ </label>
202
+ </p>
203
+ <p id="tsf-title-wrap">
204
+ <input type="text" name="<?php $this->field_name( 'homepage_title' ); ?>" class="large-text" id="<?php $this->field_id( 'homepage_title' ); ?>" placeholder="<?php echo esc_attr( $home_title_placeholder ); ?>" value="<?php echo esc_attr( $home_title ); ?>" />
205
+ <span id="tsf-title-offset" class="hide-if-no-js"></span><span id="tsf-title-placeholder" class="hide-if-no-js"></span>
206
+ </p>
207
+ <?php
208
+ if ( $title_from_post_message ) {
209
+ $this->description( $title_from_post_message );
210
+ }
211
+ ?>
212
+ <hr>
213
+
214
+ <p>
215
+ <label for="<?php $this->field_id( 'homepage_description' ); ?>" class="tsf-toblock">
216
+ <strong><?php printf( esc_html__( 'Custom %s Description', 'autodescription' ), $home_page_i18n ); ?></strong>
217
+ <a href="<?php echo esc_url( 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#1' ); ?>" target="_blank" title="<?php _e( 'Recommended Length: 145 to 155 characters', 'autodescription' ) ?>">[?]</a>
218
+ <span class="description tsf-counter">
219
+ <?php printf( __( 'Characters Used: %s', 'autodescription' ), '<span id="' . $this->field_id( 'homepage_description', false ) . '_chars">'. mb_strlen( $desc_len ) .'</span>' ); ?>
220
+ <span class="hide-if-no-js tsf-ajax"></span>
221
+ </span>
222
+ </label>
223
+ </p>
224
+ <p>
225
+ <textarea name="<?php $this->field_name( 'homepage_description' ); ?>" class="large-text" id="<?php $this->field_id( 'homepage_description' ); ?>" rows="3" cols="70" placeholder="<?php echo $description_placeholder ?>"><?php echo esc_textarea( $home_description ); ?></textarea>
226
+ </p>
227
+ <?php
228
+ $this->description( __( 'The meta description can be used to determine the text used under the title on Search Engine results pages.', 'autodescription' ) );
229
+
230
+ if ( $description_from_post_message ) {
231
+ echo '<p class="description">' . esc_html( $description_from_post_message ) . '</p>';
232
+ }
233
+ break;
234
+
235
+ case 'the_seo_framework_homepage_metabox_additions' :
236
+
237
+ //* Fetches escaped title parts.
238
+ $title_args = $this->generate_home_title();
239
+ $title = $title_args['title'];
240
+ $blogname = $title_args['blogname'];
241
+ $sep = $this->get_separator( 'title' );
242
+
243
+ $example_left = '<em><span class="custom-title-js">' . $title . '</span><span class="tsf-custom-blogname-js"><span class="autodescription-sep-js"> ' . $sep . ' </span><span class="tsf-custom-tagline-js">' . $blogname . '</span></span></span></em>';
244
+ $example_right = '<em><span class="tsf-custom-blogname-js"><span class="tsf-custom-tagline-js">' . $blogname . '</span><span class="autodescription-sep-js"> ' . $sep . ' </span></span><span class="custom-title-js">' . $title . '</span></em>';
245
+
246
+ $home_page_i18n = esc_html__( 'Home Page', 'autodescription' );
247
+
248
+ ?>
249
+ <fieldset>
250
+ <legend><h4><?php esc_html_e( 'Document Title Additions Location', 'autodescription' ); ?></h4></legend>
251
+ <?php $this->description( __( 'Determines which side the added title text will go on.', 'autodescription' ) ); ?>
252
+
253
+ <p id="tsf-home-title-location" class="tsf-fields">
254
+ <span class="tsf-toblock">
255
+ <input type="radio" name="<?php $this->field_name( 'home_title_location' ); ?>" id="<?php $this->field_id( 'home_title_location_left' ); ?>" value="left" <?php checked( $this->get_field_value( 'home_title_location' ), 'left' ); ?> />
256
+ <label for="<?php $this->field_id( 'home_title_location_left' ); ?>">
257
+ <span><?php esc_html_e( 'Left:', 'autodescription' ); ?></span>
258
+ <?php echo ( $example_left ) ? $this->code_wrap_noesc( $example_left ) : ''; ?>
259
+ </label>
260
+ </span>
261
+ <span class="tsf-toblock">
262
+ <input type="radio" name="<?php $this->field_name( 'home_title_location' ); ?>" id="<?php $this->field_id( 'home_title_location_right' ); ?>" value="right" <?php checked( $this->get_field_value( 'home_title_location' ), 'right' ); ?> />
263
+ <label for="<?php $this->field_id( 'home_title_location_right' ); ?>">
264
+ <span><?php esc_html_e( 'Right:', 'autodescription' ); ?></span>
265
+ <?php echo $example_right ? $this->code_wrap_noesc( $example_right ) : ''; ?>
266
+ </label>
267
+ </span>
268
+ </p>
269
+ </fieldset>
270
+
271
+ <hr>
272
+ <h4><?php printf( esc_html__( '%s Tagline', 'autodescription' ), $home_page_i18n ); ?></h4>
273
+ <p id="tsf-title-tagline-toggle">
274
+ <label for="<?php $this->field_id( 'homepage_tagline' ); ?>" class="tsf-toblock">
275
+ <input type="checkbox" name="<?php $this->field_name( 'homepage_tagline' ); ?>" id="<?php $this->field_id( 'homepage_tagline' ); ?>" <?php $this->is_conditional_checked( 'homepage_tagline' ); ?> value="1" <?php checked( $this->get_field_value( 'homepage_tagline' ) ); ?> />
276
+ <?php printf( esc_html__( 'Add site description (tagline) to the Title on the %s?', 'autodescription' ), $home_page_i18n ); ?>
277
+ </label>
278
+ </p>
279
+ <?php
280
+ break;
281
+
282
+ case 'the_seo_framework_homepage_metabox_robots' :
283
+
284
+ $language = $this->google_language();
285
+ $home_page_i18n = esc_html__( 'Home Page', 'autodescription' );
286
+
287
+ //* Get home page ID. If blog on front, it's 0.
288
+ $home_id = $this->get_the_front_page_ID();
289
+
290
+ $noindex_post = $this->get_custom_field( '_genesis_noindex', $home_id );
291
+ $nofollow_post = $this->get_custom_field( '_genesis_nofollow', $home_id );
292
+ $noarchive_post = $this->get_custom_field( '_genesis_noarchive', $home_id );
293
+
294
+ $checked_home = '';
295
+ /**
296
+ * Shows user that the setting is checked on the home page.
297
+ * Adds starting - with space to maintain readability.
298
+ *
299
+ * @since 2.2.4
300
+ */
301
+ if ( $noindex_post || $nofollow_post || $noarchive_post ) {
302
+ $checked_home = ' - <a href="' . esc_url( admin_url( 'post.php?post=' . $home_id . '&action=edit#tsf-inpost-box' ) ) . '" target="_blank" class="attention" title="' . esc_attr__( 'View Home Page Settings', 'autodescription' ) . '" >' . esc_html__( 'Checked in Page', 'autodescription' ) . '</a>';
303
+ }
304
+
305
+ ?><h4><?php esc_html_e( 'Home Page Robots Meta Settings', 'autodescription' ); ?></h4><?php
306
+
307
+ $noindex_note = $noindex_post ? $checked_home : '';
308
+ $nofollow_note = $nofollow_post ? $checked_home : '';
309
+ $noarchive_note = $noarchive_post ? $checked_home : '';
310
+
311
+ //* Index label.
312
+ /* translators: 1: Option, 2: Location */
313
+ $i_label = sprintf( esc_html__( 'Apply %1$s to the %2$s?', 'autodescription' ), $this->code_wrap( 'noindex' ), $home_page_i18n );
314
+ $i_label .= ' ';
315
+ $i_label .= $this->make_info(
316
+ __( 'Tell Search Engines not to show this page in their search results', 'autodescription' ),
317
+ 'https://support.google.com/webmasters/answer/93710?hl=' . $language,
318
+ false
319
+ ) . $noindex_note;
320
+
321
+ //* Follow label.
322
+ /* translators: 1: Option, 2: Location */
323
+ $f_label = sprintf( esc_html__( 'Apply %1$s to the %2$s?', 'autodescription' ), $this->code_wrap( 'nofollow' ), $home_page_i18n );
324
+ $f_label .= ' ';
325
+ $f_label .= $this->make_info(
326
+ __( 'Tell Search Engines not to follow links on this page', 'autodescription' ),
327
+ 'https://support.google.com/webmasters/answer/96569?hl=' . $language,
328
+ false
329
+ ) . $nofollow_note;
330
+
331
+ //* Archive label.
332
+ /* translators: 1: Option, 2: Location */
333
+ $a_label = sprintf( esc_html__( 'Apply %1$s to the %2$s?', 'autodescription' ), $this->code_wrap( 'noarchive' ), $home_page_i18n );
334
+ $a_label .= ' ';
335
+ $a_label .= $this->make_info(
336
+ __( 'Tell Search Engines not to save a cached copy of this page', 'autodescription' ),
337
+ 'https://support.google.com/webmasters/answer/79812?hl=' . $language,
338
+ false
339
+ ) . $noarchive_note;
340
+
341
+ //* Echo checkboxes.
342
+ $this->wrap_fields(
343
+ array(
344
+ $this->make_checkbox(
345
+ 'homepage_noindex',
346
+ $i_label,
347
+ '',
348
+ false
349
+ ),
350
+ $this->make_checkbox(
351
+ 'homepage_nofollow',
352
+ $f_label,
353
+ '',
354
+ false
355
+ ),
356
+ $this->make_checkbox(
357
+ 'homepage_noarchive',
358
+ $a_label,
359
+ '',
360
+ false
361
+ ),
362
+ ),
363
+ true
364
+ );
365
+
366
+ // Add notice if any options are checked on the post.
367
+ if ( $noindex_post || $nofollow_post || $noarchive_post ) {
368
+ $this->description( __( 'Note: If any of these options are unchecked, but are checked on the Home Page, they will be outputted regardless.', 'autodescription' ) );
369
+ }
370
+ ?>
371
+
372
+ <hr>
373
+
374
+ <h4><?php esc_html_e( 'Home Page Pagination Robots Settings', 'autodescription' ); ?></h4>
375
+ <?php $this->description( __( "If your Home Page is paginated and outputs content that's also found elsewhere on the website, enabling this option might prevent duplicate content.", 'autodescription' ) ); ?>
376
+
377
+ <?php
378
+ //* Echo checkbox.
379
+ $this->wrap_fields(
380
+ $this->make_checkbox(
381
+ 'home_paged_noindex',
382
+ /* translators: 1: Option, 2: Location */
383
+ sprintf( esc_html__( 'Apply %1$s to every second or later page on the %2$s?', 'autodescription' ), $this->code_wrap( 'noindex' ), $home_page_i18n ),
384
+ '',
385
+ false
386
+ ),
387
+ true
388
+ );
389
+ break;
390
+
391
+ default :
392
+ break;
393
+ endswitch;
inc/views/metaboxes/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ //* When I have them working together, it's like a beautiful kaleidoscope. - Ornette Coleman
inc/views/metaboxes/knowledge-metabox.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_knowledge_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_knowledge_metabox_main' :
10
+
11
+ /**
12
+ * Parse tabs content.
13
+ *
14
+ * @since 2.2.8
15
+ *
16
+ * @param array $default_tabs { 'id' = The identifier =>
17
+ * array(
18
+ * 'name' => The name
19
+ * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
20
+ * 'dashicon' => Desired dashicon
21
+ * )
22
+ * }
23
+ */
24
+ $default_tabs = array(
25
+ 'general' => array(
26
+ 'name' => __( 'General', 'autodescription' ),
27
+ 'callback' => array( $this, 'knowledge_metabox_general_tab' ),
28
+ 'dashicon' => 'admin-generic',
29
+ ),
30
+ 'website' => array(
31
+ 'name' => __( 'Website', 'autodescription' ),
32
+ 'callback' => array( $this, 'knowledge_metabox_about_tab' ),
33
+ 'dashicon' => 'admin-home',
34
+ ),
35
+ 'social' => array(
36
+ 'name' => 'Social Sites',
37
+ 'callback' => array( $this, 'knowledge_metabox_social_tab' ),
38
+ 'dashicon' => 'networking',
39
+ ),
40
+ );
41
+
42
+ /**
43
+ * Applies filter knowledgegraph_settings_tabs : Array see $default_tabs
44
+ * @since 2.2.8
45
+ * Used to extend Knowledge Graph tabs
46
+ */
47
+ $defaults = (array) apply_filters( 'the_seo_framework_knowledgegraph_settings_tabs', $default_tabs, $args );
48
+
49
+ $tabs = wp_parse_args( $args, $defaults );
50
+
51
+ $this->nav_tab_wrapper( 'knowledge', $tabs, '2.2.8' );
52
+ break;
53
+
54
+ case 'the_seo_framework_knowledge_metabox_general' :
55
+
56
+ ?><h4><?php esc_html_e( 'Knowledge Graph Settings', 'autodescription' ); ?></h4><?php
57
+ $this->description( __( "The Knowledge Graph lets Google and other Search Engines know where to find you or your organization and its relevant content.", 'autodescription' ) );
58
+ $this->description( __( "Google is becoming more of an 'Answer Engine' than a 'Search Engine'. Setting up these options could have a positive impact on the SEO value of your website.", 'autodescription' ) );
59
+
60
+ //* Echo checkbox.
61
+ $this->wrap_fields(
62
+ $this->make_checkbox(
63
+ 'knowledge_output',
64
+ __( 'Output Knowledge tags?', 'autodescription' ),
65
+ '',
66
+ true
67
+ ), true
68
+ );
69
+
70
+ if ( $this->wp_version( '4.2.999', '>=' ) ) :
71
+ ?>
72
+ <hr>
73
+
74
+ <h4><?php esc_html_e( 'Website logo', 'autodescription' ); ?></h4>
75
+ <?php
76
+ //* Echo checkbox.
77
+ $this->wrap_fields(
78
+ $this->make_checkbox(
79
+ 'knowledge_logo',
80
+ __( 'Use the Favicon from Customizer as the Organization Logo?', 'autodescription' ),
81
+ __( 'This option only has an effect when this site represents an Organization. If left disabled, Search Engines will look elsewhere for a logo, if it exists and is assigned as a logo.', 'autodescription' ),
82
+ true
83
+ ), true
84
+ );
85
+ endif;
86
+ break;
87
+
88
+ case 'the_seo_framework_knowledge_metabox_about' :
89
+
90
+ $blogname = $this->get_blogname();
91
+
92
+ ?><h4><?php esc_html_e( 'About this website', 'autodescription' ); ?></h4><?php
93
+ $this->description( __( 'Who or what is your website about?', 'autodescription' ) );
94
+
95
+ ?>
96
+ <hr>
97
+
98
+ <p>
99
+ <label for="<?php $this->field_id( 'knowledge_type' ); ?>"><?php echo esc_html_x( 'This website represents:', '...Organization or Person.', 'autodescription' ); ?></label>
100
+ <select name="<?php $this->field_name( 'knowledge_type' ); ?>" id="<?php $this->field_id( 'knowledge_type' ); ?>">
101
+ <?php
102
+ $knowledge_type = (array) apply_filters(
103
+ 'the_seo_framework_knowledge_types',
104
+ array(
105
+ 'organization' => __( 'An Organization', 'autodescription' ),
106
+ 'person' => __( 'A Person', 'autodescription' ),
107
+ )
108
+ );
109
+ foreach ( $knowledge_type as $value => $name )
110
+ echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->get_field_value( 'knowledge_type' ), esc_attr( $value ), false ) . '>' . esc_html( $name ) . '</option>' . "\n";
111
+ ?>
112
+ </select>
113
+ </p>
114
+
115
+ <hr>
116
+
117
+ <p>
118
+ <label for="<?php $this->field_id( 'knowledge_name' ); ?>">
119
+ <strong><?php esc_html_e( 'The organization or personal name', 'autodescription' ); ?></strong>
120
+ </label>
121
+ </p>
122
+ <p>
123
+ <input type="text" name="<?php $this->field_name( 'knowledge_name' ); ?>" class="large-text" id="<?php $this->field_id( 'knowledge_name' ); ?>" placeholder="<?php echo esc_attr( $blogname ) ?>" value="<?php echo esc_attr( $this->get_field_value( 'knowledge_name' ) ); ?>" />
124
+ </p>
125
+ <?php
126
+ break;
127
+
128
+ case 'the_seo_framework_knowledge_metabox_social' :
129
+
130
+ ?><h4><?php esc_html_e( 'Social Pages connected to this website', 'autodescription' ); ?></h4><?php
131
+ $this->description( __( "Don't have a page at a site or is the profile only privately accessible? Leave that field empty. Unsure? Fill it in anyway.", 'autodescription' ) );
132
+ $this->description( __( 'Add the link that leads directly to the social page of this website.', 'autodescription' ) );
133
+
134
+ ?><hr><?php
135
+
136
+ $connectedi18n = _x( 'RelatedProfile', 'No spaces. E.g. https://facebook.com/RelatedProfile', 'autodescription' );
137
+ $profile18n = _x( 'Profile', 'Social Profile', 'autodescription' );
138
+
139
+ /**
140
+ * @todo maybe genericons?
141
+ */
142
+
143
+ $socialsites = array(
144
+ 'facebook' => array(
145
+ 'option' => 'knowledge_facebook',
146
+ 'dashicon' => 'dashicons-facebook',
147
+ 'desc' => 'Facebook ' . __( 'Page', 'autodescription' ),
148
+ 'placeholder' => 'http://www.facebook.com/' . $connectedi18n,
149
+ 'examplelink' => esc_url( 'https://facebook.com/me' ),
150
+ ),
151
+ 'twitter' => array(
152
+ 'option' => 'knowledge_twitter',
153
+ 'dashicon' => 'dashicons-twitter',
154
+ 'desc' => 'Twitter ' . $profile18n,
155
+ 'placeholder' => 'http://www.twitter.com/' . $connectedi18n,
156
+ 'examplelink' => esc_url( 'https://twitter.com/home' ), // No example link available.
157
+ ),
158
+ 'gplus' => array(
159
+ 'option' => 'knowledge_gplus',
160
+ 'dashicon' => 'dashicons-googleplus',
161
+ 'desc' => 'Google+ ' . $profile18n,
162
+ 'placeholder' => 'https://plus.google.com/' . $connectedi18n,
163
+ 'examplelink' => esc_url( 'https://plus.google.com/me' ),
164
+ ),
165
+ 'instagram' => array(
166
+ 'option' => 'knowledge_instagram',
167
+ 'dashicon' => 'genericon-instagram',
168
+ 'desc' => 'Instagram ' . $profile18n,
169
+ 'placeholder' => 'http://instagram.com/' . $connectedi18n,
170
+ 'examplelink' => esc_url( 'https://instagram.com/' ), // No example link available.
171
+ ),
172
+ 'youtube' => array(
173
+ 'option' => 'knowledge_youtube',
174
+ 'dashicon' => 'genericon-youtube',
175
+ 'desc' => 'Youtube ' . $profile18n,
176
+ 'placeholder' => 'http://www.youtube.com/' . $connectedi18n,
177
+ 'examplelink' => esc_url( 'https://www.youtube.com/user/%2f' ), // Yes a double slash.
178
+ ),
179
+ 'linkedin' => array(
180
+ 'option' => 'knowledge_linkedin',
181
+ 'dashicon' => 'genericon-linkedin-alt',
182
+ 'desc' => 'LinkedIn ' . $profile18n . ' ID',
183
+ 'placeholder' => 'http://www.linkedin.com/profile/view?id=' . $connectedi18n,
184
+ 'examplelink' => esc_url( 'https://www.linkedin.com/profile/view' ), // This generates a query arg. We should allow that.
185
+ ),
186
+ 'pinterest' => array(
187
+ 'option' => 'knowledge_pinterest',
188
+ 'dashicon' => 'genericon-pinterest-alt',
189
+ 'desc' => 'Pinterest ' . $profile18n,
190
+ 'placeholder' => 'https://www.pinterest.com/' . $connectedi18n . '/',
191
+ 'examplelink' => esc_url( 'https://www.pinterest.com/me/' ),
192
+ ),
193
+ 'soundcloud' => array(
194
+ 'option' => 'knowledge_soundcloud',
195
+ 'dashicon' => 'genericon-cloud', // I know, it's not the real one. D:
196
+ 'desc' => 'SoundCloud ' . $profile18n,
197
+ 'placeholder' => 'https://soundcloud.com/' . $connectedi18n,
198
+ 'examplelink' => esc_url( 'https://soundcloud.com/you' ),
199
+ ),
200
+ 'tumblr' => array(
201
+ 'option' => 'knowledge_tumblr',
202
+ 'dashicon' => 'genericon-tumblr',
203
+ 'desc' => 'Tumblr ' . __( 'Blog', 'autodescription' ),
204
+ 'placeholder' => 'https://tumblr.com/blog/' . $connectedi18n,
205
+ 'examplelink' => esc_url( 'https://www.tumblr.com/dashboard' ), // No example link available.
206
+ ),
207
+ );
208
+
209
+ foreach ( $socialsites as $key => $value ) {
210
+ ?>
211
+ <p>
212
+ <label for="<?php $this->field_id( $value['option'] ); ?>">
213
+ <strong><?php echo esc_html( $value['desc'] ); ?></strong>
214
+ <?php
215
+ if ( $value['examplelink'] ) {
216
+ ?><a href="<?php echo esc_url( $value['examplelink'] ); ?>" target="_blank">[?]</a><?php
217
+ }
218
+ ?>
219
+ </label>
220
+ </p>
221
+ <p>
222
+ <input type="text" name="<?php $this->field_name( $value['option'] ); ?>" class="large-text" id="<?php $this->field_id( $value['option'] ); ?>" placeholder="<?php echo esc_attr( $value['placeholder'] ) ?>" value="<?php echo esc_attr( $this->get_field_value( $value['option'] ) ); ?>" />
223
+ </p>
224
+ <?php
225
+ }
226
+ break;
227
+
228
+ default :
229
+ break;
230
+ endswitch;
inc/views/metaboxes/robots-metabox.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_robots_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_robots_metabox_main' :
10
+
11
+ //* Robots types
12
+ $types = array(
13
+ 'category' => __( 'Category', 'autodescription' ),
14
+ 'tag' => __( 'Tag', 'autodescription' ),
15
+ 'author' => __( 'Author', 'autodescription' ),
16
+ 'date' => __( 'Date', 'autodescription' ),
17
+ 'search' => __( 'Search Pages', 'autodescription' ),
18
+ 'attachment' => __( 'Attachment Pages', 'autodescription' ),
19
+ 'site' => _x( 'the entire site', '...for the entire site', 'autodescription' ),
20
+ );
21
+
22
+ //* Robots i18n
23
+ $robots = array(
24
+ 'noindex' => array(
25
+ 'value' => 'noindex',
26
+ 'name' => __( 'NoIndex', 'autodescription' ),
27
+ 'desc' => __( 'These options prevent indexing of the selected archives and pages. If you enable this, the selected archives or pages will be removed from Search Engine results pages.', 'autodescription' ),
28
+ ),
29
+ 'nofollow' => array(
30
+ 'value' => 'nofollow',
31
+ 'name' => __( 'NoFollow', 'autodescription' ),
32
+ 'desc' => __( 'These options prevent links from being followed on the selected archives and pages. If you enable this, the selected archives or pages in-page links will gain no SEO value, including your own links.', 'autodescription' ),
33
+ ),
34
+ 'noarchive' => array(
35
+ 'value' => 'noarchive',
36
+ 'name' => __( 'NoArchive', 'autodescription' ),
37
+ 'desc' => __( 'These options prevent caching of the selected archives and pages. If you enable this, Search Engines will not create a cached copy of the selected archives or pages.', 'autodescription' ),
38
+ ),
39
+ );
40
+
41
+ /**
42
+ * Parse tabs content.
43
+ *
44
+ * @since 2.2.2
45
+ *
46
+ * @param array $default_tabs { 'id' = The identifier =>
47
+ * array(
48
+ * 'name' => The name
49
+ * 'callback' => function callback
50
+ * 'dashicon' => WordPress Dashicon
51
+ * 'args' => function args
52
+ * )
53
+ * }
54
+ */
55
+ $default_tabs = array(
56
+ 'general' => array(
57
+ 'name' => __( 'General', 'autodescription' ),
58
+ 'callback' => array( $this, 'robots_metabox_general_tab' ),
59
+ 'dashicon' => 'admin-generic',
60
+ 'args' => '',
61
+ ),
62
+ 'index' => array(
63
+ 'name' => __( 'Indexing', 'autodescription' ),
64
+ 'callback' => array( $this, 'robots_metabox_no_tab' ),
65
+ 'dashicon' => 'filter',
66
+ 'args' => array( $types, $robots['noindex'] ),
67
+ ),
68
+ 'follow' => array(
69
+ 'name' => __( 'Following', 'autodescription' ),
70
+ 'callback' => array( $this, 'robots_metabox_no_tab' ),
71
+ 'dashicon' => 'editor-unlink',
72
+ 'args' => array( $types, $robots['nofollow'] ),
73
+ ),
74
+ 'archive' => array(
75
+ 'name' => __( 'Archiving', 'autodescription' ),
76
+ 'callback' => array( $this, 'robots_metabox_no_tab' ),
77
+ 'dashicon' => 'download',
78
+ 'args' => array( $types, $robots['noarchive'] ),
79
+ ),
80
+ );
81
+
82
+ /**
83
+ * Applies filters 'the_seo_framework_robots_settings_tabs' : array see $default_tabs
84
+ *
85
+ * Used to extend Social tabs
86
+ * @since 2.2.4
87
+ */
88
+ $defaults = (array) apply_filters( 'the_seo_framework_robots_settings_tabs', $default_tabs, $args );
89
+
90
+ $tabs = wp_parse_args( $args, $defaults );
91
+
92
+ $this->nav_tab_wrapper( 'robots', $tabs, '2.2.4' );
93
+ break;
94
+
95
+ case 'the_seo_framework_robots_metabox_general' :
96
+
97
+ ?><h4><?php esc_html_e( 'Open Directory Settings', 'autodescription' ); ?></h4><?php
98
+ $this->description( __( "Sometimes, Search Engines use resources from certain Directories to find titles and descriptions for your content. You generally don't want them to. Turn these options on to prevent them from doing so.", 'autodescription' ) );
99
+ $this->description( __( "The Open Directory Project and the Yahoo! Directory may contain outdated SEO values. Therefore, it's best to leave these options checked.", 'autodescription' ) );
100
+
101
+ $fields = $this->wrap_fields(
102
+ array(
103
+ $this->make_checkbox(
104
+ 'noodp',
105
+ sprintf( esc_html__( 'Apply %s to the entire site?', 'autodescription' ), $this->code_wrap( 'noodp' ) ),
106
+ '',
107
+ false
108
+ ),
109
+ $this->make_checkbox(
110
+ 'noydir',
111
+ sprintf( esc_html__( 'Apply %s to the entire site?', 'autodescription' ), $this->code_wrap( 'noydir' ) ),
112
+ '',
113
+ false
114
+ ),
115
+ ), true
116
+ );
117
+ ?>
118
+ <hr>
119
+
120
+ <h4><?php esc_html_e( 'Paginated Archive Settings', 'autodescription' ); ?></h4>
121
+ <p class="description"><?php printf( esc_html__( "Indexing the second or later page of any archive might cause duplication errors. Search Engines look down upon them; therefore, it's recommended to disable indexing of those pages.", 'autodescription' ), $this->code_wrap( 'noodp' ), $this->code_wrap( 'noydir' ) ); ?></p>
122
+ <?php
123
+
124
+ $this->wrap_fields(
125
+ $this->make_checkbox(
126
+ 'paged_noindex',
127
+ sprintf( esc_html__( 'Apply %s to every second or later archive page?', 'autodescription' ), $this->code_wrap( 'noindex' ) ),
128
+ '',
129
+ false
130
+ ), true
131
+ );
132
+ break;
133
+
134
+ case 'the_seo_framework_robots_metabox_no' :
135
+
136
+ $ro_value = $robots['value'];
137
+ $ro_name = esc_html( $robots['name'] );
138
+ $ro_i18n = $robots['desc'];
139
+
140
+ ?><h4><?php printf( esc_html__( '%s Robots Settings', 'autodescription' ), $ro_name ); ?></h4><?php
141
+ $this->description( $ro_i18n );
142
+
143
+ $checkboxes = '';
144
+ foreach ( $types as $type => $i18n ) {
145
+
146
+ if ( 'site' === $type || 'attachment' === $type || 'search' === $type ) {
147
+ //* Singular.
148
+ /* translators: 1: Option, 2: Post Type */
149
+ $label = sprintf( esc_html__( 'Apply %1$s to %2$s?', 'autodescription' ), $this->code_wrap( $ro_name ), esc_html( $i18n ) );
150
+ } else {
151
+ //* Archive.
152
+ /* translators: 1: Option, 2: Post Type */
153
+ $label = sprintf( esc_html__( 'Apply %1$s to %2$s Archives?', 'autodescription' ), $this->code_wrap( $ro_name ), esc_html( $i18n ) );
154
+ }
155
+
156
+ $id = $type . '_' . $ro_value;
157
+
158
+ //* Add <hr> if it's 'site'
159
+ $checkboxes .= 'site' === $type ? '<hr class="tsf-option-spacer">' : '';
160
+
161
+ $checkboxes .= $this->make_checkbox( esc_html( $id ), $label, '', false );
162
+ }
163
+
164
+ ?><p class="tsf-fields"><?php
165
+ //* Echo checkboxes.
166
+ $this->wrap_fields( $checkboxes, true );
167
+ ?></p><?php
168
+ break;
169
+
170
+ default :
171
+ break;
172
+ endswitch;
inc/views/metaboxes/schema-metabox.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_schema_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_schema_metabox_main' :
10
+
11
+ ?><h4><?php esc_html_e( 'Schema.org Output Settings', 'autodescription' ); ?></h4><?php
12
+
13
+ if ( $this->has_json_ld_plugin() ) :
14
+ $this->description( __( 'Another Schema.org plugin has been detected.', 'autodescription' ) );
15
+ else :
16
+ $this->description( __( 'The Schema.org markup is a standard way of annotating structured data for Search Engines. This markup is represented within hidden scripts throughout the website.', 'autodescription' ) );
17
+ $this->description( __( 'When your web pages include structured data markup, Search Engines can use that data to index your content better, present it more prominently in Search Results, and use it in several different applications.', 'autodescription' ) );
18
+
19
+ ?>
20
+ <hr>
21
+
22
+ <?php /* translators: https://developers.google.com/search/docs/data-types/sitelinks-searchbox */ ?>
23
+ <h4><?php echo esc_html( _x( 'Sitelinks Searchbox', 'Product name', 'autodescription' ) ); ?></h4><?php
24
+ $this->description( __( 'When Search users search for your brand name, the following option allows them to search through your website directly from the Search Results.', 'autodescription' ) );
25
+
26
+ $info = $this->make_info(
27
+ _x( 'Sitelinks Searchbox', 'Product name', 'autodescription' ),
28
+ 'https://developers.google.com/search/docs/data-types/sitelinks-searchbox',
29
+ false
30
+ );
31
+ $this->wrap_fields(
32
+ $this->make_checkbox(
33
+ 'ld_json_searchbox',
34
+ esc_html_x( 'Enable Sitelinks Searchbox?', 'Product name', 'autodescription' ) . ' ' . $info,
35
+ '',
36
+ false
37
+ ),
38
+ true
39
+ );
40
+
41
+ ?>
42
+ <hr>
43
+
44
+ <h4><?php esc_html_e( 'Site Name', 'autodescription' ); ?></h4><?php
45
+ $this->description( __( "When using breadcrumbs, the first entry is by default your website's address. Using the following option will convert it to the Site Name.", 'autodescription' ) );
46
+
47
+ $info = $this->make_info(
48
+ __( 'Include your Site Name in Search Results', 'autodescription' ),
49
+ 'https://developers.google.com/search/docs/data-types/sitename',
50
+ false
51
+ );
52
+ $this->wrap_fields(
53
+ $this->make_checkbox(
54
+ 'ld_json_sitename',
55
+ esc_html__( 'Convert URL to Site Name?', 'autodescription' ) . ' ' . $info,
56
+ sprintf( esc_html__( 'The Site Name is: %s', 'autodescription' ), $this->code_wrap( $this->get_blogname() ) ),
57
+ false
58
+ ),
59
+ true
60
+ );
61
+
62
+ ?>
63
+ <hr>
64
+
65
+ <h4><?php esc_html_e( 'Breadcrumbs', 'autodescription' ); ?></h4><?php
66
+ $this->description( __( "Breadcrumb trails indicate the page's position in the site hierarchy. Using the following option will show the hierarchy within the Search Results when available.", 'autodescription' ) );
67
+
68
+ $info = $this->make_info(
69
+ __( 'About Breadcrumbs', 'autodescription' ),
70
+ 'https://developers.google.com/search/docs/data-types/breadcrumbs',
71
+ false
72
+ );
73
+ $this->wrap_fields(
74
+ $this->make_checkbox(
75
+ 'ld_json_breadcrumbs',
76
+ esc_html__( 'Enable Breadcrumbs?', 'autodescription' ) . ' ' . $info,
77
+ esc_html__( 'Multiple trails can be outputted. The longest trail is prioritized.', 'autodescription' ),
78
+ false
79
+ ),
80
+ true
81
+ );
82
+ endif;
83
+ break;
84
+
85
+ default :
86
+ break;
87
+ endswitch;
inc/views/metaboxes/sitemaps-metabox.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_sitemaps_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_sitemaps_metabox_main' :
10
+
11
+ if ( ! $this->pretty_permalinks ) {
12
+
13
+ $permalink_settings_url = admin_url( 'options-permalink.php' );
14
+ $here = '<a href="' . esc_url( $permalink_settings_url ) . '" target="_blank" title="' . esc_attr__( 'Permalink Settings', 'autodescription' ) . '">' . esc_html_x( 'here', 'The sitemap can be found %s.', 'autodescription' ) . '</a>';
15
+
16
+ ?><h4><?php esc_html_e( "You're using the plain permalink structure.", 'autodescription' ); ?></h4><?php
17
+ $this->description( __( "This means we can't output the sitemap through the WordPress rewrite rules.", 'autodescription' ) );
18
+ ?><hr><?php
19
+ $this->description_noesc( sprintf( esc_html_x( "Change your Permalink Settings %s (Recommended: 'postname').", '%s = here', 'autodescription' ), $here ) );
20
+
21
+ } else {
22
+
23
+ /**
24
+ * Parse tabs content
25
+ *
26
+ * @param array $default_tabs { 'id' = The identifier =>
27
+ * array(
28
+ * 'name' => The name
29
+ * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
30
+ * 'dashicon' => Desired dashicon
31
+ * )
32
+ * }
33
+ *
34
+ * @since 2.2.9
35
+ */
36
+ $default_tabs = array(
37
+ 'general' => array(
38
+ 'name' => __( 'General', 'autodescription' ),
39
+ 'callback' => array( $this, 'sitemaps_metabox_general_tab' ),
40
+ 'dashicon' => 'admin-generic',
41
+ ),
42
+ 'robots' => array(
43
+ 'name' => 'Robots.txt',
44
+ 'callback' => array( $this, 'sitemaps_metabox_robots_tab' ),
45
+ 'dashicon' => 'share-alt2',
46
+ ),
47
+ 'timestamps' => array(
48
+ 'name' => __( 'Timestamps', 'autodescription' ),
49
+ 'callback' => array( $this, 'sitemaps_metabox_timestamps_tab' ),
50
+ 'dashicon' => 'backup',
51
+ ),
52
+ 'notify' => array(
53
+ 'name' => _x( 'Ping', 'Ping or notify Search Engine', 'autodescription' ),
54
+ 'callback' => array( $this, 'sitemaps_metabox_notify_tab' ),
55
+ 'dashicon' => 'megaphone',
56
+ ),
57
+ );
58
+
59
+ /**
60
+ * Applies filters the_seo_framework_sitemaps_settings_tabs : array see $default_tabs
61
+ *
62
+ * Used to extend Knowledge Graph tabs
63
+ */
64
+ $defaults = (array) apply_filters( 'the_seo_framework_sitemaps_settings_tabs', $default_tabs, $args );
65
+
66
+ $tabs = wp_parse_args( $args, $defaults );
67
+ $use_tabs = true;
68
+
69
+ $sitemap_plugin = $this->detect_sitemap_plugin();
70
+ $sitemap_detected = $this->has_sitemap_xml();
71
+ $robots_detected = $this->has_robots_txt();
72
+
73
+ /**
74
+ * Remove the timestamps and notify submenus
75
+ * @since 2.5.2
76
+ */
77
+ if ( $sitemap_plugin || $sitemap_detected ) {
78
+ unset( $tabs['timestamps'] );
79
+ unset( $tabs['notify'] );
80
+ }
81
+
82
+ /**
83
+ * Remove the robots submenu
84
+ * @since 2.5.2
85
+ */
86
+ if ( $robots_detected ) {
87
+ unset( $tabs['robots'] );
88
+ }
89
+
90
+ if ( $robots_detected && ( $sitemap_plugin || $sitemap_detected ) )
91
+ $use_tabs = false;
92
+
93
+ $this->nav_tab_wrapper( 'sitemaps', $tabs, '2.2.8', $use_tabs );
94
+
95
+ }
96
+ break;
97
+
98
+ case 'the_seo_framework_sitemaps_metabox_general' :
99
+
100
+ $site_url = $this->the_home_url_from_cache( true );
101
+
102
+ $sitemap_url = $site_url . 'sitemap.xml';
103
+ $has_sitemap_plugin = $this->detect_sitemap_plugin();
104
+ $sitemap_detected = $this->has_sitemap_xml();
105
+
106
+ ?><h4><?php esc_html_e( 'Sitemap Integration Settings', 'autodescription' ); ?></h4><?php
107
+
108
+ if ( $has_sitemap_plugin ) {
109
+ $this->description( __( 'Another active sitemap plugin has been detected. This means that the sitemap functionality has been replaced.', 'autodescription' ) );
110
+ } elseif ( $sitemap_detected ) {
111
+ $this->description( __( 'A sitemap has been detected in the root folder of your website. This means that the sitemap functionality has no effect.', 'autodescription' ) );
112
+ } else {
113
+ $this->description( __( 'The Sitemap is an XML file that lists pages and posts for your website along with optional metadata about each post or page. This helps Search Engines crawl your website more easily.', 'autodescription' ) );
114
+ $this->description( __( 'The optional metadata include the post and page modified time and a page priority indication, which is automated.', 'autodescription' ) );
115
+
116
+ ?>
117
+ <hr>
118
+
119
+ <h4><?php esc_html_e( 'Sitemap Output', 'autodescription' ); ?></h4>
120
+ <?php
121
+
122
+ //* Echo checkbox.
123
+ $this->wrap_fields(
124
+ $this->make_checkbox(
125
+ 'sitemaps_output',
126
+ __( 'Output Sitemap?', 'autodescription' ),
127
+ '',
128
+ true
129
+ ), true
130
+ );
131
+ }
132
+
133
+ if ( ! ( $has_sitemap_plugin || $sitemap_detected ) && $this->get_option( 'sitemaps_output' ) ) {
134
+ $here = '<a href="' . esc_url( $sitemap_url ) . '" target="_blank" title="' . esc_attr__( 'View sitemap', 'autodescription' ) . '">' . esc_attr_x( 'here', 'The sitemap can be found %s.', 'autodescription' ) . '</a>';
135
+ $this->description_noesc( sprintf( _x( 'The sitemap can be found %s.', '%s = here', 'autodescription' ), $here ) );
136
+ }
137
+ break;
138
+
139
+ case 'the_seo_framework_sitemaps_metabox_robots' :
140
+
141
+ $site_url = $this->the_home_url_from_cache( true );
142
+ $robots_url = trailingslashit( $site_url ) . 'robots.txt';
143
+ $here = '<a href="' . esc_url( $robots_url ) . '" target="_blank" title="' . esc_attr__( 'View robots.txt', 'autodescription' ) . '">' . esc_html_x( 'here', 'The sitemap can be found %s.', 'autodescription' ) . '</a>';
144
+
145
+ ?><h4><?php esc_html_e( 'Robots.txt Settings', 'autodescription' ); ?></h4><?php
146
+
147
+ if ( $this->can_do_sitemap_robots() ) :
148
+ $this->description( __( 'The robots.txt file is the first thing Search Engines look for. If you add the sitemap location in the robots.txt file, then Search Engines will look for and index the sitemap.', 'autodescription' ) );
149
+ $this->description( __( 'If you do not add the sitemap location to the robots.txt file, you will need to notify Search Engines manually through the Webmaster Console provided by the Search Engines.', 'autodescription' ) );
150
+
151
+ ?>
152
+ <hr>
153
+
154
+ <h4><?php esc_html_e( 'Add sitemap location in robots.txt', 'autodescription' ); ?></h4>
155
+ <?php
156
+
157
+ //* Echo checkbox.
158
+ $this->wrap_fields(
159
+ $this->make_checkbox(
160
+ 'sitemaps_robots',
161
+ __( 'Add sitemap location in robots?', 'autodescription' ),
162
+ '',
163
+ true
164
+ ), true
165
+ );
166
+ else :
167
+ $this->description( __( 'Another robots.txt sitemap Location addition has been detected.', 'autodescription' ) );
168
+ endif;
169
+
170
+ $this->description_noesc( sprintf( esc_html_x( 'The robots.txt file can be found %s.', '%s = here', 'autodescription' ), $here ) );
171
+ break;
172
+
173
+ case 'the_seo_framework_sitemaps_metabox_timestamps' :
174
+
175
+ //* Sets timezone according to WordPress settings.
176
+ $this->set_timezone();
177
+
178
+ $timestamp_0 = date( 'Y-m-d' );
179
+
180
+ /**
181
+ * @link https://www.w3.org/TR/NOTE-datetime
182
+ * We use the second expression of the time zone offset handling.
183
+ */
184
+ $timestamp_1 = date( 'Y-m-d\TH:iP' );
185
+
186
+ //* Reset timezone to previous value.
187
+ $this->reset_timezone();
188
+
189
+ ?><h4><?php esc_html_e( 'Timestamps Settings', 'autodescription' ); ?></h4><?php
190
+ $this->description( __( 'The modified time suggests to Search Engines where to look for content changes. It has no impact on the SEO value unless you drastically change pages or posts. It then depends on how well your content is constructed.', 'autodescription' ) );
191
+ $this->description( __( "By default, the sitemap only outputs the modified date if you've enabled them within the Social Metabox. This setting overrides those settings for the Sitemap.", 'autodescription' ) );
192
+
193
+ ?>
194
+ <hr>
195
+
196
+ <h4><?php esc_html_e( 'Output Modified Date', 'autodescription' ); ?></h4>
197
+ <?php
198
+
199
+ //* Echo checkbox.
200
+ $this->wrap_fields(
201
+ $this->make_checkbox(
202
+ 'sitemaps_modified',
203
+ sprintf( esc_html__( 'Add %s to the sitemap?', 'autodescription' ), $this->code_wrap( '<lastmod>' ) ),
204
+ '',
205
+ false
206
+ ), true
207
+ );
208
+
209
+ ?>
210
+ <hr>
211
+
212
+ <fieldset>
213
+ <legend><h4><?php esc_html_e( 'Timestamp Format Settings', 'autodescription' ); ?></h4></legend>
214
+ <?php $this->description( __( 'Determines how specific the modification timestamp is.', 'autodescription' ) ); ?>
215
+
216
+ <p id="sitemaps-timestamp-format" class="tsf-fields">
217
+ <span class="tsf-toblock">
218
+ <input type="radio" name="<?php $this->field_name( 'sitemap_timestamps' ); ?>" id="<?php $this->field_id( 'sitemap_timestamps_0' ); ?>" value="0" <?php checked( $this->get_field_value( 'sitemap_timestamps' ), '0' ); ?> />
219
+ <label for="<?php $this->field_id( 'sitemap_timestamps_0' ); ?>">
220
+ <span title="<?php esc_attr_e( 'Complete date', 'autodescription' ); ?>"><?php echo $this->code_wrap( $timestamp_0 ); ?> [?]</span>
221
+ </label>
222
+ </span>
223
+ <span class="tsf-toblock">
224
+ <input type="radio" name="<?php $this->field_name( 'sitemap_timestamps' ); ?>" id="<?php $this->field_id( 'sitemap_timestamps_1' ); ?>" value="1" <?php checked( $this->get_field_value( 'sitemap_timestamps' ), '1' ); ?> />
225
+ <label for="<?php $this->field_id( 'sitemap_timestamps_1' ); ?>">
226
+ <span title="<?php esc_attr_e( 'Complete date plus hours, minutes and timezone', 'autodescription' ); ?>"><?php echo $this->code_wrap( $timestamp_1 ); ?> [?]</span>
227
+ </label>
228
+ </span>
229
+ </p>
230
+ </fieldset>
231
+ <?php
232
+ break;
233
+
234
+ case 'the_seo_framework_sitemaps_metabox_notify' :
235
+
236
+ ?><h4><?php esc_html_e( 'Ping Settings', 'autodescription' ); ?></h4><?php
237
+ $this->description( __( 'Notifying Search Engines of a sitemap change is helpful to get your content indexed as soon as possible.', 'autodescription' ) );
238
+ $this->description( __( 'By default this will happen at most once an hour.', 'autodescription' ) );
239
+
240
+ ?>
241
+ <hr>
242
+
243
+ <h4><?php esc_html_e( 'Notify Search Engines', 'autodescription' ); ?></h4>
244
+ <?php
245
+
246
+ $engines = array(
247
+ 'ping_google' => 'Google',
248
+ 'ping_bing' => 'Bing',
249
+ 'ping_yandex' => 'Yandex',
250
+ );
251
+
252
+ $ping_checkbox = '';
253
+
254
+ foreach ( $engines as $option => $engine ) {
255
+ $ping_label = sprintf( __( 'Notify %s about sitemap changes?', 'autodescription' ), $engine );
256
+ $ping_checkbox .= $this->make_checkbox( $option, $ping_label, '', true );
257
+ }
258
+
259
+ //* Echo checkbox.
260
+ $this->wrap_fields( $ping_checkbox, true );
261
+ break;
262
+
263
+ default :
264
+ break;
265
+ endswitch;
inc/views/metaboxes/social-metabox.php ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_social_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_social_metabox_main' :
10
+ /**
11
+ * Parse tabs content.
12
+ *
13
+ * @since 2.2.2
14
+ *
15
+ * @param array $default_tabs { 'id' = The identifier =>
16
+ * array(
17
+ * 'name' => The name
18
+ * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
19
+ * 'dashicon' => Desired dashicon
20
+ * )
21
+ * }
22
+ */
23
+ $default_tabs = array(
24
+ 'general' => array(
25
+ 'name' => __( 'General', 'autodescription' ),
26
+ 'callback' => array( $this, 'social_metabox_general_tab' ),
27
+ 'dashicon' => 'admin-generic',
28
+ ),
29
+ 'facebook' => array(
30
+ 'name' => 'Facebook',
31
+ 'callback' => array( $this, 'social_metabox_facebook_tab' ),
32
+ 'dashicon' => 'facebook-alt',
33
+ ),
34
+ 'twitter' => array(
35
+ 'name' => 'Twitter',
36
+ 'callback' => array( $this, 'social_metabox_twitter_tab' ),
37
+ 'dashicon' => 'twitter',
38
+ ),
39
+ 'postdates' => array(
40
+ 'name' => __( 'Post Dates', 'autodescription' ),
41
+ 'callback' => array( $this, 'social_metabox_postdates_tab' ),
42
+ 'dashicon' => 'backup',
43
+ ),
44
+ 'relationships' => array(
45
+ 'name' => __( 'Link Relationships', 'autodescription' ),
46
+ 'callback' => array( $this, 'social_metabox_relationships_tab' ),
47
+ 'dashicon' => 'leftright',
48
+ ),
49
+ );
50
+
51
+ /**
52
+ * Applies filters the_seo_framework_social_settings_tabs : array see $default_tabs
53
+ *
54
+ * Used to extend Social tabs
55
+ */
56
+ $defaults = (array) apply_filters( 'the_seo_framework_social_settings_tabs', $default_tabs, $args );
57
+
58
+ $tabs = wp_parse_args( $args, $defaults );
59
+
60
+ $this->nav_tab_wrapper( 'social', $tabs, '2.2.2' );
61
+ break;
62
+
63
+ case 'the_seo_framework_social_metabox_general' :
64
+
65
+ ?><h4><?php esc_html_e( 'Site Shortlink Settings', 'autodescription' ); ?></h4><?php
66
+ $this->description( __( 'The shortlink tag might have some use for 3rd party service discoverability, but it has little to no SEO value whatsoever.', 'autodescription' ) );
67
+
68
+ //* Echo checkboxes.
69
+ $this->wrap_fields(
70
+ $this->make_checkbox(
71
+ 'shortlink_tag',
72
+ __( 'Output shortlink tag?', 'autodescription' ),
73
+ '',
74
+ true
75
+ ),
76
+ true
77
+ );
78
+
79
+ ?>
80
+ <hr>
81
+
82
+ <h4><?php esc_html_e( 'Social Meta Tags Settings', 'autodescription' ); ?></h4>
83
+ <?php
84
+ $this->description( __( 'Output various meta tags for social site integration, among other 3rd party services.', 'autodescription' ) );
85
+
86
+ ?><hr><?php
87
+
88
+ //* Echo Open Graph Tags checkboxes.
89
+ $this->wrap_fields(
90
+ $this->make_checkbox(
91
+ 'og_tags',
92
+ __( 'Output Open Graph meta tags?', 'autodescription' ),
93
+ __( 'Facebook, Twitter, Pinterest and many other social sites make use of these tags.', 'autodescription' ),
94
+ true
95
+ ),
96
+ true
97
+ );
98
+
99
+ if ( $this->detect_og_plugin() )
100
+ $this->description( __( 'Note: Another Open Graph plugin has been detected.', 'autodescription' ) );
101
+
102
+ ?><hr><?php
103
+
104
+ //* Echo Facebook Tags checkbox.
105
+ $this->wrap_fields(
106
+ $this->make_checkbox(
107
+ 'facebook_tags',
108
+ __( 'Output Facebook meta tags?', 'autodescription' ),
109
+ sprintf( __( 'Output various tags targetted at %s.', 'autodescription' ), 'Facebook' ),
110
+ true
111
+ ),
112
+ true
113
+ );
114
+
115
+ ?><hr><?php
116
+
117
+ //* Echo Twitter Tags checkboxes.
118
+ $this->wrap_fields(
119
+ $this->make_checkbox(
120
+ 'twitter_tags',
121
+ __( 'Output Twitter meta tags?', 'autodescription' ),
122
+ sprintf( __( 'Output various tags targetted at %s.', 'autodescription' ), 'Twitter' ),
123
+ true
124
+ ),
125
+ true
126
+ );
127
+
128
+ if ( $this->detect_twitter_card_plugin() ) {
129
+ $this->description( __( 'Note: Another Twitter Card plugin has been detected.', 'autodescription' ) );
130
+ }
131
+ break;
132
+
133
+ case 'the_seo_framework_social_metabox_facebook' :
134
+
135
+ $fb_author = $this->get_field_value( 'facebook_author' );
136
+ $fb_author_placeholder = empty( $fb_publisher ) ? _x( 'http://www.facebook.com/YourPersonalProfile', 'Example Facebook Personal URL', 'autodescription' ) : '';
137
+
138
+ $fb_publisher = $this->get_field_value( 'facebook_publisher' );
139
+ $fb_publisher_placeholder = empty( $fb_publisher ) ? _x( 'http://www.facebook.com/YourVerifiedBusinessProfile', 'Example Verified Facebook Business URL', 'autodescription' ) : '';
140
+
141
+ $fb_appid = $this->get_field_value( 'facebook_appid' );
142
+ $fb_appid_placeholder = empty( $fb_appid ) ? '123456789012345' : '';
143
+
144
+ ?><h4><?php esc_html_e( 'Default Facebook Integration Settings', 'autodescription' ); ?></h4><?php
145
+ $this->description( __( 'Facebook post sharing works mostly through Open Graph. However, you can also link your Business and Personal Facebook pages, among various other options.', 'autodescription' ) );
146
+ $this->description( __( 'When these options are filled in, Facebook might link your Facebook profile to be followed and liked when your post or page is shared.', 'autodescription' ) );
147
+
148
+ ?>
149
+ <hr>
150
+
151
+ <p>
152
+ <label for="<?php $this->field_id( 'facebook_author' ); ?>">
153
+ <strong><?php esc_html_e( 'Article Author Facebook URL', 'autodescription' ); ?></strong>
154
+ <a href="<?php echo esc_url( 'https://facebook.com/me' ); ?>" class="description" target="_blank" title="<?php esc_attr_e( 'Your Facebook Profile', 'autodescription' ); ?>">[?]</a>
155
+ </label>
156
+ </p>
157
+ <p>
158
+ <input type="text" name="<?php $this->field_name( 'facebook_author' ); ?>" class="large-text" id="<?php $this->field_id( 'facebook_author' ); ?>" placeholder="<?php echo esc_attr( $fb_author_placeholder ); ?>" value="<?php echo esc_attr( $fb_author ); ?>" />
159
+ </p>
160
+
161
+ <p>
162
+ <label for="<?php $this->field_id( 'facebook_publisher' ); ?>">
163
+ <strong><?php esc_html_e( 'Article Publisher Facebook URL', 'autodescription' ); ?></strong>
164
+ <a href="<?php echo esc_url( 'https://instantarticles.fb.com/' ); ?>" class="description" target="_blank" title="<?php esc_html_e( 'To use this, you need to be a verified business', 'autodescription' ); ?>">[?]</a>
165
+ </label>
166
+ </p>
167
+ <p>
168
+ <input type="text" name="<?php $this->field_name( 'facebook_publisher' ); ?>" class="large-text" id="<?php $this->field_id( 'facebook_publisher' ); ?>" placeholder="<?php echo esc_attr( $fb_publisher_placeholder ); ?>" value="<?php echo esc_attr( $fb_publisher ); ?>" />
169
+ </p>
170
+
171
+ <p>
172
+ <label for="<?php $this->field_id( 'facebook_appid' ); ?>">
173
+ <strong><?php esc_html_e( 'Facebook App ID', 'autodescription' ); ?></strong>
174
+ <a href="<?php echo esc_url( 'https://developers.facebook.com/apps' ); ?>" target="_blank" class="description" title="<?php esc_html_e( 'Get Facebook App ID', 'autodescription' ); ?>">[?]</a>
175
+ </label>
176
+ </p>
177
+ <p>
178
+ <input type="text" name="<?php $this->field_name( 'facebook_appid' ); ?>" class="large-text" id="<?php $this->field_id( 'facebook_appid' ); ?>" placeholder="<?php echo esc_attr( $fb_appid_placeholder ); ?>" value="<?php echo esc_attr( $fb_appid ); ?>" />
179
+ </p>
180
+ <?php
181
+ break;
182
+
183
+ case 'the_seo_framework_social_metabox_twitter' :
184
+
185
+ $tw_site = $this->get_field_value( 'twitter_site' );
186
+ $tw_site_placeholder = empty( $tw_site ) ? _x( '@your-site-username', 'Twitter @username', 'autodescription' ) : '';
187
+
188
+ $tw_creator = $this->get_field_value( 'twitter_creator' );
189
+ $tw_creator_placeholder = empty( $tw_creator ) ? _x( '@your-personal-username', 'Twitter @username', 'autodescription' ) : '';
190
+
191
+ $twitter_card = $this->get_twitter_card_types();
192
+
193
+ ?><h4><?php esc_html_e( 'Default Twitter Integration Settings', 'autodescription' ); ?></h4><?php
194
+ $this->description( __( 'Twitter post sharing works mostly through Open Graph. However, you can also link your Business and Personal Twitter pages, among various other options.', 'autodescription' ) );
195
+
196
+ ?>
197
+ <hr>
198
+
199
+ <fieldset id="tsf-twitter-cards">
200
+ <legend><h4><?php esc_html_e( 'Twitter Card Type', 'autodescription' ); ?></h4></legend>
201
+ <?php $this->description_noesc( sprintf( esc_html__( 'What kind of Twitter card would you like to use? It will default to %s if no image is found.', 'autodescription' ), $this->code_wrap( 'summary' ) ) ); ?>
202
+
203
+ <p class="tsf-fields">
204
+ <?php
205
+ foreach ( $twitter_card as $type => $name ) {
206
+ ?>
207
+ <span class="tsf-toblock">
208
+ <input type="radio" name="<?php $this->field_name( 'twitter_card' ); ?>" id="<?php $this->field_id( 'twitter_card_' . $type ); ?>" value="<?php echo esc_attr( $type ); ?>" <?php checked( $this->get_field_value( 'twitter_card' ), $type ); ?> />
209
+ <label for="<?php $this->field_id( 'twitter_card_' . $type ); ?>">
210
+ <span><?php echo $this->code_wrap( $name ); ?></span>
211
+ <a class="description" href="<?php echo esc_url( 'https://dev.twitter.com/cards/types/' . $name ); ?>" target="_blank" title="Twitter Card <?php echo esc_attr( $name ) . ' ' . esc_attr__( 'Example', 'autodescription' ); ?>"><?php esc_html_e( 'Example', 'autodescription' ); ?></a>
212
+ </label>
213
+ </span>
214
+ <?php
215
+ }
216
+ ?>
217
+ </p>
218
+ </fieldset>
219
+
220
+ <hr>
221
+
222
+ <?php $this->description( __( 'When the following options are filled in, Twitter might link your Twitter Site or Personal Profile when your post or page is shared.', 'autodescription' ) ); ?>
223
+
224
+ <p>
225
+ <label for="<?php $this->field_id( 'twitter_site' ); ?>" class="tsf-toblock">
226
+ <strong><?php esc_html_e( "Your Website's Twitter Profile", 'autodescription' ); ?></strong>
227
+ <a href="<?php echo esc_url( 'https://twitter.com/home' ); ?>" target="_blank" class="description" title="<?php esc_html_e( 'Find your @username', 'autodescription' ); ?>">[?]</a>
228
+ </label>
229
+ </p>
230
+ <p>
231
+ <input type="text" name="<?php $this->field_name( 'twitter_site' ); ?>" class="large-text" id="<?php $this->field_id( 'twitter_site' ); ?>" placeholder="<?php echo esc_attr( $tw_site_placeholder ); ?>" value="<?php echo esc_attr( $tw_site ); ?>" />
232
+ </p>
233
+
234
+ <p>
235
+ <label for="<?php $this->field_id( 'twitter_creator' ); ?>" class="tsf-toblock">
236
+ <strong><?php esc_html_e( 'Your Personal Twitter Profile', 'autodescription' ); ?></strong>
237
+ <a href="<?php echo esc_url( 'https://twitter.com/home' ); ?>" target="_blank" class="description" title="<?php esc_attr_e( 'Find your @username', 'autodescription' ); ?>">[?]</a>
238
+ </label>
239
+ </p>
240
+ <p>
241
+ <input type="text" name="<?php $this->field_name( 'twitter_creator' ); ?>" class="large-text" id="<?php $this->field_id( 'twitter_creator' ); ?>" placeholder="<?php echo esc_attr( $tw_creator_placeholder ); ?>" value="<?php echo esc_attr( $tw_creator ); ?>" />
242
+ </p>
243
+ <?php
244
+ break;
245
+
246
+ case 'the_seo_framework_social_metabox_postdates' :
247
+
248
+ $pages_i18n = esc_html__( 'Pages', 'autodescription' );
249
+ $posts_i18n = esc_html__( 'Posts', 'autodescription' );
250
+ $home_i18n = esc_html__( 'Home Page', 'autodescription' );
251
+
252
+ ?><h4><?php esc_html_e( 'Post Date Settings', 'autodescription' ); ?></h4><?php
253
+ $this->description( __( 'Some Search Engines output the publishing date and modified date next to the search results. These help Search Engines find new content and could impact the SEO value.', 'autodescription' ) );
254
+ $this->description( __( "It's recommended on posts, but it's not recommended on pages unless you modify or create new pages frequently.", 'autodescription' ) );
255
+
256
+ /* translators: 1: Option, 2: Post Type */
257
+ $post_publish_time_label = sprintf( esc_html__( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:published_time' ), $posts_i18n );
258
+ $post_publish_time_checkbox = $this->make_checkbox( 'post_publish_time', $post_publish_time_label, '', false );
259
+
260
+ /* translators: 1: Option, 2: Post Type */
261
+ $page_publish_time_label = sprintf( esc_html__( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:published_time' ), $pages_i18n );
262
+ $page_publish_time_checkbox = $this->make_checkbox( 'page_publish_time', $page_publish_time_label, '', false );
263
+
264
+ //* Echo checkboxes.
265
+ $this->wrap_fields( $post_publish_time_checkbox . $page_publish_time_checkbox, true );
266
+
267
+ /* translators: 1: Option, 2: Post Type */
268
+ $post_modify_time_label = sprintf( esc_html__( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:modified_time' ), $posts_i18n );
269
+ $post_modify_time_checkbox = $this->make_checkbox( 'post_modify_time', $post_modify_time_label, '', false );
270
+
271
+ /* translators: 1: Option, 2: Post Type */
272
+ $page_modify_time_label = sprintf( esc_html__( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:modified_time' ), $pages_i18n );
273
+ $page_modify_time_checkbox = $this->make_checkbox( 'page_modify_time', $page_modify_time_label, '', false );
274
+
275
+ //* Echo checkboxes.
276
+ $this->wrap_fields( $post_modify_time_checkbox . $page_modify_time_checkbox, true );
277
+
278
+ ?>
279
+ <hr>
280
+
281
+ <h4><?php esc_html_e( 'Home Page', 'autodescription' ); ?></h4>
282
+ <?php
283
+ $this->description( __( 'Because you only publish the Home Page once, Search Engines might think your website is outdated. This can be prevented by disabling the following options.', 'autodescription' ) );
284
+
285
+ /* translators: 1: Option, 2: Post Type */
286
+ $home_publish_time_label = sprintf( esc_html__( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:published_time' ), $home_i18n );
287
+ $home_publish_time_checkbox = $this->make_checkbox( 'home_publish_time', $home_publish_time_label, '', false );
288
+
289
+ /* translators: 1: Option, 2: Post Type */
290
+ $home_modify_time_label = sprintf( esc_html__( 'Add %1$s to %2$s?', 'autodescription' ), $this->code_wrap( 'article:modified_time' ), $home_i18n );
291
+ $home_modify_time_checkbox = $this->make_checkbox( 'home_modify_time', $home_modify_time_label, '', false );
292
+
293
+ //* Echo checkboxes.
294
+ $this->wrap_fields( $home_publish_time_checkbox . $home_modify_time_checkbox, true );
295
+ break;
296
+
297
+ case 'the_seo_framework_social_metabox_relationships' :
298
+
299
+ ?><h4><?php esc_html_e( 'Link Relationship Settings', 'autodescription' ); ?></h4><?php
300
+ $this->description( __( 'Some Search Engines look for relations between the content of your pages. If you have multiple pages for a single Post or Page, or have archives indexed, this option will help Search Engines look for the right page to display in the Search Results.', 'autodescription' ) );
301
+ $this->description( __( "It's recommended to turn this option on for better SEO consistency and to prevent duplicate content errors.", 'autodescription' ) );
302
+
303
+ ?><hr><?php
304
+
305
+ /* translators: %s = <code>rel</code> */
306
+ $prev_next_posts_label = sprintf( esc_html__( 'Add %s link tags to Posts and Pages?', 'autodescription' ), $this->code_wrap( 'rel' ) );
307
+ $prev_next_posts_checkbox = $this->make_checkbox( 'prev_next_posts', $prev_next_posts_label, '', false );
308
+
309
+ /* translators: %s = <code>rel</code> */
310
+ $prev_next_archives_label = sprintf( esc_html__( 'Add %s link tags to Archives?', 'autodescription' ), $this->code_wrap( 'rel' ) );
311
+ $prev_next_archives_checkbox = $this->make_checkbox( 'prev_next_archives', $prev_next_archives_label, '', false );
312
+
313
+ /* translators: %s = <code>rel</code> */
314
+ $prev_next_frontpage_label = sprintf( esc_html__( 'Add %s link tags to the Home Page?', 'autodescription' ), $this->code_wrap( 'rel' ) );
315
+ $prev_next_frontpage_checkbox = $this->make_checkbox( 'prev_next_frontpage', $prev_next_frontpage_label, '', false );
316
+
317
+ //* Echo checkboxes.
318
+ $this->wrap_fields( $prev_next_posts_checkbox . $prev_next_archives_checkbox . $prev_next_frontpage_checkbox, true );
319
+ break;
320
+
321
+ default :
322
+ break;
323
+ endswitch;
inc/views/metaboxes/title-metabox.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_title_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_title_metabox_main' :
10
+
11
+ $latest_post_id = $this->get_latest_post_id();
12
+
13
+ if ( $latest_post_id ) {
14
+ $post = get_post( $latest_post_id, OBJECT );
15
+ $title = esc_attr( $post->post_title );
16
+ } else {
17
+ $title = esc_attr__( 'Example Post Title', 'autodescription' );
18
+ }
19
+
20
+ $blogname = $this->get_blogname();
21
+ $sep = $this->get_separator( 'title' );
22
+
23
+ $additions_left = '<span class="tsf-title-additions-js">' . $blogname . '<span class="autodescription-sep-js">' . " $sep " . '</span></span>';
24
+ $additions_right = '<span class="tsf-title-additions-js"><span class="autodescription-sep-js">' . " $sep " . '</span>' . $blogname . '</span>';
25
+
26
+ $example_left = '<em>' . $additions_left . $title . '</em>';
27
+ $example_right = '<em>' . $title . $additions_right . '</em>';
28
+
29
+ //* There's no need for "hide-if-no-js" here.
30
+ //* Check left first, as right is default (and thus fallback).
31
+ $showleft = 'left' === $this->get_option( 'title_location' );
32
+
33
+ ?><h4><?php esc_html_e( 'Automated Title Settings', 'autodescription' ); ?></h4><?php
34
+ $this->description( __( 'The page title is prominently shown within the browser tab as well as within the Search Engine results pages.', 'autodescription' ) );
35
+
36
+ ?>
37
+ <h4><?php esc_html_e( 'Example Automated Title Output', 'autodescription' ); ?></h4>
38
+ <p>
39
+ <span class="tsf-title-additions-example-left" style="display:<?php echo $showleft ? 'inline' : 'none'; ?>"><?php echo $this->code_wrap_noesc( $example_left ); ?></span>
40
+ <span class="tsf-title-additions-example-right" style="display:<?php echo $showleft ? 'none' : 'inline'; ?>"><?php echo $this->code_wrap_noesc( $example_right ); ?></span>
41
+ </p>
42
+
43
+ <hr>
44
+ <?php
45
+
46
+ /**
47
+ * Parse tabs content.
48
+ *
49
+ * @since 2.2.2
50
+ *
51
+ * @param array $default_tabs { 'id' = The identifier =>
52
+ * array(
53
+ * 'name' => The name
54
+ * 'callback' => The callback function, use array for method calling (accepts $this, but isn't used here for optimization purposes)
55
+ * 'dashicon' => Desired dashicon
56
+ * )
57
+ * }
58
+ */
59
+ $default_tabs = array(
60
+ 'general' => array(
61
+ 'name' => __( 'General', 'autodescription' ),
62
+ 'callback' => array( $this, 'title_metabox_general_tab' ),
63
+ 'dashicon' => 'admin-generic',
64
+ ),
65
+ 'additions' => array(
66
+ 'name' => __( 'Additions', 'autodescription' ),
67
+ 'callback' => array( $this, 'title_metabox_additions_tab' ),
68
+ 'dashicon' => 'plus',
69
+ 'args' => array(
70
+ 'examples' => array(
71
+ 'left' => $example_left,
72
+ 'right' => $example_right,
73
+ ),
74
+ ),
75
+ ),
76
+ 'prefixes' => array(
77
+ 'name' => __( 'Prefixes', 'autodescription' ),
78
+ 'callback' => array( $this, 'title_metabox_prefixes_tab' ),
79
+ 'dashicon' => 'plus-alt',
80
+ 'args' => array(
81
+ 'additions' => array(
82
+ 'left' => $additions_left,
83
+ 'right' => $additions_right,
84
+ ),
85
+ 'showleft' => $showleft,
86
+ ),
87
+ ),
88
+ );
89
+
90
+ /**
91
+ * Applies filters the_seo_framework_title_settings_tabs : array see $default_tabs
92
+ * @since 2.6.0
93
+ *
94
+ * Used to extend Description tabs.
95
+ */
96
+ $defaults = (array) apply_filters( 'the_seo_framework_title_settings_tabs', $default_tabs, $args );
97
+
98
+ $tabs = wp_parse_args( $args, $defaults );
99
+
100
+ $this->nav_tab_wrapper( 'title', $tabs, '2.6.0' );
101
+ break;
102
+
103
+ case 'the_seo_framework_title_metabox_general' :
104
+ $title_separator = $this->get_separator_list();
105
+ $recommended = ' class="tsf-recommended" title="' . esc_attr__( 'Recommended', 'autodescription' ) . '"';
106
+
107
+ ?>
108
+ <fieldset>
109
+ <legend><h4><?php esc_html_e( 'Document Title Separator', 'autodescription' ); ?></h4></legend>
110
+ <p id="tsf-title-separator" class="tsf-fields">
111
+ <?php foreach ( $title_separator as $name => $html ) { ?>
112
+ <input type="radio" name="<?php $this->field_name( 'title_seperator' ); ?>" id="<?php $this->field_id( 'title_seperator_' . $name ); ?>" value="<?php echo esc_attr( $name ); ?>" <?php checked( $this->get_field_value( 'title_seperator' ), $name ); ?> />
113
+ <label for="<?php $this->field_id( 'title_seperator_' . $name ); ?>" <?php echo in_array( $name, array( 'dash', 'pipe' ), true ) ? $recommended : ''; ?>><?php echo esc_html( $html ); ?></label>
114
+ <?php } ?>
115
+ </p>
116
+ <?php $this->description( __( 'If the title consists of two parts (original title and optional addition), then the separator will go in-between them.', 'autodescription' ) ); ?>
117
+ </fieldset>
118
+ <?php
119
+ break;
120
+
121
+ case 'the_seo_framework_title_metabox_additions' :
122
+
123
+ $language = $this->google_language();
124
+
125
+ $example_left = $examples['left'];
126
+ $example_right = $examples['right'];
127
+
128
+ $home_page_has_option = __( 'The Home Page has a specific option.', 'autodescription' );
129
+
130
+ ?>
131
+ <fieldset>
132
+ <legend><h4><?php esc_html_e( 'Document Title Additions Location', 'autodescription' ); ?></h4></legend>
133
+
134
+ <?php $this->description( __( 'Determines which side the added title text will go on.', 'autodescription' ) ); ?>
135
+
136
+ <p id="tsf-title-location" class="tsf-fields">
137
+ <span class="tsf-toblock">
138
+ <input type="radio" name="<?php $this->field_name( 'title_location' ); ?>" id="<?php $this->field_id( 'title_location_left' ); ?>" value="left" <?php checked( $this->get_field_value( 'title_location' ), 'left' ); ?> />
139
+ <label for="<?php $this->field_id( 'title_location_left' ); ?>">
140
+ <span><?php esc_html_e( 'Left:', 'autodescription' ); ?></span>
141
+ <?php echo $this->code_wrap_noesc( $example_left ) ?>
142
+ </label>
143
+ </span>
144
+ <span class="tsf-toblock">
145
+ <input type="radio" name="<?php $this->field_name( 'title_location' ); ?>" id="<?php $this->field_id( 'title_location_right' ); ?>" value="right" <?php checked( $this->get_field_value( 'title_location' ), 'right' ); ?> />
146
+ <label for="<?php $this->field_id( 'title_location_right' ); ?>">
147
+ <span><?php esc_html_e( 'Right:', 'autodescription' ); ?></span>
148
+ <?php echo $this->code_wrap_noesc( $example_right ); ?>
149
+ </label>
150
+ </span>
151
+ </p>
152
+ <?php $this->description( $home_page_has_option ); ?>
153
+ </fieldset>
154
+ <?php
155
+
156
+ //* Only add this option if the theme is doing it right.
157
+ if ( $this->can_manipulate_title() ) :
158
+ ?>
159
+ <hr>
160
+
161
+ <h4><?php esc_html_e( 'Remove Blogname from Title', 'autodescription' ); ?></h4>
162
+ <div id="tsf-title-additions-toggle">
163
+ <?php
164
+ $info = $this->make_info(
165
+ __( 'This might decouple your posts and pages from the rest of the website', 'autodescription' ),
166
+ 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#3',
167
+ false
168
+ );
169
+
170
+ $this->wrap_fields(
171
+ $this->make_checkbox(
172
+ 'title_rem_additions',
173
+ esc_html__( 'Remove Blogname from title?', 'autodescription' ) . ' ' . $info,
174
+ '',
175
+ false
176
+ ),
177
+ true
178
+ );
179
+ ?>
180
+ </div>
181
+ <?php
182
+ $this->description( __( 'Only use this option if you are aware of its SEO effects.', 'autodescription' ), false );
183
+ echo ' ';
184
+ $this->description( $home_page_has_option, false );
185
+ endif;
186
+ break;
187
+
188
+ case 'the_seo_framework_title_metabox_prefixes' :
189
+
190
+ //* Get translated category label, if it exists. Otherwise, fallback to translation.
191
+ $term_labels = $this->get_tax_labels( 'category' );
192
+ $label = isset( $term_labels->singular_name ) ? $term_labels->singular_name : __( 'Category', 'autodescription' );
193
+
194
+ /**
195
+ * @since WordPress Core 4.5.0 get_terms first parameter is converted to the latter.
196
+ */
197
+ $cats = get_terms( array(), array( 'taxonomy' => 'category', 'fields' => 'ids', 'hide_empty' => false, 'order' => 'ASC', 'number' => 1 ) );
198
+ if ( is_array( $cats ) && ! empty( $cats ) ) {
199
+ //* Category should exist.
200
+ $cat = reset( $cats );
201
+ } else {
202
+ //* Default fallback category.
203
+ $cat = 1;
204
+ }
205
+
206
+ //* If cat is found, it will return its name. Otherwise it's an empty string.
207
+ $cat_name = get_cat_name( $cat );
208
+ $cat_name = $cat_name ? $cat_name : __( 'Example Category', 'autodescription' );
209
+
210
+ $display_prefix = $this->is_option_checked( 'title_rem_prefixes' ) ? 'none' : 'inline';
211
+ $title = '<span class="tsf-title-prefix-example" style="display:' . $display_prefix . '">' . esc_html( $label ) . ': </span>' . esc_html( $cat_name );
212
+
213
+ $additions_left = $additions['left'];
214
+ $additions_right = $additions['right'];
215
+
216
+ $example_left = '<em>' . $additions_left . $title . '</em>';
217
+ $example_right = '<em>' . $title . $additions_right . '</em>';
218
+
219
+ $language = $this->google_language();
220
+
221
+ /**
222
+ * @todo use checkbox function
223
+ * @priority low 2.6.x
224
+ */
225
+
226
+ ?><h4><?php esc_html_e( 'Title prefix options', 'autodescription' ); ?></h4><?php
227
+ $this->description( __( 'On archives a descriptive prefix may be added to the title.', 'autodescription' ) );
228
+
229
+ ?>
230
+ <h4><?php esc_html_e( 'Example Automated Archive Title Output', 'autodescription' ); ?></h4>
231
+ <p>
232
+ <span class="tsf-title-additions-example-left" style="display:<?php echo $showleft ? 'inline' : 'none'; ?>"><?php echo $this->code_wrap_noesc( $example_left ); ?></span>
233
+ <span class="tsf-title-additions-example-right" style="display:<?php echo $showleft ? 'none' : 'inline'; ?>"><?php echo $this->code_wrap_noesc( $example_right ); ?></span>
234
+ </p>
235
+
236
+ <hr>
237
+
238
+ <h4><?php esc_html_e( 'Remove Archive Title Prefixes', 'autodescription' ); ?></h4>
239
+ <p id="title-prefixes-toggle">
240
+ <label for="<?php $this->field_id( 'title_rem_prefixes' ); ?>">
241
+ <input type="checkbox" name="<?php $this->field_name( 'title_rem_prefixes' ); ?>" id="<?php $this->field_id( 'title_rem_prefixes' ); ?>" <?php $this->is_conditional_checked( 'title_rem_prefixes' ); ?> value="1" <?php checked( $this->get_field_value( 'title_rem_prefixes' ) ); ?> />
242
+ <?php esc_html_e( 'Remove prefixes from title?', 'autodescription' ); ?>
243
+ </label>
244
+ <?php
245
+ $this->make_info(
246
+ __( "The prefix helps visitors and Search Engines determine what kind of page they're visiting", 'autodescription' ),
247
+ 'https://support.google.com/webmasters/answer/35624?hl=' . $language . '#3',
248
+ true
249
+ );
250
+ ?>
251
+ </p>
252
+ <?php
253
+ break;
254
+
255
+ default :
256
+ break;
257
+ endswitch;
inc/views/metaboxes/webmaster-metabox.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) and $_this = the_seo_framework_class() and $this instanceof $_this or die;
4
+
5
+ //* Fetch the required instance within this file.
6
+ $instance = $this->get_view_instance( 'the_seo_framework_webmaster_metabox', $instance );
7
+
8
+ switch ( $instance ) :
9
+ case 'the_seo_framework_webmaster_metabox_main' :
10
+ $site_url = $this->the_home_url_from_cache();
11
+ $language = $this->google_language();
12
+
13
+ $bing_site_url = 'https://www.bing.com/webmaster/configure/verify/ownership?url=' . urlencode( $site_url );
14
+ $google_site_url = 'https://www.google.com/webmasters/verification/verification?hl=' . $language . '&siteUrl=' . $site_url;
15
+ $pint_site_url = 'https://analytics.pinterest.com/';
16
+ $yandex_site_url = 'https://webmaster.yandex.com/site/verification.xml';
17
+
18
+ ?><h4><?php esc_html_e( 'Webmaster Integration Settings', 'autodescription' ); ?></h4><?php
19
+ $this->description( __( "When adding your website to Google, Bing and other Webmaster Tools, you'll be asked to add a code or file to your website for verification purposes. These options will help you easily integrate those codes.", 'autodescription' ) );
20
+ $this->description( __( "Verifying your website has no SEO value whatsoever. But you might gain added benefits such as search ranking insights to help you improve your website's content.", 'autodescription' ) );
21
+
22
+ ?>
23
+ <hr>
24
+
25
+ <p>
26
+ <label for="<?php $this->field_id( 'google_verification' ); ?>" class="tsf-toblock">
27
+ <strong><?php esc_html_e( 'Google Webmaster Verification Code', 'autodescription' ); ?></strong>
28
+ <a href="<?php echo esc_url( $google_site_url ); ?>" target="_blank" class="description" title="<?php esc_attr_e( 'Get the Google Verification code', 'autodescription' ); ?>">[?]</a>
29
+ </label>
30
+ </p>
31
+ <p>
32
+ <input type="text" name="<?php $this->field_name( 'google_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'google_verification' ); ?>" placeholder="ABC1d2eFg34H5iJ6klmNOp7qRstUvWXyZaBc8dEfG9" value="<?php echo esc_attr( $this->get_field_value( 'google_verification' ) ); ?>" />
33
+ </p>
34
+
35
+ <p>
36
+ <label for="<?php $this->field_id( 'bing_verification' ); ?>" class="tsf-toblock">
37
+ <strong><?php esc_html_e( 'Bing Webmaster Verification Code', 'autodescription' ); ?></strong>
38
+ <a href="<?php echo esc_url( $bing_site_url ); ?>" target="_blank" class="description" title="<?php esc_attr_e( 'Get the Bing Verification Code', 'autodescription' ); ?>">[?]</a>
39
+ </label>
40
+ </p>
41
+ <p>
42
+ <input type="text" name="<?php $this->field_name( 'bing_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'bing_verification' ); ?>" placeholder="123A456B78901C2D3456E7890F1A234D" value="<?php echo esc_attr( $this->get_field_value( 'bing_verification' ) ); ?>" />
43
+ </p>
44
+
45
+ <p>
46
+ <label for="<?php $this->field_id( 'yandex_verification' ); ?>" class="tsf-toblock">
47
+ <strong><?php esc_html_e( 'Yandex Webmaster Verification Code', 'autodescription' ); ?></strong>
48
+ <a href="<?php echo esc_url( $yandex_site_url ); ?>" target="_blank" class="description" title="<?php esc_attr_e( 'Get the Yandex Verification Code', 'autodescription' ); ?>">[?]</a>
49
+ </label>
50
+ </p>
51
+ <p>
52
+ <input type="text" name="<?php $this->field_name( 'yandex_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'yandex_verification' ); ?>" placeholder="12345abc678901d2" value="<?php echo esc_attr( $this->get_field_value( 'yandex_verification' ) ); ?>" />
53
+ </p>
54
+
55
+ <p>
56
+ <label for="<?php $this->field_id( 'pint_verification' ); ?>" class="tsf-toblock">
57
+ <strong><?php esc_html_e( 'Pinterest Analytics Verification Code', 'autodescription' ); ?></strong>
58
+ <a href="<?php echo esc_url( $pint_site_url ); ?>" target="_blank" class="description" title="<?php esc_attr_e( 'Get the Pinterest Verification Code', 'autodescription' ); ?>">[?]</a>
59
+ </label>
60
+ </p>
61
+ <p>
62
+ <input type="text" name="<?php $this->field_name( 'pint_verification' ); ?>" class="large-text" id="<?php $this->field_id( 'pint_verification' ); ?>" placeholder="123456a7b8901de2fa34bcdef5a67b98" value="<?php echo esc_attr( $this->get_field_value( 'pint_verification' ) ); ?>" />
63
+ </p>
64
+ <?php
65
+ break;
66
+
67
+ default :
68
+ break;
69
+ endswitch;
language/autodescription.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the The SEO Framework package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: The SEO Framework 2.6.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/autodescription\n"
7
- "POT-Creation-Date: 2016-06-08 22:02:53+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,159 +12,163 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: inc/classes/admininit.class.php:220
16
  msgid "Good"
17
  msgstr ""
18
 
19
- #: inc/classes/admininit.class.php:221
20
  msgid "Okay"
21
  msgstr ""
22
 
23
- #: inc/classes/admininit.class.php:222
24
  msgid "Bad"
25
  msgstr ""
26
 
27
- #: inc/classes/admininit.class.php:223
28
  msgid "Unknown"
29
  msgstr ""
30
 
31
- #: inc/classes/admininit.class.php:310
32
  msgid "The changes you made will be lost if you navigate away from this page."
33
  msgstr ""
34
 
35
- #: inc/classes/admininit.class.php:311
36
  msgid "Are you sure you want to reset all SEO settings to their defaults?"
37
  msgstr ""
38
 
39
- #: inc/classes/adminpages.class.php:114
40
  msgid "Save Settings"
41
  msgstr ""
42
 
43
- #: inc/classes/adminpages.class.php:115
44
  msgid "Reset Settings"
45
  msgstr ""
46
 
47
- #: inc/classes/adminpages.class.php:116
48
  msgid "Settings are saved."
49
  msgstr ""
50
 
51
- #: inc/classes/adminpages.class.php:117
52
  msgid "Settings are reset."
53
  msgstr ""
54
 
55
- #: inc/classes/adminpages.class.php:118
56
  msgid "Error saving settings."
57
  msgstr ""
58
 
59
- #: inc/classes/adminpages.class.php:119
60
  msgid "New SEO Settings have been updated."
61
  msgstr ""
62
 
63
- #: inc/classes/adminpages.class.php:135 inc/classes/core.class.php:108
64
- #: inc/classes/siteoptions.class.php:461
65
  msgid "SEO Settings"
66
  msgstr ""
67
 
68
- #: inc/classes/adminpages.class.php:136
69
  msgid "SEO"
70
  msgstr ""
71
 
72
- #: inc/classes/adminpages.class.php:177
73
- msgid "Network SEO Settings"
74
- msgstr ""
75
-
76
- #: inc/classes/adminpages.class.php:178
77
- msgid "Network SEO"
78
- msgstr ""
79
-
80
- #: inc/classes/adminpages.class.php:297
81
  msgid "Title Settings"
82
  msgstr ""
83
 
84
- #: inc/classes/adminpages.class.php:307
85
  msgid "Description Meta Settings"
86
  msgstr ""
87
 
88
- #: inc/classes/adminpages.class.php:317
89
  msgid "Home Page Settings"
90
  msgstr ""
91
 
92
- #: inc/classes/adminpages.class.php:327
93
  msgid "Social Meta Settings"
94
  msgstr ""
95
 
96
- #: inc/classes/adminpages.class.php:337 inc/classes/metaboxes.class.php:1802
 
97
  msgid "Knowledge Graph Settings"
98
  msgstr ""
99
 
100
- #: inc/classes/adminpages.class.php:347
101
  msgid "Schema Settings"
102
  msgstr ""
103
 
104
- #: inc/classes/adminpages.class.php:357 inc/classes/inpost.class.php:377
105
- #: inc/classes/inpost.class.php:604
106
  msgid "Robots Meta Settings"
107
  msgstr ""
108
 
109
- #: inc/classes/adminpages.class.php:367
110
  msgid "Webmaster Meta Settings"
111
  msgstr ""
112
 
113
- #: inc/classes/adminpages.class.php:377
114
  msgid "Sitemap Settings"
115
  msgstr ""
116
 
117
- #: inc/classes/adminpages.class.php:387
118
  msgid "Feed Settings"
119
  msgstr ""
120
 
121
- #: inc/classes/core.class.php:110
122
  msgctxt "As in: The Plugin Home Page"
123
  msgid "Plugin Home"
124
  msgstr ""
125
 
126
- #: inc/classes/core.class.php:149
127
  msgid "Dismiss"
128
  msgstr ""
129
 
130
- #: inc/classes/core.class.php:257
131
  msgctxt "e.g. en for English, nl for Dutch, fi for Finish, de for German"
132
  msgid "en"
133
  msgstr ""
134
 
135
- #: inc/classes/debug.class.php:90
 
 
 
136
  msgid "%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework! Use %3$s instead."
137
  msgstr ""
138
 
139
- #: inc/classes/debug.class.php:92
 
 
140
  msgid "%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework with no alternative available."
141
  msgstr ""
142
 
143
- #: inc/classes/debug.class.php:142
144
  msgid "(This message was added in version %s of The SEO Framework.)"
145
  msgstr ""
146
 
147
  #. translators: %s: Codex URL
148
 
149
- #: inc/classes/debug.class.php:144
150
  msgid "Please see <a href=\"%s\">Debugging in WordPress</a> for more information."
151
  msgstr ""
152
 
153
- #: inc/classes/debug.class.php:145
154
  msgid "https://codex.wordpress.org/Debugging_in_WordPress"
155
  msgstr ""
156
 
157
  #. translators: 1: Function name, 2: Message, 3: Plugin Version notification
158
 
159
- #: inc/classes/debug.class.php:148
160
  msgid "%1$s was called <strong>incorrectly</strong>. %2$s %3$s"
161
  msgstr ""
162
 
163
- #: inc/classes/doingitright.class.php:86
 
 
 
 
 
 
164
  msgid "No Search"
165
  msgstr ""
166
 
167
- #: inc/classes/doingitright.class.php:300
168
  msgid "Refresh to see the SEO Bar status."
169
  msgstr ""
170
 
@@ -172,9 +176,9 @@ msgstr ""
172
  msgid "Post"
173
  msgstr ""
174
 
175
- #: inc/classes/doingitright.class.php:384 inc/classes/inpost.class.php:242
176
- #: inc/classes/metaboxes.class.php:1905 inc/classes/termdata.class.php:187
177
- #: inc/classes/termdata.class.php:223
178
  msgid "Page"
179
  msgstr ""
180
 
@@ -184,1518 +188,1550 @@ msgstr ""
184
 
185
  #. translators: %s = But or And
186
 
187
- #: inc/classes/doingitright.class.php:826
188
  msgid "%s the Title contains the Blogname multiple times."
189
  msgstr ""
190
 
191
- #: inc/classes/doingitright.class.php:929
192
- #: inc/classes/doingitright.class.php:1569
193
- msgid "Length is far too short."
194
- msgstr ""
195
-
196
- #: inc/classes/doingitright.class.php:932
197
- #: inc/classes/doingitright.class.php:1572
198
- msgid "Length is too short."
199
- msgstr ""
200
-
201
- #: inc/classes/doingitright.class.php:937
202
- #: inc/classes/doingitright.class.php:1575
203
- msgid "Length is too long."
204
- msgstr ""
205
-
206
- #: inc/classes/doingitright.class.php:942
207
- #: inc/classes/doingitright.class.php:1578
208
- msgid "Length is far too long."
209
- msgstr ""
210
-
211
- #: inc/classes/doingitright.class.php:945
212
- #: inc/classes/doingitright.class.php:1581
213
- msgid "Length is good."
214
- msgstr ""
215
 
216
- #: inc/classes/doingitright.class.php:1043
217
- msgid "%s is used %d times."
218
  msgstr ""
219
 
220
- #: inc/classes/doingitright.class.php:1087
221
  msgid "%s is being indexed."
222
  msgstr ""
223
 
224
- #: inc/classes/doingitright.class.php:1096
225
  msgid "But you've disabled indexing for the whole site."
226
  msgstr ""
227
 
228
  #. translators: 1: But or And, 2: Current taxonomy term plural label
229
 
230
- #: inc/classes/doingitright.class.php:1120
231
  msgid "%1$s indexing for %2$s have been disabled."
232
  msgstr ""
233
 
234
  #. translators: %s = But or And
235
 
236
- #: inc/classes/doingitright.class.php:1130
237
  msgid "%s the blog isn't set to public. This means WordPress discourages indexing."
238
  msgstr ""
239
 
240
  #. translators: %s = But or And
241
 
242
- #: inc/classes/doingitright.class.php:1144
243
  msgid "%s there are no posts in this term; therefore, indexing has been disabled."
244
  msgstr ""
245
 
246
- #: inc/classes/doingitright.class.php:1229
247
  msgid "%s links aren't being followed."
248
  msgstr ""
249
 
250
- #: inc/classes/doingitright.class.php:1235
251
  msgid "%s links are being followed."
252
  msgstr ""
253
 
254
  #. translators: %s = But or And
255
 
256
- #: inc/classes/doingitright.class.php:1247
257
  msgid "%s you've disabled the following of links for the whole site."
258
  msgstr ""
259
 
260
  #. translators: 1: But or And, 2: Current taxonomy term plural label
261
 
262
- #: inc/classes/doingitright.class.php:1273
263
  msgid "%1$s following for %2$s have been disabled."
264
  msgstr ""
265
 
266
  #. translators: %s = But or And
267
 
268
- #: inc/classes/doingitright.class.php:1285
269
  msgid "%s the blog isn't set to public. This means WordPress allows the links to be followed regardless."
270
  msgstr ""
271
 
272
- #: inc/classes/doingitright.class.php:1337
273
  msgid "Search Engine aren't allowed to archive this %s."
274
  msgstr ""
275
 
276
- #: inc/classes/doingitright.class.php:1342
277
  msgid "Search Engine are allowed to archive this %s."
278
  msgstr ""
279
 
280
- #: inc/classes/doingitright.class.php:1354
281
  msgid "But you've disabled archiving for the whole site."
282
  msgstr ""
283
 
284
  #. translators: 1: But or And, 2: Current taxonomy term plural label
285
 
286
- #: inc/classes/doingitright.class.php:1380
287
  msgid "%1$s archiving for %2$s have been disabled."
288
  msgstr ""
289
 
290
  #. translators: %s = But or And
291
 
292
- #: inc/classes/doingitright.class.php:1393
293
  msgid "%s the blog isn't set to public. This means WordPress allows the blog to be archived regardless."
294
  msgstr ""
295
 
296
- #: inc/classes/doingitright.class.php:1439
297
  msgid "%s isn't being redirected."
298
  msgstr ""
299
 
300
- #: inc/classes/doingitright.class.php:1482
301
- #: inc/classes/doingitright.class.php:1511
302
  msgid "%s is being redirected. This means no SEO values have to be set."
303
  msgstr ""
304
 
305
- #: inc/classes/doingitright.class.php:1485
306
- #: inc/classes/doingitright.class.php:1527
307
  msgid "%s is not being indexed. This means no SEO values have to be set."
308
  msgstr ""
309
 
310
- #: inc/classes/doingitright.class.php:1640
311
  msgid "Title:"
312
  msgstr ""
313
 
314
- #: inc/classes/doingitright.class.php:1641
315
  msgid "Description:"
316
  msgstr ""
317
 
318
- #: inc/classes/doingitright.class.php:1642
319
  msgid "Index:"
320
  msgstr ""
321
 
322
- #: inc/classes/doingitright.class.php:1643
323
  msgid "Follow:"
324
  msgstr ""
325
 
326
- #: inc/classes/doingitright.class.php:1644
327
  msgid "Archive:"
328
  msgstr ""
329
 
330
- #: inc/classes/doingitright.class.php:1645
331
  msgid "Redirect:"
332
  msgstr ""
333
 
334
- #: inc/classes/doingitright.class.php:1647
335
  msgid "Generated: Automatically generated."
336
  msgstr ""
337
 
338
- #: inc/classes/doingitright.class.php:1649
339
  msgctxt "Generated"
340
  msgid "G"
341
  msgstr ""
342
 
343
- #: inc/classes/doingitright.class.php:1650
344
  msgctxt "Title"
345
  msgid "T"
346
  msgstr ""
347
 
348
- #: inc/classes/doingitright.class.php:1651
349
  msgctxt "Description"
350
  msgid "D"
351
  msgstr ""
352
 
353
- #: inc/classes/doingitright.class.php:1652
354
  msgctxt "no-Index"
355
  msgid "I"
356
  msgstr ""
357
 
358
- #: inc/classes/doingitright.class.php:1653
359
  msgctxt "no-Follow"
360
  msgid "F"
361
  msgstr ""
362
 
363
- #: inc/classes/doingitright.class.php:1654
364
  msgctxt "no-Archive"
365
  msgid "A"
366
  msgstr ""
367
 
368
- #: inc/classes/doingitright.class.php:1655
369
  msgctxt "Redirect"
370
  msgid "R"
371
  msgstr ""
372
 
373
- #: inc/classes/doingitright.class.php:1657
374
  msgctxt "But there are..."
375
  msgid "But"
376
  msgstr ""
377
 
378
- #: inc/classes/doingitright.class.php:1658
379
  msgctxt "And there are..."
380
  msgid "And"
381
  msgstr ""
382
 
383
- #: inc/classes/feed.class.php:133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  msgctxt "The content source"
385
  msgid "Source"
386
  msgstr ""
387
 
388
  #. translators: 1: Title, 2: on, 3: Blogname
389
- #. translators: 1: Title on Blogname, 2: Separator, 3: Excerpt
390
 
391
- #: inc/classes/generate-description.class.php:471
392
- #: inc/classes/generate-description.class.php:475
 
 
 
 
 
 
 
393
  msgid "%1$s %2$s %3$s"
394
  msgstr ""
395
 
396
  #. translators: Front-end output.
397
 
398
- #: inc/classes/generate-description.class.php:611
399
- #: inc/classes/metaboxes.class.php:498
400
  msgctxt "Placement. e.g. Post Title \"on\" Blog Name"
401
  msgid "on"
402
  msgstr ""
403
 
404
  #. translators: Front-end output.
405
 
406
- #: inc/classes/generate-description.class.php:675
407
  msgid "Latest posts:"
408
  msgstr ""
409
 
410
  #. translators: Front-end output. 1: Taxonomy singular name, 2: Current
411
  #. taxonomy term
412
 
413
- #: inc/classes/generate-title.class.php:857
414
- #: inc/classes/generate-title.class.php:917
415
  msgid "%1$s: %2$s"
416
  msgstr ""
417
 
418
  #. translators: Front-end output.
419
 
420
- #: inc/classes/generate-title.class.php:861
421
  msgid "Author: %s"
422
  msgstr ""
423
 
424
  #. translators: Front-end output.
425
 
426
- #: inc/classes/generate-title.class.php:865
427
  msgctxt "yearly archives date format"
428
  msgid "Y"
429
  msgstr ""
430
 
431
  #. translators: Front-end output.
432
 
433
- #: inc/classes/generate-title.class.php:867
434
  msgid "Year: %s"
435
  msgstr ""
436
 
437
  #. translators: Front-end output.
438
 
439
- #: inc/classes/generate-title.class.php:870
440
  msgctxt "monthly archives date format"
441
  msgid "F Y"
442
  msgstr ""
443
 
444
  #. translators: Front-end output.
445
 
446
- #: inc/classes/generate-title.class.php:872
447
  msgid "Month: %s"
448
  msgstr ""
449
 
450
  #. translators: Front-end output.
451
 
452
- #: inc/classes/generate-title.class.php:875
453
  msgctxt "daily archives date format"
454
  msgid "F j, Y"
455
  msgstr ""
456
 
457
  #. translators: Front-end output.
458
 
459
- #: inc/classes/generate-title.class.php:877
460
  msgid "Day: %s"
461
  msgstr ""
462
 
463
  #. translators: Front-end output.
464
 
465
- #: inc/classes/generate-title.class.php:882
466
  msgctxt "post format archive title"
467
  msgid "Asides"
468
  msgstr ""
469
 
470
  #. translators: Front-end output.
471
 
472
- #: inc/classes/generate-title.class.php:885
473
  msgctxt "post format archive title"
474
  msgid "Galleries"
475
  msgstr ""
476
 
477
  #. translators: Front-end output.
478
 
479
- #: inc/classes/generate-title.class.php:888
480
  msgctxt "post format archive title"
481
  msgid "Images"
482
  msgstr ""
483
 
484
  #. translators: Front-end output.
485
 
486
- #: inc/classes/generate-title.class.php:891
487
  msgctxt "post format archive title"
488
  msgid "Videos"
489
  msgstr ""
490
 
491
  #. translators: Front-end output.
492
 
493
- #: inc/classes/generate-title.class.php:894
494
  msgctxt "post format archive title"
495
  msgid "Quotes"
496
  msgstr ""
497
 
498
  #. translators: Front-end output.
499
 
500
- #: inc/classes/generate-title.class.php:897
501
  msgctxt "post format archive title"
502
  msgid "Links"
503
  msgstr ""
504
 
505
  #. translators: Front-end output.
506
 
507
- #: inc/classes/generate-title.class.php:900
508
  msgctxt "post format archive title"
509
  msgid "Statuses"
510
  msgstr ""
511
 
512
  #. translators: Front-end output.
513
 
514
- #: inc/classes/generate-title.class.php:903
515
  msgctxt "post format archive title"
516
  msgid "Audio"
517
  msgstr ""
518
 
519
  #. translators: Front-end output.
520
 
521
- #: inc/classes/generate-title.class.php:906
522
  msgctxt "post format archive title"
523
  msgid "Chats"
524
  msgstr ""
525
 
526
  #. translators: Front-end output.
527
 
528
- #: inc/classes/generate-title.class.php:911
529
  msgid "Archives: %s"
530
  msgstr ""
531
 
532
  #. translators: Front-end output.
533
 
534
- #: inc/classes/generate-title.class.php:921
535
  msgid "Archives"
536
  msgstr ""
537
 
538
  #. translators: Front-end output.
539
 
540
- #: inc/classes/generate-title.class.php:1025
541
  msgid "Untitled"
542
  msgstr ""
543
 
544
  #. translators: Front-end output.
545
 
546
- #: inc/classes/generate-title.class.php:1062
547
  msgid "Search results for:"
548
  msgstr ""
549
 
550
  #. translators: Front-end output
551
 
552
- #: inc/classes/generate-title.class.php:1238
553
  msgid "Protected: %s"
554
  msgstr ""
555
 
556
  #. translators: Front-end output
557
 
558
- #: inc/classes/generate-title.class.php:1242
559
  msgid "Private: %s"
560
  msgstr ""
561
 
562
  #. translators: Front-end output.
563
 
564
- #: inc/classes/generate-title.class.php:1275
565
  msgid "Page %s"
566
  msgstr ""
567
 
568
- #: inc/classes/init.class.php:314
569
  msgid "Start The Seo Framework"
570
  msgstr ""
571
 
572
- #: inc/classes/init.class.php:315
573
  msgid "End The Seo Framework"
574
  msgstr ""
575
 
576
- #: inc/classes/init.class.php:316
577
  msgid "by Sybre Waaijer"
578
  msgstr ""
579
 
580
- #: inc/classes/inpost.class.php:155 inc/classes/inpost.class.php:333
581
  msgid "%s SEO Settings"
582
  msgstr ""
583
 
584
- #: inc/classes/inpost.class.php:340 inc/classes/inpost.class.php:407
585
- #: inc/classes/inpost.class.php:565 inc/classes/inpost.class.php:660
586
  msgid "Doing it Right"
587
  msgstr ""
588
 
589
- #: inc/classes/inpost.class.php:350
590
  msgid "%s Title"
591
  msgstr ""
592
 
593
- #: inc/classes/inpost.class.php:351 inc/classes/inpost.class.php:572
594
- #: inc/classes/metaboxes.class.php:1073
595
  msgid "Recommended Length: 50 to 55 characters"
596
  msgstr ""
597
 
598
- #: inc/classes/inpost.class.php:359 inc/classes/inpost.class.php:372
599
- #: inc/classes/inpost.class.php:573 inc/classes/inpost.class.php:587
600
- #: inc/classes/metaboxes.class.php:1074 inc/classes/metaboxes.class.php:1092
 
601
  msgid "Characters Used: %s"
602
  msgstr ""
603
 
604
- #: inc/classes/inpost.class.php:366
605
  msgid "%s Meta Description"
606
  msgstr ""
607
 
608
- #: inc/classes/inpost.class.php:367 inc/classes/inpost.class.php:586
609
- #: inc/classes/metaboxes.class.php:1091
610
  msgid "Recommended Length: 145 to 155 characters"
611
  msgstr ""
612
 
613
- #: inc/classes/inpost.class.php:380 inc/classes/inpost.class.php:387
614
- #: inc/classes/inpost.class.php:394
615
- msgid "Apply %s to this term"
616
  msgstr ""
617
 
618
- #: inc/classes/inpost.class.php:381 inc/classes/metaboxes.class.php:1222
 
619
  msgid "Tell Search Engines not to show this page in their search results"
620
  msgstr ""
621
 
622
- #: inc/classes/inpost.class.php:388 inc/classes/metaboxes.class.php:1232
 
623
  msgid "Tell Search Engines not to follow links on this page"
624
  msgstr ""
625
 
626
- #: inc/classes/inpost.class.php:395 inc/classes/metaboxes.class.php:1242
 
627
  msgid "Tell Search Engines not to save a cached copy of this page"
628
  msgstr ""
629
 
630
- #: inc/classes/inpost.class.php:571 inc/classes/metaboxes.class.php:1072
 
631
  msgid "Custom %s Title"
632
  msgstr ""
633
 
634
- #: inc/classes/inpost.class.php:585 inc/classes/metaboxes.class.php:1090
 
635
  msgid "Custom %s Description"
636
  msgstr ""
637
 
638
- #: inc/classes/inpost.class.php:596
639
  msgid "Custom Canonical URL"
640
  msgstr ""
641
 
642
- #: inc/classes/inpost.class.php:597
643
  msgid "Preferred %s URL location"
644
  msgstr ""
645
 
646
  #. translators: 1: Option, 2: Post or Page
647
 
648
- #: inc/classes/inpost.class.php:609 inc/classes/inpost.class.php:619
649
- #: inc/classes/inpost.class.php:629
650
  msgid "Apply %1$s to this %2$s"
651
  msgstr ""
652
 
653
- #: inc/classes/inpost.class.php:611
654
  msgid "Tell Search Engines not to show this %s in their search results"
655
  msgstr ""
656
 
657
- #: inc/classes/inpost.class.php:621
658
  msgid "Tell Search Engines not to follow links on this %s"
659
  msgstr ""
660
 
661
- #: inc/classes/inpost.class.php:631
662
  msgid "Tell Search Engines not to save a cached copy of this %s"
663
  msgstr ""
664
 
665
- #: inc/classes/inpost.class.php:640
666
  msgid "Local Search Settings"
667
  msgstr ""
668
 
669
- #: inc/classes/inpost.class.php:643
670
  msgid "Exclude this %s from local search"
671
  msgstr ""
672
 
673
- #: inc/classes/inpost.class.php:644
674
  msgid "This excludes this %s from local on-site search results"
675
  msgstr ""
676
 
677
- #: inc/classes/inpost.class.php:650
678
  msgid "Custom 301 Redirect URL"
679
  msgstr ""
680
 
681
- #: inc/classes/inpost.class.php:651
682
  msgid "This will force visitors to go to another URL"
683
  msgstr ""
684
 
685
- #: inc/classes/metaboxes.class.php:212
686
- msgid "Example Post Title"
687
- msgstr ""
688
-
689
- #: inc/classes/metaboxes.class.php:229
690
- msgid "Automated Title Settings"
691
- msgstr ""
692
-
693
- #: inc/classes/metaboxes.class.php:230
694
- msgid "The page title is prominently shown within the browser tab as well as within the Search Engine results pages."
695
- msgstr ""
696
-
697
- #: inc/classes/metaboxes.class.php:232
698
- msgid "Example Automated Title Output"
699
- msgstr ""
700
-
701
- #: inc/classes/metaboxes.class.php:256 inc/classes/metaboxes.class.php:551
702
- #: inc/classes/metaboxes.class.php:707 inc/classes/metaboxes.class.php:878
703
- #: inc/classes/metaboxes.class.php:1328 inc/classes/metaboxes.class.php:1761
704
- #: inc/classes/metaboxes.class.php:2027
705
- msgid "General"
706
- msgstr ""
707
-
708
- #: inc/classes/metaboxes.class.php:261 inc/classes/metaboxes.class.php:556
709
- #: inc/classes/metaboxes.class.php:883
710
- msgid "Additions"
711
- msgstr ""
712
-
713
- #: inc/classes/metaboxes.class.php:272
714
- msgid "Prefixes"
715
- msgstr ""
716
-
717
- #: inc/classes/metaboxes.class.php:311 inc/classes/metaboxes.class.php:592
718
- msgid "Recommended"
719
- msgstr ""
720
-
721
- #: inc/classes/metaboxes.class.php:315
722
- msgid "Document Title Separator"
723
- msgstr ""
724
-
725
- #: inc/classes/metaboxes.class.php:322
726
- msgid "If the title consists of two parts (original title and optional addition), then the separator will go in-between them."
727
- msgstr ""
728
-
729
- #: inc/classes/metaboxes.class.php:347
730
- msgid "The Home Page has a specific option."
731
- msgstr ""
732
-
733
- #: inc/classes/metaboxes.class.php:351 inc/classes/metaboxes.class.php:1139
734
- msgid "Document Title Additions Location"
735
- msgstr ""
736
-
737
- #: inc/classes/metaboxes.class.php:354 inc/classes/metaboxes.class.php:1141
738
- msgid "Determines which side the added title text will go on."
739
- msgstr ""
740
-
741
- #: inc/classes/metaboxes.class.php:360 inc/classes/metaboxes.class.php:1148
742
- msgid "Left:"
743
- msgstr ""
744
-
745
- #: inc/classes/metaboxes.class.php:367 inc/classes/metaboxes.class.php:1155
746
- msgid "Right:"
747
- msgstr ""
748
-
749
- #: inc/classes/metaboxes.class.php:385
750
- msgid "Remove Blogname from Title"
751
- msgstr ""
752
-
753
- #: inc/classes/metaboxes.class.php:389
754
- msgid "Remove Blogname from title?"
755
  msgstr ""
756
 
757
- #: inc/classes/metaboxes.class.php:391
758
- msgid "This might decouple your posts and pages from the rest of the website."
759
  msgstr ""
760
 
761
- #: inc/classes/metaboxes.class.php:393
762
- msgid "Only use this option if you are aware of its SEO effects."
763
  msgstr ""
764
 
765
- #: inc/classes/metaboxes.class.php:419 inc/classes/metaboxes.class.php:663
766
- msgid "Category"
767
  msgstr ""
768
 
769
- #: inc/classes/metaboxes.class.php:431
770
- msgid "Example Category"
 
771
  msgstr ""
772
 
773
- #: inc/classes/metaboxes.class.php:449
774
- msgid "Title prefix options"
 
775
  msgstr ""
776
 
777
- #: inc/classes/metaboxes.class.php:450
778
- msgid "On archives a descriptive prefix may be added to the title."
779
  msgstr ""
780
 
781
- #: inc/classes/metaboxes.class.php:452
782
- msgid "Example Automated Archive Title Output"
783
  msgstr ""
784
 
785
- #: inc/classes/metaboxes.class.php:460
786
- msgid "Remove Archive Title Prefixes"
787
  msgstr ""
788
 
789
- #: inc/classes/metaboxes.class.php:464
790
- msgid "Remove Prefixes from title?"
791
  msgstr ""
792
 
793
- #: inc/classes/metaboxes.class.php:468
794
- msgid "The prefix helps visitors and Search Engines determine what kind of page they're visiting"
795
  msgstr ""
796
 
797
- #: inc/classes/metaboxes.class.php:497
798
- msgid "Example Title"
 
799
  msgstr ""
800
 
801
- #: inc/classes/metaboxes.class.php:499
802
- msgid "This is an example description..."
803
  msgstr ""
804
 
805
- #: inc/classes/metaboxes.class.php:526
806
- msgid "Automated Description Settings"
 
 
 
 
 
 
807
  msgstr ""
808
 
809
- #: inc/classes/metaboxes.class.php:527 inc/classes/metaboxes.class.php:1099
810
- msgid "The meta description can be used to determine the text used under the title on Search Engine results pages."
 
 
811
  msgstr ""
812
 
813
- #: inc/classes/metaboxes.class.php:529
814
- msgid "Example Automated Description Output"
 
815
  msgstr ""
816
 
817
- #: inc/classes/metaboxes.class.php:596
818
  msgid "Description Excerpt Separator"
819
  msgstr ""
820
 
821
- #: inc/classes/metaboxes.class.php:603
822
  msgid "If the Automated Description consists of two parts (title and excerpt), then the separator will go in-between them."
823
  msgstr ""
824
 
825
- #: inc/classes/metaboxes.class.php:626
826
  msgid "Description Additions Settings"
827
  msgstr ""
828
 
829
- #: inc/classes/metaboxes.class.php:627
830
  msgid "To create a more organic description, a small introduction can be added before the description."
831
  msgstr ""
832
 
833
- #: inc/classes/metaboxes.class.php:628
834
  msgid "The introduction consists of the title and optionally the blogname."
835
  msgstr ""
836
 
837
- #: inc/classes/metaboxes.class.php:632
838
  msgid "Add descriptive Additions to Description"
839
  msgstr ""
840
 
841
- #: inc/classes/metaboxes.class.php:636
842
  msgid "Add Additions to automated description?"
843
  msgstr ""
844
 
845
- #: inc/classes/metaboxes.class.php:637
846
  msgid "This creates good meta descriptions"
847
  msgstr ""
848
 
849
- #: inc/classes/metaboxes.class.php:641
850
  msgid "Add Blogname to Additions"
851
  msgstr ""
852
 
853
- #: inc/classes/metaboxes.class.php:645
854
  msgid "Add Blogname to automated description additions?"
855
  msgstr ""
856
 
857
- #: inc/classes/metaboxes.class.php:664
858
- msgid "Tag"
859
- msgstr ""
860
-
861
- #: inc/classes/metaboxes.class.php:665
862
- msgid "Author"
863
- msgstr ""
864
-
865
- #: inc/classes/metaboxes.class.php:666
866
- msgid "Date"
867
- msgstr ""
868
-
869
- #: inc/classes/metaboxes.class.php:667
870
- msgid "Search Pages"
871
- msgstr ""
872
-
873
- #: inc/classes/metaboxes.class.php:668
874
- msgid "Attachment Pages"
875
- msgstr ""
876
-
877
- #: inc/classes/metaboxes.class.php:669
878
- msgctxt "...for the entire site"
879
- msgid "the entire site"
880
- msgstr ""
881
-
882
- #: inc/classes/metaboxes.class.php:676
883
- msgid "NoIndex"
884
- msgstr ""
885
-
886
- #: inc/classes/metaboxes.class.php:677
887
- msgid "These options prevent indexing of the selected archives and pages. If you enable this, the selected archives or pages will be removed from Search Engine results pages."
888
- msgstr ""
889
-
890
- #: inc/classes/metaboxes.class.php:681
891
- msgid "NoFollow"
892
- msgstr ""
893
-
894
- #: inc/classes/metaboxes.class.php:682
895
- msgid "These options prevent links from being followed on the selected archives and pages. If you enable this, the selected archives or pages in-page links will gain no SEO value, including your own links."
896
- msgstr ""
897
-
898
- #: inc/classes/metaboxes.class.php:686
899
- msgid "NoArchive"
900
- msgstr ""
901
-
902
- #: inc/classes/metaboxes.class.php:687
903
- msgid "These options prevent caching of the selected archives and pages. If you enable this, Search Engines will not create a cached copy of the selected archives or pages."
904
- msgstr ""
905
-
906
- #: inc/classes/metaboxes.class.php:713
907
- msgid "Indexing"
908
  msgstr ""
909
 
910
- #: inc/classes/metaboxes.class.php:719
911
- msgid "Following"
912
  msgstr ""
913
 
914
- #: inc/classes/metaboxes.class.php:725
915
- msgid "Archiving"
916
  msgstr ""
917
 
918
- #: inc/classes/metaboxes.class.php:758
919
- msgid "Open Directory Settings"
920
  msgstr ""
921
 
922
- #: inc/classes/metaboxes.class.php:759
923
- msgid "Sometimes, Search Engines use resources from certain Directories to find titles and descriptions for your content. You generally don't want them to. Turn these options on to prevent them from doing so."
924
  msgstr ""
925
 
926
- #: inc/classes/metaboxes.class.php:760
927
- msgid "The Open Directory Project and the Yahoo! Directory may contain outdated SEO values. Therefore, it's best to leave these options checked."
928
  msgstr ""
929
 
930
- #: inc/classes/metaboxes.class.php:767 inc/classes/metaboxes.class.php:772
931
- msgid "Apply %s to the entire site?"
932
  msgstr ""
933
 
934
- #: inc/classes/metaboxes.class.php:782
935
- msgid "Paginated Archive Settings"
936
  msgstr ""
937
 
938
- #: inc/classes/metaboxes.class.php:783
939
- msgid "Indexing the second or later page of any archive might cause duplication errors. Search Engines look down upon them; therefore, it's recommended to disable indexing of those pages."
940
  msgstr ""
941
 
942
- #: inc/classes/metaboxes.class.php:789
943
- msgid "Apply %s to every second or later archive page?"
 
944
  msgstr ""
945
 
946
- #: inc/classes/metaboxes.class.php:811
947
- msgid "%s Robots Settings"
948
  msgstr ""
949
 
950
- #. translators: 1: Option, 2: Post Type
951
-
952
- #: inc/classes/metaboxes.class.php:823
953
- msgid "Apply %1$s to %2$s?"
954
  msgstr ""
955
 
956
- #. translators: 1: Option, 2: Post Type
957
-
958
- #: inc/classes/metaboxes.class.php:827
959
- msgid "Apply %1$s to %2$s Archives?"
960
  msgstr ""
961
 
962
- #: inc/classes/metaboxes.class.php:858
963
  msgid "These settings will take precedence over the settings set within the Home Page edit screen, if any."
964
  msgstr ""
965
 
966
- #: inc/classes/metaboxes.class.php:888
967
  msgid "Robots"
968
  msgstr ""
969
 
970
- #: inc/classes/metaboxes.class.php:938
971
  msgid "Title"
972
  msgstr ""
973
 
974
- #: inc/classes/metaboxes.class.php:939
975
  msgid "Description"
976
  msgstr ""
977
 
978
- #: inc/classes/metaboxes.class.php:940 inc/classes/metaboxes.class.php:1117
979
- #: inc/classes/metaboxes.class.php:1188 inc/classes/metaboxes.class.php:1583
980
- #: inc/classes/metaboxes.class.php:1616
 
 
981
  msgid "Home Page"
982
  msgstr ""
983
 
984
  #. translators: 1: Option, 2: Page SEO Settings, 3: Home Page
985
 
986
- #: inc/classes/metaboxes.class.php:983 inc/classes/metaboxes.class.php:1044
 
987
  msgid "Note: The %1$s is fetched from the %2$s on the %3$s."
988
  msgstr ""
989
 
990
- #: inc/classes/metaboxes.class.php:983 inc/classes/metaboxes.class.php:1044
 
991
  msgid "Page SEO Settings"
992
  msgstr ""
993
 
994
- #: inc/classes/metaboxes.class.php:1061
995
  msgid "Custom %s Title Tagline"
996
  msgstr ""
997
 
998
- #: inc/classes/metaboxes.class.php:1169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  msgid "%s Tagline"
1000
  msgstr ""
1001
 
1002
- #: inc/classes/metaboxes.class.php:1173
1003
  msgid "Add site description (tagline) to the Title on the %s?"
1004
  msgstr ""
1005
 
1006
- #: inc/classes/metaboxes.class.php:1205
1007
  msgid "View Home Page Settings"
1008
  msgstr ""
1009
 
1010
- #: inc/classes/metaboxes.class.php:1205
1011
  msgid "Checked in Page"
1012
  msgstr ""
1013
 
1014
- #: inc/classes/metaboxes.class.php:1211
1015
  msgid "Home Page Robots Meta Settings"
1016
  msgstr ""
1017
 
1018
  #. translators: 1: Option, 2: Location
1019
 
1020
- #: inc/classes/metaboxes.class.php:1219 inc/classes/metaboxes.class.php:1229
1021
- #: inc/classes/metaboxes.class.php:1239
 
1022
  msgid "Apply %1$s to the %2$s?"
1023
  msgstr ""
1024
 
1025
- #: inc/classes/metaboxes.class.php:1272
1026
  msgid "Note: If any of these options are unchecked, but are checked on the Home Page, they will be outputted regardless."
1027
  msgstr ""
1028
 
1029
- #: inc/classes/metaboxes.class.php:1278
1030
  msgid "Home Page Pagination Robots Settings"
1031
  msgstr ""
1032
 
1033
- #: inc/classes/metaboxes.class.php:1280
1034
  msgid "If your Home Page is paginated and outputs content that's also found elsewhere on the website, enabling this option might prevent duplicate content."
1035
  msgstr ""
1036
 
1037
  #. translators: 1: Option, 2: Location
1038
 
1039
- #: inc/classes/metaboxes.class.php:1288
1040
  msgid "Apply %1$s to every second or later page on the %2$s?"
1041
  msgstr ""
1042
 
1043
- #: inc/classes/metaboxes.class.php:1343
1044
- msgid "Post Dates"
1045
  msgstr ""
1046
 
1047
- #: inc/classes/metaboxes.class.php:1348
1048
- msgid "Link Relationships"
1049
  msgstr ""
1050
 
1051
- #: inc/classes/metaboxes.class.php:1379
1052
- msgid "Site Shortlink Settings"
1053
  msgstr ""
1054
 
1055
- #: inc/classes/metaboxes.class.php:1380
1056
- msgid "The shortlink tag might have some use for 3rd party service discoverability, but it has little to no SEO value whatsoever."
1057
  msgstr ""
1058
 
1059
- #: inc/classes/metaboxes.class.php:1387
1060
- msgid "Output shortlink tag?"
1061
  msgstr ""
1062
 
1063
- #: inc/classes/metaboxes.class.php:1396
1064
- msgid "Social Meta Tags Settings"
1065
  msgstr ""
1066
 
1067
- #: inc/classes/metaboxes.class.php:1397
1068
- msgid "Output various meta tags for social site integration, among other 3rd party services."
1069
  msgstr ""
1070
 
1071
- #: inc/classes/metaboxes.class.php:1406
1072
- msgid "Output Open Graph meta tags?"
1073
  msgstr ""
1074
 
1075
- #: inc/classes/metaboxes.class.php:1407
1076
- msgid "Facebook, Twitter, Pinterest and many other social sites make use of these tags."
1077
  msgstr ""
1078
 
1079
- #: inc/classes/metaboxes.class.php:1413
1080
- msgid "Note: Another Open Graph plugin has been detected."
 
1081
  msgstr ""
1082
 
1083
- #: inc/classes/metaboxes.class.php:1421
1084
- msgid "Output Facebook meta tags?"
1085
  msgstr ""
1086
 
1087
- #: inc/classes/metaboxes.class.php:1422 inc/classes/metaboxes.class.php:1434
1088
- msgid "Output various tags targetted at %s."
1089
  msgstr ""
1090
 
1091
- #: inc/classes/metaboxes.class.php:1433
1092
- msgid "Output Twitter meta tags?"
1093
  msgstr ""
1094
 
1095
- #: inc/classes/metaboxes.class.php:1440
1096
- msgid "Note: Another Twitter Card plugin has been detected."
1097
  msgstr ""
1098
 
1099
- #: inc/classes/metaboxes.class.php:1454
1100
- msgctxt "Example Facebook Personal URL"
1101
- msgid "http://www.facebook.com/YourPersonalProfile"
1102
  msgstr ""
1103
 
1104
- #: inc/classes/metaboxes.class.php:1457
1105
- msgctxt "Example Verified Facebook Business URL"
1106
- msgid "http://www.facebook.com/YourVerifiedBusinessProfile"
1107
- msgstr ""
1108
-
1109
- #: inc/classes/metaboxes.class.php:1463
1110
- msgid "Default Facebook Integration Settings"
1111
- msgstr ""
1112
-
1113
- #: inc/classes/metaboxes.class.php:1464
1114
- msgid "Facebook post sharing works mostly through Open Graph. However, you can also link your Business and Personal Facebook pages, among various other options."
1115
- msgstr ""
1116
-
1117
- #: inc/classes/metaboxes.class.php:1465
1118
- msgid "When these options are filled in, Facebook might link your Facebook profile to be followed and liked when your post or page is shared."
1119
- msgstr ""
1120
-
1121
- #: inc/classes/metaboxes.class.php:1471
1122
- msgid "Article Author Facebook URL"
1123
- msgstr ""
1124
-
1125
- #: inc/classes/metaboxes.class.php:1472
1126
- msgid "Your Facebook Profile"
1127
- msgstr ""
1128
-
1129
- #: inc/classes/metaboxes.class.php:1481
1130
- msgid "Article Publisher Facebook URL"
1131
- msgstr ""
1132
-
1133
- #: inc/classes/metaboxes.class.php:1482
1134
- msgid "To use this, you need to be a verified business"
1135
- msgstr ""
1136
-
1137
- #: inc/classes/metaboxes.class.php:1491
1138
- msgid "Facebook App ID"
1139
- msgstr ""
1140
-
1141
- #: inc/classes/metaboxes.class.php:1492
1142
- msgid "Get Facebook App ID"
1143
- msgstr ""
1144
-
1145
- #: inc/classes/metaboxes.class.php:1512
1146
- msgctxt "Twitter @username"
1147
- msgid "@your-site-username"
1148
- msgstr ""
1149
-
1150
- #: inc/classes/metaboxes.class.php:1515
1151
- msgctxt "Twitter @username"
1152
- msgid "@your-personal-username"
1153
- msgstr ""
1154
-
1155
- #: inc/classes/metaboxes.class.php:1520
1156
- msgid "Default Twitter Integration Settings"
1157
- msgstr ""
1158
-
1159
- #: inc/classes/metaboxes.class.php:1521
1160
- msgid "Twitter post sharing works mostly through Open Graph. However, you can also link your Business and Personal Twitter pages, among various other options."
1161
- msgstr ""
1162
-
1163
- #: inc/classes/metaboxes.class.php:1526
1164
- msgid "Twitter Card Type"
1165
  msgstr ""
1166
 
1167
- #: inc/classes/metaboxes.class.php:1527
1168
- msgid "What kind of Twitter card would you like to use? It will default to %s if no image is found."
 
1169
  msgstr ""
1170
 
1171
- #: inc/classes/metaboxes.class.php:1537
1172
- msgid "Example"
 
1173
  msgstr ""
1174
 
1175
- #: inc/classes/metaboxes.class.php:1548
1176
- msgid "When the following options are filled in, Twitter might link your Twitter Site or Personal Profile when your post or page is shared."
1177
  msgstr ""
1178
 
1179
- #: inc/classes/metaboxes.class.php:1551
1180
- msgid "Your Website's Twitter Profile"
 
1181
  msgstr ""
1182
 
1183
- #: inc/classes/metaboxes.class.php:1552 inc/classes/metaboxes.class.php:1562
1184
- msgid "Find your @username"
1185
  msgstr ""
1186
 
1187
- #: inc/classes/metaboxes.class.php:1561
1188
- msgid "Your Personal Twitter Profile"
1189
  msgstr ""
1190
 
1191
- #: inc/classes/metaboxes.class.php:1581 inc/classes/termdata.class.php:189
1192
- #: inc/classes/termdata.class.php:225
1193
- msgid "Pages"
1194
  msgstr ""
1195
 
1196
- #: inc/classes/metaboxes.class.php:1582
1197
- msgid "Posts"
1198
  msgstr ""
1199
 
1200
- #: inc/classes/metaboxes.class.php:1586
1201
- msgid "Post Date Settings"
1202
  msgstr ""
1203
 
1204
- #: inc/classes/metaboxes.class.php:1587
1205
- msgid "Some Search Engines output the publishing date and modified date next to the search results. These help Search Engines find new content and could impact the SEO value."
 
1206
  msgstr ""
1207
 
1208
- #: inc/classes/metaboxes.class.php:1588
1209
- msgid "It's recommended on posts, but it's not recommended on pages unless you modify or create new pages frequently."
1210
  msgstr ""
1211
 
1212
- #. translators: 1: Option, 2: Post Type
1213
-
1214
- #: inc/classes/metaboxes.class.php:1592 inc/classes/metaboxes.class.php:1596
1215
- #: inc/classes/metaboxes.class.php:1603 inc/classes/metaboxes.class.php:1607
1216
- #: inc/classes/metaboxes.class.php:1621 inc/classes/metaboxes.class.php:1625
1217
- msgid "Add %1$s to %2$s?"
1218
  msgstr ""
1219
 
1220
- #: inc/classes/metaboxes.class.php:1617
1221
- msgid "Because you only publish the Home Page once, Search Engines might think your website is outdated. This can be prevented by disabling the following options."
1222
  msgstr ""
1223
 
1224
- #: inc/classes/metaboxes.class.php:1643
1225
- msgid "Link Relationship Settings"
1226
  msgstr ""
1227
 
1228
- #: inc/classes/metaboxes.class.php:1644
1229
- msgid "Some Search Engines look for relations between the content of your pages. If you have multiple pages for a single Post or Page, or have archives indexed, this option will help Search Engines look for the right page to display in the Search Results."
1230
  msgstr ""
1231
 
1232
- #: inc/classes/metaboxes.class.php:1645
1233
- msgid "It's recommended to turn this option on for better SEO consistency and to prevent duplicate content errors."
1234
  msgstr ""
1235
 
1236
- #. translators: %s = <code>rel</code>
1237
-
1238
- #: inc/classes/metaboxes.class.php:1650
1239
- msgid "Add %s link tags to Posts and Pages?"
1240
  msgstr ""
1241
 
1242
- #. translators: %s = <code>rel</code>
1243
-
1244
- #: inc/classes/metaboxes.class.php:1654
1245
- msgid "Add %s link tags to Archives?"
1246
  msgstr ""
1247
 
1248
- #. translators: %s = <code>rel</code>
1249
-
1250
- #: inc/classes/metaboxes.class.php:1658
1251
- msgid "Add %s link tags to the Home Page?"
1252
  msgstr ""
1253
 
1254
- #: inc/classes/metaboxes.class.php:1684
1255
- msgid "Webmaster Integration Settings"
1256
  msgstr ""
1257
 
1258
- #: inc/classes/metaboxes.class.php:1685
1259
- msgid "When adding your website to Google, Bing and other Webmaster Tools, you'll be asked to add a code or file to your website for verification purposes. These options will help you easily integrate those codes."
1260
  msgstr ""
1261
 
1262
- #: inc/classes/metaboxes.class.php:1686
1263
- msgid "Verifying your website has no SEO value whatsoever. But you might gain added benefits such as search ranking insights to help you improve your website's content."
1264
  msgstr ""
1265
 
1266
- #: inc/classes/metaboxes.class.php:1692
1267
- msgid "Google Webmaster Verification Code"
 
1268
  msgstr ""
1269
 
1270
- #: inc/classes/metaboxes.class.php:1693
1271
- msgid "Get the Google Verification code"
1272
  msgstr ""
1273
 
1274
- #: inc/classes/metaboxes.class.php:1702
1275
- msgid "Bing Webmaster Verification Code"
1276
  msgstr ""
1277
 
1278
- #: inc/classes/metaboxes.class.php:1703
1279
- msgid "Get the Bing Verification Code"
1280
  msgstr ""
1281
 
1282
- #: inc/classes/metaboxes.class.php:1712
1283
- msgid "Yandex Webmaster Verification Code"
1284
  msgstr ""
1285
 
1286
- #: inc/classes/metaboxes.class.php:1713
1287
- msgid "Get the Yandex Verification Code"
1288
- msgstr ""
1289
 
1290
- #: inc/classes/metaboxes.class.php:1722
1291
- msgid "Pinterest Analytics Verification Code"
1292
  msgstr ""
1293
 
1294
- #: inc/classes/metaboxes.class.php:1723
1295
- msgid "Get the Pinterest Verification Code"
1296
- msgstr ""
1297
 
1298
- #: inc/classes/metaboxes.class.php:1766
1299
- msgid "Website"
1300
  msgstr ""
1301
 
1302
- #: inc/classes/metaboxes.class.php:1803
1303
- msgid "The Knowledge Graph lets Google and other Search Engines know where to find you or your organization and its relevant content."
1304
  msgstr ""
1305
 
1306
- #: inc/classes/metaboxes.class.php:1804
1307
- msgid "Google is becoming more of an 'Answer Engine' than a 'Search Engine'. Setting up these options could have a positive impact on the SEO value of your website."
1308
  msgstr ""
1309
 
1310
- #: inc/classes/metaboxes.class.php:1807
1311
- msgid "Output Knowledge tags?"
1312
  msgstr ""
1313
 
1314
- #: inc/classes/metaboxes.class.php:1817
1315
- msgctxt "WordPress Customizer"
1316
- msgid "Website logo"
1317
  msgstr ""
1318
 
1319
- #: inc/classes/metaboxes.class.php:1819
1320
- msgid "Use the Favicon from Customizer as the Organization Logo?"
1321
- msgstr ""
1322
 
1323
- #: inc/classes/metaboxes.class.php:1820
1324
- msgid "This option only has an effect when this site represents an Organization. If left disabled, Search Engines will look elsewhere for a logo, if it exists and is assigned as a logo."
 
 
1325
  msgstr ""
1326
 
1327
- #: inc/classes/metaboxes.class.php:1841
1328
- msgid "About this website"
1329
  msgstr ""
1330
 
1331
- #: inc/classes/metaboxes.class.php:1842
1332
- msgid "Who or what is your website about?"
 
1333
  msgstr ""
1334
 
1335
- #: inc/classes/metaboxes.class.php:1847
1336
- msgctxt "...Organization or Person."
1337
- msgid "This website represents:"
1338
  msgstr ""
1339
 
1340
- #: inc/classes/metaboxes.class.php:1853
1341
- msgid "An Organization"
1342
  msgstr ""
1343
 
1344
- #: inc/classes/metaboxes.class.php:1854
1345
- msgid "A Person"
1346
  msgstr ""
1347
 
1348
- #: inc/classes/metaboxes.class.php:1867
1349
- msgid "The organization or personal name"
1350
  msgstr ""
1351
 
1352
- #: inc/classes/metaboxes.class.php:1887
1353
- msgid "Social Pages connected to this website"
1354
  msgstr ""
1355
 
1356
- #: inc/classes/metaboxes.class.php:1888
1357
- msgid "Don't have a page at a site or is the profile only privately accessible? Leave that field empty. Unsure? Fill it in anyway."
1358
  msgstr ""
1359
 
1360
- #: inc/classes/metaboxes.class.php:1889
1361
- msgid "Add the link that leads directly to the social page of this website."
1362
  msgstr ""
1363
 
1364
- #: inc/classes/metaboxes.class.php:1894
1365
- msgctxt "No spaces. E.g. https://facebook.com/RelatedProfile"
1366
- msgid "RelatedProfile"
1367
  msgstr ""
1368
 
1369
- #: inc/classes/metaboxes.class.php:1895
1370
- msgctxt "Social Profile"
1371
- msgid "Profile"
1372
  msgstr ""
1373
 
1374
- #: inc/classes/metaboxes.class.php:1961
1375
- msgid "Blog"
1376
  msgstr ""
1377
 
1378
- #: inc/classes/metaboxes.class.php:2001
1379
  msgid "Permalink Settings"
1380
  msgstr ""
1381
 
1382
- #: inc/classes/metaboxes.class.php:2001 inc/classes/metaboxes.class.php:2134
1383
- #: inc/classes/metaboxes.class.php:2153
 
1384
  msgctxt "The sitemap can be found %s."
1385
  msgid "here"
1386
  msgstr ""
1387
 
1388
- #: inc/classes/metaboxes.class.php:2004
1389
  msgid "You're using the plain permalink structure."
1390
  msgstr ""
1391
 
1392
- #: inc/classes/metaboxes.class.php:2005
1393
  msgid "This means we can't output the sitemap through the WordPress rewrite rules."
1394
  msgstr ""
1395
 
1396
- #: inc/classes/metaboxes.class.php:2007
1397
  msgctxt "%s = here"
1398
  msgid "Change your Permalink Settings %s (Recommended: 'postname')."
1399
  msgstr ""
1400
 
1401
- #: inc/classes/metaboxes.class.php:2037
1402
  msgid "Timestamps"
1403
  msgstr ""
1404
 
1405
- #: inc/classes/metaboxes.class.php:2042
1406
  msgctxt "Ping or notify Search Engine"
1407
  msgid "Ping"
1408
  msgstr ""
1409
 
1410
- #: inc/classes/metaboxes.class.php:2106
1411
  msgid "Sitemap Integration Settings"
1412
  msgstr ""
1413
 
1414
- #: inc/classes/metaboxes.class.php:2111
1415
  msgid "Another active sitemap plugin has been detected. This means that the sitemap functionality has been replaced."
1416
  msgstr ""
1417
 
1418
- #: inc/classes/metaboxes.class.php:2115
1419
  msgid "A sitemap has been detected in the root folder of your website. This means that the sitemap functionality has no effect."
1420
  msgstr ""
1421
 
1422
- #: inc/classes/metaboxes.class.php:2119
1423
  msgid "The Sitemap is an XML file that lists pages and posts for your website along with optional metadata about each post or page. This helps Search Engines crawl your website more easily."
1424
  msgstr ""
1425
 
1426
- #: inc/classes/metaboxes.class.php:2120
1427
  msgid "The optional metadata include the post and page modified time and a page priority indication, which is automated."
1428
  msgstr ""
1429
 
1430
- #: inc/classes/metaboxes.class.php:2124
1431
  msgid "Sitemap Output"
1432
  msgstr ""
1433
 
1434
- #: inc/classes/metaboxes.class.php:2126
1435
  msgid "Output Sitemap?"
1436
  msgstr ""
1437
 
1438
- #: inc/classes/metaboxes.class.php:2134
1439
  msgid "View sitemap"
1440
  msgstr ""
1441
 
1442
- #: inc/classes/metaboxes.class.php:2136
1443
  msgctxt "%s = here"
1444
  msgid "The sitemap can be found %s."
1445
  msgstr ""
1446
 
1447
- #: inc/classes/metaboxes.class.php:2153
1448
  msgid "View robots.txt"
1449
  msgstr ""
1450
 
1451
- #: inc/classes/metaboxes.class.php:2156
1452
  msgid "Robots.txt Settings"
1453
  msgstr ""
1454
 
1455
- #: inc/classes/metaboxes.class.php:2160
1456
  msgid "The robots.txt file is the first thing Search Engines look for. If you add the sitemap location in the robots.txt file, then Search Engines will look for and index the sitemap."
1457
  msgstr ""
1458
 
1459
- #: inc/classes/metaboxes.class.php:2161
1460
  msgid "If you do not add the sitemap location to the robots.txt file, you will need to notify Search Engines manually through the Webmaster Console provided by the Search Engines."
1461
  msgstr ""
1462
 
1463
- #: inc/classes/metaboxes.class.php:2165
1464
  msgid "Add sitemap location in robots.txt"
1465
  msgstr ""
1466
 
1467
- #: inc/classes/metaboxes.class.php:2171
1468
  msgid "Add sitemap location in robots?"
1469
  msgstr ""
1470
 
1471
- #: inc/classes/metaboxes.class.php:2177
1472
  msgid "Another robots.txt sitemap Location addition has been detected."
1473
  msgstr ""
1474
 
1475
- #: inc/classes/metaboxes.class.php:2182
1476
  msgctxt "%s = here"
1477
  msgid "The robots.txt file can be found %s."
1478
  msgstr ""
1479
 
1480
- #: inc/classes/metaboxes.class.php:2211
1481
  msgid "Timestamps Settings"
1482
  msgstr ""
1483
 
1484
- #: inc/classes/metaboxes.class.php:2212
1485
  msgid "The modified time suggests to Search Engines where to look for content changes. It has no impact on the SEO value unless you drastically change pages or posts. It then depends on how well your content is constructed."
1486
  msgstr ""
1487
 
1488
- #: inc/classes/metaboxes.class.php:2213
1489
  msgid "By default, the sitemap only outputs the modified date if you've enabled them within the Social Metabox. This setting overrides those settings for the Sitemap."
1490
  msgstr ""
1491
 
1492
- #: inc/classes/metaboxes.class.php:2217
1493
  msgid "Output Modified Date"
1494
  msgstr ""
1495
 
1496
- #: inc/classes/metaboxes.class.php:2219
1497
  msgid "Add %s to the sitemap?"
1498
  msgstr ""
1499
 
1500
- #: inc/classes/metaboxes.class.php:2229
1501
  msgid "Timestamp Format Settings"
1502
  msgstr ""
1503
 
1504
- #: inc/classes/metaboxes.class.php:2231
1505
  msgid "Determines how specific the modification timestamp is."
1506
  msgstr ""
1507
 
1508
- #: inc/classes/metaboxes.class.php:2238
1509
  msgid "Complete date"
1510
  msgstr ""
1511
 
1512
- #: inc/classes/metaboxes.class.php:2244
1513
  msgid "Complete date plus hours, minutes and timezone"
1514
  msgstr ""
1515
 
1516
- #: inc/classes/metaboxes.class.php:2263
1517
  msgid "Ping Settings"
1518
  msgstr ""
1519
 
1520
- #: inc/classes/metaboxes.class.php:2264
1521
  msgid "Notifying Search Engines of a sitemap change is helpful to get your content indexed as soon as possible."
1522
  msgstr ""
1523
 
1524
- #: inc/classes/metaboxes.class.php:2265
1525
  msgid "By default this will happen at most once an hour."
1526
  msgstr ""
1527
 
1528
- #: inc/classes/metaboxes.class.php:2269
1529
  msgid "Notify Search Engines"
1530
  msgstr ""
1531
 
1532
- #: inc/classes/metaboxes.class.php:2280
1533
  msgid "Notify %s about sitemap changes?"
1534
  msgstr ""
1535
 
1536
- #: inc/classes/metaboxes.class.php:2299
1537
- msgid "Content Feed Settings"
1538
  msgstr ""
1539
 
1540
- #: inc/classes/metaboxes.class.php:2300
1541
- msgid "Sometimes, your content can get stolen by robots through the WordPress feeds. This can cause duplicate content issues. To prevent this from happening, it's recommended to convert the feed's content into an excerpt."
1542
  msgstr ""
1543
 
1544
- #: inc/classes/metaboxes.class.php:2301
1545
- msgid "Adding a backlink below the feed's content will also let the visitors know where the content came from."
1546
  msgstr ""
1547
 
1548
- #: inc/classes/metaboxes.class.php:2305
1549
- msgid "Change Feed Settings"
1550
  msgstr ""
1551
 
1552
- #: inc/classes/metaboxes.class.php:2307
1553
- msgid "Convert feed content into excerpts?"
1554
  msgstr ""
1555
 
1556
- #: inc/classes/metaboxes.class.php:2308
1557
- msgid "By default the excerpt will be at most 400 characters long"
1558
  msgstr ""
1559
 
1560
- #: inc/classes/metaboxes.class.php:2310
1561
- msgid "Add backlinks below the feed content?"
1562
  msgstr ""
1563
 
1564
- #: inc/classes/metaboxes.class.php:2311
1565
- msgid "This link will not be followed by Search Engines"
1566
  msgstr ""
1567
 
1568
- #: inc/classes/metaboxes.class.php:2323
1569
- msgid "Reading Settings"
1570
  msgstr ""
1571
 
1572
- #: inc/classes/metaboxes.class.php:2326
1573
- msgctxt "%s = Reading Settings"
1574
- msgid "Note: The feed is already converted into an excerpt through the %s."
1575
  msgstr ""
1576
 
1577
- #: inc/classes/metaboxes.class.php:2331
1578
- msgid "View feed"
1579
  msgstr ""
1580
 
1581
- #: inc/classes/metaboxes.class.php:2331
1582
- msgctxt "The feed can be found %s."
1583
- msgid "here"
1584
  msgstr ""
1585
 
1586
- #: inc/classes/metaboxes.class.php:2333
1587
- msgctxt "%s = here"
1588
- msgid "The feed can be found %s."
1589
  msgstr ""
1590
 
1591
- #: inc/classes/metaboxes.class.php:2349
1592
- msgid "Schema.org Output Settings"
1593
  msgstr ""
1594
 
1595
- #: inc/classes/metaboxes.class.php:2352
1596
- msgid "Another Schema.org plugin has been detected."
 
1597
  msgstr ""
1598
 
1599
- #: inc/classes/metaboxes.class.php:2354
1600
- msgid "The Schema.org markup is a standard way of annotating structured data for Search Engines. This markup is represented within hidden scripts throughout the website."
 
1601
  msgstr ""
1602
 
1603
- #: inc/classes/metaboxes.class.php:2355
1604
- msgid "When your web pages include structured data markup, Search Engines can use that data to index your content better, present it more prominently in Search Results, and use it in several different applications."
1605
  msgstr ""
1606
 
1607
- #. translators:
1608
- #. https:developers.google.com/search/docs/data-types/sitelinks-searchbox
 
1609
 
1610
- #: inc/classes/metaboxes.class.php:2360 inc/classes/metaboxes.class.php:2364
1611
- msgctxt "Product name"
1612
- msgid "Sitelinks Searchbox"
1613
  msgstr ""
1614
 
1615
- #: inc/classes/metaboxes.class.php:2361
1616
- msgid "When Search users search for your brand name, the following option allows them to search through your website directly from the Search Results."
1617
  msgstr ""
1618
 
1619
- #: inc/classes/metaboxes.class.php:2371
1620
- msgctxt "Product name"
1621
- msgid "Enable Sitelinks Searchbox?"
1622
  msgstr ""
1623
 
1624
- #: inc/classes/metaboxes.class.php:2380
1625
- msgid "Site Name"
1626
  msgstr ""
1627
 
1628
- #: inc/classes/metaboxes.class.php:2381
1629
- msgid "When using breadcrumbs, the first entry is by default your website's address. Using the following option will convert it to the Site Name."
1630
  msgstr ""
1631
 
1632
- #: inc/classes/metaboxes.class.php:2384
1633
- msgid "Include your Site Name in Search Results"
1634
  msgstr ""
1635
 
1636
- #: inc/classes/metaboxes.class.php:2388
1637
- msgid "The Site Name is: %s"
1638
  msgstr ""
1639
 
1640
- #: inc/classes/metaboxes.class.php:2392
1641
- msgid "Convert URL to Site Name?"
 
1642
  msgstr ""
1643
 
1644
- #: inc/classes/metaboxes.class.php:2401
1645
- msgid "Breadcrumbs"
 
1646
  msgstr ""
1647
 
1648
- #: inc/classes/metaboxes.class.php:2402
1649
- msgid "Breadcrumb trails indicate the page's position in the site hierarchy. Using the following option will show the hierarchy within the Search Results when available."
1650
  msgstr ""
1651
 
1652
- #: inc/classes/metaboxes.class.php:2405
1653
- msgid "About Breadcrumbs"
1654
  msgstr ""
1655
 
1656
- #: inc/classes/metaboxes.class.php:2409
1657
- msgid "Multiple trails can be outputted. The longest trail is prioritized."
1658
  msgstr ""
1659
 
1660
- #: inc/classes/metaboxes.class.php:2413
1661
- msgid "Enable Breadcrumbs?"
1662
  msgstr ""
1663
 
1664
- #: inc/classes/sitemaps.class.php:277
1665
- msgid "Sitemap is generated for this view"
1666
  msgstr ""
1667
 
1668
- #: inc/classes/sitemaps.class.php:279
1669
- msgid "Sitemap is served from cache"
1670
  msgstr ""
1671
 
1672
- #: inc/classes/sitemaps.class.php:399
1673
- msgid "Sitemap is generated on"
1674
  msgstr ""
1675
 
1676
- #: inc/classes/siteoptions.class.php:461
1677
- msgid "here"
 
1678
  msgstr ""
1679
 
1680
- #: inc/classes/siteoptions.class.php:463
1681
- msgctxt "%s = here"
1682
- msgid "View the new options %s."
1683
  msgstr ""
1684
 
1685
- #: inc/classes/transients.class.php:259
1686
- msgid "Third parameter must be a known type."
1687
  msgstr ""
1688
 
1689
- #: load.class.php:224 load.class.php:234 load.class.php:246
1690
- msgid "Class or Method not found."
1691
  msgstr ""
1692
 
1693
- #: load.class.php:258
1694
- msgid "Function needs to be called as a string."
1695
  msgstr ""
1696
 
1697
- #: load.class.php:271
1698
- msgid "%s of The SEO Framework"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1699
  msgstr ""
1700
  #. Plugin Name of the plugin/theme
1701
  msgid "The SEO Framework"
2
  # This file is distributed under the same license as the The SEO Framework package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: The SEO Framework 2.7.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/autodescription\n"
7
+ "POT-Creation-Date: 2016-09-09 18:15:47+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: inc/classes/admin-init.class.php:232
16
  msgid "Good"
17
  msgstr ""
18
 
19
+ #: inc/classes/admin-init.class.php:233
20
  msgid "Okay"
21
  msgstr ""
22
 
23
+ #: inc/classes/admin-init.class.php:234
24
  msgid "Bad"
25
  msgstr ""
26
 
27
+ #: inc/classes/admin-init.class.php:235
28
  msgid "Unknown"
29
  msgstr ""
30
 
31
+ #: inc/classes/admin-init.class.php:316
32
  msgid "The changes you made will be lost if you navigate away from this page."
33
  msgstr ""
34
 
35
+ #: inc/classes/admin-init.class.php:317
36
  msgid "Are you sure you want to reset all SEO settings to their defaults?"
37
  msgstr ""
38
 
39
+ #: inc/classes/adminpages.class.php:123
40
  msgid "Save Settings"
41
  msgstr ""
42
 
43
+ #: inc/classes/adminpages.class.php:124
44
  msgid "Reset Settings"
45
  msgstr ""
46
 
47
+ #: inc/classes/adminpages.class.php:125
48
  msgid "Settings are saved."
49
  msgstr ""
50
 
51
+ #: inc/classes/adminpages.class.php:126
52
  msgid "Settings are reset."
53
  msgstr ""
54
 
55
+ #: inc/classes/adminpages.class.php:127
56
  msgid "Error saving settings."
57
  msgstr ""
58
 
59
+ #: inc/classes/adminpages.class.php:128
60
  msgid "New SEO Settings have been updated."
61
  msgstr ""
62
 
63
+ #: inc/classes/adminpages.class.php:144 inc/classes/core.class.php:181
64
+ #: inc/classes/siteoptions.class.php:471
65
  msgid "SEO Settings"
66
  msgstr ""
67
 
68
+ #: inc/classes/adminpages.class.php:145
69
  msgid "SEO"
70
  msgstr ""
71
 
72
+ #: inc/classes/adminpages.class.php:275
 
 
 
 
 
 
 
 
73
  msgid "Title Settings"
74
  msgstr ""
75
 
76
+ #: inc/classes/adminpages.class.php:286
77
  msgid "Description Meta Settings"
78
  msgstr ""
79
 
80
+ #: inc/classes/adminpages.class.php:297
81
  msgid "Home Page Settings"
82
  msgstr ""
83
 
84
+ #: inc/classes/adminpages.class.php:308
85
  msgid "Social Meta Settings"
86
  msgstr ""
87
 
88
+ #: inc/classes/adminpages.class.php:319
89
+ #: inc/views/metaboxes/knowledge-metabox.php:56
90
  msgid "Knowledge Graph Settings"
91
  msgstr ""
92
 
93
+ #: inc/classes/adminpages.class.php:330
94
  msgid "Schema Settings"
95
  msgstr ""
96
 
97
+ #: inc/classes/adminpages.class.php:341 inc/classes/inpost.class.php:414
98
+ #: inc/classes/inpost.class.php:645
99
  msgid "Robots Meta Settings"
100
  msgstr ""
101
 
102
+ #: inc/classes/adminpages.class.php:352
103
  msgid "Webmaster Meta Settings"
104
  msgstr ""
105
 
106
+ #: inc/classes/adminpages.class.php:363
107
  msgid "Sitemap Settings"
108
  msgstr ""
109
 
110
+ #: inc/classes/adminpages.class.php:374
111
  msgid "Feed Settings"
112
  msgstr ""
113
 
114
+ #: inc/classes/core.class.php:183
115
  msgctxt "As in: The Plugin Home Page"
116
  msgid "Plugin Home"
117
  msgstr ""
118
 
119
+ #: inc/classes/core.class.php:234
120
  msgid "Dismiss"
121
  msgstr ""
122
 
123
+ #: inc/classes/core.class.php:368
124
  msgctxt "e.g. en for English, nl for Dutch, fi for Finish, de for German"
125
  msgid "en"
126
  msgstr ""
127
 
128
+ #. translators: 1: Function name, 2: Plugin Version notification, 3:
129
+ #. Replacement function
130
+
131
+ #: inc/classes/debug.class.php:114
132
  msgid "%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework! Use %3$s instead."
133
  msgstr ""
134
 
135
+ #. translators: 1: Function name, 2: Plugin Version notification
136
+
137
+ #: inc/classes/debug.class.php:117
138
  msgid "%1$s is <strong>deprecated</strong> since version %2$s of The SEO Framework with no alternative available."
139
  msgstr ""
140
 
141
+ #: inc/classes/debug.class.php:167
142
  msgid "(This message was added in version %s of The SEO Framework.)"
143
  msgstr ""
144
 
145
  #. translators: %s: Codex URL
146
 
147
+ #: inc/classes/debug.class.php:169
148
  msgid "Please see <a href=\"%s\">Debugging in WordPress</a> for more information."
149
  msgstr ""
150
 
151
+ #: inc/classes/debug.class.php:170
152
  msgid "https://codex.wordpress.org/Debugging_in_WordPress"
153
  msgstr ""
154
 
155
  #. translators: 1: Function name, 2: Message, 3: Plugin Version notification
156
 
157
+ #: inc/classes/debug.class.php:173
158
  msgid "%1$s was called <strong>incorrectly</strong>. %2$s %3$s"
159
  msgstr ""
160
 
161
+ #. translators: 1: Method or Property name, 2: Message
162
+
163
+ #: inc/classes/debug.class.php:223
164
+ msgid "%1$s is not <strong>accessible</strong>. %2$s"
165
+ msgstr ""
166
+
167
+ #: inc/classes/doingitright.class.php:101
168
  msgid "No Search"
169
  msgstr ""
170
 
171
+ #: inc/classes/doingitright.class.php:302
172
  msgid "Refresh to see the SEO Bar status."
173
  msgstr ""
174
 
176
  msgid "Post"
177
  msgstr ""
178
 
179
+ #: inc/classes/doingitright.class.php:384 inc/classes/inpost.class.php:273
180
+ #: inc/classes/termdata.class.php:359
181
+ #: inc/views/metaboxes/knowledge-metabox.php:147
182
  msgid "Page"
183
  msgstr ""
184
 
188
 
189
  #. translators: %s = But or And
190
 
191
+ #: inc/classes/doingitright.class.php:798
192
  msgid "%s the Title contains the Blogname multiple times."
193
  msgstr ""
194
 
195
+ #. translators: 1: Word, 2: Occurences
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
+ #: inc/classes/doingitright.class.php:969
198
+ msgid "%1$s is used %2$d times."
199
  msgstr ""
200
 
201
+ #: inc/classes/doingitright.class.php:1013
202
  msgid "%s is being indexed."
203
  msgstr ""
204
 
205
+ #: inc/classes/doingitright.class.php:1022
206
  msgid "But you've disabled indexing for the whole site."
207
  msgstr ""
208
 
209
  #. translators: 1: But or And, 2: Current taxonomy term plural label
210
 
211
+ #: inc/classes/doingitright.class.php:1046
212
  msgid "%1$s indexing for %2$s have been disabled."
213
  msgstr ""
214
 
215
  #. translators: %s = But or And
216
 
217
+ #: inc/classes/doingitright.class.php:1056
218
  msgid "%s the blog isn't set to public. This means WordPress discourages indexing."
219
  msgstr ""
220
 
221
  #. translators: %s = But or And
222
 
223
+ #: inc/classes/doingitright.class.php:1070
224
  msgid "%s there are no posts in this term; therefore, indexing has been disabled."
225
  msgstr ""
226
 
227
+ #: inc/classes/doingitright.class.php:1154
228
  msgid "%s links aren't being followed."
229
  msgstr ""
230
 
231
+ #: inc/classes/doingitright.class.php:1160
232
  msgid "%s links are being followed."
233
  msgstr ""
234
 
235
  #. translators: %s = But or And
236
 
237
+ #: inc/classes/doingitright.class.php:1172
238
  msgid "%s you've disabled the following of links for the whole site."
239
  msgstr ""
240
 
241
  #. translators: 1: But or And, 2: Current taxonomy term plural label
242
 
243
+ #: inc/classes/doingitright.class.php:1198
244
  msgid "%1$s following for %2$s have been disabled."
245
  msgstr ""
246
 
247
  #. translators: %s = But or And
248
 
249
+ #: inc/classes/doingitright.class.php:1210
250
  msgid "%s the blog isn't set to public. This means WordPress allows the links to be followed regardless."
251
  msgstr ""
252
 
253
+ #: inc/classes/doingitright.class.php:1262
254
  msgid "Search Engine aren't allowed to archive this %s."
255
  msgstr ""
256
 
257
+ #: inc/classes/doingitright.class.php:1267
258
  msgid "Search Engine are allowed to archive this %s."
259
  msgstr ""
260
 
261
+ #: inc/classes/doingitright.class.php:1279
262
  msgid "But you've disabled archiving for the whole site."
263
  msgstr ""
264
 
265
  #. translators: 1: But or And, 2: Current taxonomy term plural label
266
 
267
+ #: inc/classes/doingitright.class.php:1305
268
  msgid "%1$s archiving for %2$s have been disabled."
269
  msgstr ""
270
 
271
  #. translators: %s = But or And
272
 
273
+ #: inc/classes/doingitright.class.php:1318
274
  msgid "%s the blog isn't set to public. This means WordPress allows the blog to be archived regardless."
275
  msgstr ""
276
 
277
+ #: inc/classes/doingitright.class.php:1364
278
  msgid "%s isn't being redirected."
279
  msgstr ""
280
 
281
+ #: inc/classes/doingitright.class.php:1406
282
+ #: inc/classes/doingitright.class.php:1435
283
  msgid "%s is being redirected. This means no SEO values have to be set."
284
  msgstr ""
285
 
286
+ #: inc/classes/doingitright.class.php:1409
287
+ #: inc/classes/doingitright.class.php:1451
288
  msgid "%s is not being indexed. This means no SEO values have to be set."
289
  msgstr ""
290
 
291
+ #: inc/classes/doingitright.class.php:1565
292
  msgid "Title:"
293
  msgstr ""
294
 
295
+ #: inc/classes/doingitright.class.php:1566
296
  msgid "Description:"
297
  msgstr ""
298
 
299
+ #: inc/classes/doingitright.class.php:1567
300
  msgid "Index:"
301
  msgstr ""
302
 
303
+ #: inc/classes/doingitright.class.php:1568
304
  msgid "Follow:"
305
  msgstr ""
306
 
307
+ #: inc/classes/doingitright.class.php:1569
308
  msgid "Archive:"
309
  msgstr ""
310
 
311
+ #: inc/classes/doingitright.class.php:1570
312
  msgid "Redirect:"
313
  msgstr ""
314
 
315
+ #: inc/classes/doingitright.class.php:1572
316
  msgid "Generated: Automatically generated."
317
  msgstr ""
318
 
319
+ #: inc/classes/doingitright.class.php:1574
320
  msgctxt "Generated"
321
  msgid "G"
322
  msgstr ""
323
 
324
+ #: inc/classes/doingitright.class.php:1575
325
  msgctxt "Title"
326
  msgid "T"
327
  msgstr ""
328
 
329
+ #: inc/classes/doingitright.class.php:1576
330
  msgctxt "Description"
331
  msgid "D"
332
  msgstr ""
333
 
334
+ #: inc/classes/doingitright.class.php:1577
335
  msgctxt "no-Index"
336
  msgid "I"
337
  msgstr ""
338
 
339
+ #: inc/classes/doingitright.class.php:1578
340
  msgctxt "no-Follow"
341
  msgid "F"
342
  msgstr ""
343
 
344
+ #: inc/classes/doingitright.class.php:1579
345
  msgctxt "no-Archive"
346
  msgid "A"
347
  msgstr ""
348
 
349
+ #: inc/classes/doingitright.class.php:1580
350
  msgctxt "Redirect"
351
  msgid "R"
352
  msgstr ""
353
 
354
+ #: inc/classes/doingitright.class.php:1582
355
  msgctxt "But there are..."
356
  msgid "But"
357
  msgstr ""
358
 
359
+ #: inc/classes/doingitright.class.php:1583
360
  msgctxt "And there are..."
361
  msgid "And"
362
  msgstr ""
363
 
364
+ #: inc/classes/doingitright.class.php:1585
365
+ msgid "Length is far too short."
366
+ msgstr ""
367
+
368
+ #: inc/classes/doingitright.class.php:1586
369
+ msgid "Length is too short."
370
+ msgstr ""
371
+
372
+ #: inc/classes/doingitright.class.php:1587
373
+ msgid "Length is too long."
374
+ msgstr ""
375
+
376
+ #: inc/classes/doingitright.class.php:1588
377
+ msgid "Length is far too long."
378
+ msgstr ""
379
+
380
+ #: inc/classes/doingitright.class.php:1589
381
+ msgid "Length is good."
382
+ msgstr ""
383
+
384
+ #: inc/classes/feed.class.php:147
385
  msgctxt "The content source"
386
  msgid "Source"
387
  msgstr ""
388
 
389
  #. translators: 1: Title, 2: on, 3: Blogname
 
390
 
391
+ #: inc/classes/generate-description.class.php:464
392
+ msgctxt "1: Title, 2: on, 3: Blogname"
393
+ msgid "%1$s %2$s %3$s"
394
+ msgstr ""
395
+
396
+ #. translators: 1: Title, 2: Separator, 3: Excerpt
397
+
398
+ #: inc/classes/generate-description.class.php:468
399
+ msgctxt "1: Title, 2: Separator, 3: Excerpt"
400
  msgid "%1$s %2$s %3$s"
401
  msgstr ""
402
 
403
  #. translators: Front-end output.
404
 
405
+ #: inc/classes/generate-description.class.php:605
406
+ #: inc/views/metaboxes/description-metabox.php:18
407
  msgctxt "Placement. e.g. Post Title \"on\" Blog Name"
408
  msgid "on"
409
  msgstr ""
410
 
411
  #. translators: Front-end output.
412
 
413
+ #: inc/classes/generate-description.class.php:668
414
  msgid "Latest posts:"
415
  msgstr ""
416
 
417
  #. translators: Front-end output. 1: Taxonomy singular name, 2: Current
418
  #. taxonomy term
419
 
420
+ #: inc/classes/generate-title.class.php:833
421
+ #: inc/classes/generate-title.class.php:893
422
  msgid "%1$s: %2$s"
423
  msgstr ""
424
 
425
  #. translators: Front-end output.
426
 
427
+ #: inc/classes/generate-title.class.php:837
428
  msgid "Author: %s"
429
  msgstr ""
430
 
431
  #. translators: Front-end output.
432
 
433
+ #: inc/classes/generate-title.class.php:841
434
  msgctxt "yearly archives date format"
435
  msgid "Y"
436
  msgstr ""
437
 
438
  #. translators: Front-end output.
439
 
440
+ #: inc/classes/generate-title.class.php:843
441
  msgid "Year: %s"
442
  msgstr ""
443
 
444
  #. translators: Front-end output.
445
 
446
+ #: inc/classes/generate-title.class.php:846
447
  msgctxt "monthly archives date format"
448
  msgid "F Y"
449
  msgstr ""
450
 
451
  #. translators: Front-end output.
452
 
453
+ #: inc/classes/generate-title.class.php:848
454
  msgid "Month: %s"
455
  msgstr ""
456
 
457
  #. translators: Front-end output.
458
 
459
+ #: inc/classes/generate-title.class.php:851
460
  msgctxt "daily archives date format"
461
  msgid "F j, Y"
462
  msgstr ""
463
 
464
  #. translators: Front-end output.
465
 
466
+ #: inc/classes/generate-title.class.php:853
467
  msgid "Day: %s"
468
  msgstr ""
469
 
470
  #. translators: Front-end output.
471
 
472
+ #: inc/classes/generate-title.class.php:858
473
  msgctxt "post format archive title"
474
  msgid "Asides"
475
  msgstr ""
476
 
477
  #. translators: Front-end output.
478
 
479
+ #: inc/classes/generate-title.class.php:861
480
  msgctxt "post format archive title"
481
  msgid "Galleries"
482
  msgstr ""
483
 
484
  #. translators: Front-end output.
485
 
486
+ #: inc/classes/generate-title.class.php:864
487
  msgctxt "post format archive title"
488
  msgid "Images"
489
  msgstr ""
490
 
491
  #. translators: Front-end output.
492
 
493
+ #: inc/classes/generate-title.class.php:867
494
  msgctxt "post format archive title"
495
  msgid "Videos"
496
  msgstr ""
497
 
498
  #. translators: Front-end output.
499
 
500
+ #: inc/classes/generate-title.class.php:870
501
  msgctxt "post format archive title"
502
  msgid "Quotes"
503
  msgstr ""
504
 
505
  #. translators: Front-end output.
506
 
507
+ #: inc/classes/generate-title.class.php:873
508
  msgctxt "post format archive title"
509
  msgid "Links"
510
  msgstr ""
511
 
512
  #. translators: Front-end output.
513
 
514
+ #: inc/classes/generate-title.class.php:876
515
  msgctxt "post format archive title"
516
  msgid "Statuses"
517
  msgstr ""
518
 
519
  #. translators: Front-end output.
520
 
521
+ #: inc/classes/generate-title.class.php:879
522
  msgctxt "post format archive title"
523
  msgid "Audio"
524
  msgstr ""
525
 
526
  #. translators: Front-end output.
527
 
528
+ #: inc/classes/generate-title.class.php:882
529
  msgctxt "post format archive title"
530
  msgid "Chats"
531
  msgstr ""
532
 
533
  #. translators: Front-end output.
534
 
535
+ #: inc/classes/generate-title.class.php:887
536
  msgid "Archives: %s"
537
  msgstr ""
538
 
539
  #. translators: Front-end output.
540
 
541
+ #: inc/classes/generate-title.class.php:897
542
  msgid "Archives"
543
  msgstr ""
544
 
545
  #. translators: Front-end output.
546
 
547
+ #: inc/classes/generate-title.class.php:998
548
  msgid "Untitled"
549
  msgstr ""
550
 
551
  #. translators: Front-end output.
552
 
553
+ #: inc/classes/generate-title.class.php:1033
554
  msgid "Search results for:"
555
  msgstr ""
556
 
557
  #. translators: Front-end output
558
 
559
+ #: inc/classes/generate-title.class.php:1206
560
  msgid "Protected: %s"
561
  msgstr ""
562
 
563
  #. translators: Front-end output
564
 
565
+ #: inc/classes/generate-title.class.php:1210
566
  msgid "Private: %s"
567
  msgstr ""
568
 
569
  #. translators: Front-end output.
570
 
571
+ #: inc/classes/generate-title.class.php:1242
572
  msgid "Page %s"
573
  msgstr ""
574
 
575
+ #: inc/classes/init.class.php:326
576
  msgid "Start The Seo Framework"
577
  msgstr ""
578
 
579
+ #: inc/classes/init.class.php:327
580
  msgid "End The Seo Framework"
581
  msgstr ""
582
 
583
+ #: inc/classes/init.class.php:328
584
  msgid "by Sybre Waaijer"
585
  msgstr ""
586
 
587
+ #: inc/classes/inpost.class.php:186 inc/classes/inpost.class.php:364
588
  msgid "%s SEO Settings"
589
  msgstr ""
590
 
591
+ #: inc/classes/inpost.class.php:371 inc/classes/inpost.class.php:444
592
+ #: inc/classes/inpost.class.php:600 inc/classes/inpost.class.php:696
593
  msgid "Doing it Right"
594
  msgstr ""
595
 
596
+ #: inc/classes/inpost.class.php:381
597
  msgid "%s Title"
598
  msgstr ""
599
 
600
+ #: inc/classes/inpost.class.php:382 inc/classes/inpost.class.php:607
601
+ #: inc/views/metaboxes/homepage-metabox.php:196
602
  msgid "Recommended Length: 50 to 55 characters"
603
  msgstr ""
604
 
605
+ #: inc/classes/inpost.class.php:391 inc/classes/inpost.class.php:407
606
+ #: inc/classes/inpost.class.php:609 inc/classes/inpost.class.php:626
607
+ #: inc/views/metaboxes/homepage-metabox.php:198
608
+ #: inc/views/metaboxes/homepage-metabox.php:219
609
  msgid "Characters Used: %s"
610
  msgstr ""
611
 
612
+ #: inc/classes/inpost.class.php:400
613
  msgid "%s Meta Description"
614
  msgstr ""
615
 
616
+ #: inc/classes/inpost.class.php:401 inc/classes/inpost.class.php:624
617
+ #: inc/views/metaboxes/homepage-metabox.php:217
618
  msgid "Recommended Length: 145 to 155 characters"
619
  msgstr ""
620
 
621
+ #: inc/classes/inpost.class.php:417 inc/classes/inpost.class.php:424
622
+ #: inc/classes/inpost.class.php:431
623
+ msgid "Apply %s to this term?"
624
  msgstr ""
625
 
626
+ #: inc/classes/inpost.class.php:418
627
+ #: inc/views/metaboxes/homepage-metabox.php:316
628
  msgid "Tell Search Engines not to show this page in their search results"
629
  msgstr ""
630
 
631
+ #: inc/classes/inpost.class.php:425
632
+ #: inc/views/metaboxes/homepage-metabox.php:326
633
  msgid "Tell Search Engines not to follow links on this page"
634
  msgstr ""
635
 
636
+ #: inc/classes/inpost.class.php:432
637
+ #: inc/views/metaboxes/homepage-metabox.php:336
638
  msgid "Tell Search Engines not to save a cached copy of this page"
639
  msgstr ""
640
 
641
+ #: inc/classes/inpost.class.php:606
642
+ #: inc/views/metaboxes/homepage-metabox.php:195
643
  msgid "Custom %s Title"
644
  msgstr ""
645
 
646
+ #: inc/classes/inpost.class.php:623
647
+ #: inc/views/metaboxes/homepage-metabox.php:216
648
  msgid "Custom %s Description"
649
  msgstr ""
650
 
651
+ #: inc/classes/inpost.class.php:637
652
  msgid "Custom Canonical URL"
653
  msgstr ""
654
 
655
+ #: inc/classes/inpost.class.php:638
656
  msgid "Preferred %s URL location"
657
  msgstr ""
658
 
659
  #. translators: 1: Option, 2: Post or Page
660
 
661
+ #: inc/classes/inpost.class.php:650 inc/classes/inpost.class.php:660
662
+ #: inc/classes/inpost.class.php:670
663
  msgid "Apply %1$s to this %2$s"
664
  msgstr ""
665
 
666
+ #: inc/classes/inpost.class.php:652
667
  msgid "Tell Search Engines not to show this %s in their search results"
668
  msgstr ""
669
 
670
+ #: inc/classes/inpost.class.php:662
671
  msgid "Tell Search Engines not to follow links on this %s"
672
  msgstr ""
673
 
674
+ #: inc/classes/inpost.class.php:672
675
  msgid "Tell Search Engines not to save a cached copy of this %s"
676
  msgstr ""
677
 
678
+ #: inc/classes/inpost.class.php:676
679
  msgid "Local Search Settings"
680
  msgstr ""
681
 
682
+ #: inc/classes/inpost.class.php:679
683
  msgid "Exclude this %s from local search"
684
  msgstr ""
685
 
686
+ #: inc/classes/inpost.class.php:680
687
  msgid "This excludes this %s from local on-site search results"
688
  msgstr ""
689
 
690
+ #: inc/classes/inpost.class.php:686
691
  msgid "Custom 301 Redirect URL"
692
  msgstr ""
693
 
694
+ #: inc/classes/inpost.class.php:687
695
  msgid "This will force visitors to go to another URL"
696
  msgstr ""
697
 
698
+ #: inc/classes/sitemaps.class.php:287
699
+ msgid "Sitemap is generated for this view"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
700
  msgstr ""
701
 
702
+ #: inc/classes/sitemaps.class.php:289
703
+ msgid "Sitemap is served from cache"
704
  msgstr ""
705
 
706
+ #: inc/classes/sitemaps.class.php:407
707
+ msgid "Sitemap is generated on"
708
  msgstr ""
709
 
710
+ #: inc/classes/siteoptions.class.php:471
711
+ msgid "here"
712
  msgstr ""
713
 
714
+ #: inc/classes/siteoptions.class.php:472
715
+ msgctxt "%s = here"
716
+ msgid "View the new options %s."
717
  msgstr ""
718
 
719
+ #: inc/classes/termdata.class.php:361
720
+ #: inc/views/metaboxes/social-metabox.php:248
721
+ msgid "Pages"
722
  msgstr ""
723
 
724
+ #: inc/classes/transients.class.php:263
725
+ msgid "Third parameter must be a known type."
726
  msgstr ""
727
 
728
+ #: inc/deprecated/deprecated.class.php:627
729
+ msgid "%s of The SEO Framework"
730
  msgstr ""
731
 
732
+ #: inc/views/metaboxes/description-metabox.php:17
733
+ msgid "Example Title"
734
  msgstr ""
735
 
736
+ #: inc/views/metaboxes/description-metabox.php:19
737
+ msgid "This is an example description..."
738
  msgstr ""
739
 
740
+ #: inc/views/metaboxes/description-metabox.php:41
741
+ msgid "Automated Description Settings"
742
  msgstr ""
743
 
744
+ #: inc/views/metaboxes/description-metabox.php:42
745
+ #: inc/views/metaboxes/homepage-metabox.php:228
746
+ msgid "The meta description can be used to determine the text used under the title on Search Engine results pages."
747
  msgstr ""
748
 
749
+ #: inc/views/metaboxes/description-metabox.php:45
750
+ msgid "Example Automated Description Output"
751
  msgstr ""
752
 
753
+ #: inc/views/metaboxes/description-metabox.php:67
754
+ #: inc/views/metaboxes/homepage-metabox.php:30
755
+ #: inc/views/metaboxes/knowledge-metabox.php:26
756
+ #: inc/views/metaboxes/robots-metabox.php:57
757
+ #: inc/views/metaboxes/sitemaps-metabox.php:38
758
+ #: inc/views/metaboxes/social-metabox.php:25
759
+ #: inc/views/metaboxes/title-metabox.php:61
760
+ msgid "General"
761
  msgstr ""
762
 
763
+ #: inc/views/metaboxes/description-metabox.php:72
764
+ #: inc/views/metaboxes/homepage-metabox.php:35
765
+ #: inc/views/metaboxes/title-metabox.php:66
766
+ msgid "Additions"
767
  msgstr ""
768
 
769
+ #: inc/views/metaboxes/description-metabox.php:98
770
+ #: inc/views/metaboxes/title-metabox.php:105
771
+ msgid "Recommended"
772
  msgstr ""
773
 
774
+ #: inc/views/metaboxes/description-metabox.php:102
775
  msgid "Description Excerpt Separator"
776
  msgstr ""
777
 
778
+ #: inc/views/metaboxes/description-metabox.php:109
779
  msgid "If the Automated Description consists of two parts (title and excerpt), then the separator will go in-between them."
780
  msgstr ""
781
 
782
+ #: inc/views/metaboxes/description-metabox.php:120
783
  msgid "Description Additions Settings"
784
  msgstr ""
785
 
786
+ #: inc/views/metaboxes/description-metabox.php:122
787
  msgid "To create a more organic description, a small introduction can be added before the description."
788
  msgstr ""
789
 
790
+ #: inc/views/metaboxes/description-metabox.php:123
791
  msgid "The introduction consists of the title and optionally the blogname."
792
  msgstr ""
793
 
794
+ #: inc/views/metaboxes/description-metabox.php:128
795
  msgid "Add descriptive Additions to Description"
796
  msgstr ""
797
 
798
+ #: inc/views/metaboxes/description-metabox.php:132
799
  msgid "Add Additions to automated description?"
800
  msgstr ""
801
 
802
+ #: inc/views/metaboxes/description-metabox.php:133
803
  msgid "This creates good meta descriptions"
804
  msgstr ""
805
 
806
+ #: inc/views/metaboxes/description-metabox.php:137
807
  msgid "Add Blogname to Additions"
808
  msgstr ""
809
 
810
+ #: inc/views/metaboxes/description-metabox.php:141
811
  msgid "Add Blogname to automated description additions?"
812
  msgstr ""
813
 
814
+ #: inc/views/metaboxes/feed-metabox.php:10
815
+ msgid "Content Feed Settings"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  msgstr ""
817
 
818
+ #: inc/views/metaboxes/feed-metabox.php:11
819
+ msgid "Sometimes, your content can get stolen by robots through the WordPress feeds. This can cause duplicate content issues. To prevent this from happening, it's recommended to convert the feed's content into an excerpt."
820
  msgstr ""
821
 
822
+ #: inc/views/metaboxes/feed-metabox.php:12
823
+ msgid "Adding a backlink below the feed's content will also let the visitors know where the content came from."
824
  msgstr ""
825
 
826
+ #: inc/views/metaboxes/feed-metabox.php:17
827
+ msgid "Change Feed Settings"
828
  msgstr ""
829
 
830
+ #: inc/views/metaboxes/feed-metabox.php:19
831
+ msgid "Convert feed content into excerpts?"
832
  msgstr ""
833
 
834
+ #: inc/views/metaboxes/feed-metabox.php:20
835
+ msgid "By default the excerpt will be at most 400 characters long"
836
  msgstr ""
837
 
838
+ #: inc/views/metaboxes/feed-metabox.php:22
839
+ msgid "Add backlinks below the feed content?"
840
  msgstr ""
841
 
842
+ #: inc/views/metaboxes/feed-metabox.php:23
843
+ msgid "This link will not be followed by Search Engines"
844
  msgstr ""
845
 
846
+ #: inc/views/metaboxes/feed-metabox.php:35
847
+ msgid "Reading Settings"
848
  msgstr ""
849
 
850
+ #: inc/views/metaboxes/feed-metabox.php:38
851
+ msgctxt "%s = Reading Settings"
852
+ msgid "Note: The feed is already converted into an excerpt (summary) through the %s."
853
  msgstr ""
854
 
855
+ #: inc/views/metaboxes/feed-metabox.php:42
856
+ msgid "View feed"
857
  msgstr ""
858
 
859
+ #: inc/views/metaboxes/feed-metabox.php:42
860
+ msgctxt "The feed can be found %s."
861
+ msgid "here"
 
862
  msgstr ""
863
 
864
+ #: inc/views/metaboxes/feed-metabox.php:44
865
+ msgctxt "%s = here"
866
+ msgid "The feed can be found %s."
 
867
  msgstr ""
868
 
869
+ #: inc/views/metaboxes/homepage-metabox.php:11
870
  msgid "These settings will take precedence over the settings set within the Home Page edit screen, if any."
871
  msgstr ""
872
 
873
+ #: inc/views/metaboxes/homepage-metabox.php:40
874
  msgid "Robots"
875
  msgstr ""
876
 
877
+ #: inc/views/metaboxes/homepage-metabox.php:68
878
  msgid "Title"
879
  msgstr ""
880
 
881
+ #: inc/views/metaboxes/homepage-metabox.php:69
882
  msgid "Description"
883
  msgstr ""
884
 
885
+ #: inc/views/metaboxes/homepage-metabox.php:70
886
+ #: inc/views/metaboxes/homepage-metabox.php:246
887
+ #: inc/views/metaboxes/homepage-metabox.php:285
888
+ #: inc/views/metaboxes/social-metabox.php:250
889
+ #: inc/views/metaboxes/social-metabox.php:281
890
  msgid "Home Page"
891
  msgstr ""
892
 
893
  #. translators: 1: Option, 2: Page SEO Settings, 3: Home Page
894
 
895
+ #: inc/views/metaboxes/homepage-metabox.php:108
896
+ #: inc/views/metaboxes/homepage-metabox.php:167
897
  msgid "Note: The %1$s is fetched from the %2$s on the %3$s."
898
  msgstr ""
899
 
900
+ #: inc/views/metaboxes/homepage-metabox.php:108
901
+ #: inc/views/metaboxes/homepage-metabox.php:165
902
  msgid "Page SEO Settings"
903
  msgstr ""
904
 
905
+ #: inc/views/metaboxes/homepage-metabox.php:184
906
  msgid "Custom %s Title Tagline"
907
  msgstr ""
908
 
909
+ #: inc/views/metaboxes/homepage-metabox.php:250
910
+ #: inc/views/metaboxes/title-metabox.php:132
911
+ msgid "Document Title Additions Location"
912
+ msgstr ""
913
+
914
+ #: inc/views/metaboxes/homepage-metabox.php:251
915
+ #: inc/views/metaboxes/title-metabox.php:134
916
+ msgid "Determines which side the added title text will go on."
917
+ msgstr ""
918
+
919
+ #: inc/views/metaboxes/homepage-metabox.php:257
920
+ #: inc/views/metaboxes/title-metabox.php:140
921
+ msgid "Left:"
922
+ msgstr ""
923
+
924
+ #: inc/views/metaboxes/homepage-metabox.php:264
925
+ #: inc/views/metaboxes/title-metabox.php:147
926
+ msgid "Right:"
927
+ msgstr ""
928
+
929
+ #: inc/views/metaboxes/homepage-metabox.php:272
930
  msgid "%s Tagline"
931
  msgstr ""
932
 
933
+ #: inc/views/metaboxes/homepage-metabox.php:276
934
  msgid "Add site description (tagline) to the Title on the %s?"
935
  msgstr ""
936
 
937
+ #: inc/views/metaboxes/homepage-metabox.php:302
938
  msgid "View Home Page Settings"
939
  msgstr ""
940
 
941
+ #: inc/views/metaboxes/homepage-metabox.php:302
942
  msgid "Checked in Page"
943
  msgstr ""
944
 
945
+ #: inc/views/metaboxes/homepage-metabox.php:305
946
  msgid "Home Page Robots Meta Settings"
947
  msgstr ""
948
 
949
  #. translators: 1: Option, 2: Location
950
 
951
+ #: inc/views/metaboxes/homepage-metabox.php:313
952
+ #: inc/views/metaboxes/homepage-metabox.php:323
953
+ #: inc/views/metaboxes/homepage-metabox.php:333
954
  msgid "Apply %1$s to the %2$s?"
955
  msgstr ""
956
 
957
+ #: inc/views/metaboxes/homepage-metabox.php:368
958
  msgid "Note: If any of these options are unchecked, but are checked on the Home Page, they will be outputted regardless."
959
  msgstr ""
960
 
961
+ #: inc/views/metaboxes/homepage-metabox.php:374
962
  msgid "Home Page Pagination Robots Settings"
963
  msgstr ""
964
 
965
+ #: inc/views/metaboxes/homepage-metabox.php:375
966
  msgid "If your Home Page is paginated and outputs content that's also found elsewhere on the website, enabling this option might prevent duplicate content."
967
  msgstr ""
968
 
969
  #. translators: 1: Option, 2: Location
970
 
971
+ #: inc/views/metaboxes/homepage-metabox.php:383
972
  msgid "Apply %1$s to every second or later page on the %2$s?"
973
  msgstr ""
974
 
975
+ #: inc/views/metaboxes/knowledge-metabox.php:31
976
+ msgid "Website"
977
  msgstr ""
978
 
979
+ #: inc/views/metaboxes/knowledge-metabox.php:57
980
+ msgid "The Knowledge Graph lets Google and other Search Engines know where to find you or your organization and its relevant content."
981
  msgstr ""
982
 
983
+ #: inc/views/metaboxes/knowledge-metabox.php:58
984
+ msgid "Google is becoming more of an 'Answer Engine' than a 'Search Engine'. Setting up these options could have a positive impact on the SEO value of your website."
985
  msgstr ""
986
 
987
+ #: inc/views/metaboxes/knowledge-metabox.php:64
988
+ msgid "Output Knowledge tags?"
989
  msgstr ""
990
 
991
+ #: inc/views/metaboxes/knowledge-metabox.php:74
992
+ msgid "Website logo"
993
  msgstr ""
994
 
995
+ #: inc/views/metaboxes/knowledge-metabox.php:80
996
+ msgid "Use the Favicon from Customizer as the Organization Logo?"
997
  msgstr ""
998
 
999
+ #: inc/views/metaboxes/knowledge-metabox.php:81
1000
+ msgid "This option only has an effect when this site represents an Organization. If left disabled, Search Engines will look elsewhere for a logo, if it exists and is assigned as a logo."
1001
  msgstr ""
1002
 
1003
+ #: inc/views/metaboxes/knowledge-metabox.php:92
1004
+ msgid "About this website"
1005
  msgstr ""
1006
 
1007
+ #: inc/views/metaboxes/knowledge-metabox.php:93
1008
+ msgid "Who or what is your website about?"
1009
  msgstr ""
1010
 
1011
+ #: inc/views/metaboxes/knowledge-metabox.php:99
1012
+ msgctxt "...Organization or Person."
1013
+ msgid "This website represents:"
1014
  msgstr ""
1015
 
1016
+ #: inc/views/metaboxes/knowledge-metabox.php:105
1017
+ msgid "An Organization"
1018
  msgstr ""
1019
 
1020
+ #: inc/views/metaboxes/knowledge-metabox.php:106
1021
+ msgid "A Person"
1022
  msgstr ""
1023
 
1024
+ #: inc/views/metaboxes/knowledge-metabox.php:119
1025
+ msgid "The organization or personal name"
1026
  msgstr ""
1027
 
1028
+ #: inc/views/metaboxes/knowledge-metabox.php:130
1029
+ msgid "Social Pages connected to this website"
1030
  msgstr ""
1031
 
1032
+ #: inc/views/metaboxes/knowledge-metabox.php:131
1033
+ msgid "Don't have a page at a site or is the profile only privately accessible? Leave that field empty. Unsure? Fill it in anyway."
 
1034
  msgstr ""
1035
 
1036
+ #: inc/views/metaboxes/knowledge-metabox.php:132
1037
+ msgid "Add the link that leads directly to the social page of this website."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1038
  msgstr ""
1039
 
1040
+ #: inc/views/metaboxes/knowledge-metabox.php:136
1041
+ msgctxt "No spaces. E.g. https://facebook.com/RelatedProfile"
1042
+ msgid "RelatedProfile"
1043
  msgstr ""
1044
 
1045
+ #: inc/views/metaboxes/knowledge-metabox.php:137
1046
+ msgctxt "Social Profile"
1047
+ msgid "Profile"
1048
  msgstr ""
1049
 
1050
+ #: inc/views/metaboxes/knowledge-metabox.php:203
1051
+ msgid "Blog"
1052
  msgstr ""
1053
 
1054
+ #: inc/views/metaboxes/robots-metabox.php:13
1055
+ #: inc/views/metaboxes/title-metabox.php:192
1056
+ msgid "Category"
1057
  msgstr ""
1058
 
1059
+ #: inc/views/metaboxes/robots-metabox.php:14
1060
+ msgid "Tag"
1061
  msgstr ""
1062
 
1063
+ #: inc/views/metaboxes/robots-metabox.php:15
1064
+ msgid "Author"
1065
  msgstr ""
1066
 
1067
+ #: inc/views/metaboxes/robots-metabox.php:16
1068
+ msgid "Date"
 
1069
  msgstr ""
1070
 
1071
+ #: inc/views/metaboxes/robots-metabox.php:17
1072
+ msgid "Search Pages"
1073
  msgstr ""
1074
 
1075
+ #: inc/views/metaboxes/robots-metabox.php:18
1076
+ msgid "Attachment Pages"
1077
  msgstr ""
1078
 
1079
+ #: inc/views/metaboxes/robots-metabox.php:19
1080
+ msgctxt "...for the entire site"
1081
+ msgid "the entire site"
1082
  msgstr ""
1083
 
1084
+ #: inc/views/metaboxes/robots-metabox.php:26
1085
+ msgid "NoIndex"
1086
  msgstr ""
1087
 
1088
+ #: inc/views/metaboxes/robots-metabox.php:27
1089
+ msgid "These options prevent indexing of the selected archives and pages. If you enable this, the selected archives or pages will be removed from Search Engine results pages."
 
 
 
 
1090
  msgstr ""
1091
 
1092
+ #: inc/views/metaboxes/robots-metabox.php:31
1093
+ msgid "NoFollow"
1094
  msgstr ""
1095
 
1096
+ #: inc/views/metaboxes/robots-metabox.php:32
1097
+ msgid "These options prevent links from being followed on the selected archives and pages. If you enable this, the selected archives or pages in-page links will gain no SEO value, including your own links."
1098
  msgstr ""
1099
 
1100
+ #: inc/views/metaboxes/robots-metabox.php:36
1101
+ msgid "NoArchive"
1102
  msgstr ""
1103
 
1104
+ #: inc/views/metaboxes/robots-metabox.php:37
1105
+ msgid "These options prevent caching of the selected archives and pages. If you enable this, Search Engines will not create a cached copy of the selected archives or pages."
1106
  msgstr ""
1107
 
1108
+ #: inc/views/metaboxes/robots-metabox.php:63
1109
+ msgid "Indexing"
 
 
1110
  msgstr ""
1111
 
1112
+ #: inc/views/metaboxes/robots-metabox.php:69
1113
+ msgid "Following"
 
 
1114
  msgstr ""
1115
 
1116
+ #: inc/views/metaboxes/robots-metabox.php:75
1117
+ msgid "Archiving"
 
 
1118
  msgstr ""
1119
 
1120
+ #: inc/views/metaboxes/robots-metabox.php:97
1121
+ msgid "Open Directory Settings"
1122
  msgstr ""
1123
 
1124
+ #: inc/views/metaboxes/robots-metabox.php:98
1125
+ msgid "Sometimes, Search Engines use resources from certain Directories to find titles and descriptions for your content. You generally don't want them to. Turn these options on to prevent them from doing so."
1126
  msgstr ""
1127
 
1128
+ #: inc/views/metaboxes/robots-metabox.php:99
1129
+ msgid "The Open Directory Project and the Yahoo! Directory may contain outdated SEO values. Therefore, it's best to leave these options checked."
1130
  msgstr ""
1131
 
1132
+ #: inc/views/metaboxes/robots-metabox.php:105
1133
+ #: inc/views/metaboxes/robots-metabox.php:111
1134
+ msgid "Apply %s to the entire site?"
1135
  msgstr ""
1136
 
1137
+ #: inc/views/metaboxes/robots-metabox.php:120
1138
+ msgid "Paginated Archive Settings"
1139
  msgstr ""
1140
 
1141
+ #: inc/views/metaboxes/robots-metabox.php:121
1142
+ msgid "Indexing the second or later page of any archive might cause duplication errors. Search Engines look down upon them; therefore, it's recommended to disable indexing of those pages."
1143
  msgstr ""
1144
 
1145
+ #: inc/views/metaboxes/robots-metabox.php:127
1146
+ msgid "Apply %s to every second or later archive page?"
1147
  msgstr ""
1148
 
1149
+ #: inc/views/metaboxes/robots-metabox.php:140
1150
+ msgid "%s Robots Settings"
1151
  msgstr ""
1152
 
1153
+ #. translators: 1: Option, 2: Post Type
 
 
1154
 
1155
+ #: inc/views/metaboxes/robots-metabox.php:149
1156
+ msgid "Apply %1$s to %2$s?"
1157
  msgstr ""
1158
 
1159
+ #. translators: 1: Option, 2: Post Type
 
 
1160
 
1161
+ #: inc/views/metaboxes/robots-metabox.php:153
1162
+ msgid "Apply %1$s to %2$s Archives?"
1163
  msgstr ""
1164
 
1165
+ #: inc/views/metaboxes/schema-metabox.php:11
1166
+ msgid "Schema.org Output Settings"
1167
  msgstr ""
1168
 
1169
+ #: inc/views/metaboxes/schema-metabox.php:14
1170
+ msgid "Another Schema.org plugin has been detected."
1171
  msgstr ""
1172
 
1173
+ #: inc/views/metaboxes/schema-metabox.php:16
1174
+ msgid "The Schema.org markup is a standard way of annotating structured data for Search Engines. This markup is represented within hidden scripts throughout the website."
1175
  msgstr ""
1176
 
1177
+ #: inc/views/metaboxes/schema-metabox.php:17
1178
+ msgid "When your web pages include structured data markup, Search Engines can use that data to index your content better, present it more prominently in Search Results, and use it in several different applications."
 
1179
  msgstr ""
1180
 
1181
+ #. translators:
1182
+ #. https:developers.google.com/search/docs/data-types/sitelinks-searchbox
 
1183
 
1184
+ #: inc/views/metaboxes/schema-metabox.php:23
1185
+ #: inc/views/metaboxes/schema-metabox.php:27
1186
+ msgctxt "Product name"
1187
+ msgid "Sitelinks Searchbox"
1188
  msgstr ""
1189
 
1190
+ #: inc/views/metaboxes/schema-metabox.php:24
1191
+ msgid "When Search users search for your brand name, the following option allows them to search through your website directly from the Search Results."
1192
  msgstr ""
1193
 
1194
+ #: inc/views/metaboxes/schema-metabox.php:34
1195
+ msgctxt "Product name"
1196
+ msgid "Enable Sitelinks Searchbox?"
1197
  msgstr ""
1198
 
1199
+ #: inc/views/metaboxes/schema-metabox.php:44
1200
+ msgid "Site Name"
 
1201
  msgstr ""
1202
 
1203
+ #: inc/views/metaboxes/schema-metabox.php:45
1204
+ msgid "When using breadcrumbs, the first entry is by default your website's address. Using the following option will convert it to the Site Name."
1205
  msgstr ""
1206
 
1207
+ #: inc/views/metaboxes/schema-metabox.php:48
1208
+ msgid "Include your Site Name in Search Results"
1209
  msgstr ""
1210
 
1211
+ #: inc/views/metaboxes/schema-metabox.php:55
1212
+ msgid "Convert URL to Site Name?"
1213
  msgstr ""
1214
 
1215
+ #: inc/views/metaboxes/schema-metabox.php:56
1216
+ msgid "The Site Name is: %s"
1217
  msgstr ""
1218
 
1219
+ #: inc/views/metaboxes/schema-metabox.php:65
1220
+ msgid "Breadcrumbs"
1221
  msgstr ""
1222
 
1223
+ #: inc/views/metaboxes/schema-metabox.php:66
1224
+ msgid "Breadcrumb trails indicate the page's position in the site hierarchy. Using the following option will show the hierarchy within the Search Results when available."
1225
  msgstr ""
1226
 
1227
+ #: inc/views/metaboxes/schema-metabox.php:69
1228
+ msgid "About Breadcrumbs"
 
1229
  msgstr ""
1230
 
1231
+ #: inc/views/metaboxes/schema-metabox.php:76
1232
+ msgid "Enable Breadcrumbs?"
 
1233
  msgstr ""
1234
 
1235
+ #: inc/views/metaboxes/schema-metabox.php:77
1236
+ msgid "Multiple trails can be outputted. The longest trail is prioritized."
1237
  msgstr ""
1238
 
1239
+ #: inc/views/metaboxes/sitemaps-metabox.php:14
1240
  msgid "Permalink Settings"
1241
  msgstr ""
1242
 
1243
+ #: inc/views/metaboxes/sitemaps-metabox.php:14
1244
+ #: inc/views/metaboxes/sitemaps-metabox.php:134
1245
+ #: inc/views/metaboxes/sitemaps-metabox.php:143
1246
  msgctxt "The sitemap can be found %s."
1247
  msgid "here"
1248
  msgstr ""
1249
 
1250
+ #: inc/views/metaboxes/sitemaps-metabox.php:16
1251
  msgid "You're using the plain permalink structure."
1252
  msgstr ""
1253
 
1254
+ #: inc/views/metaboxes/sitemaps-metabox.php:17
1255
  msgid "This means we can't output the sitemap through the WordPress rewrite rules."
1256
  msgstr ""
1257
 
1258
+ #: inc/views/metaboxes/sitemaps-metabox.php:19
1259
  msgctxt "%s = here"
1260
  msgid "Change your Permalink Settings %s (Recommended: 'postname')."
1261
  msgstr ""
1262
 
1263
+ #: inc/views/metaboxes/sitemaps-metabox.php:48
1264
  msgid "Timestamps"
1265
  msgstr ""
1266
 
1267
+ #: inc/views/metaboxes/sitemaps-metabox.php:53
1268
  msgctxt "Ping or notify Search Engine"
1269
  msgid "Ping"
1270
  msgstr ""
1271
 
1272
+ #: inc/views/metaboxes/sitemaps-metabox.php:106
1273
  msgid "Sitemap Integration Settings"
1274
  msgstr ""
1275
 
1276
+ #: inc/views/metaboxes/sitemaps-metabox.php:109
1277
  msgid "Another active sitemap plugin has been detected. This means that the sitemap functionality has been replaced."
1278
  msgstr ""
1279
 
1280
+ #: inc/views/metaboxes/sitemaps-metabox.php:111
1281
  msgid "A sitemap has been detected in the root folder of your website. This means that the sitemap functionality has no effect."
1282
  msgstr ""
1283
 
1284
+ #: inc/views/metaboxes/sitemaps-metabox.php:113
1285
  msgid "The Sitemap is an XML file that lists pages and posts for your website along with optional metadata about each post or page. This helps Search Engines crawl your website more easily."
1286
  msgstr ""
1287
 
1288
+ #: inc/views/metaboxes/sitemaps-metabox.php:114
1289
  msgid "The optional metadata include the post and page modified time and a page priority indication, which is automated."
1290
  msgstr ""
1291
 
1292
+ #: inc/views/metaboxes/sitemaps-metabox.php:119
1293
  msgid "Sitemap Output"
1294
  msgstr ""
1295
 
1296
+ #: inc/views/metaboxes/sitemaps-metabox.php:126
1297
  msgid "Output Sitemap?"
1298
  msgstr ""
1299
 
1300
+ #: inc/views/metaboxes/sitemaps-metabox.php:134
1301
  msgid "View sitemap"
1302
  msgstr ""
1303
 
1304
+ #: inc/views/metaboxes/sitemaps-metabox.php:135
1305
  msgctxt "%s = here"
1306
  msgid "The sitemap can be found %s."
1307
  msgstr ""
1308
 
1309
+ #: inc/views/metaboxes/sitemaps-metabox.php:143
1310
  msgid "View robots.txt"
1311
  msgstr ""
1312
 
1313
+ #: inc/views/metaboxes/sitemaps-metabox.php:145
1314
  msgid "Robots.txt Settings"
1315
  msgstr ""
1316
 
1317
+ #: inc/views/metaboxes/sitemaps-metabox.php:148
1318
  msgid "The robots.txt file is the first thing Search Engines look for. If you add the sitemap location in the robots.txt file, then Search Engines will look for and index the sitemap."
1319
  msgstr ""
1320
 
1321
+ #: inc/views/metaboxes/sitemaps-metabox.php:149
1322
  msgid "If you do not add the sitemap location to the robots.txt file, you will need to notify Search Engines manually through the Webmaster Console provided by the Search Engines."
1323
  msgstr ""
1324
 
1325
+ #: inc/views/metaboxes/sitemaps-metabox.php:154
1326
  msgid "Add sitemap location in robots.txt"
1327
  msgstr ""
1328
 
1329
+ #: inc/views/metaboxes/sitemaps-metabox.php:161
1330
  msgid "Add sitemap location in robots?"
1331
  msgstr ""
1332
 
1333
+ #: inc/views/metaboxes/sitemaps-metabox.php:167
1334
  msgid "Another robots.txt sitemap Location addition has been detected."
1335
  msgstr ""
1336
 
1337
+ #: inc/views/metaboxes/sitemaps-metabox.php:170
1338
  msgctxt "%s = here"
1339
  msgid "The robots.txt file can be found %s."
1340
  msgstr ""
1341
 
1342
+ #: inc/views/metaboxes/sitemaps-metabox.php:189
1343
  msgid "Timestamps Settings"
1344
  msgstr ""
1345
 
1346
+ #: inc/views/metaboxes/sitemaps-metabox.php:190
1347
  msgid "The modified time suggests to Search Engines where to look for content changes. It has no impact on the SEO value unless you drastically change pages or posts. It then depends on how well your content is constructed."
1348
  msgstr ""
1349
 
1350
+ #: inc/views/metaboxes/sitemaps-metabox.php:191
1351
  msgid "By default, the sitemap only outputs the modified date if you've enabled them within the Social Metabox. This setting overrides those settings for the Sitemap."
1352
  msgstr ""
1353
 
1354
+ #: inc/views/metaboxes/sitemaps-metabox.php:196
1355
  msgid "Output Modified Date"
1356
  msgstr ""
1357
 
1358
+ #: inc/views/metaboxes/sitemaps-metabox.php:203
1359
  msgid "Add %s to the sitemap?"
1360
  msgstr ""
1361
 
1362
+ #: inc/views/metaboxes/sitemaps-metabox.php:213
1363
  msgid "Timestamp Format Settings"
1364
  msgstr ""
1365
 
1366
+ #: inc/views/metaboxes/sitemaps-metabox.php:214
1367
  msgid "Determines how specific the modification timestamp is."
1368
  msgstr ""
1369
 
1370
+ #: inc/views/metaboxes/sitemaps-metabox.php:220
1371
  msgid "Complete date"
1372
  msgstr ""
1373
 
1374
+ #: inc/views/metaboxes/sitemaps-metabox.php:226
1375
  msgid "Complete date plus hours, minutes and timezone"
1376
  msgstr ""
1377
 
1378
+ #: inc/views/metaboxes/sitemaps-metabox.php:236
1379
  msgid "Ping Settings"
1380
  msgstr ""
1381
 
1382
+ #: inc/views/metaboxes/sitemaps-metabox.php:237
1383
  msgid "Notifying Search Engines of a sitemap change is helpful to get your content indexed as soon as possible."
1384
  msgstr ""
1385
 
1386
+ #: inc/views/metaboxes/sitemaps-metabox.php:238
1387
  msgid "By default this will happen at most once an hour."
1388
  msgstr ""
1389
 
1390
+ #: inc/views/metaboxes/sitemaps-metabox.php:243
1391
  msgid "Notify Search Engines"
1392
  msgstr ""
1393
 
1394
+ #: inc/views/metaboxes/sitemaps-metabox.php:255
1395
  msgid "Notify %s about sitemap changes?"
1396
  msgstr ""
1397
 
1398
+ #: inc/views/metaboxes/social-metabox.php:40
1399
+ msgid "Post Dates"
1400
  msgstr ""
1401
 
1402
+ #: inc/views/metaboxes/social-metabox.php:45
1403
+ msgid "Link Relationships"
1404
  msgstr ""
1405
 
1406
+ #: inc/views/metaboxes/social-metabox.php:65
1407
+ msgid "Site Shortlink Settings"
1408
  msgstr ""
1409
 
1410
+ #: inc/views/metaboxes/social-metabox.php:66
1411
+ msgid "The shortlink tag might have some use for 3rd party service discoverability, but it has little to no SEO value whatsoever."
1412
  msgstr ""
1413
 
1414
+ #: inc/views/metaboxes/social-metabox.php:72
1415
+ msgid "Output shortlink tag?"
1416
  msgstr ""
1417
 
1418
+ #: inc/views/metaboxes/social-metabox.php:82
1419
+ msgid "Social Meta Tags Settings"
1420
  msgstr ""
1421
 
1422
+ #: inc/views/metaboxes/social-metabox.php:84
1423
+ msgid "Output various meta tags for social site integration, among other 3rd party services."
1424
  msgstr ""
1425
 
1426
+ #: inc/views/metaboxes/social-metabox.php:92
1427
+ msgid "Output Open Graph meta tags?"
1428
  msgstr ""
1429
 
1430
+ #: inc/views/metaboxes/social-metabox.php:93
1431
+ msgid "Facebook, Twitter, Pinterest and many other social sites make use of these tags."
1432
  msgstr ""
1433
 
1434
+ #: inc/views/metaboxes/social-metabox.php:100
1435
+ msgid "Note: Another Open Graph plugin has been detected."
 
1436
  msgstr ""
1437
 
1438
+ #: inc/views/metaboxes/social-metabox.php:108
1439
+ msgid "Output Facebook meta tags?"
1440
  msgstr ""
1441
 
1442
+ #: inc/views/metaboxes/social-metabox.php:109
1443
+ #: inc/views/metaboxes/social-metabox.php:122
1444
+ msgid "Output various tags targetted at %s."
1445
  msgstr ""
1446
 
1447
+ #: inc/views/metaboxes/social-metabox.php:121
1448
+ msgid "Output Twitter meta tags?"
 
1449
  msgstr ""
1450
 
1451
+ #: inc/views/metaboxes/social-metabox.php:129
1452
+ msgid "Note: Another Twitter Card plugin has been detected."
1453
  msgstr ""
1454
 
1455
+ #: inc/views/metaboxes/social-metabox.php:136
1456
+ msgctxt "Example Facebook Personal URL"
1457
+ msgid "http://www.facebook.com/YourPersonalProfile"
1458
  msgstr ""
1459
 
1460
+ #: inc/views/metaboxes/social-metabox.php:139
1461
+ msgctxt "Example Verified Facebook Business URL"
1462
+ msgid "http://www.facebook.com/YourVerifiedBusinessProfile"
1463
  msgstr ""
1464
 
1465
+ #: inc/views/metaboxes/social-metabox.php:144
1466
+ msgid "Default Facebook Integration Settings"
1467
  msgstr ""
1468
 
1469
+ #: inc/views/metaboxes/social-metabox.php:145
1470
+ msgid "Facebook post sharing works mostly through Open Graph. However, you can also link your Business and Personal Facebook pages, among various other options."
1471
+ msgstr ""
1472
 
1473
+ #: inc/views/metaboxes/social-metabox.php:146
1474
+ msgid "When these options are filled in, Facebook might link your Facebook profile to be followed and liked when your post or page is shared."
 
1475
  msgstr ""
1476
 
1477
+ #: inc/views/metaboxes/social-metabox.php:153
1478
+ msgid "Article Author Facebook URL"
1479
  msgstr ""
1480
 
1481
+ #: inc/views/metaboxes/social-metabox.php:154
1482
+ msgid "Your Facebook Profile"
 
1483
  msgstr ""
1484
 
1485
+ #: inc/views/metaboxes/social-metabox.php:163
1486
+ msgid "Article Publisher Facebook URL"
1487
  msgstr ""
1488
 
1489
+ #: inc/views/metaboxes/social-metabox.php:164
1490
+ msgid "To use this, you need to be a verified business"
1491
  msgstr ""
1492
 
1493
+ #: inc/views/metaboxes/social-metabox.php:173
1494
+ msgid "Facebook App ID"
1495
  msgstr ""
1496
 
1497
+ #: inc/views/metaboxes/social-metabox.php:174
1498
+ msgid "Get Facebook App ID"
1499
  msgstr ""
1500
 
1501
+ #: inc/views/metaboxes/social-metabox.php:186
1502
+ msgctxt "Twitter @username"
1503
+ msgid "@your-site-username"
1504
  msgstr ""
1505
 
1506
+ #: inc/views/metaboxes/social-metabox.php:189
1507
+ msgctxt "Twitter @username"
1508
+ msgid "@your-personal-username"
1509
  msgstr ""
1510
 
1511
+ #: inc/views/metaboxes/social-metabox.php:193
1512
+ msgid "Default Twitter Integration Settings"
1513
  msgstr ""
1514
 
1515
+ #: inc/views/metaboxes/social-metabox.php:194
1516
+ msgid "Twitter post sharing works mostly through Open Graph. However, you can also link your Business and Personal Twitter pages, among various other options."
1517
  msgstr ""
1518
 
1519
+ #: inc/views/metaboxes/social-metabox.php:200
1520
+ msgid "Twitter Card Type"
1521
  msgstr ""
1522
 
1523
+ #: inc/views/metaboxes/social-metabox.php:201
1524
+ msgid "What kind of Twitter card would you like to use? It will default to %s if no image is found."
1525
  msgstr ""
1526
 
1527
+ #: inc/views/metaboxes/social-metabox.php:211
1528
+ msgid "Example"
1529
  msgstr ""
1530
 
1531
+ #: inc/views/metaboxes/social-metabox.php:222
1532
+ msgid "When the following options are filled in, Twitter might link your Twitter Site or Personal Profile when your post or page is shared."
1533
  msgstr ""
1534
 
1535
+ #: inc/views/metaboxes/social-metabox.php:226
1536
+ msgid "Your Website's Twitter Profile"
1537
  msgstr ""
1538
 
1539
+ #: inc/views/metaboxes/social-metabox.php:227
1540
+ #: inc/views/metaboxes/social-metabox.php:237
1541
+ msgid "Find your @username"
1542
  msgstr ""
1543
 
1544
+ #: inc/views/metaboxes/social-metabox.php:236
1545
+ msgid "Your Personal Twitter Profile"
 
1546
  msgstr ""
1547
 
1548
+ #: inc/views/metaboxes/social-metabox.php:249
1549
+ msgid "Posts"
1550
  msgstr ""
1551
 
1552
+ #: inc/views/metaboxes/social-metabox.php:252
1553
+ msgid "Post Date Settings"
1554
  msgstr ""
1555
 
1556
+ #: inc/views/metaboxes/social-metabox.php:253
1557
+ msgid "Some Search Engines output the publishing date and modified date next to the search results. These help Search Engines find new content and could impact the SEO value."
1558
  msgstr ""
1559
 
1560
+ #: inc/views/metaboxes/social-metabox.php:254
1561
+ msgid "It's recommended on posts, but it's not recommended on pages unless you modify or create new pages frequently."
1562
+ msgstr ""
1563
+
1564
+ #. translators: 1: Option, 2: Post Type
1565
+
1566
+ #: inc/views/metaboxes/social-metabox.php:257
1567
+ #: inc/views/metaboxes/social-metabox.php:261
1568
+ #: inc/views/metaboxes/social-metabox.php:268
1569
+ #: inc/views/metaboxes/social-metabox.php:272
1570
+ #: inc/views/metaboxes/social-metabox.php:286
1571
+ #: inc/views/metaboxes/social-metabox.php:290
1572
+ msgid "Add %1$s to %2$s?"
1573
+ msgstr ""
1574
+
1575
+ #: inc/views/metaboxes/social-metabox.php:283
1576
+ msgid "Because you only publish the Home Page once, Search Engines might think your website is outdated. This can be prevented by disabling the following options."
1577
+ msgstr ""
1578
+
1579
+ #: inc/views/metaboxes/social-metabox.php:299
1580
+ msgid "Link Relationship Settings"
1581
+ msgstr ""
1582
+
1583
+ #: inc/views/metaboxes/social-metabox.php:300
1584
+ msgid "Some Search Engines look for relations between the content of your pages. If you have multiple pages for a single Post or Page, or have archives indexed, this option will help Search Engines look for the right page to display in the Search Results."
1585
+ msgstr ""
1586
+
1587
+ #: inc/views/metaboxes/social-metabox.php:301
1588
+ msgid "It's recommended to turn this option on for better SEO consistency and to prevent duplicate content errors."
1589
+ msgstr ""
1590
+
1591
+ #. translators: %s = <code>rel</code>
1592
+
1593
+ #: inc/views/metaboxes/social-metabox.php:306
1594
+ msgid "Add %s link tags to Posts and Pages?"
1595
+ msgstr ""
1596
+
1597
+ #. translators: %s = <code>rel</code>
1598
+
1599
+ #: inc/views/metaboxes/social-metabox.php:310
1600
+ msgid "Add %s link tags to Archives?"
1601
+ msgstr ""
1602
+
1603
+ #. translators: %s = <code>rel</code>
1604
+
1605
+ #: inc/views/metaboxes/social-metabox.php:314
1606
+ msgid "Add %s link tags to the Home Page?"
1607
+ msgstr ""
1608
+
1609
+ #: inc/views/metaboxes/title-metabox.php:17
1610
+ msgid "Example Post Title"
1611
+ msgstr ""
1612
+
1613
+ #: inc/views/metaboxes/title-metabox.php:33
1614
+ msgid "Automated Title Settings"
1615
+ msgstr ""
1616
+
1617
+ #: inc/views/metaboxes/title-metabox.php:34
1618
+ msgid "The page title is prominently shown within the browser tab as well as within the Search Engine results pages."
1619
+ msgstr ""
1620
+
1621
+ #: inc/views/metaboxes/title-metabox.php:37
1622
+ msgid "Example Automated Title Output"
1623
+ msgstr ""
1624
+
1625
+ #: inc/views/metaboxes/title-metabox.php:77
1626
+ msgid "Prefixes"
1627
+ msgstr ""
1628
+
1629
+ #: inc/views/metaboxes/title-metabox.php:109
1630
+ msgid "Document Title Separator"
1631
+ msgstr ""
1632
+
1633
+ #: inc/views/metaboxes/title-metabox.php:116
1634
+ msgid "If the title consists of two parts (original title and optional addition), then the separator will go in-between them."
1635
+ msgstr ""
1636
+
1637
+ #: inc/views/metaboxes/title-metabox.php:128
1638
+ msgid "The Home Page has a specific option."
1639
+ msgstr ""
1640
+
1641
+ #: inc/views/metaboxes/title-metabox.php:161
1642
+ msgid "Remove Blogname from Title"
1643
+ msgstr ""
1644
+
1645
+ #: inc/views/metaboxes/title-metabox.php:165
1646
+ msgid "This might decouple your posts and pages from the rest of the website"
1647
+ msgstr ""
1648
+
1649
+ #: inc/views/metaboxes/title-metabox.php:173
1650
+ msgid "Remove Blogname from title?"
1651
+ msgstr ""
1652
+
1653
+ #: inc/views/metaboxes/title-metabox.php:182
1654
+ msgid "Only use this option if you are aware of its SEO effects."
1655
+ msgstr ""
1656
+
1657
+ #: inc/views/metaboxes/title-metabox.php:208
1658
+ msgid "Example Category"
1659
+ msgstr ""
1660
+
1661
+ #: inc/views/metaboxes/title-metabox.php:226
1662
+ msgid "Title prefix options"
1663
+ msgstr ""
1664
+
1665
+ #: inc/views/metaboxes/title-metabox.php:227
1666
+ msgid "On archives a descriptive prefix may be added to the title."
1667
+ msgstr ""
1668
+
1669
+ #: inc/views/metaboxes/title-metabox.php:230
1670
+ msgid "Example Automated Archive Title Output"
1671
+ msgstr ""
1672
+
1673
+ #: inc/views/metaboxes/title-metabox.php:238
1674
+ msgid "Remove Archive Title Prefixes"
1675
+ msgstr ""
1676
+
1677
+ #: inc/views/metaboxes/title-metabox.php:242
1678
+ msgid "Remove prefixes from title?"
1679
+ msgstr ""
1680
+
1681
+ #: inc/views/metaboxes/title-metabox.php:246
1682
+ msgid "The prefix helps visitors and Search Engines determine what kind of page they're visiting"
1683
+ msgstr ""
1684
+
1685
+ #: inc/views/metaboxes/webmaster-metabox.php:18
1686
+ msgid "Webmaster Integration Settings"
1687
+ msgstr ""
1688
+
1689
+ #: inc/views/metaboxes/webmaster-metabox.php:19
1690
+ msgid "When adding your website to Google, Bing and other Webmaster Tools, you'll be asked to add a code or file to your website for verification purposes. These options will help you easily integrate those codes."
1691
+ msgstr ""
1692
+
1693
+ #: inc/views/metaboxes/webmaster-metabox.php:20
1694
+ msgid "Verifying your website has no SEO value whatsoever. But you might gain added benefits such as search ranking insights to help you improve your website's content."
1695
+ msgstr ""
1696
+
1697
+ #: inc/views/metaboxes/webmaster-metabox.php:27
1698
+ msgid "Google Webmaster Verification Code"
1699
+ msgstr ""
1700
+
1701
+ #: inc/views/metaboxes/webmaster-metabox.php:28
1702
+ msgid "Get the Google Verification code"
1703
+ msgstr ""
1704
+
1705
+ #: inc/views/metaboxes/webmaster-metabox.php:37
1706
+ msgid "Bing Webmaster Verification Code"
1707
+ msgstr ""
1708
+
1709
+ #: inc/views/metaboxes/webmaster-metabox.php:38
1710
+ msgid "Get the Bing Verification Code"
1711
+ msgstr ""
1712
+
1713
+ #: inc/views/metaboxes/webmaster-metabox.php:47
1714
+ msgid "Yandex Webmaster Verification Code"
1715
+ msgstr ""
1716
+
1717
+ #: inc/views/metaboxes/webmaster-metabox.php:48
1718
+ msgid "Get the Yandex Verification Code"
1719
+ msgstr ""
1720
+
1721
+ #: inc/views/metaboxes/webmaster-metabox.php:57
1722
+ msgid "Pinterest Analytics Verification Code"
1723
+ msgstr ""
1724
+
1725
+ #: inc/views/metaboxes/webmaster-metabox.php:58
1726
+ msgid "Get the Pinterest Verification Code"
1727
+ msgstr ""
1728
+
1729
+ #: load.class.php:245 load.class.php:255 load.class.php:267
1730
+ msgid "Class or Method not found."
1731
+ msgstr ""
1732
+
1733
+ #: load.class.php:279
1734
+ msgid "Function needs to be called as a string."
1735
  msgstr ""
1736
  #. Plugin Name of the plugin/theme
1737
  msgid "The SEO Framework"
lib/css/autodescription-rtl.css CHANGED
@@ -1,11 +1,42 @@
1
  /**
2
  * Dismissible Notices.
3
  */
4
- .seo-notice {
5
  position: relative;
6
  }
7
 
8
- a.autodescription-dismiss {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  position: absolute;
10
  top: 0;
11
  left: 1px;
@@ -18,7 +49,7 @@ a.autodescription-dismiss {
18
  text-decoration: none;
19
  }
20
 
21
- a.autodescription-dismiss:before {
22
  background: 0 0;
23
  content: "\f153";
24
  display: block;
@@ -31,7 +62,7 @@ a.autodescription-dismiss:before {
31
  -moz-osx-font-smoothing: grayscale;
32
  }
33
 
34
- a.autodescription-dismiss:hover {
35
  color: #c00;
36
  }
37
 
@@ -42,18 +73,22 @@ table.wp-list-table .column-name {
42
  width: 15%;
43
  }
44
 
 
 
 
45
  table.wp-list-table .column-is_in_stock,
46
  table.wp-list-table .column-sku,
47
- table.wp-list-table .column-price {
48
- width: 8%;
 
49
  }
50
 
51
- .ad-seo a {
52
  text-decoration: none;
53
  font-size: 13px;
54
  }
55
 
56
- #autodescription-title-wrap {
57
  position: relative;
58
  display: block;
59
  padding: 0;
@@ -61,7 +96,7 @@ table.wp-list-table .column-price {
61
  width: auto;
62
  }
63
 
64
- #autodescription-title-offset {
65
  visibility: hidden;
66
  height: 0;
67
  display: inline-block;
@@ -71,7 +106,7 @@ table.wp-list-table .column-price {
71
  white-space: pre;
72
  }
73
 
74
- #autodescription-title-placeholder {
75
  position: absolute;
76
  color: #777;
77
  -webkit-user-select: none;
@@ -88,7 +123,7 @@ table.wp-list-table .column-price {
88
 
89
  /* START Character Counters */
90
 
91
- .theseoframework-counter {
92
  font-weight: 600;
93
  cursor: pointer;
94
  -webkit-user-select: none;
@@ -97,15 +132,15 @@ table.wp-list-table .column-price {
97
  user-select: none;
98
  }
99
 
100
- span.ad-count-bad {
101
  color: #dd3811;
102
  }
103
 
104
- span.ad-count-okay {
105
  color: #ffa700;
106
  }
107
 
108
- span.ad-count-good {
109
  color: #0cc34b;
110
  }
111
 
@@ -119,28 +154,28 @@ span.tsf-counter-one {
119
  text-align: center;
120
  vertical-align: baseline;
121
  }
122
- span.tsf-counter-one.ad-count-bad {
123
  background-color: #dd3811;
124
  }
125
- span.tsf-counter-one.ad-count-okay {
126
  background-color: #ffa700;
127
  }
128
- span.tsf-counter-one.ad-count-good {
129
  background-color: #0cc34b;
130
  }
131
 
132
  /* END Character Counters */
133
 
134
- #ad_seo {
135
  width: 18%;
136
  }
137
 
138
  /* WooCommerce fix */
139
- th:last-of-type#ad_seo {
140
  width: 160px;
141
  }
142
 
143
- span.ad-seo {
144
  display: block;
145
  width: 95%;
146
  max-width: 220px;
@@ -149,11 +184,11 @@ span.ad-seo {
149
  text-shadow: 0 0 3px rgba(0,0,0,0.3);
150
  }
151
 
152
- span.ad-seo.ad-100 {
153
  width: 100%;
154
  }
155
 
156
- span.ad-bar-wrap {
157
  display: table;
158
  width: 100%;
159
  border-radius: 0;
@@ -165,12 +200,12 @@ span.ad-bar-wrap {
165
  }
166
 
167
 
168
- span.ad-sec-wrap {
169
  display: table-cell;
170
  border-collapse: collapse;
171
  }
172
 
173
- .ad-bar-wrap a {
174
  display: table;
175
  width: 100%;
176
  color: #fff;
@@ -183,60 +218,60 @@ span.ad-sec-wrap {
183
  box-shadow: 2px 0px 0px -1px rgba(0,0,0,0.1) inset, -2px 0px 0px -1px rgba(0,0,0,0.1) inset;
184
  }
185
 
186
- span.ad-seo.pill,
187
- span.ad-seo.pill span.ad-bar-wrap {
188
  border-radius: 30px;
189
  }
190
 
191
- span.ad-seo.pill span.ad-bar-wrap a {
192
  box-shadow: 2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6);
193
  }
194
 
195
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type,
196
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type a {
197
  border-top-left-radius: 30px;
198
  border-bottom-left-radius: 30px;
199
  }
200
 
201
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type,
202
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type a {
203
  border-top-right-radius: 30px;
204
  border-bottom-right-radius: 30px;
205
  }
206
 
207
- .ad-100 {
208
  width: 100%;
209
  }
210
 
211
- .ad-60 {
212
  width: 60%;
213
  }
214
 
215
- .ad-50 {
216
  width: 50%;
217
  }
218
 
219
- .ad-40 {
220
  width: 40%;
221
  }
222
 
223
- .ad-33 {
224
  width: 33.333%;
225
  }
226
 
227
- .ad-25 {
228
  width: 25%;
229
  }
230
 
231
- .ad-20 {
232
  width: 20%;
233
  }
234
 
235
- .ad-16 {
236
  width: 16.666%;
237
  }
238
 
239
- .ad-12-5 {
240
  width: 12.5%;
241
  }
242
 
@@ -244,27 +279,27 @@ span.ad-seo.pill span.ad-bar-wrap a {
244
  width: 11.333%;
245
  }
246
 
247
- .ad-10 {
248
  width: 10%;
249
  }
250
 
251
- .ad-seo-bad {
252
  background-color: #dd3811;
253
  }
254
 
255
- .ad-seo-okay {
256
  background-color: #ffa700;
257
  }
258
 
259
- .ad-seo-good {
260
  background-color: #0cc34b;
261
  }
262
 
263
- .ad-seo-unknown {
264
  background-color: #007bd2;
265
  }
266
 
267
- span.ad-seo .explanation-desc {
268
  position: absolute;
269
  width: auto;
270
  min-width: 90%;
@@ -281,11 +316,11 @@ span.ad-seo .explanation-desc {
281
  text-align: left;
282
  }
283
 
284
- span.ad-seo .explanation-desc span {
285
  text-decoration: underline;
286
  }
287
 
288
- span.ad-seo .explanation-desc div {
289
  width: 0;
290
  height: 0;
291
  border-left: 12px solid transparent;
@@ -299,7 +334,7 @@ span.ad-seo .explanation-desc div {
299
 
300
  /* Mobile support */
301
  /* Needs more refining.... e.g. iPhone 6 = good, iPhone 6+ = offscreen */
302
- .ad_seo.column-ad_seo {
303
  overflow: initial !important;
304
  min-width: 160px;
305
  }
@@ -312,54 +347,54 @@ span.ad-seo .explanation-desc div {
312
 
313
  /* Site Settings */
314
 
315
- .autodescription-metaboxes {
316
  box-sizing: border-box;
317
  max-width: 690px;
318
  padding-bottom: 20px;
319
  }
320
 
321
- .autodescription-metaboxes .top-wrap {
322
  width: 100%;
323
  display: inline-block;
324
  vertical-align: top;
325
  }
326
 
327
- .autodescription-metaboxes .top-wrap > h1,
328
- .autodescription-metaboxes .top-wrap > h2 {
329
  float: left;
330
  }
331
 
332
- .autodescription-metaboxes .metabox-holder {
333
  clear: both;
334
  }
335
 
336
- .autodescription-metaboxes .top-buttons {
337
  float: left;
338
  }
339
 
340
- .autodescription-metaboxes .bottom-buttons {
341
  text-align: left;
342
  }
343
 
344
- .autodescription-metaboxes .top-buttons input,
345
- .autodescription-metaboxes .bottom-buttons input {
346
  margin-left: 10px;
347
  }
348
 
349
- .seo-notice {
350
  clear: both;
351
  }
352
 
353
- .autodescription-metaboxes #title-separator,
354
- .autodescription-metaboxes #description-separator {
355
  display: table;
356
  width: 100%;
357
  border-collapse: collapse;
358
  border-spacing: 0;
359
  }
360
 
361
- .autodescription-metaboxes #title-separator input,
362
- .autodescription-metaboxes #description-separator input {
363
  display: none;
364
  float: left;
365
  width: 0;
@@ -367,8 +402,8 @@ span.ad-seo .explanation-desc div {
367
  opacity: 0;
368
  }
369
 
370
- .autodescription-metaboxes #title-separator label,
371
- .autodescription-metaboxes #description-separator label {
372
  display: inline-block;
373
  width: auto;
374
  min-width: 28px;
@@ -385,48 +420,48 @@ span.ad-seo .explanation-desc div {
385
  font-size: 16px;
386
  }
387
 
388
- .autodescription-metaboxes #title-separator label.recommended,
389
- .autodescription-metaboxes #description-separator label.recommended {
390
  border: 1px solid #0cc34b;
391
  box-shadow: -1px -1px 1px #0cc34b inset;
392
  }
393
 
394
- .autodescription-metaboxes #title-separator input:hover + label,
395
- .autodescription-metaboxes #title-separator label:hover,
396
- .autodescription-metaboxes #description-separator input:hover + label,
397
- .autodescription-metaboxes #description-separator label:hover {
398
  box-shadow: 1px 1px 1px #aaa inset;
399
  background-color: #fff;
400
  }
401
 
402
- .autodescription-metaboxes #title-separator input:checked + label,
403
- .autodescription-metaboxes #description-separator input:checked + label {
404
  box-shadow: 1px 1px 1px #333 inset;
405
  background-color: #fff;
406
  }
407
 
408
- .autodescription-metaboxes #title-location,
409
- .autodescription-metaboxes #home-title-location {
410
  display: block;
411
  }
412
 
413
- .autodescription-metaboxes #title-location label span,
414
- .autodescription-metaboxes #home-title-location label span,
415
- .autodescription-metaboxes #twitter-cards label span {
416
  display: inline-block;
417
  min-width: 60px;
418
  vertical-align: baseline;
419
  }
420
 
421
- .autodescription-metaboxes #twitter-cards label span {
422
  min-width: 150px;
423
  }
424
 
425
- .autodescription-metaboxes #home-title-location label span.custom-title-js,
426
- .autodescription-metaboxes #home-title-location label span.custom-blogname-js,
427
- .autodescription-metaboxes #home-title-location label span.custom-tagline-js,
428
- .autodescription-metaboxes #title-location label .autodescription-sep-js,
429
- .autodescription-metaboxes #home-title-location label .autodescription-sep-js {
430
  display: inline;
431
  min-width: 0;
432
  white-space: pre;
@@ -435,8 +470,8 @@ span.ad-seo .explanation-desc div {
435
  /**
436
  * Start Tabs.
437
  */
438
- .autodescription-metaboxes .seoframework-tab-no-js,
439
- .autodescription-metaboxes .seoframework-nav-tab-wrapper {
440
  position: relative;
441
  clear: both;
442
  width: 100%;
@@ -447,7 +482,7 @@ span.ad-seo .explanation-desc div {
447
  margin: -4px -12px;
448
  }
449
 
450
- .autodescription-metaboxes .seoframework-nav-tab {
451
  float: right;
452
  border: 1px solid #ccc;
453
  margin-right: .5em;
@@ -460,13 +495,13 @@ span.ad-seo .explanation-desc div {
460
  font-weight: 600;
461
  }
462
 
463
- .autodescription-metaboxes .seoframework-dashicons-tabs {
464
  font-size: initial;
465
  display: inline;
466
  vertical-align: text-bottom;
467
  }
468
 
469
- .autodescription-metaboxes .seoframework-tabs-radio {
470
  display: none;
471
  width: 0;
472
  height: 0;
@@ -474,26 +509,26 @@ span.ad-seo .explanation-desc div {
474
  left: -9001px;
475
  }
476
 
477
- .autodescription-metaboxes .seoframework-tabs-radio:checked + label,
478
- .autodescription-metaboxes .seoframework-active-tab {
479
  background-color: inherit;
480
  border-bottom-color: #fff;
481
  color: #000;
482
  }
483
 
484
- .autodescription-metaboxes .seoframework-tabs-content {
485
  margin: 1.33em auto 0;
486
  }
487
 
488
- .autodescription-metaboxes .seoframework-content-no-js {
489
  margin: 1.33em auto;
490
  }
491
 
492
- body.js .autodescription-metaboxes .seoframework-tabs-content {
493
  display: none;
494
  }
495
 
496
- body.js .autodescription-metaboxes .seoframework-tabs-content.seoframework-active-tab-content {
497
  display: block;
498
  }
499
 
@@ -501,89 +536,151 @@ body.js .autodescription-metaboxes .seoframework-tabs-content.seoframework-activ
501
  * End tabs.
502
  */
503
 
504
- .autodescription-metaboxes .seoframework-default-selected {
505
  border-color: #1c9d38;
506
  }
507
 
508
- .autodescription-metaboxes .seoframework-default-selected:checked:before {
509
  color: #1c9d38;
510
  }
511
 
512
- .autodescription-metaboxes .seoframework-warning-selected {
513
  border-color: #dd3811;
514
  }
515
 
516
- .autodescription-metaboxes .seoframework-warning-selected:checked:before {
517
  color: #dd3811;
518
  }
519
 
520
- .theseoframework-fields {
521
  font-size: 13px;
522
  line-height: 1.5;
523
  margin: 1em 0;
524
  }
525
 
526
- .theseoframework-fields .toblock {
527
  display: block;
528
  width: 100%;
529
  margin-bottom: 4px;
530
  }
531
 
532
- .theseoframework-fields p.description {
533
  margin: 7px 0 5px;
534
  color: #666;
535
  }
536
 
537
- .theseoframework-option-spacer {
538
  margin: 1em 0;
539
  }
540
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  @media screen and (max-width: 782px) {
542
- .autodescription-metaboxes p.theseoframework-fields,
543
- .theseoframework-inpost-box p.theseoframework-fields {
544
  line-height: 2.8
545
  }
546
 
547
- .autodescription-metaboxes #title-location label span,
548
- .autodescription-metaboxes #home-title-location label span {
549
  min-width: 40px;
550
  }
551
  }
552
 
553
  @media screen and (max-width: 642px) {
554
- .autodescription-metaboxes span.seoframework-nav-desktop {
555
  display: none;
556
  }
557
  }
558
 
559
- @media screen and (max-width: 600px) {
560
- .autodescription-metaboxes h3.nav-tab-wrapper {
561
- border-bottom: 1px solid #ccc;
562
- }
563
-
564
- .autodescription-metaboxes h3 .nav-tab {
565
- margin-right: 7px;
566
- margin-bottom: -1px;
567
- }
568
- }
569
-
570
  @media screen and (max-width: 510px) {
571
- span.ad-seo.ad-100 {
572
  width: inherit;
573
  }
574
  }
575
 
576
  /* Firefix */
577
  @-moz-document url-prefix() {
578
- .autodescription-metaboxes .seoframework-default-selected {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  box-shadow: 0 0 2px 0 #1c9d38;
580
  }
581
 
582
- .autodescription-metaboxes .seoframework-warning-selected {
583
  box-shadow: 0 0 2px 0 #dd3811;
584
  }
585
 
586
- .autodescription-metaboxes legend h4 {
587
  margin: 2px 0;
588
  }
589
  }
1
  /**
2
  * Dismissible Notices.
3
  */
4
+ .tsf-notice {
5
  position: relative;
6
  }
7
 
8
+ .tsf-notice.tsf-show-icon p:before {
9
+ content: '';
10
+ margin-left: 12px;
11
+ background: 0 0;
12
+ display: inline-block;
13
+ font: 400 14px/16px dashicons;
14
+ speak: none;
15
+ height: 16px;
16
+ text-align: center;
17
+ vertical-align: middle;
18
+ width: 16px;
19
+ line-height: 14px;
20
+ -webkit-font-smoothing: antialiased;
21
+ }
22
+
23
+ .error.tsf-notice.tsf-show-icon p:before {
24
+ color: #dd3811;
25
+ content: "\f534";
26
+ }
27
+
28
+ .notice-warning.tsf-notice.tsf-show-icon p:before {
29
+ color: #ffa01b;
30
+ content: "\f227";
31
+ }
32
+
33
+ .updated.tsf-notice.tsf-show-icon p:before {
34
+ color: #0cc34b;
35
+ font-size: 16px;
36
+ content: "\f147";
37
+ }
38
+
39
+ a.tsf-dismiss {
40
  position: absolute;
41
  top: 0;
42
  left: 1px;
49
  text-decoration: none;
50
  }
51
 
52
+ a.tsf-dismiss:before {
53
  background: 0 0;
54
  content: "\f153";
55
  display: block;
62
  -moz-osx-font-smoothing: grayscale;
63
  }
64
 
65
+ a.tsf-dismiss:hover {
66
  color: #c00;
67
  }
68
 
73
  width: 15%;
74
  }
75
 
76
+ /**
77
+ * WooCommerce fix
78
+ */
79
  table.wp-list-table .column-is_in_stock,
80
  table.wp-list-table .column-sku,
81
+ table.wp-list-table .column-price,
82
+ table.wp-list-table .column-icl_translations {
83
+ width: 8%;
84
  }
85
 
86
+ .tsf-seo-bar a {
87
  text-decoration: none;
88
  font-size: 13px;
89
  }
90
 
91
+ #tsf-title-wrap {
92
  position: relative;
93
  display: block;
94
  padding: 0;
96
  width: auto;
97
  }
98
 
99
+ #tsf-title-offset {
100
  visibility: hidden;
101
  height: 0;
102
  display: inline-block;
106
  white-space: pre;
107
  }
108
 
109
+ #tsf-title-placeholder {
110
  position: absolute;
111
  color: #777;
112
  -webkit-user-select: none;
123
 
124
  /* START Character Counters */
125
 
126
+ .tsf-counter {
127
  font-weight: 600;
128
  cursor: pointer;
129
  -webkit-user-select: none;
132
  user-select: none;
133
  }
134
 
135
+ span.tsf-count-bad {
136
  color: #dd3811;
137
  }
138
 
139
+ span.tsf-count-okay {
140
  color: #ffa700;
141
  }
142
 
143
+ span.tsf-count-good {
144
  color: #0cc34b;
145
  }
146
 
154
  text-align: center;
155
  vertical-align: baseline;
156
  }
157
+ span.tsf-counter-one.tsf-count-bad {
158
  background-color: #dd3811;
159
  }
160
+ span.tsf-counter-one.tsf-count-okay {
161
  background-color: #ffa700;
162
  }
163
+ span.tsf-counter-one.tsf-count-good {
164
  background-color: #0cc34b;
165
  }
166
 
167
  /* END Character Counters */
168
 
169
+ #tsf-seo-bar-wrap {
170
  width: 18%;
171
  }
172
 
173
  /* WooCommerce fix */
174
+ th:last-of-type#tsf-seo-bar-wrap {
175
  width: 160px;
176
  }
177
 
178
+ span.tsf-seo-bar {
179
  display: block;
180
  width: 95%;
181
  max-width: 220px;
184
  text-shadow: 0 0 3px rgba(0,0,0,0.3);
185
  }
186
 
187
+ span.tsf-seo-bar.tsf-100 {
188
  width: 100%;
189
  }
190
 
191
+ span.tsf-seo-bar-inner-wrap {
192
  display: table;
193
  width: 100%;
194
  border-radius: 0;
200
  }
201
 
202
 
203
+ span.tsf-seo-bar-section-wrap {
204
  display: table-cell;
205
  border-collapse: collapse;
206
  }
207
 
208
+ .tsf-seo-bar-inner-wrap a {
209
  display: table;
210
  width: 100%;
211
  color: #fff;
218
  box-shadow: 2px 0px 0px -1px rgba(0,0,0,0.1) inset, -2px 0px 0px -1px rgba(0,0,0,0.1) inset;
219
  }
220
 
221
+ span.tsf-seo-bar.pill,
222
+ span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap {
223
  border-radius: 30px;
224
  }
225
 
226
+ span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap a {
227
  box-shadow: 2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6);
228
  }
229
 
230
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type,
231
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type a {
232
  border-top-left-radius: 30px;
233
  border-bottom-left-radius: 30px;
234
  }
235
 
236
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type,
237
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type a {
238
  border-top-right-radius: 30px;
239
  border-bottom-right-radius: 30px;
240
  }
241
 
242
+ .tsf-100 {
243
  width: 100%;
244
  }
245
 
246
+ .tsf-60 {
247
  width: 60%;
248
  }
249
 
250
+ .tsf-50 {
251
  width: 50%;
252
  }
253
 
254
+ .tsf-40 {
255
  width: 40%;
256
  }
257
 
258
+ .tsf-33 {
259
  width: 33.333%;
260
  }
261
 
262
+ .tsf-25 {
263
  width: 25%;
264
  }
265
 
266
+ .tsf-20 {
267
  width: 20%;
268
  }
269
 
270
+ .tsf-16 {
271
  width: 16.666%;
272
  }
273
 
274
+ .tsf-12-5 {
275
  width: 12.5%;
276
  }
277
 
279
  width: 11.333%;
280
  }
281
 
282
+ .tsf-10 {
283
  width: 10%;
284
  }
285
 
286
+ .tsf-seo-bar-bad {
287
  background-color: #dd3811;
288
  }
289
 
290
+ .tsf-seo-bar-okay {
291
  background-color: #ffa700;
292
  }
293
 
294
+ .tsf-seo-bar-good {
295
  background-color: #0cc34b;
296
  }
297
 
298
+ .tsf-seo-bar-unknown {
299
  background-color: #007bd2;
300
  }
301
 
302
+ span.tsf-seo-bar .tsf-explanation-desc {
303
  position: absolute;
304
  width: auto;
305
  min-width: 90%;
316
  text-align: left;
317
  }
318
 
319
+ span.tsf-seo-bar .tsf-explanation-desc span {
320
  text-decoration: underline;
321
  }
322
 
323
+ span.tsf-seo-bar .tsf-explanation-desc div {
324
  width: 0;
325
  height: 0;
326
  border-left: 12px solid transparent;
334
 
335
  /* Mobile support */
336
  /* Needs more refining.... e.g. iPhone 6 = good, iPhone 6+ = offscreen */
337
+ .tsf-seo-bar-wrap.column-tsf-seo-bar-temp {
338
  overflow: initial !important;
339
  min-width: 160px;
340
  }
347
 
348
  /* Site Settings */
349
 
350
+ .tsf-metaboxes {
351
  box-sizing: border-box;
352
  max-width: 690px;
353
  padding-bottom: 20px;
354
  }
355
 
356
+ .tsf-metaboxes .tsf-top-wrap {
357
  width: 100%;
358
  display: inline-block;
359
  vertical-align: top;
360
  }
361
 
362
+ .tsf-metaboxes .tsf-top-wrap > h1,
363
+ .tsf-metaboxes .tsf-top-wrap > h2 {
364
  float: left;
365
  }
366
 
367
+ .tsf-metaboxes .metabox-holder {
368
  clear: both;
369
  }
370
 
371
+ .tsf-metaboxes .tsf-top-buttons {
372
  float: left;
373
  }
374
 
375
+ .tsf-metaboxes .tsf-bottom-buttons {
376
  text-align: left;
377
  }
378
 
379
+ .tsf-metaboxes .tsf-top-buttons input,
380
+ .tsf-metaboxes .tsf-bottom-buttons input {
381
  margin-left: 10px;
382
  }
383
 
384
+ .tsf-notice {
385
  clear: both;
386
  }
387
 
388
+ .tsf-metaboxes #tsf-title-separator,
389
+ .tsf-metaboxes #tsf-description-separator {
390
  display: table;
391
  width: 100%;
392
  border-collapse: collapse;
393
  border-spacing: 0;
394
  }
395
 
396
+ .tsf-metaboxes #tsf-title-separator input,
397
+ .tsf-metaboxes #tsf-description-separator input {
398
  display: none;
399
  float: left;
400
  width: 0;
402
  opacity: 0;
403
  }
404
 
405
+ .tsf-metaboxes #tsf-title-separator label,
406
+ .tsf-metaboxes #tsf-description-separator label {
407
  display: inline-block;
408
  width: auto;
409
  min-width: 28px;
420
  font-size: 16px;
421
  }
422
 
423
+ .tsf-metaboxes #tsf-title-separator label.tsf-recommended,
424
+ .tsf-metaboxes #tsf-description-separator label.tsf-recommended {
425
  border: 1px solid #0cc34b;
426
  box-shadow: -1px -1px 1px #0cc34b inset;
427
  }
428
 
429
+ .tsf-metaboxes #tsf-title-separator input:hover + label,
430
+ .tsf-metaboxes #tsf-title-separator label:hover,
431
+ .tsf-metaboxes #tsf-description-separator input:hover + label,
432
+ .tsf-metaboxes #tsf-description-separator label:hover {
433
  box-shadow: 1px 1px 1px #aaa inset;
434
  background-color: #fff;
435
  }
436
 
437
+ .tsf-metaboxes #tsf-title-separator input:checked + label,
438
+ .tsf-metaboxes #tsf-description-separator input:checked + label {
439
  box-shadow: 1px 1px 1px #333 inset;
440
  background-color: #fff;
441
  }
442
 
443
+ .tsf-metaboxes #tsf-title-location,
444
+ .tsf-metaboxes #tsf-home-title-location {
445
  display: block;
446
  }
447
 
448
+ .tsf-metaboxes #tsf-title-location label span,
449
+ .tsf-metaboxes #tsf-home-title-location label span,
450
+ .tsf-metaboxes #tsf-twitter-cards label span {
451
  display: inline-block;
452
  min-width: 60px;
453
  vertical-align: baseline;
454
  }
455
 
456
+ .tsf-metaboxes #tsf-twitter-cards label span {
457
  min-width: 150px;
458
  }
459
 
460
+ .tsf-metaboxes #tsf-home-title-location label span.custom-title-js,
461
+ .tsf-metaboxes #tsf-home-title-location label span.tsf-custom-blogname-js,
462
+ .tsf-metaboxes #tsf-home-title-location label span.tsf-custom-tagline-js,
463
+ .tsf-metaboxes #tsf-title-location label .autodescription-sep-js,
464
+ .tsf-metaboxes #tsf-home-title-location label .autodescription-sep-js {
465
  display: inline;
466
  min-width: 0;
467
  white-space: pre;
470
  /**
471
  * Start Tabs.
472
  */
473
+ .tsf-metaboxes .tsf-tab-no-js,
474
+ .tsf-metaboxes .tsf-nav-tab-wrapper {
475
  position: relative;
476
  clear: both;
477
  width: 100%;
482
  margin: -4px -12px;
483
  }
484
 
485
+ .tsf-metaboxes .tsf-nav-tab {
486
  float: right;
487
  border: 1px solid #ccc;
488
  margin-right: .5em;
495
  font-weight: 600;
496
  }
497
 
498
+ .tsf-metaboxes .tsf-dashicons-tabs {
499
  font-size: initial;
500
  display: inline;
501
  vertical-align: text-bottom;
502
  }
503
 
504
+ .tsf-metaboxes .tsf-tabs-radio {
505
  display: none;
506
  width: 0;
507
  height: 0;
509
  left: -9001px;
510
  }
511
 
512
+ .tsf-metaboxes .tsf-tabs-radio:checked + label,
513
+ .tsf-metaboxes .tsf-active-tab {
514
  background-color: inherit;
515
  border-bottom-color: #fff;
516
  color: #000;
517
  }
518
 
519
+ .tsf-metaboxes .tsf-tabs-content {
520
  margin: 1.33em auto 0;
521
  }
522
 
523
+ .tsf-metaboxes .seoframework-content-no-js {
524
  margin: 1.33em auto;
525
  }
526
 
527
+ body.js .tsf-metaboxes .tsf-tabs-content {
528
  display: none;
529
  }
530
 
531
+ body.js .tsf-metaboxes .tsf-tabs-content.tsf-active-tab-content {
532
  display: block;
533
  }
534
 
536
  * End tabs.
537
  */
538
 
539
+ .tsf-metaboxes .tsf-default-selected {
540
  border-color: #1c9d38;
541
  }
542
 
543
+ .tsf-metaboxes .tsf-default-selected:checked:before {
544
  color: #1c9d38;
545
  }
546
 
547
+ .tsf-metaboxes .tsf-warning-selected {
548
  border-color: #dd3811;
549
  }
550
 
551
+ .tsf-metaboxes .tsf-warning-selected:checked:before {
552
  color: #dd3811;
553
  }
554
 
555
+ .tsf-fields {
556
  font-size: 13px;
557
  line-height: 1.5;
558
  margin: 1em 0;
559
  }
560
 
561
+ .tsf-fields .tsf-toblock {
562
  display: block;
563
  width: 100%;
564
  margin-bottom: 4px;
565
  }
566
 
567
+ .tsf-fields p.description {
568
  margin: 7px 0 5px;
569
  color: #666;
570
  }
571
 
572
+ .tsf-option-spacer {
573
  margin: 1em 0;
574
  }
575
 
576
+ .tsf-counter .tsf-ajax {
577
+ margin-right: 3px;
578
+ }
579
+
580
+ .tsf-ajax:before {
581
+ display: inline-block;
582
+ line-height: 1;
583
+ font-family: dashicons;
584
+ font-style: normal;
585
+ font-weight: 400;
586
+ font-size: 1.225em;
587
+ vertical-align: middle;
588
+ content: "";
589
+ }
590
+
591
+ .tsf-ajax.tsf-loading:before {
592
+ content: "\f463";
593
+ color: #007bd2;
594
+ -webkit-animation: tsf-spin 1.5s linear infinite;
595
+ -moz-animation: tsf-spin 1.5s linear infinite;
596
+ -o-animation: tsf-spin 1.5s linear infinite;
597
+ animation: tsf-spin 1.5s linear infinite;
598
+ }
599
+
600
+ .tsf-ajax.tsf-error:before {
601
+ content: "\f158";
602
+ color: #dd3811;
603
+ }
604
+
605
+ .tsf-ajax.tsf-success:before {
606
+ content: "\f147";
607
+ color: #0cc34b;
608
+ }
609
+
610
+ @-webkit-keyframes tsf-spin {
611
+ 0% {
612
+ -webkit-transform: rotate( 0deg );
613
+ }
614
+ 100% {
615
+ -webkit-transform: rotate( 360deg );
616
+ }
617
+ }
618
+
619
+ @keyframes tsf-spin {
620
+ 0% {
621
+ transform: rotate( 0deg );
622
+ }
623
+ 100% {
624
+ transform: rotate( 360deg );
625
+ }
626
+ }
627
+
628
  @media screen and (max-width: 782px) {
629
+ .tsf-metaboxes p.tsf-fields,
630
+ .tsf-inpost-box p.tsf-fields {
631
  line-height: 2.8
632
  }
633
 
634
+ .tsf-metaboxes #tsf-title-location label span,
635
+ .tsf-metaboxes #tsf-home-title-location label span {
636
  min-width: 40px;
637
  }
638
  }
639
 
640
  @media screen and (max-width: 642px) {
641
+ .tsf-metaboxes span.tsf-nav-desktop {
642
  display: none;
643
  }
644
  }
645
 
 
 
 
 
 
 
 
 
 
 
 
646
  @media screen and (max-width: 510px) {
647
+ span.tsf-seo-bar.tsf-100 {
648
  width: inherit;
649
  }
650
  }
651
 
652
  /* Firefix */
653
  @-moz-document url-prefix() {
654
+ .tsf-metaboxes #tsf-title-separator label,
655
+ .tsf-metaboxes #tsf-description-separator label {
656
+ margin: 3px 1px;
657
+ }
658
+
659
+ @media only screen and ( min-width: 768px ) {
660
+ /**
661
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=587438
662
+ * Only fix when title is second element and there are more than 6 elemnents in the table.
663
+ */
664
+ .widefat tr th.column-title:nth-child(2):nth-last-child(n+6),
665
+ .widefat tr td.column-title:nth-child(2):nth-last-child(n+6),
666
+ .widefat tr th.title:nth-child(2):nth-last-child(n+6),
667
+ .widefat tr td.title:nth-child(2):nth-last-child(n+6) {
668
+ min-width: 1em;
669
+ width: 25%;
670
+ max-width: 100%;
671
+ white-space: unset;
672
+ }
673
+ }
674
+
675
+ .tsf-metaboxes .tsf-default-selected {
676
  box-shadow: 0 0 2px 0 #1c9d38;
677
  }
678
 
679
+ .tsf-metaboxes .tsf-warning-selected {
680
  box-shadow: 0 0 2px 0 #dd3811;
681
  }
682
 
683
+ .tsf-metaboxes legend h4 {
684
  margin: 2px 0;
685
  }
686
  }
lib/css/autodescription-rtl.min.css CHANGED
@@ -1 +1 @@
1
- .autodescription-metaboxes .top-buttons,.autodescription-metaboxes .top-wrap>h1,.autodescription-metaboxes .top-wrap>h2{float:left}.seo-notice{position:relative;clear:both}a.autodescription-dismiss{position:absolute;top:0;left:1px;border:none;margin:0;padding:9px;background:0 0;color:#b4b9be;cursor:pointer;text-decoration:none}a.autodescription-dismiss:before{background:0 0;content:"\f153";display:block;font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a.autodescription-dismiss:hover{color:#c00}table.wp-list-table .column-name{width:15%}table.wp-list-table .column-is_in_stock,table.wp-list-table .column-price,table.wp-list-table .column-sku{width:8%}.ad-seo a{text-decoration:none;font-size:13px}#autodescription-title-wrap{position:relative;display:block;padding:0;height:auto;width:auto}#autodescription-title-offset{visibility:hidden;height:0;display:inline-block;position:absolute;right:0;color:transparent;white-space:pre}#autodescription-title-placeholder{position:absolute;color:#777;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box;top:0;left:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.theseoframework-counter{font-weight:600;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}span.ad-count-bad{color:#dd3811}span.ad-count-okay{color:#ffa700}span.ad-count-good{color:#0cc34b}span.tsf-counter-one{color:#fff;border-radius:58px;padding:0 1px;min-width:29px;display:inline-block;text-align:center;vertical-align:baseline}span.tsf-counter-one.ad-count-bad{background-color:#dd3811}span.tsf-counter-one.ad-count-okay{background-color:#ffa700}span.tsf-counter-one.ad-count-good{background-color:#0cc34b}#ad_seo{width:18%}th:last-of-type#ad_seo{width:160px}span.ad-seo{display:block;width:95%;max-width:220px;border-radius:0;padding:3px;text-shadow:0 0 3px rgba(0,0,0,.3)}.ad-100,.ad-bar-wrap a,span.ad-seo.ad-100{width:100%}span.ad-bar-wrap{display:table;width:100%;border-radius:0;margin:0 auto;border-collapse:separate;border-spacing:0;vertical-align:middle;position:relative}span.ad-sec-wrap{display:table-cell;border-collapse:collapse}.ad-bar-wrap a{display:table;color:#fff;text-align:center;cursor:help;height:100%;min-width:12px;vertical-align:top;line-height:1.625em;box-shadow:2px 0 0 -1px rgba(0,0,0,.1) inset,-2px 0 0 -1px rgba(0,0,0,.1) inset}span.ad-seo.pill,span.ad-seo.pill span.ad-bar-wrap{border-radius:30px}span.ad-seo.pill span.ad-bar-wrap a{box-shadow:2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6)}.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type,.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type a{border-top-left-radius:30px;border-bottom-left-radius:30px}.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type,.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type a{border-top-right-radius:30px;border-bottom-right-radius:30px}.ad-60{width:60%}.ad-50{width:50%}.ad-40{width:40%}.ad-33{width:33.333%}.ad-25{width:25%}.ad-20{width:20%}.ad-16{width:16.666%}.ad-12-5{width:12.5%}.ad-11{width:11.333%}.ad-10{width:10%}.ad-seo-bad{background-color:#dd3811}.ad-seo-okay{background-color:#ffa700}.ad-seo-good{background-color:#0cc34b}.ad-seo-unknown{background-color:#007bd2}span.ad-seo .explanation-desc{position:absolute;width:auto;min-width:90%;max-width:220px;font-weight:600;background:#007bd2;padding:8px 12px;color:#fdfdfd;border-radius:0;z-index:900142;box-shadow:0 0 2px rgba(0,0,0,.6);left:0;right:0;text-align:left}span.ad-seo .explanation-desc span{text-decoration:underline}span.ad-seo .explanation-desc div{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #007bd2;position:absolute;bottom:-8px;z-index:9999999;left:0}.ad_seo.column-ad_seo{overflow:initial!important;min-width:160px}#col-container,#col-right{overflow:initial}.autodescription-metaboxes{box-sizing:border-box;max-width:690px;padding-bottom:20px}.autodescription-metaboxes .top-wrap{width:100%;display:inline-block;vertical-align:top}.autodescription-metaboxes .metabox-holder{clear:both}.autodescription-metaboxes .bottom-buttons{text-align:left}.autodescription-metaboxes .bottom-buttons input,.autodescription-metaboxes .top-buttons input{margin-left:10px}.autodescription-metaboxes #description-separator,.autodescription-metaboxes #title-separator{display:table;width:100%;border-collapse:collapse;border-spacing:0}.autodescription-metaboxes #description-separator input,.autodescription-metaboxes #title-separator input{display:none;float:left;width:0;min-width:0;opacity:0}.autodescription-metaboxes #description-separator label,.autodescription-metaboxes #title-separator label{display:inline-block;width:auto;min-width:28px;min-height:28px;margin:3px;-moz-margin-end:1.5px;-moz-margin-start:1.5px;padding:0 4px;border:1px solid #ccc;line-height:28px;text-align:center;cursor:pointer;box-shadow:-1px -1px 1px #aaa inset;font-size:16px}.autodescription-metaboxes #description-separator label.recommended,.autodescription-metaboxes #title-separator label.recommended{border:1px solid #0cc34b;box-shadow:-1px -1px 1px #0cc34b inset}.autodescription-metaboxes #description-separator input:hover+label,.autodescription-metaboxes #description-separator label:hover,.autodescription-metaboxes #title-separator input:hover+label,.autodescription-metaboxes #title-separator label:hover{box-shadow:1px 1px 1px #aaa inset;background-color:#fff}.autodescription-metaboxes #description-separator input:checked+label,.autodescription-metaboxes #title-separator input:checked+label{box-shadow:1px 1px 1px #333 inset;background-color:#fff}.autodescription-metaboxes #home-title-location,.autodescription-metaboxes #title-location{display:block}.autodescription-metaboxes #home-title-location label span,.autodescription-metaboxes #title-location label span,.autodescription-metaboxes #twitter-cards label span{display:inline-block;min-width:60px;vertical-align:baseline}.autodescription-metaboxes #twitter-cards label span{min-width:150px}.autodescription-metaboxes #home-title-location label .autodescription-sep-js,.autodescription-metaboxes #home-title-location label span.custom-blogname-js,.autodescription-metaboxes #home-title-location label span.custom-tagline-js,.autodescription-metaboxes #home-title-location label span.custom-title-js,.autodescription-metaboxes #title-location label .autodescription-sep-js{display:inline;min-width:0;white-space:pre}.autodescription-metaboxes .seoframework-nav-tab-wrapper,.autodescription-metaboxes .seoframework-tab-no-js{position:relative;clear:both;width:100%;display:inline-block;border-bottom:1px solid #ccc;line-height:inherit;padding:8px 12px 0;margin:-4px -12px}.autodescription-metaboxes .seoframework-nav-tab{float:right;border:1px solid #ccc;margin-right:.5em;margin-bottom:-1px;padding:5px 14px;font-size:12px;line-height:16px;background:#f1f1f1;color:#555;font-weight:600}.autodescription-metaboxes .seoframework-dashicons-tabs{font-size:initial;display:inline;vertical-align:text-bottom}.autodescription-metaboxes .seoframework-tabs-radio{display:none;width:0;height:0;position:absolute;left:-9001px}.autodescription-metaboxes .seoframework-active-tab,.autodescription-metaboxes .seoframework-tabs-radio:checked+label{background-color:inherit;border-bottom-color:#fff;color:#000}.autodescription-metaboxes .seoframework-tabs-content{margin:1.33em auto 0}.autodescription-metaboxes .seoframework-content-no-js{margin:1.33em auto}body.js .autodescription-metaboxes .seoframework-tabs-content{display:none}body.js .autodescription-metaboxes .seoframework-tabs-content.seoframework-active-tab-content{display:block}.autodescription-metaboxes .seoframework-default-selected{border-color:#1c9d38}.autodescription-metaboxes .seoframework-default-selected:checked:before{color:#1c9d38}.autodescription-metaboxes .seoframework-warning-selected{border-color:#dd3811}.autodescription-metaboxes .seoframework-warning-selected:checked:before{color:#dd3811}.theseoframework-fields{font-size:13px;line-height:1.5;margin:1em 0}.theseoframework-fields .toblock{display:block;width:100%;margin-bottom:4px}.theseoframework-fields p.description{margin:7px 0 5px;color:#666}.theseoframework-option-spacer{margin:1em 0}@media screen and (max-width:782px){.autodescription-metaboxes p.theseoframework-fields,.theseoframework-inpost-box p.theseoframework-fields{line-height:2.8}.autodescription-metaboxes #home-title-location label span,.autodescription-metaboxes #title-location label span{min-width:40px}}@media screen and (max-width:642px){.autodescription-metaboxes span.seoframework-nav-desktop{display:none}}@media screen and (max-width:600px){.autodescription-metaboxes h3.nav-tab-wrapper{border-bottom:1px solid #ccc}.autodescription-metaboxes h3 .nav-tab{margin-right:7px;margin-bottom:-1px}}@media screen and (max-width:510px){span.ad-seo.ad-100{width:inherit}}@-moz-document url-prefix(){.autodescription-metaboxes .seoframework-default-selected{box-shadow:0 0 2px 0 #1c9d38}.autodescription-metaboxes .seoframework-warning-selected{box-shadow:0 0 2px 0 #dd3811}.autodescription-metaboxes legend h4{margin:2px 0}}
1
+ .tsf-metaboxes .tsf-top-buttons,.tsf-metaboxes .tsf-top-wrap>h1,.tsf-metaboxes .tsf-top-wrap>h2{float:left}.tsf-notice{position:relative;clear:both}.tsf-notice.tsf-show-icon p:before{content:'';margin-left:12px;background:0 0;display:inline-block;font:400 14px/16px dashicons;speak:none;height:16px;text-align:center;vertical-align:middle;width:16px;line-height:14px;-webkit-font-smoothing:antialiased}.error.tsf-notice.tsf-show-icon p:before{color:#dd3811;content:"\f534"}.notice-warning.tsf-notice.tsf-show-icon p:before{color:#ffa01b;content:"\f227"}.updated.tsf-notice.tsf-show-icon p:before{color:#0cc34b;font-size:16px;content:"\f147"}a.tsf-dismiss{position:absolute;top:0;left:1px;border:none;margin:0;padding:9px;background:0 0;color:#b4b9be;cursor:pointer;text-decoration:none}a.tsf-dismiss:before{background:0 0;content:"\f153";display:block;font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a.tsf-dismiss:hover{color:#c00}table.wp-list-table .column-name{width:15%}table.wp-list-table .column-icl_translations,table.wp-list-table .column-is_in_stock,table.wp-list-table .column-price,table.wp-list-table .column-sku{width:8%}.tsf-seo-bar a{text-decoration:none;font-size:13px}#tsf-title-wrap{position:relative;display:block;padding:0;height:auto;width:auto}#tsf-title-offset{visibility:hidden;height:0;display:inline-block;position:absolute;right:0;color:transparent;white-space:pre}#tsf-title-placeholder{position:absolute;color:#777;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box;top:0;left:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tsf-counter{font-weight:600;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}span.tsf-count-bad{color:#dd3811}span.tsf-count-okay{color:#ffa700}span.tsf-count-good{color:#0cc34b}span.tsf-counter-one{color:#fff;border-radius:58px;padding:0 1px;min-width:29px;display:inline-block;text-align:center;vertical-align:baseline}span.tsf-counter-one.tsf-count-bad{background-color:#dd3811}span.tsf-counter-one.tsf-count-okay{background-color:#ffa700}span.tsf-counter-one.tsf-count-good{background-color:#0cc34b}#tsf-seo-bar-wrap{width:18%}th:last-of-type#tsf-seo-bar-wrap{width:160px}span.tsf-seo-bar{display:block;width:95%;max-width:220px;border-radius:0;padding:3px;text-shadow:0 0 3px rgba(0,0,0,.3)}span.tsf-seo-bar.tsf-100{width:100%}span.tsf-seo-bar-inner-wrap{display:table;width:100%;border-radius:0;margin:0 auto;border-collapse:separate;border-spacing:0;vertical-align:middle;position:relative}span.tsf-seo-bar-section-wrap{display:table-cell;border-collapse:collapse}.tsf-seo-bar-inner-wrap a{display:table;width:100%;color:#fff;text-align:center;cursor:help;height:100%;min-width:12px;vertical-align:top;line-height:1.625em;box-shadow:2px 0 0 -1px rgba(0,0,0,.1) inset,-2px 0 0 -1px rgba(0,0,0,.1) inset}span.tsf-seo-bar.pill,span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap{border-radius:30px}span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap a{box-shadow:2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6)}.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type,.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type a{border-top-left-radius:30px;border-bottom-left-radius:30px}.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type,.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type a{border-top-right-radius:30px;border-bottom-right-radius:30px}.tsf-100{width:100%}.tsf-60{width:60%}.tsf-50{width:50%}.tsf-40{width:40%}.tsf-33{width:33.333%}.tsf-25{width:25%}.tsf-20{width:20%}.tsf-16{width:16.666%}.tsf-12-5{width:12.5%}.ad-11{width:11.333%}.tsf-10{width:10%}.tsf-seo-bar-bad{background-color:#dd3811}.tsf-seo-bar-okay{background-color:#ffa700}.tsf-seo-bar-good{background-color:#0cc34b}.tsf-seo-bar-unknown{background-color:#007bd2}span.tsf-seo-bar .tsf-explanation-desc{position:absolute;width:auto;min-width:90%;max-width:220px;font-weight:600;background:#007bd2;padding:8px 12px;color:#fdfdfd;border-radius:0;z-index:900142;box-shadow:0 0 2px rgba(0,0,0,.6);left:0;right:0;text-align:left}span.tsf-seo-bar .tsf-explanation-desc span{text-decoration:underline}span.tsf-seo-bar .tsf-explanation-desc div{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #007bd2;position:absolute;bottom:-8px;z-index:9999999;left:0}.tsf-seo-bar-wrap.column-tsf-seo-bar-temp{overflow:initial!important;min-width:160px}#col-container,#col-right{overflow:initial}.tsf-metaboxes{box-sizing:border-box;max-width:690px;padding-bottom:20px}.tsf-metaboxes .tsf-top-wrap{width:100%;display:inline-block;vertical-align:top}.tsf-metaboxes .metabox-holder{clear:both}.tsf-metaboxes .tsf-bottom-buttons{text-align:left}.tsf-metaboxes .tsf-bottom-buttons input,.tsf-metaboxes .tsf-top-buttons input{margin-left:10px}.tsf-metaboxes #tsf-description-separator,.tsf-metaboxes #tsf-title-separator{display:table;width:100%;border-collapse:collapse;border-spacing:0}.tsf-metaboxes #tsf-description-separator input,.tsf-metaboxes #tsf-title-separator input{display:none;float:left;width:0;min-width:0;opacity:0}.tsf-metaboxes #tsf-description-separator label,.tsf-metaboxes #tsf-title-separator label{display:inline-block;width:auto;min-width:28px;min-height:28px;margin:3px;-moz-margin-end:1.5px;-moz-margin-start:1.5px;padding:0 4px;border:1px solid #ccc;line-height:28px;text-align:center;cursor:pointer;box-shadow:-1px -1px 1px #aaa inset;font-size:16px}.tsf-metaboxes #tsf-description-separator label.tsf-recommended,.tsf-metaboxes #tsf-title-separator label.tsf-recommended{border:1px solid #0cc34b;box-shadow:-1px -1px 1px #0cc34b inset}.tsf-metaboxes #tsf-description-separator input:hover+label,.tsf-metaboxes #tsf-description-separator label:hover,.tsf-metaboxes #tsf-title-separator input:hover+label,.tsf-metaboxes #tsf-title-separator label:hover{box-shadow:1px 1px 1px #aaa inset;background-color:#fff}.tsf-metaboxes #tsf-description-separator input:checked+label,.tsf-metaboxes #tsf-title-separator input:checked+label{box-shadow:1px 1px 1px #333 inset;background-color:#fff}.tsf-metaboxes #tsf-home-title-location,.tsf-metaboxes #tsf-title-location{display:block}.tsf-metaboxes #tsf-home-title-location label span,.tsf-metaboxes #tsf-title-location label span,.tsf-metaboxes #tsf-twitter-cards label span{display:inline-block;min-width:60px;vertical-align:baseline}.tsf-metaboxes #tsf-twitter-cards label span{min-width:150px}.tsf-metaboxes #tsf-home-title-location label .autodescription-sep-js,.tsf-metaboxes #tsf-home-title-location label span.custom-title-js,.tsf-metaboxes #tsf-home-title-location label span.tsf-custom-blogname-js,.tsf-metaboxes #tsf-home-title-location label span.tsf-custom-tagline-js,.tsf-metaboxes #tsf-title-location label .autodescription-sep-js{display:inline;min-width:0;white-space:pre}.tsf-metaboxes .tsf-nav-tab-wrapper,.tsf-metaboxes .tsf-tab-no-js{position:relative;clear:both;width:100%;display:inline-block;border-bottom:1px solid #ccc;line-height:inherit;padding:8px 12px 0;margin:-4px -12px}.tsf-metaboxes .tsf-nav-tab{float:right;border:1px solid #ccc;margin-right:.5em;margin-bottom:-1px;padding:5px 14px;font-size:12px;line-height:16px;background:#f1f1f1;color:#555;font-weight:600}.tsf-metaboxes .tsf-dashicons-tabs{font-size:initial;display:inline;vertical-align:text-bottom}.tsf-metaboxes .tsf-tabs-radio{display:none;width:0;height:0;position:absolute;left:-9001px}.tsf-metaboxes .tsf-active-tab,.tsf-metaboxes .tsf-tabs-radio:checked+label{background-color:inherit;border-bottom-color:#fff;color:#000}.tsf-metaboxes .tsf-tabs-content{margin:1.33em auto 0}.tsf-metaboxes .seoframework-content-no-js{margin:1.33em auto}body.js .tsf-metaboxes .tsf-tabs-content{display:none}body.js .tsf-metaboxes .tsf-tabs-content.tsf-active-tab-content{display:block}.tsf-metaboxes .tsf-default-selected{border-color:#1c9d38}.tsf-metaboxes .tsf-default-selected:checked:before{color:#1c9d38}.tsf-metaboxes .tsf-warning-selected{border-color:#dd3811}.tsf-metaboxes .tsf-warning-selected:checked:before{color:#dd3811}.tsf-fields{font-size:13px;line-height:1.5;margin:1em 0}.tsf-fields .tsf-toblock{display:block;width:100%;margin-bottom:4px}.tsf-fields p.description{margin:7px 0 5px;color:#666}.tsf-option-spacer{margin:1em 0}.tsf-counter .tsf-ajax{margin-right:3px}.tsf-ajax:before{display:inline-block;line-height:1;font-family:dashicons;font-style:normal;font-weight:400;font-size:1.225em;vertical-align:middle;content:""}.tsf-ajax.tsf-loading:before{content:"\f463";color:#007bd2;-webkit-animation:tsf-spin 1.5s linear infinite;-moz-animation:tsf-spin 1.5s linear infinite;-o-animation:tsf-spin 1.5s linear infinite;animation:tsf-spin 1.5s linear infinite}.tsf-ajax.tsf-error:before{content:"\f158";color:#dd3811}.tsf-ajax.tsf-success:before{content:"\f147";color:#0cc34b}@-webkit-keyframes tsf-spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes tsf-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@media screen and (max-width:782px){.tsf-inpost-box p.tsf-fields,.tsf-metaboxes p.tsf-fields{line-height:2.8}.tsf-metaboxes #tsf-home-title-location label span,.tsf-metaboxes #tsf-title-location label span{min-width:40px}}@media screen and (max-width:642px){.tsf-metaboxes span.tsf-nav-desktop{display:none}}@media screen and (max-width:510px){span.tsf-seo-bar.tsf-100{width:inherit}}@-moz-document url-prefix(){.tsf-metaboxes #tsf-description-separator label,.tsf-metaboxes #tsf-title-separator label{margin:3px 1px}@media only screen and (min-width:768px){.widefat tr td.column-title:nth-child(2):nth-last-child(n+6),.widefat tr td.title:nth-child(2):nth-last-child(n+6),.widefat tr th.column-title:nth-child(2):nth-last-child(n+6),.widefat tr th.title:nth-child(2):nth-last-child(n+6){min-width:1em;width:25%;max-width:100%;white-space:unset}}.tsf-metaboxes .tsf-default-selected{box-shadow:0 0 2px 0 #1c9d38}.tsf-metaboxes .tsf-warning-selected{box-shadow:0 0 2px 0 #dd3811}.tsf-metaboxes legend h4{margin:2px 0}}
lib/css/autodescription.css CHANGED
@@ -6,11 +6,42 @@
6
  /**
7
  * Dismissible Notices.
8
  */
9
- .seo-notice {
10
  position: relative;
11
  }
12
 
13
- a.autodescription-dismiss {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  position: absolute;
15
  top: 0;
16
  right: 1px;
@@ -23,7 +54,7 @@ a.autodescription-dismiss {
23
  text-decoration: none;
24
  }
25
 
26
- a.autodescription-dismiss:before {
27
  background: 0 0;
28
  content: "\f153";
29
  display: block;
@@ -36,29 +67,33 @@ a.autodescription-dismiss:before {
36
  -moz-osx-font-smoothing: grayscale;
37
  }
38
 
39
- a.autodescription-dismiss:hover {
40
  color: #c00;
41
  }
42
 
43
  /**
44
- * WooCommerce fix
45
  */
46
  table.wp-list-table .column-name {
47
  width: 15%;
48
  }
49
 
 
 
 
50
  table.wp-list-table .column-is_in_stock,
51
  table.wp-list-table .column-sku,
52
- table.wp-list-table .column-price {
 
53
  width: 8%;
54
  }
55
 
56
- .ad-seo a {
57
  text-decoration: none;
58
  font-size: 13px;
59
  }
60
 
61
- #autodescription-title-wrap {
62
  position: relative;
63
  display: block;
64
  padding: 0;
@@ -66,7 +101,7 @@ table.wp-list-table .column-price {
66
  width: auto;
67
  }
68
 
69
- #autodescription-title-offset {
70
  visibility: hidden;
71
  height: 0;
72
  display: inline-block;
@@ -76,7 +111,7 @@ table.wp-list-table .column-price {
76
  white-space: pre;
77
  }
78
 
79
- #autodescription-title-placeholder {
80
  position: absolute;
81
  color: #777;
82
  -webkit-user-select: none;
@@ -93,7 +128,7 @@ table.wp-list-table .column-price {
93
 
94
  /* START Character Counters */
95
 
96
- .theseoframework-counter {
97
  font-weight: 600;
98
  cursor: pointer;
99
  -webkit-user-select: none;
@@ -102,15 +137,15 @@ table.wp-list-table .column-price {
102
  user-select: none;
103
  }
104
 
105
- span.ad-count-bad {
106
  color: #dd3811;
107
  }
108
 
109
- span.ad-count-okay {
110
  color: #ffa700;
111
  }
112
 
113
- span.ad-count-good {
114
  color: #0cc34b;
115
  }
116
 
@@ -124,28 +159,28 @@ span.tsf-counter-one {
124
  text-align: center;
125
  vertical-align: baseline;
126
  }
127
- span.tsf-counter-one.ad-count-bad {
128
  background-color: #dd3811;
129
  }
130
- span.tsf-counter-one.ad-count-okay {
131
  background-color: #ffa700;
132
  }
133
- span.tsf-counter-one.ad-count-good {
134
  background-color: #0cc34b;
135
  }
136
 
137
  /* END Character Counters */
138
 
139
- #ad_seo {
140
  width: 18%;
141
  }
142
 
143
  /* WooCommerce fix */
144
- th:last-of-type#ad_seo {
145
  width: 160px;
146
  }
147
 
148
- span.ad-seo {
149
  display: block;
150
  width: 95%;
151
  max-width: 220px;
@@ -154,11 +189,11 @@ span.ad-seo {
154
  text-shadow: 0 0 3px rgba(0,0,0,0.3);
155
  }
156
 
157
- span.ad-seo.ad-100 {
158
  width: 100%;
159
  }
160
 
161
- span.ad-bar-wrap {
162
  display: table;
163
  width: 100%;
164
  border-radius: 0;
@@ -169,12 +204,12 @@ span.ad-bar-wrap {
169
  position: relative;
170
  }
171
 
172
- span.ad-sec-wrap {
173
  display: table-cell;
174
  border-collapse: collapse;
175
  }
176
 
177
- .ad-bar-wrap a {
178
  display: table;
179
  width: 100%;
180
  color: #fff;
@@ -187,60 +222,60 @@ span.ad-sec-wrap {
187
  box-shadow: 2px 0px 0px -1px rgba(0,0,0,0.1) inset, -2px 0px 0px -1px rgba(0,0,0,0.1) inset;
188
  }
189
 
190
- span.ad-seo.pill,
191
- span.ad-seo.pill span.ad-bar-wrap {
192
  border-radius: 30px;
193
  }
194
 
195
- span.ad-seo.pill span.ad-bar-wrap a {
196
  box-shadow: 2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6);
197
  }
198
 
199
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type,
200
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type a {
201
  border-top-left-radius: 30px;
202
  border-bottom-left-radius: 30px;
203
  }
204
 
205
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type,
206
- .ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type a {
207
  border-top-right-radius: 30px;
208
  border-bottom-right-radius: 30px;
209
  }
210
 
211
- .ad-100 {
212
  width: 100%;
213
  }
214
 
215
- .ad-60 {
216
  width: 60%;
217
  }
218
 
219
- .ad-50 {
220
  width: 50%;
221
  }
222
 
223
- .ad-40 {
224
  width: 40%;
225
  }
226
 
227
- .ad-33 {
228
  width: 33.333%;
229
  }
230
 
231
- .ad-25 {
232
  width: 25%;
233
  }
234
 
235
- .ad-20 {
236
  width: 20%;
237
  }
238
 
239
- .ad-16 {
240
  width: 16.666%;
241
  }
242
 
243
- .ad-12-5 {
244
  width: 12.5%;
245
  }
246
 
@@ -248,27 +283,27 @@ span.ad-seo.pill span.ad-bar-wrap a {
248
  width: 11.333%;
249
  }
250
 
251
- .ad-10 {
252
  width: 10%;
253
  }
254
 
255
- .ad-seo-bad {
256
  background-color: #dd3811;
257
  }
258
 
259
- .ad-seo-okay {
260
  background-color: #ffa700;
261
  }
262
 
263
- .ad-seo-good {
264
  background-color: #0cc34b;
265
  }
266
 
267
- .ad-seo-unknown {
268
  background-color: #007bd2;
269
  }
270
 
271
- span.ad-seo .explanation-desc {
272
  position: absolute;
273
  width: auto;
274
  min-width: 90%;
@@ -285,11 +320,11 @@ span.ad-seo .explanation-desc {
285
  text-align: left;
286
  }
287
 
288
- span.ad-seo .explanation-desc span {
289
  text-decoration: underline;
290
  }
291
 
292
- span.ad-seo .explanation-desc div {
293
  width: 0;
294
  height: 0;
295
  border-left: 12px solid transparent;
@@ -303,7 +338,7 @@ span.ad-seo .explanation-desc div {
303
 
304
  /* Mobile support */
305
  /* Needs more refining.... e.g. iPhone 6 = good, iPhone 6+ = offscreen */
306
- .ad_seo.column-ad_seo {
307
  overflow: initial !important;
308
  min-width: 160px;
309
  }
@@ -316,54 +351,54 @@ span.ad-seo .explanation-desc div {
316
 
317
  /* Site Settings */
318
 
319
- .autodescription-metaboxes {
320
  box-sizing: border-box;
321
  max-width: 690px;
322
  padding-bottom: 20px;
323
  }
324
 
325
- .autodescription-metaboxes .top-wrap {
326
  width: 100%;
327
  display: inline-block;
328
  vertical-align: top;
329
  }
330
 
331
- .autodescription-metaboxes .top-wrap > h1,
332
- .autodescription-metaboxes .top-wrap > h2 {
333
  float: left;
334
  }
335
 
336
- .autodescription-metaboxes .metabox-holder {
337
  clear: both;
338
  }
339
 
340
- .autodescription-metaboxes .top-buttons {
341
  float: right;
342
  }
343
 
344
- .autodescription-metaboxes .bottom-buttons {
345
  text-align: right;
346
  }
347
 
348
- .autodescription-metaboxes .top-buttons input,
349
- .autodescription-metaboxes .bottom-buttons input {
350
  margin-left: 10px;
351
  }
352
 
353
- .seo-notice {
354
  clear: both;
355
  }
356
 
357
- .autodescription-metaboxes #title-separator,
358
- .autodescription-metaboxes #description-separator {
359
  display: table;
360
  width: 100%;
361
  border-collapse: collapse;
362
  border-spacing: 0;
363
  }
364
 
365
- .autodescription-metaboxes #title-separator input,
366
- .autodescription-metaboxes #description-separator input {
367
  display: none;
368
  float: left;
369
  width: 0;
@@ -371,8 +406,8 @@ span.ad-seo .explanation-desc div {
371
  opacity: 0;
372
  }
373
 
374
- .autodescription-metaboxes #title-separator label,
375
- .autodescription-metaboxes #description-separator label {
376
  display: inline-block;
377
  width: auto;
378
  min-width: 28px;
@@ -389,48 +424,48 @@ span.ad-seo .explanation-desc div {
389
  font-size: 16px;
390
  }
391
 
392
- .autodescription-metaboxes #title-separator label.recommended,
393
- .autodescription-metaboxes #description-separator label.recommended {
394
  border: 1px solid #0cc34b;
395
  box-shadow: -1px -1px 1px #0cc34b inset;
396
  }
397
 
398
- .autodescription-metaboxes #title-separator input:hover + label,
399
- .autodescription-metaboxes #title-separator label:hover,
400
- .autodescription-metaboxes #description-separator input:hover + label,
401
- .autodescription-metaboxes #description-separator label:hover {
402
  box-shadow: 1px 1px 1px #aaa inset;
403
  background-color: #fff;
404
  }
405
 
406
- .autodescription-metaboxes #title-separator input:checked + label,
407
- .autodescription-metaboxes #description-separator input:checked + label {
408
  box-shadow: 1px 1px 1px #333 inset;
409
  background-color: #fff;
410
  }
411
 
412
- .autodescription-metaboxes #title-location,
413
- .autodescription-metaboxes #home-title-location {
414
  display: block;
415
  }
416
 
417
- .autodescription-metaboxes #title-location label span,
418
- .autodescription-metaboxes #home-title-location label span,
419
- .autodescription-metaboxes #twitter-cards label span {
420
  display: inline-block;
421
  min-width: 60px;
422
  vertical-align: baseline;
423
  }
424
 
425
- .autodescription-metaboxes #twitter-cards label span {
426
  min-width: 150px;
427
  }
428
 
429
- .autodescription-metaboxes #home-title-location label span.custom-title-js,
430
- .autodescription-metaboxes #home-title-location label span.custom-blogname-js,
431
- .autodescription-metaboxes #home-title-location label span.custom-tagline-js,
432
- .autodescription-metaboxes #title-location label .autodescription-sep-js,
433
- .autodescription-metaboxes #home-title-location label .autodescription-sep-js {
434
  display: inline;
435
  min-width: 0;
436
  white-space: pre;
@@ -439,8 +474,8 @@ span.ad-seo .explanation-desc div {
439
  /**
440
  * Start Tabs.
441
  */
442
- .autodescription-metaboxes .seoframework-tab-no-js,
443
- .autodescription-metaboxes .seoframework-nav-tab-wrapper {
444
  position: relative;
445
  clear: both;
446
  width: 100%;
@@ -451,7 +486,7 @@ span.ad-seo .explanation-desc div {
451
  margin: -4px -12px;
452
  }
453
 
454
- .autodescription-metaboxes .seoframework-nav-tab {
455
  float: left;
456
  border: 1px solid #ccc;
457
  margin-left: .5em;
@@ -464,13 +499,13 @@ span.ad-seo .explanation-desc div {
464
  font-weight: 600;
465
  }
466
 
467
- .autodescription-metaboxes .seoframework-dashicons-tabs {
468
  font-size: initial;
469
  display: inline;
470
  vertical-align: text-bottom;
471
  }
472
 
473
- .autodescription-metaboxes .seoframework-tabs-radio {
474
  display: none;
475
  width: 0;
476
  height: 0;
@@ -478,26 +513,26 @@ span.ad-seo .explanation-desc div {
478
  left: -9001px;
479
  }
480
 
481
- .autodescription-metaboxes .seoframework-tabs-radio:checked + label,
482
- .autodescription-metaboxes .seoframework-active-tab {
483
  background-color: inherit;
484
  border-bottom-color: #fff;
485
  color: #000;
486
  }
487
 
488
- .autodescription-metaboxes .seoframework-tabs-content {
489
  margin: 1.33em auto 0;
490
  }
491
 
492
- .autodescription-metaboxes .seoframework-content-no-js {
493
  margin: 1.33em auto;
494
  }
495
 
496
- body.js .autodescription-metaboxes .seoframework-tabs-content {
497
  display: none;
498
  }
499
 
500
- body.js .autodescription-metaboxes .seoframework-tabs-content.seoframework-active-tab-content {
501
  display: block;
502
  }
503
 
@@ -505,89 +540,151 @@ body.js .autodescription-metaboxes .seoframework-tabs-content.seoframework-activ
505
  * End tabs.
506
  */
507
 
508
- .autodescription-metaboxes .seoframework-default-selected {
509
  border-color: #1c9d38;
510
  }
511
 
512
- .autodescription-metaboxes .seoframework-default-selected:checked:before {
513
  color: #1c9d38;
514
  }
515
 
516
- .autodescription-metaboxes .seoframework-warning-selected {
517
  border-color: #dd3811;
518
  }
519
 
520
- .autodescription-metaboxes .seoframework-warning-selected:checked:before {
521
  color: #dd3811;
522
  }
523
 
524
- .theseoframework-fields {
525
  font-size: 13px;
526
  line-height: 1.5;
527
  margin: 1em 0;
528
  }
529
 
530
- .theseoframework-fields .toblock {
531
  display: block;
532
  width: 100%;
533
  margin-bottom: 4px;
534
  }
535
 
536
- .theseoframework-fields p.description {
537
  margin: 7px 0 5px;
538
  color: #666;
539
  }
540
 
541
- .theseoframework-option-spacer {
542
  margin: 1em 0;
543
  }
544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  @media screen and (max-width: 782px) {
546
- .autodescription-metaboxes p.theseoframework-fields,
547
- .theseoframework-inpost-box p.theseoframework-fields {
548
  line-height: 2.8;
549
  }
550
 
551
- .autodescription-metaboxes #title-location label span,
552
- .autodescription-metaboxes #home-title-location label span {
553
  min-width: 40px;
554
  }
555
  }
556
 
557
  @media screen and (max-width: 642px) {
558
- .autodescription-metaboxes span.seoframework-nav-desktop {
559
  display: none;
560
  }
561
  }
562
 
563
- @media screen and (max-width: 600px) {
564
- .autodescription-metaboxes h3.nav-tab-wrapper {
565
- border-bottom: 1px solid #ccc;
566
- }
567
-
568
- .autodescription-metaboxes h3 .nav-tab {
569
- margin-right: 7px;
570
- margin-bottom: -1px;
571
- }
572
- }
573
-
574
  @media screen and (max-width: 510px) {
575
- span.ad-seo.ad-100 {
576
  width: inherit;
577
  }
578
  }
579
 
580
  /* Firefix */
581
  @-moz-document url-prefix() {
582
- .autodescription-metaboxes .seoframework-default-selected {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  box-shadow: 0 0 2px 0 #1c9d38;
584
  }
585
 
586
- .autodescription-metaboxes .seoframework-warning-selected {
587
  box-shadow: 0 0 2px 0 #dd3811;
588
  }
589
 
590
- .autodescription-metaboxes legend h4 {
591
  margin: 2px 0;
592
  }
593
  }
6
  /**
7
  * Dismissible Notices.
8
  */
9
+ .tsf-notice {
10
  position: relative;
11
  }
12
 
13
+ .tsf-notice.tsf-show-icon p:before {
14
+ content: '';
15
+ margin-right: 12px;
16
+ background: 0 0;
17
+ display: inline-block;
18
+ font: 400 14px/16px dashicons;
19
+ speak: none;
20
+ height: 16px;
21
+ text-align: center;
22
+ vertical-align: middle;
23
+ width: 16px;
24
+ line-height: 14px;
25
+ -webkit-font-smoothing: antialiased;
26
+ }
27
+
28
+ .error.tsf-notice.tsf-show-icon p:before {
29
+ color: #dd3811;
30
+ content: "\f534";
31
+ }
32
+
33
+ .notice-warning.tsf-notice.tsf-show-icon p:before {
34
+ color: #ffa01b;
35
+ content: "\f227";
36
+ }
37
+
38
+ .updated.tsf-notice.tsf-show-icon p:before {
39
+ color: #0cc34b;
40
+ font-size: 16px;
41
+ content: "\f147";
42
+ }
43
+
44
+ a.tsf-dismiss {
45
  position: absolute;
46
  top: 0;
47
  right: 1px;
54
  text-decoration: none;
55
  }
56
 
57
+ a.tsf-dismiss:before {
58
  background: 0 0;
59
  content: "\f153";
60
  display: block;
67
  -moz-osx-font-smoothing: grayscale;
68
  }
69
 
70
+ a.tsf-dismiss:hover {
71
  color: #c00;
72
  }
73
 
74
  /**
75
+ * WooCommerce fix @TODO make this load only when admin bar is showing.
76
  */
77
  table.wp-list-table .column-name {
78
  width: 15%;
79
  }
80
 
81
+ /**
82
+ * WooCommerce fix
83
+ */
84
  table.wp-list-table .column-is_in_stock,
85
  table.wp-list-table .column-sku,
86
+ table.wp-list-table .column-price,
87
+ table.wp-list-table .column-icl_translations {
88
  width: 8%;
89
  }
90
 
91
+ .tsf-seo-bar a {
92
  text-decoration: none;
93
  font-size: 13px;
94
  }
95
 
96
+ #tsf-title-wrap {
97
  position: relative;
98
  display: block;
99
  padding: 0;
101
  width: auto;
102
  }
103
 
104
+ #tsf-title-offset {
105
  visibility: hidden;
106
  height: 0;
107
  display: inline-block;
111
  white-space: pre;
112
  }
113
 
114
+ #tsf-title-placeholder {
115
  position: absolute;
116
  color: #777;
117
  -webkit-user-select: none;
128
 
129
  /* START Character Counters */
130
 
131
+ .tsf-counter {
132
  font-weight: 600;
133
  cursor: pointer;
134
  -webkit-user-select: none;
137
  user-select: none;
138
  }
139
 
140
+ span.tsf-count-bad {
141
  color: #dd3811;
142
  }
143
 
144
+ span.tsf-count-okay {
145
  color: #ffa700;
146
  }
147
 
148
+ span.tsf-count-good {
149
  color: #0cc34b;
150
  }
151
 
159
  text-align: center;
160
  vertical-align: baseline;
161
  }
162
+ span.tsf-counter-one.tsf-count-bad {
163
  background-color: #dd3811;
164
  }
165
+ span.tsf-counter-one.tsf-count-okay {
166
  background-color: #ffa700;
167
  }
168
+ span.tsf-counter-one.tsf-count-good {
169
  background-color: #0cc34b;
170
  }
171
 
172
  /* END Character Counters */
173
 
174
+ #tsf-seo-bar-wrap {
175
  width: 18%;
176
  }
177
 
178
  /* WooCommerce fix */
179
+ th:last-of-type#tsf-seo-bar-wrap {
180
  width: 160px;
181
  }
182
 
183
+ span.tsf-seo-bar {
184
  display: block;
185
  width: 95%;
186
  max-width: 220px;
189
  text-shadow: 0 0 3px rgba(0,0,0,0.3);
190
  }
191
 
192
+ span.tsf-seo-bar.tsf-100 {
193
  width: 100%;
194
  }
195
 
196
+ span.tsf-seo-bar-inner-wrap {
197
  display: table;
198
  width: 100%;
199
  border-radius: 0;
204
  position: relative;
205
  }
206
 
207
+ span.tsf-seo-bar-section-wrap {
208
  display: table-cell;
209
  border-collapse: collapse;
210
  }
211
 
212
+ .tsf-seo-bar-inner-wrap a {
213
  display: table;
214
  width: 100%;
215
  color: #fff;
222
  box-shadow: 2px 0px 0px -1px rgba(0,0,0,0.1) inset, -2px 0px 0px -1px rgba(0,0,0,0.1) inset;
223
  }
224
 
225
+ span.tsf-seo-bar.pill,
226
+ span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap {
227
  border-radius: 30px;
228
  }
229
 
230
+ span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap a {
231
  box-shadow: 2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6);
232
  }
233
 
234
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type,
235
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type a {
236
  border-top-left-radius: 30px;
237
  border-bottom-left-radius: 30px;
238
  }
239
 
240
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type,
241
+ .tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type a {
242
  border-top-right-radius: 30px;
243
  border-bottom-right-radius: 30px;
244
  }
245
 
246
+ .tsf-100 {
247
  width: 100%;
248
  }
249
 
250
+ .tsf-60 {
251
  width: 60%;
252
  }
253
 
254
+ .tsf-50 {
255
  width: 50%;
256
  }
257
 
258
+ .tsf-40 {
259
  width: 40%;
260
  }
261
 
262
+ .tsf-33 {
263
  width: 33.333%;
264
  }
265
 
266
+ .tsf-25 {
267
  width: 25%;
268
  }
269
 
270
+ .tsf-20 {
271
  width: 20%;
272
  }
273
 
274
+ .tsf-16 {
275
  width: 16.666%;
276
  }
277
 
278
+ .tsf-12-5 {
279
  width: 12.5%;
280
  }
281
 
283
  width: 11.333%;
284
  }
285
 
286
+ .tsf-10 {
287
  width: 10%;
288
  }
289
 
290
+ .tsf-seo-bar-bad {
291
  background-color: #dd3811;
292
  }
293
 
294
+ .tsf-seo-bar-okay {
295
  background-color: #ffa700;
296
  }
297
 
298
+ .tsf-seo-bar-good {
299
  background-color: #0cc34b;
300
  }
301
 
302
+ .tsf-seo-bar-unknown {
303
  background-color: #007bd2;
304
  }
305
 
306
+ span.tsf-seo-bar .tsf-explanation-desc {
307
  position: absolute;
308
  width: auto;
309
  min-width: 90%;
320
  text-align: left;
321
  }
322
 
323
+ span.tsf-seo-bar .tsf-explanation-desc span {
324
  text-decoration: underline;
325
  }
326
 
327
+ span.tsf-seo-bar .tsf-explanation-desc div {
328
  width: 0;
329
  height: 0;
330
  border-left: 12px solid transparent;
338
 
339
  /* Mobile support */
340
  /* Needs more refining.... e.g. iPhone 6 = good, iPhone 6+ = offscreen */
341
+ .tsf-seo-bar-wrap.column-tsf-seo-bar-temp {
342
  overflow: initial !important;
343
  min-width: 160px;
344
  }
351
 
352
  /* Site Settings */
353
 
354
+ .tsf-metaboxes {
355
  box-sizing: border-box;
356
  max-width: 690px;
357
  padding-bottom: 20px;
358
  }
359
 
360
+ .tsf-metaboxes .tsf-top-wrap {
361
  width: 100%;
362
  display: inline-block;
363
  vertical-align: top;
364
  }
365
 
366
+ .tsf-metaboxes .tsf-top-wrap > h1,
367
+ .tsf-metaboxes .tsf-top-wrap > h2 {
368
  float: left;
369
  }
370
 
371
+ .tsf-metaboxes .metabox-holder {
372
  clear: both;
373
  }
374
 
375
+ .tsf-metaboxes .tsf-top-buttons {
376
  float: right;
377
  }
378
 
379
+ .tsf-metaboxes .tsf-bottom-buttons {
380
  text-align: right;
381
  }
382
 
383
+ .tsf-metaboxes .tsf-top-buttons input,
384
+ .tsf-metaboxes .tsf-bottom-buttons input {
385
  margin-left: 10px;
386
  }
387
 
388
+ .tsf-notice {
389
  clear: both;
390
  }
391
 
392
+ .tsf-metaboxes #tsf-title-separator,
393
+ .tsf-metaboxes #tsf-description-separator {
394
  display: table;
395
  width: 100%;
396
  border-collapse: collapse;
397
  border-spacing: 0;
398
  }
399
 
400
+ .tsf-metaboxes #tsf-title-separator input,
401
+ .tsf-metaboxes #tsf-description-separator input {
402
  display: none;
403
  float: left;
404
  width: 0;
406
  opacity: 0;
407
  }
408
 
409
+ .tsf-metaboxes #tsf-title-separator label,
410
+ .tsf-metaboxes #tsf-description-separator label {
411
  display: inline-block;
412
  width: auto;
413
  min-width: 28px;
424
  font-size: 16px;
425
  }
426
 
427
+ .tsf-metaboxes #tsf-title-separator label.tsf-recommended,
428
+ .tsf-metaboxes #tsf-description-separator label.tsf-recommended {
429
  border: 1px solid #0cc34b;
430
  box-shadow: -1px -1px 1px #0cc34b inset;
431
  }
432
 
433
+ .tsf-metaboxes #tsf-title-separator input:hover + label,
434
+ .tsf-metaboxes #tsf-title-separator label:hover,
435
+ .tsf-metaboxes #tsf-description-separator input:hover + label,
436
+ .tsf-metaboxes #tsf-description-separator label:hover {
437
  box-shadow: 1px 1px 1px #aaa inset;
438
  background-color: #fff;
439
  }
440
 
441
+ .tsf-metaboxes #tsf-title-separator input:checked + label,
442
+ .tsf-metaboxes #tsf-description-separator input:checked + label {
443
  box-shadow: 1px 1px 1px #333 inset;
444
  background-color: #fff;
445
  }
446
 
447
+ .tsf-metaboxes #tsf-title-location,
448
+ .tsf-metaboxes #tsf-home-title-location {
449
  display: block;
450
  }
451
 
452
+ .tsf-metaboxes #tsf-title-location label span,
453
+ .tsf-metaboxes #tsf-home-title-location label span,
454
+ .tsf-metaboxes #tsf-twitter-cards label span {
455
  display: inline-block;
456
  min-width: 60px;
457
  vertical-align: baseline;
458
  }
459
 
460
+ .tsf-metaboxes #tsf-twitter-cards label span {
461
  min-width: 150px;
462
  }
463
 
464
+ .tsf-metaboxes #tsf-home-title-location label span.custom-title-js,
465
+ .tsf-metaboxes #tsf-home-title-location label span.tsf-custom-blogname-js,
466
+ .tsf-metaboxes #tsf-home-title-location label span.tsf-custom-tagline-js,
467
+ .tsf-metaboxes #tsf-title-location label .autodescription-sep-js,
468
+ .tsf-metaboxes #tsf-home-title-location label .autodescription-sep-js {
469
  display: inline;
470
  min-width: 0;
471
  white-space: pre;
474
  /**
475
  * Start Tabs.
476
  */
477
+ .tsf-metaboxes .tsf-tab-no-js,
478
+ .tsf-metaboxes .tsf-nav-tab-wrapper {
479
  position: relative;
480
  clear: both;
481
  width: 100%;
486
  margin: -4px -12px;
487
  }
488
 
489
+ .tsf-metaboxes .tsf-nav-tab {
490
  float: left;
491
  border: 1px solid #ccc;
492
  margin-left: .5em;
499
  font-weight: 600;
500
  }
501
 
502
+ .tsf-metaboxes .tsf-dashicons-tabs {
503
  font-size: initial;
504
  display: inline;
505
  vertical-align: text-bottom;
506
  }
507
 
508
+ .tsf-metaboxes .tsf-tabs-radio {
509
  display: none;
510
  width: 0;
511
  height: 0;
513
  left: -9001px;
514
  }
515
 
516
+ .tsf-metaboxes .tsf-tabs-radio:checked + label,
517
+ .tsf-metaboxes .tsf-active-tab {
518
  background-color: inherit;
519
  border-bottom-color: #fff;
520
  color: #000;
521
  }
522
 
523
+ .tsf-metaboxes .tsf-tabs-content {
524
  margin: 1.33em auto 0;
525
  }
526
 
527
+ .tsf-metaboxes .seoframework-content-no-js {
528
  margin: 1.33em auto;
529
  }
530
 
531
+ body.js .tsf-metaboxes .tsf-tabs-content {
532
  display: none;
533
  }
534
 
535
+ body.js .tsf-metaboxes .tsf-tabs-content.tsf-active-tab-content {
536
  display: block;
537
  }
538
 
540
  * End tabs.
541
  */
542
 
543
+ .tsf-metaboxes .tsf-default-selected {
544
  border-color: #1c9d38;
545
  }
546
 
547
+ .tsf-metaboxes .tsf-default-selected:checked:before {
548
  color: #1c9d38;
549
  }
550
 
551
+ .tsf-metaboxes .tsf-warning-selected {
552
  border-color: #dd3811;
553
  }
554
 
555
+ .tsf-metaboxes .tsf-warning-selected:checked:before {
556
  color: #dd3811;
557
  }
558
 
559
+ .tsf-fields {
560
  font-size: 13px;
561
  line-height: 1.5;
562
  margin: 1em 0;
563
  }
564
 
565
+ .tsf-fields .tsf-toblock {
566
  display: block;
567
  width: 100%;
568
  margin-bottom: 4px;
569
  }
570
 
571
+ .tsf-fields p.description {
572
  margin: 7px 0 5px;
573
  color: #666;
574
  }
575
 
576
+ .tsf-option-spacer {
577
  margin: 1em 0;
578
  }
579
 
580
+ .tsf-counter .tsf-ajax {
581
+ margin-left: 3px;
582
+ }
583
+
584
+ .tsf-ajax:before {
585
+ display: inline-block;
586
+ line-height: 1;
587
+ font-family: dashicons;
588
+ font-style: normal;
589
+ font-weight: 400;
590
+ font-size: 1.225em;
591
+ vertical-align: middle;
592
+ content: "";
593
+ }
594
+
595
+ .tsf-ajax.tsf-loading:before {
596
+ content: "\f463";
597
+ color: #007bd2;
598
+ -webkit-animation: tsf-spin 1.5s linear infinite;
599
+ -moz-animation: tsf-spin 1.5s linear infinite;
600
+ -o-animation: tsf-spin 1.5s linear infinite;
601
+ animation: tsf-spin 1.5s linear infinite;
602
+ }
603
+
604
+ .tsf-ajax.tsf-error:before {
605
+ content: "\f158";
606
+ color: #dd3811;
607
+ }
608
+
609
+ .tsf-ajax.tsf-success:before {
610
+ content: "\f147";
611
+ color: #0cc34b;
612
+ }
613
+
614
+ @-webkit-keyframes tsf-spin {
615
+ 0% {
616
+ -webkit-transform: rotate( 0deg );
617
+ }
618
+ 100% {
619
+ -webkit-transform: rotate( 360deg );
620
+ }
621
+ }
622
+
623
+ @keyframes tsf-spin {
624
+ 0% {
625
+ transform: rotate( 0deg );
626
+ }
627
+ 100% {
628
+ transform: rotate( 360deg );
629
+ }
630
+ }
631
+
632
  @media screen and (max-width: 782px) {
633
+ .tsf-metaboxes p.tsf-fields,
634
+ .tsf-inpost-box p.tsf-fields {
635
  line-height: 2.8;
636
  }
637
 
638
+ .tsf-metaboxes #tsf-title-location label span,
639
+ .tsf-metaboxes #tsf-home-title-location label span {
640
  min-width: 40px;
641
  }
642
  }
643
 
644
  @media screen and (max-width: 642px) {
645
+ .tsf-metaboxes span.tsf-nav-desktop {
646
  display: none;
647
  }
648
  }
649
 
 
 
 
 
 
 
 
 
 
 
 
650
  @media screen and (max-width: 510px) {
651
+ span.tsf-seo-bar.tsf-100 {
652
  width: inherit;
653
  }
654
  }
655
 
656
  /* Firefix */
657
  @-moz-document url-prefix() {
658
+ .tsf-metaboxes #tsf-title-separator label,
659
+ .tsf-metaboxes #tsf-description-separator label {
660
+ margin: 3px 1px;
661
+ }
662
+
663
+ @media only screen and ( min-width: 768px ) {
664
+ /**
665
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=587438
666
+ * Only fix when title is second element and there are more than 6 elements in the table.
667
+ */
668
+ .widefat tr th.column-title:nth-child(2):nth-last-child(n+6),
669
+ .widefat tr td.column-title:nth-child(2):nth-last-child(n+6),
670
+ .widefat tr th.title:nth-child(2):nth-last-child(n+6),
671
+ .widefat tr td.title:nth-child(2):nth-last-child(n+6) {
672
+ min-width: 1em;
673
+ width: 25%;
674
+ max-width: 100%;
675
+ white-space: unset;
676
+ }
677
+ }
678
+
679
+ .tsf-metaboxes .tsf-default-selected {
680
  box-shadow: 0 0 2px 0 #1c9d38;
681
  }
682
 
683
+ .tsf-metaboxes .tsf-warning-selected {
684
  box-shadow: 0 0 2px 0 #dd3811;
685
  }
686
 
687
+ .tsf-metaboxes legend h4 {
688
  margin: 2px 0;
689
  }
690
  }
lib/css/autodescription.min.css CHANGED
@@ -1 +1 @@
1
- .seo-notice{position:relative;clear:both}a.autodescription-dismiss{position:absolute;top:0;right:1px;border:none;margin:0;padding:9px;background:0 0;color:#b4b9be;cursor:pointer;text-decoration:none}a.autodescription-dismiss:before{background:0 0;content:"\f153";display:block;font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a.autodescription-dismiss:hover{color:#c00}table.wp-list-table .column-name{width:15%}table.wp-list-table .column-is_in_stock,table.wp-list-table .column-price,table.wp-list-table .column-sku{width:8%}.ad-seo a{text-decoration:none;font-size:13px}#autodescription-title-wrap{position:relative;display:block;padding:0;height:auto;width:auto}#autodescription-title-offset{visibility:hidden;height:0;display:inline-block;position:absolute;left:0;color:transparent;white-space:pre}#autodescription-title-placeholder{position:absolute;color:#777;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box;top:0;left:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.theseoframework-counter{font-weight:600;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}span.ad-count-bad{color:#dd3811}span.ad-count-okay{color:#ffa700}span.ad-count-good{color:#0cc34b}span.tsf-counter-one{color:#fff;border-radius:58px;padding:0 1px;min-width:29px;display:inline-block;text-align:center;vertical-align:baseline}span.tsf-counter-one.ad-count-bad{background-color:#dd3811}span.tsf-counter-one.ad-count-okay{background-color:#ffa700}span.tsf-counter-one.ad-count-good{background-color:#0cc34b}#ad_seo{width:18%}th:last-of-type#ad_seo{width:160px}span.ad-seo{display:block;width:95%;max-width:220px;border-radius:0;padding:3px;text-shadow:0 0 3px rgba(0,0,0,.3)}.ad-100,.ad-bar-wrap a,span.ad-seo.ad-100{width:100%}span.ad-bar-wrap{display:table;width:100%;border-radius:0;margin:0 auto;border-collapse:separate;border-spacing:0;vertical-align:middle;position:relative}span.ad-sec-wrap{display:table-cell;border-collapse:collapse}.ad-bar-wrap a{display:table;color:#fff;text-align:center;cursor:help;height:100%;min-width:12px;vertical-align:top;line-height:1.625em;box-shadow:2px 0 0 -1px rgba(0,0,0,.1) inset,-2px 0 0 -1px rgba(0,0,0,.1) inset}span.ad-seo.pill,span.ad-seo.pill span.ad-bar-wrap{border-radius:30px}span.ad-seo.pill span.ad-bar-wrap a{box-shadow:2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6)}.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type,.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:first-of-type a{border-top-left-radius:30px;border-bottom-left-radius:30px}.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type,.ad-seo.pill .ad-bar-wrap span.ad-sec-wrap:last-of-type a{border-top-right-radius:30px;border-bottom-right-radius:30px}.ad-60{width:60%}.ad-50{width:50%}.ad-40{width:40%}.ad-33{width:33.333%}.ad-25{width:25%}.ad-20{width:20%}.ad-16{width:16.666%}.ad-12-5{width:12.5%}.ad-11{width:11.333%}.ad-10{width:10%}.ad-seo-bad{background-color:#dd3811}.ad-seo-okay{background-color:#ffa700}.ad-seo-good{background-color:#0cc34b}.ad-seo-unknown{background-color:#007bd2}span.ad-seo .explanation-desc{position:absolute;width:auto;min-width:90%;max-width:220px;font-weight:600;background:#007bd2;padding:8px 12px;color:#fdfdfd;border-radius:0;z-index:900142;box-shadow:0 0 2px rgba(0,0,0,.6);left:0;right:0;text-align:left}span.ad-seo .explanation-desc span{text-decoration:underline}span.ad-seo .explanation-desc div{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #007bd2;position:absolute;bottom:-8px;z-index:9999999;left:0}.ad_seo.column-ad_seo{overflow:initial!important;min-width:160px}#col-container,#col-right{overflow:initial}.autodescription-metaboxes{box-sizing:border-box;max-width:690px;padding-bottom:20px}.autodescription-metaboxes .top-wrap{width:100%;display:inline-block;vertical-align:top}.autodescription-metaboxes .top-wrap>h1,.autodescription-metaboxes .top-wrap>h2{float:left}.autodescription-metaboxes .metabox-holder{clear:both}.autodescription-metaboxes .top-buttons{float:right}.autodescription-metaboxes .bottom-buttons{text-align:right}.autodescription-metaboxes .bottom-buttons input,.autodescription-metaboxes .top-buttons input{margin-left:10px}.autodescription-metaboxes #description-separator,.autodescription-metaboxes #title-separator{display:table;width:100%;border-collapse:collapse;border-spacing:0}.autodescription-metaboxes #description-separator input,.autodescription-metaboxes #title-separator input{display:none;float:left;width:0;min-width:0;opacity:0}.autodescription-metaboxes #description-separator label,.autodescription-metaboxes #title-separator label{display:inline-block;width:auto;min-width:28px;min-height:28px;margin:3px;-moz-margin-end:1.5px;-moz-margin-start:1.5px;padding:0 4px;border:1px solid #ccc;line-height:28px;text-align:center;cursor:pointer;box-shadow:-1px -1px 1px #aaa inset;font-size:16px}.autodescription-metaboxes #description-separator label.recommended,.autodescription-metaboxes #title-separator label.recommended{border:1px solid #0cc34b;box-shadow:-1px -1px 1px #0cc34b inset}.autodescription-metaboxes #description-separator input:hover+label,.autodescription-metaboxes #description-separator label:hover,.autodescription-metaboxes #title-separator input:hover+label,.autodescription-metaboxes #title-separator label:hover{box-shadow:1px 1px 1px #aaa inset;background-color:#fff}.autodescription-metaboxes #description-separator input:checked+label,.autodescription-metaboxes #title-separator input:checked+label{box-shadow:1px 1px 1px #333 inset;background-color:#fff}.autodescription-metaboxes #home-title-location,.autodescription-metaboxes #title-location{display:block}.autodescription-metaboxes #home-title-location label span,.autodescription-metaboxes #title-location label span,.autodescription-metaboxes #twitter-cards label span{display:inline-block;min-width:60px;vertical-align:baseline}.autodescription-metaboxes #twitter-cards label span{min-width:150px}.autodescription-metaboxes #home-title-location label .autodescription-sep-js,.autodescription-metaboxes #home-title-location label span.custom-blogname-js,.autodescription-metaboxes #home-title-location label span.custom-tagline-js,.autodescription-metaboxes #home-title-location label span.custom-title-js,.autodescription-metaboxes #title-location label .autodescription-sep-js{display:inline;min-width:0;white-space:pre}.autodescription-metaboxes .seoframework-nav-tab-wrapper,.autodescription-metaboxes .seoframework-tab-no-js{position:relative;clear:both;width:100%;display:inline-block;border-bottom:1px solid #ccc;line-height:inherit;padding:8px 12px 0;margin:-4px -12px}.autodescription-metaboxes .seoframework-nav-tab{float:left;border:1px solid #ccc;margin-left:.5em;margin-bottom:-1px;padding:5px 14px;font-size:12px;line-height:16px;background:#f1f1f1;color:#555;font-weight:600}.autodescription-metaboxes .seoframework-dashicons-tabs{font-size:initial;display:inline;vertical-align:text-bottom}.autodescription-metaboxes .seoframework-tabs-radio{display:none;width:0;height:0;position:absolute;left:-9001px}.autodescription-metaboxes .seoframework-active-tab,.autodescription-metaboxes .seoframework-tabs-radio:checked+label{background-color:inherit;border-bottom-color:#fff;color:#000}.autodescription-metaboxes .seoframework-tabs-content{margin:1.33em auto 0}.autodescription-metaboxes .seoframework-content-no-js{margin:1.33em auto}body.js .autodescription-metaboxes .seoframework-tabs-content{display:none}body.js .autodescription-metaboxes .seoframework-tabs-content.seoframework-active-tab-content{display:block}.autodescription-metaboxes .seoframework-default-selected{border-color:#1c9d38}.autodescription-metaboxes .seoframework-default-selected:checked:before{color:#1c9d38}.autodescription-metaboxes .seoframework-warning-selected{border-color:#dd3811}.autodescription-metaboxes .seoframework-warning-selected:checked:before{color:#dd3811}.theseoframework-fields{font-size:13px;line-height:1.5;margin:1em 0}.theseoframework-fields .toblock{display:block;width:100%;margin-bottom:4px}.theseoframework-fields p.description{margin:7px 0 5px;color:#666}.theseoframework-option-spacer{margin:1em 0}@media screen and (max-width:782px){.autodescription-metaboxes p.theseoframework-fields,.theseoframework-inpost-box p.theseoframework-fields{line-height:2.8}.autodescription-metaboxes #home-title-location label span,.autodescription-metaboxes #title-location label span{min-width:40px}}@media screen and (max-width:642px){.autodescription-metaboxes span.seoframework-nav-desktop{display:none}}@media screen and (max-width:600px){.autodescription-metaboxes h3.nav-tab-wrapper{border-bottom:1px solid #ccc}.autodescription-metaboxes h3 .nav-tab{margin-right:7px;margin-bottom:-1px}}@media screen and (max-width:510px){span.ad-seo.ad-100{width:inherit}}@-moz-document url-prefix(){.autodescription-metaboxes .seoframework-default-selected{box-shadow:0 0 2px 0 #1c9d38}.autodescription-metaboxes .seoframework-warning-selected{box-shadow:0 0 2px 0 #dd3811}.autodescription-metaboxes legend h4{margin:2px 0}}
1
+ .tsf-notice{position:relative;clear:both}.tsf-notice.tsf-show-icon p:before{content:'';margin-right:12px;background:0 0;display:inline-block;font:400 14px/16px dashicons;speak:none;height:16px;text-align:center;vertical-align:middle;width:16px;line-height:14px;-webkit-font-smoothing:antialiased}.error.tsf-notice.tsf-show-icon p:before{color:#dd3811;content:"\f534"}.notice-warning.tsf-notice.tsf-show-icon p:before{color:#ffa01b;content:"\f227"}.updated.tsf-notice.tsf-show-icon p:before{color:#0cc34b;font-size:16px;content:"\f147"}a.tsf-dismiss{position:absolute;top:0;right:1px;border:none;margin:0;padding:9px;background:0 0;color:#b4b9be;cursor:pointer;text-decoration:none}a.tsf-dismiss:before{background:0 0;content:"\f153";display:block;font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a.tsf-dismiss:hover{color:#c00}table.wp-list-table .column-name{width:15%}table.wp-list-table .column-icl_translations,table.wp-list-table .column-is_in_stock,table.wp-list-table .column-price,table.wp-list-table .column-sku{width:8%}.tsf-seo-bar a{text-decoration:none;font-size:13px}#tsf-title-wrap{position:relative;display:block;padding:0;height:auto;width:auto}#tsf-title-offset{visibility:hidden;height:0;display:inline-block;position:absolute;left:0;color:transparent;white-space:pre}#tsf-title-placeholder{position:absolute;color:#777;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box;top:0;left:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tsf-counter{font-weight:600;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}span.tsf-count-bad{color:#dd3811}span.tsf-count-okay{color:#ffa700}span.tsf-count-good{color:#0cc34b}span.tsf-counter-one{color:#fff;border-radius:58px;padding:0 1px;min-width:29px;display:inline-block;text-align:center;vertical-align:baseline}span.tsf-counter-one.tsf-count-bad{background-color:#dd3811}span.tsf-counter-one.tsf-count-okay{background-color:#ffa700}span.tsf-counter-one.tsf-count-good{background-color:#0cc34b}#tsf-seo-bar-wrap{width:18%}th:last-of-type#tsf-seo-bar-wrap{width:160px}span.tsf-seo-bar{display:block;width:95%;max-width:220px;border-radius:0;padding:3px;text-shadow:0 0 3px rgba(0,0,0,.3)}span.tsf-seo-bar.tsf-100{width:100%}span.tsf-seo-bar-inner-wrap{display:table;width:100%;border-radius:0;margin:0 auto;border-collapse:separate;border-spacing:0;vertical-align:middle;position:relative}span.tsf-seo-bar-section-wrap{display:table-cell;border-collapse:collapse}.tsf-seo-bar-inner-wrap a{display:table;width:100%;color:#fff;text-align:center;cursor:help;height:100%;min-width:12px;vertical-align:top;line-height:1.625em;box-shadow:2px 0 0 -1px rgba(0,0,0,.1) inset,-2px 0 0 -1px rgba(0,0,0,.1) inset}span.tsf-seo-bar.pill,span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap{border-radius:30px}span.tsf-seo-bar.pill span.tsf-seo-bar-inner-wrap a{box-shadow:2px 6px 3px -2px rgba(255,255,255,.2) inset,-2px -6px 3px -2px rgba(41,41,41,.2) inset,0 0 1px rgba(41,41,41,.6)}.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type,.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:first-of-type a{border-top-left-radius:30px;border-bottom-left-radius:30px}.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type,.tsf-seo-bar.pill .tsf-seo-bar-inner-wrap span.tsf-seo-bar-section-wrap:last-of-type a{border-top-right-radius:30px;border-bottom-right-radius:30px}.tsf-100{width:100%}.tsf-60{width:60%}.tsf-50{width:50%}.tsf-40{width:40%}.tsf-33{width:33.333%}.tsf-25{width:25%}.tsf-20{width:20%}.tsf-16{width:16.666%}.tsf-12-5{width:12.5%}.ad-11{width:11.333%}.tsf-10{width:10%}.tsf-seo-bar-bad{background-color:#dd3811}.tsf-seo-bar-okay{background-color:#ffa700}.tsf-seo-bar-good{background-color:#0cc34b}.tsf-seo-bar-unknown{background-color:#007bd2}span.tsf-seo-bar .tsf-explanation-desc{position:absolute;width:auto;min-width:90%;max-width:220px;font-weight:600;background:#007bd2;padding:8px 12px;color:#fdfdfd;border-radius:0;z-index:900142;box-shadow:0 0 2px rgba(0,0,0,.6);left:0;right:0;text-align:left}span.tsf-seo-bar .tsf-explanation-desc span{text-decoration:underline}span.tsf-seo-bar .tsf-explanation-desc div{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #007bd2;position:absolute;bottom:-8px;z-index:9999999;left:0}.tsf-seo-bar-wrap.column-tsf-seo-bar-temp{overflow:initial!important;min-width:160px}#col-container,#col-right{overflow:initial}.tsf-metaboxes{box-sizing:border-box;max-width:690px;padding-bottom:20px}.tsf-metaboxes .tsf-top-wrap{width:100%;display:inline-block;vertical-align:top}.tsf-metaboxes .tsf-top-wrap>h1,.tsf-metaboxes .tsf-top-wrap>h2{float:left}.tsf-metaboxes .metabox-holder{clear:both}.tsf-metaboxes .tsf-top-buttons{float:right}.tsf-metaboxes .tsf-bottom-buttons{text-align:right}.tsf-metaboxes .tsf-bottom-buttons input,.tsf-metaboxes .tsf-top-buttons input{margin-left:10px}.tsf-metaboxes #tsf-description-separator,.tsf-metaboxes #tsf-title-separator{display:table;width:100%;border-collapse:collapse;border-spacing:0}.tsf-metaboxes #tsf-description-separator input,.tsf-metaboxes #tsf-title-separator input{display:none;float:left;width:0;min-width:0;opacity:0}.tsf-metaboxes #tsf-description-separator label,.tsf-metaboxes #tsf-title-separator label{display:inline-block;width:auto;min-width:28px;min-height:28px;margin:3px;-moz-margin-end:1.5px;-moz-margin-start:1.5px;padding:0 4px;border:1px solid #ccc;line-height:28px;text-align:center;cursor:pointer;box-shadow:-1px -1px 1px #aaa inset;font-size:16px}.tsf-metaboxes #tsf-description-separator label.tsf-recommended,.tsf-metaboxes #tsf-title-separator label.tsf-recommended{border:1px solid #0cc34b;box-shadow:-1px -1px 1px #0cc34b inset}.tsf-metaboxes #tsf-description-separator input:hover+label,.tsf-metaboxes #tsf-description-separator label:hover,.tsf-metaboxes #tsf-title-separator input:hover+label,.tsf-metaboxes #tsf-title-separator label:hover{box-shadow:1px 1px 1px #aaa inset;background-color:#fff}.tsf-metaboxes #tsf-description-separator input:checked+label,.tsf-metaboxes #tsf-title-separator input:checked+label{box-shadow:1px 1px 1px #333 inset;background-color:#fff}.tsf-metaboxes #tsf-home-title-location,.tsf-metaboxes #tsf-title-location{display:block}.tsf-metaboxes #tsf-home-title-location label span,.tsf-metaboxes #tsf-title-location label span,.tsf-metaboxes #tsf-twitter-cards label span{display:inline-block;min-width:60px;vertical-align:baseline}.tsf-metaboxes #tsf-twitter-cards label span{min-width:150px}.tsf-metaboxes #tsf-home-title-location label .autodescription-sep-js,.tsf-metaboxes #tsf-home-title-location label span.custom-title-js,.tsf-metaboxes #tsf-home-title-location label span.tsf-custom-blogname-js,.tsf-metaboxes #tsf-home-title-location label span.tsf-custom-tagline-js,.tsf-metaboxes #tsf-title-location label .autodescription-sep-js{display:inline;min-width:0;white-space:pre}.tsf-metaboxes .tsf-nav-tab-wrapper,.tsf-metaboxes .tsf-tab-no-js{position:relative;clear:both;width:100%;display:inline-block;border-bottom:1px solid #ccc;line-height:inherit;padding:8px 12px 0;margin:-4px -12px}.tsf-metaboxes .tsf-nav-tab{float:left;border:1px solid #ccc;margin-left:.5em;margin-bottom:-1px;padding:5px 14px;font-size:12px;line-height:16px;background:#f1f1f1;color:#555;font-weight:600}.tsf-metaboxes .tsf-dashicons-tabs{font-size:initial;display:inline;vertical-align:text-bottom}.tsf-metaboxes .tsf-tabs-radio{display:none;width:0;height:0;position:absolute;left:-9001px}.tsf-metaboxes .tsf-active-tab,.tsf-metaboxes .tsf-tabs-radio:checked+label{background-color:inherit;border-bottom-color:#fff;color:#000}.tsf-metaboxes .tsf-tabs-content{margin:1.33em auto 0}.tsf-metaboxes .seoframework-content-no-js{margin:1.33em auto}body.js .tsf-metaboxes .tsf-tabs-content{display:none}body.js .tsf-metaboxes .tsf-tabs-content.tsf-active-tab-content{display:block}.tsf-metaboxes .tsf-default-selected{border-color:#1c9d38}.tsf-metaboxes .tsf-default-selected:checked:before{color:#1c9d38}.tsf-metaboxes .tsf-warning-selected{border-color:#dd3811}.tsf-metaboxes .tsf-warning-selected:checked:before{color:#dd3811}.tsf-fields{font-size:13px;line-height:1.5;margin:1em 0}.tsf-fields .tsf-toblock{display:block;width:100%;margin-bottom:4px}.tsf-fields p.description{margin:7px 0 5px;color:#666}.tsf-option-spacer{margin:1em 0}.tsf-counter .tsf-ajax{margin-left:3px}.tsf-ajax:before{display:inline-block;line-height:1;font-family:dashicons;font-style:normal;font-weight:400;font-size:1.225em;vertical-align:middle;content:""}.tsf-ajax.tsf-loading:before{content:"\f463";color:#007bd2;-webkit-animation:tsf-spin 1.5s linear infinite;-moz-animation:tsf-spin 1.5s linear infinite;-o-animation:tsf-spin 1.5s linear infinite;animation:tsf-spin 1.5s linear infinite}.tsf-ajax.tsf-error:before{content:"\f158";color:#dd3811}.tsf-ajax.tsf-success:before{content:"\f147";color:#0cc34b}@-webkit-keyframes tsf-spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes tsf-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@media screen and (max-width:782px){.tsf-inpost-box p.tsf-fields,.tsf-metaboxes p.tsf-fields{line-height:2.8}.tsf-metaboxes #tsf-home-title-location label span,.tsf-metaboxes #tsf-title-location label span{min-width:40px}}@media screen and (max-width:642px){.tsf-metaboxes span.tsf-nav-desktop{display:none}}@media screen and (max-width:510px){span.tsf-seo-bar.tsf-100{width:inherit}}@-moz-document url-prefix(){.tsf-metaboxes #tsf-description-separator label,.tsf-metaboxes #tsf-title-separator label{margin:3px 1px}@media only screen and (min-width:768px){.widefat tr td.column-title:nth-child(2):nth-last-child(n+6),.widefat tr td.title:nth-child(2):nth-last-child(n+6),.widefat tr th.column-title:nth-child(2):nth-last-child(n+6),.widefat tr th.title:nth-child(2):nth-last-child(n+6){min-width:1em;width:25%;max-width:100%;white-space:unset}}.tsf-metaboxes .tsf-default-selected{box-shadow:0 0 2px 0 #1c9d38}.tsf-metaboxes .tsf-warning-selected{box-shadow:0 0 2px 0 #dd3811}.tsf-metaboxes legend h4{margin:2px 0}}
lib/js/autodescription.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * This file holds The SEO Framework plugin's JS code.\
3
  * Serve JavaScript as an addition, not as a means.
4
  *
5
  * @author Sybre Waaijer https://cyberwire.nl/
@@ -49,18 +49,44 @@
49
  */
50
  window[ 'autodescription' ] = {
51
 
 
 
 
 
52
  settingsChanged: false,
53
 
 
 
 
 
54
  titleTagline : autodescriptionL10n['titleTagline'],
55
 
 
 
 
 
 
 
56
  /**
57
  * Mixed string and int (i10n is string, JS is int).
58
- * @param {String|int} autodescription.counterType
59
  */
60
  counterType : autodescriptionL10n['counterType'],
61
 
 
 
 
 
62
  additionsClass : '',
63
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Cached doctitle function.
66
  *
@@ -139,13 +165,13 @@ window[ 'autodescription' ] = {
139
  }
140
 
141
  if ( $length < 100 || $length >= 175 ) {
142
- $counterClass = 'ad-count-bad';
143
  $name = autodescription.getCounterName( 'bad' );
144
  } else if ( $length < 137 || ( $length > 155 && $length < 175 ) ) {
145
- $counterClass = 'ad-count-okay';
146
  $name = autodescription.getCounterName( 'okay' );
147
  } else {
148
- $counterClass = 'ad-count-good';
149
  $name = autodescription.getCounterName( 'good' );
150
  }
151
 
@@ -229,13 +255,13 @@ window[ 'autodescription' ] = {
229
  }
230
 
231
  if ( $length < 25 || $length >= 75 ) {
232
- $counterClass = 'ad-count-bad';
233
  $name = autodescription.getCounterName( 'bad' );
234
  } else if ( $length < 42 || ( $length > 55 && $length < 75 ) ) {
235
- $counterClass = 'ad-count-okay';
236
  $name = autodescription.getCounterName( 'okay' );
237
  } else {
238
- $counterClass = 'ad-count-good';
239
  $name = autodescription.getCounterName( 'good' );
240
  }
241
 
@@ -272,24 +298,6 @@ window[ 'autodescription' ] = {
272
  return str;
273
  },
274
 
275
- /**
276
- * Escapes HTML entities.
277
- *
278
- * @since 2.5.2.4
279
- * @function
280
- *
281
- * @param {String|null} str
282
- * @return {String} HTML to jQuery converted string
283
- */
284
- escapeTags: function( str ) {
285
- 'use strict';
286
-
287
- if ( str )
288
- str.replace( /&/g, '&amp;' ).replace( /</g, '&lt;' ).replace( />/g, '&gt;' );
289
-
290
- return str;
291
- },
292
-
293
  /**
294
  * Dynamic Title separator replacement in metabox
295
  *
@@ -304,6 +312,9 @@ window[ 'autodescription' ] = {
304
  var $sep = jQuery( ".autodescription-sep-js" ),
305
  $val = jQuery( event.target ).val();
306
 
 
 
 
307
  if ( 'pipe' === $val ) {
308
  $sep.text( " | " );
309
  } else if ( 'dash' === $val ) {
@@ -346,11 +357,11 @@ window[ 'autodescription' ] = {
346
  statusBarHover: function() {
347
  'use strict';
348
 
349
- var $wrap = jQuery( '.ad-bar-wrap' ).find( 'a' );
350
 
351
- $wrap.on( "mouseenter", autodescription.statusBarHoverEnter );
352
- $wrap.on( "mousemove", autodescription.statusBarHoverMove );
353
- $wrap.on( "mouseleave", autodescription.statusBarHoverLeave );
354
 
355
  },
356
 
@@ -368,11 +379,11 @@ window[ 'autodescription' ] = {
368
  $thisDesc = $this.attr( 'data-desc' );
369
 
370
  if ( $thisDesc !== undefined && 0 === $this.find( 'div' ).length ) {
371
- $this.append( '<div class="explanation-desc">' + $thisDesc + '<div></div></div>' );
372
 
373
- var $thisHeight = $this.find( 'div.explanation-desc' ).height() + 28;
374
 
375
- $this.find( 'div.explanation-desc' ).css( 'top', ( $this.position().top - $thisHeight ) + 'px' );
376
  }
377
  },
378
 
@@ -389,8 +400,8 @@ window[ 'autodescription' ] = {
389
 
390
  var $this = jQuery( event.target ),
391
  $pagex = event.pageX,
392
- $mousex = $pagex - jQuery( '.ad-bar-wrap' ).offset().left - 11, // 22px width of arrow / 2 = 11 middle
393
- $balloon = $this.find( '.explanation-desc' ),
394
  $arrow = $balloon.find( 'div' );
395
 
396
  if ( $mousex < 1 ) {
@@ -418,7 +429,7 @@ window[ 'autodescription' ] = {
418
  statusBarHoverLeave: function() {
419
  'use strict';
420
 
421
- jQuery( this ).find( 'div.explanation-desc' ).remove();
422
  },
423
 
424
  /**
@@ -433,10 +444,10 @@ window[ 'autodescription' ] = {
433
  'use strict';
434
 
435
  var $this = jQuery( event.target ),
436
- $desc = jQuery('.ad-bar-wrap a');
437
 
438
  if ( ! $this.closest( $desc ).length )
439
- $desc.find( 'div.explanation-desc' ).remove();
440
  },
441
 
442
  /**
@@ -461,11 +472,10 @@ window[ 'autodescription' ] = {
461
  $other = jQuery( '.' + $name + '-content' );
462
 
463
  if ( typeof $content !== 'undefined' ) {
464
- $other.removeClass( 'seoframework-active-tab-content' );
465
- $content.addClass( 'seoframework-active-tab-content' );
466
  }
467
  }
468
-
469
  },
470
 
471
  /**
@@ -480,7 +490,7 @@ window[ 'autodescription' ] = {
480
  'use strict';
481
 
482
  var $this = jQuery( event.target ),
483
- $tag = jQuery( '.custom-blogname-js' );
484
 
485
  if ( $this.is( ':checked' ) ) {
486
  $tag.css( 'display', 'inline' );
@@ -505,7 +515,7 @@ window[ 'autodescription' ] = {
505
  'use strict';
506
 
507
  var $this = jQuery( event.target ),
508
- $tagDesc = jQuery( '#on-blogname-js' );
509
 
510
  if ( $this.is(':checked') ) {
511
  $tagDesc.css( 'display', 'inline' );
@@ -526,8 +536,8 @@ window[ 'autodescription' ] = {
526
  'use strict';
527
 
528
  var $this = jQuery( event.target ).val(),
529
- $titleExampleLeft = jQuery( '.title-additions-example-left' ),
530
- $titleExampleRight = jQuery( '.title-additions-example-right' );
531
 
532
  if ( 'right' === $this ) {
533
  $titleExampleLeft.css( 'display', 'none' );
@@ -536,7 +546,6 @@ window[ 'autodescription' ] = {
536
  $titleExampleLeft.css( 'display', 'inline' );
537
  $titleExampleRight.css( 'display', 'none' );
538
  }
539
-
540
  },
541
 
542
  /**
@@ -551,14 +560,13 @@ window[ 'autodescription' ] = {
551
  'use strict';
552
 
553
  var $this = jQuery( event.target ),
554
- $prefix = jQuery( '.title-prefix-example' );
555
 
556
  if ( $this.is(':checked') ) {
557
  $prefix.css( 'display', 'none' );
558
  } else {
559
  $prefix.css( 'display', 'inline' );
560
  }
561
-
562
  },
563
 
564
  /**
@@ -573,7 +581,7 @@ window[ 'autodescription' ] = {
573
  'use strict';
574
 
575
  var $this = jQuery( event.target ),
576
- $tagDesc = jQuery( '#description-additions-js' );
577
 
578
  if ( $this.is(':checked') ) {
579
  $tagDesc.css( 'display', 'inline' );
@@ -594,14 +602,14 @@ window[ 'autodescription' ] = {
594
  taglineToggleOnload: function( event ) {
595
  'use strict';
596
 
597
- var $tagTitle = jQuery( '#title-tagline-toggle :input' ),
598
- $title = jQuery( '.custom-blogname-js' ),
599
- $tagDescAdditions = jQuery( '#description-additions-toggle :input' ),
600
- $descAdditions = jQuery( '#description-additions-js' ),
601
- $tagDescBlogname = jQuery( '#description-onblogname-toggle :input' ),
602
- $descBlogname = jQuery( '#on-blogname-js' ),
603
- $tagTitleAdditions = jQuery( '#title-additions-toggle :input' ),
604
- $titleAdditions = jQuery( '.title-additions-js' );
605
 
606
  if ( $tagTitle.is( ':checked' ) ) {
607
  $title.css( 'display', 'inline' );
@@ -664,49 +672,34 @@ window[ 'autodescription' ] = {
664
  'use strict';
665
 
666
  var $val = jQuery( event.target ).val(),
667
- $floatTag = jQuery( '.custom-tagline-js' ),
668
  $target = jQuery( '#autodescription-site-settings\\[homepage_title\\]' ),
669
- $leftRight = jQuery( '#home-title-location input:checked' ).val(),
670
  $toggle = jQuery( '#autodescription-site-settings\\[homepage_tagline\\]' ),
671
  $title = autodescriptionL10n['siteTitle'],
672
  $placeholder = $title,
673
  $description = autodescriptionL10n['blogDescription'],
674
- $sep = jQuery( '#title-separator input:checked' ).val(),
675
- $sepOutput = autodescriptionL10n['titleSeparator'];
676
 
677
  if ( $toggle.is( ':checked' ) ) {
678
 
679
  if ( $val.length !== 0 ) {
680
- $val = autodescription.escapeTags( $val );
681
-
682
- // Create a memory div to store the html in, convert to text to append in $placeholder and $floatTag
683
- $description = jQuery( '<div/>' ).text( $val ).html();
684
- }
685
-
686
- if ( $sep.length !== 0 ) {
687
- if ( 'pipe' === $sep ) {
688
- $sepOutput = ( "|" );
689
- } else if ( 'dash' === $sep ) {
690
- $sepOutput = ( "-" );
691
- } else {
692
- // Create a memory div to store the html in, convert to text to append in $placeholder
693
- $sepOutput = jQuery( '<div/>' ).html( "&" + $sep + ";" ).text();
694
- }
695
  }
696
 
697
  if ( $leftRight.length !== 0 && 'left' === $leftRight ) {
698
- $placeholder = $title + ' ' + $sepOutput + ' ' + $description;
699
  } else {
700
- $placeholder = $description + ' ' + $sepOutput + ' ' + $title;
701
  }
702
 
703
  }
704
 
705
- $floatTag.html( $description );
706
  $target.attr( "placeholder", $placeholder );
707
 
708
  // Notify tagline has changed.
709
- autodescription.docTitles().trigger( 'keyup', autodescription.updateCharacterCountTitle );
710
  },
711
 
712
  /**
@@ -719,7 +712,7 @@ window[ 'autodescription' ] = {
719
  taglinePropTrigger: function() {
720
  'use strict';
721
 
722
- jQuery( "#autodescription-site-settings\\[homepage_title_tagline\\]" ).trigger( 'keyup', autodescription.taglineProp );
723
  },
724
 
725
  /**
@@ -733,7 +726,7 @@ window[ 'autodescription' ] = {
733
  'use strict';
734
 
735
  var $this = jQuery( event.target ),
736
- $tagDesc = jQuery( '.title-additions-js' );
737
 
738
  if ( $this.is( ':checked' ) ) {
739
  $tagDesc.css( 'display', 'none' );
@@ -752,21 +745,21 @@ window[ 'autodescription' ] = {
752
  attachUnsavedChangesListener: function() {
753
  'use strict';
754
 
755
- jQuery( 'div.autodescription-metaboxes :input, div#theseoframework-inpost-box .inside :input' ).not( '.seoframework-tab :input' ).change( function() {
756
  autodescription.registerChange();
757
  });
758
 
759
- jQuery( 'div.autodescription-metaboxes input[type=text], div.autodescription-metaboxes textarea, div#theseoframework-inpost-box .inside input[type=text], div#theseoframework-inpost-box .inside textarea' ).not('.nav-tab-wrapper :input').on( 'keyup', function() {
760
  autodescription.registerChange();
761
  });
762
 
763
- window.onbeforeunload = function(){
764
  if ( autodescription.settingsChanged ) {
765
  return autodescriptionL10n['saveAlert'];
766
  }
767
  };
768
 
769
- jQuery( 'div.autodescription-metaboxes input[type="submit"], div#publishing-action input[type="submit"], div#save-action input[type="submit"], a.submitdelete' ).click( function() {
770
  window.onbeforeunload = null;
771
  });
772
  },
@@ -813,7 +806,7 @@ window[ 'autodescription' ] = {
813
  'use strict';
814
 
815
  var $hasAdditions = autodescriptionL10n['titleAdditions'].length,
816
- $placeholder = jQuery( '#autodescription-title-placeholder' );
817
 
818
  // If check is defined, we're on SEO settings page.
819
  if ( 0 === $hasAdditions ) {
@@ -825,7 +818,7 @@ window[ 'autodescription' ] = {
825
  }
826
 
827
  var $after = false,
828
- $check = jQuery( '#home-title-location input:checked' ).val(),
829
  $rtl = autodescriptionL10n['isRTL'],
830
  $additions = '';
831
 
@@ -871,7 +864,7 @@ window[ 'autodescription' ] = {
871
  }
872
  }
873
 
874
- var $tagbox = jQuery( '#title-tagline-toggle :input' );
875
 
876
  if ( typeof $tagbox !== "undefined" && $tagbox.length > 0 && ! $tagbox.is( ':checked' ) ) {
877
  //* We're on SEO Settings Page now, and tagline has been disabled.
@@ -883,14 +876,14 @@ window[ 'autodescription' ] = {
883
 
884
  var $this = jQuery( event.target ),
885
  $inputVal = $this.val(),
886
- $offsetTest = jQuery( "#autodescription-title-offset" ),
887
  $offsetWidth = 0,
888
  $heightPad = ( $this.outerHeight( true ) - $this.height() ) / 2,
889
  $horPad = ( $this.outerWidth() - $this.width() ) / 2,
890
  $leftOffset = ( $this.outerWidth( true ) - $this.width() ) / 2,
891
  $taglineVal = jQuery( "#autodescription-site-settings\\[homepage_title_tagline\\]" ).val(),
892
  $pos = 'left',
893
- $separator = autodescriptionL10n['titleSeparator'];
894
 
895
  if ( '1' === $rtl ) {
896
  $pos = 'right';
@@ -1012,12 +1005,11 @@ window[ 'autodescription' ] = {
1012
 
1013
  if ( typeof $input.val() !== "undefined" ) {
1014
  if ( $input.val().length > 0 ) {
1015
- $input.trigger( 'keyup', autodescription.dynamicPlaceholder );
1016
  } else {
1017
- $input.trigger( 'keyup', autodescription.updateCharacterCountTitle );
1018
  }
1019
  }
1020
-
1021
  },
1022
 
1023
  /**
@@ -1032,7 +1024,7 @@ window[ 'autodescription' ] = {
1032
 
1033
  var $input = autodescription.docDescriptions();
1034
 
1035
- $input.trigger( 'keyup', autodescription.updateCharacterCountDescription );
1036
  },
1037
 
1038
 
@@ -1048,7 +1040,7 @@ window[ 'autodescription' ] = {
1048
 
1049
  var $input = autodescription.docTitles();
1050
 
1051
- $input.trigger( 'keyup', autodescription.updateCharacterCountTitle );
1052
  },
1053
 
1054
  /**
@@ -1066,7 +1058,7 @@ window[ 'autodescription' ] = {
1066
  },
1067
 
1068
  /**
1069
- * Dismissible notices. Uses class .seo-notice.
1070
  *
1071
  * @since 2.6.0
1072
  *
@@ -1078,20 +1070,73 @@ window[ 'autodescription' ] = {
1078
 
1079
  var $this = jQuery( event.target );
1080
 
1081
- $this.parents( '.seo-notice' ).slideUp( 200, function() {
1082
  $this.remove();
1083
  });
1084
 
1085
  },
1086
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1087
  /**
1088
  * Updates the counter type.
1089
  *
1090
  * @since 2.6.0
1091
  *
1092
  * @function
 
1093
  */
1094
- counterUpdate: function() {
1095
  'use strict';
1096
 
1097
  // Count up, reset to 0 if needed. We have 4 options: 0, 1, 2, 3
@@ -1099,14 +1144,68 @@ window[ 'autodescription' ] = {
1099
  if ( autodescription.counterType > 3 )
1100
  autodescription.counterType = 0;
1101
 
1102
- var data = {
1103
- 'action': 'the_seo_framework_update_counter'
1104
- };
1105
 
1106
- //* Call PHP function and update all visible counters.
1107
- jQuery.post( ajaxurl, data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1108
 
1109
- autodescription.additionsClassInit();
1110
  },
1111
 
1112
  /**
@@ -1123,8 +1222,10 @@ window[ 'autodescription' ] = {
1123
  /**
1124
  * Mixed string and int (i10n is string, JS is int).
1125
  * @param {String|int} $counterType
 
1126
  */
1127
- var $counterType = autodescription.counterType;
 
1128
 
1129
  if ( 1 == $counterType ) {
1130
  autodescription.additionsClass = 'tsf-counter-one';
@@ -1141,6 +1242,9 @@ window[ 'autodescription' ] = {
1141
  }
1142
 
1143
  autodescription.updateCounters();
 
 
 
1144
  },
1145
 
1146
  /**
@@ -1164,16 +1268,46 @@ window[ 'autodescription' ] = {
1164
  * @function
1165
  *
1166
  * @param {String|null} type
1167
- * @return {String} Human Readable Counter name.
1168
  */
1169
  getCounterName: function( type ) {
1170
  'use strict';
1171
 
1172
- var name = autodescriptionL10n[type];
1173
 
1174
  return name;
1175
  },
1176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1177
  /**
1178
  * Initialises all aspects of the scripts.
1179
  *
@@ -1183,33 +1317,31 @@ window[ 'autodescription' ] = {
1183
  * keeps any screen jumping from occuring later on.
1184
  *
1185
  * @since 2.2.4
 
1186
  *
 
1187
  * @function
1188
  */
1189
- ready: function() {
1190
  'use strict';
1191
 
1192
- // Move the page updates notices below the top-wrap.
1193
- jQuery( 'div.updated, div.error, div.notice-warning' ).insertAfter( 'div.top-wrap' );
1194
 
1195
  // Set up additions classes.
1196
- jQuery( document.body ).ready( autodescription.additionsClassInit );
1197
 
1198
  // Toggle Dynamic Title Placeholder onLoad, also toggles doing it right colors.
1199
- jQuery( document.body ).ready( autodescription.dynamicPlaceholderOnLoad );
1200
- // Toggle Title doing it right colors.
1201
- jQuery( document.body ).ready( autodescription.triggerTitleOnLoad );
1202
- // Toggle Description doing it right colors.
1203
- jQuery( document.body ).ready( autodescription.triggerDescriptionOnLoad );
1204
 
1205
  // Check if the Title Tagline or Description Additions should be removed when page is loaded.
1206
- jQuery( document.body ).ready( autodescription.taglineToggleOnload );
1207
 
1208
  // Initialize the status bar hover balloon.
1209
- jQuery( document.body ).ready( autodescription.statusBarHover );
1210
 
1211
  // Initialize status bar removal hover for touch screens.
1212
- jQuery( document.body ).on( 'click touchstart MSPointerDown', autodescription.removeDesc );
1213
 
1214
  // #== Before Change listener
1215
 
@@ -1217,58 +1349,58 @@ window[ 'autodescription' ] = {
1217
  autodescription.attachUnsavedChangesListener();
1218
 
1219
  // Deregister changes.
1220
- jQuery( document.body ).ready( autodescription.onLoadUnregisterChange );
1221
 
1222
  // #== After Change listener
1223
 
1224
  // Bind character counters.
1225
- autodescription.docDescriptions().on( 'keydown keyup paste', autodescription.updateCharacterCountDescription );
1226
- autodescription.docTitles().on( 'keydown keyup paste', autodescription.updateCharacterCountTitle );
1227
 
1228
  // Allow the title separator to be changed dynamically.
1229
- jQuery( '#title-separator input' ).on( 'click', autodescription.separatorSwitch );
1230
  // Allow description separator to be changed dynamically.
1231
- jQuery( '#description-separator input' ).on( 'click', autodescription.separatorSwitchDesc );
1232
 
1233
  // Bind reset confirmation.
1234
- jQuery( '.autodescription-js-confirm-reset' ).on( 'click.autodescription.autodescription_confirm_reset', autodescription.confirmedReset );
1235
 
1236
  // Toggle Tabs in the SEO settings page.
1237
- jQuery( '.seoframework-tab' ).on( 'click', autodescription.tabToggle );
1238
 
1239
  // Toggle Title tagline aditions removal.
1240
- jQuery( '#title-tagline-toggle :input' ).on( 'click', autodescription.taglineToggle );
1241
  // Toggle Title additions location.
1242
- jQuery( '#title-location input' ).on( 'click', autodescription.titleLocationToggle );
1243
  // Toggle Title prefixes display.
1244
- jQuery( '#title-prefixes-toggle :input' ).on( 'click', autodescription.titlePrefixToggle );
1245
 
1246
  // Toggle Description additions removal.
1247
- jQuery( '#description-onblogname-toggle :input' ).on( 'click', autodescription.taglineToggleDesc );
1248
- jQuery( '#description-additions-toggle :input' ).on( 'click', autodescription.additionsToggleDesc );
1249
 
1250
  // Change Home Page Title Example prop on input changes.
1251
- jQuery( '#autodescription-site-settings\\[homepage_title\\]' ).on( 'keydown keyup paste', autodescription.titleProp );
1252
- jQuery( '#home-title-location :input, #title-tagline-toggle :input, #title-separator input' ).on( 'click', autodescription.taglinePropTrigger );
1253
- jQuery( '#autodescription-site-settings\\[homepage_title_tagline\\]' ).on( 'keydown keyup paste', autodescription.taglineProp );
1254
 
1255
  // Make sure the titleProp is correctly rendered when revealed after being hidden.
1256
- jQuery( '#homepage-tab-general' ).on( 'change', autodescription.taglinePropTrigger );
1257
 
1258
  // Change Global Title Example prop on input changes.
1259
- jQuery( '#autodescription-site-settings\\[title_rem_additions\\]' ).on( 'click', autodescription.titleToggle );
1260
 
1261
  // Dynamic Placeholder, acts on keydown for a11y, although more cpu intensive. Acts on keyup for perfect output.
1262
- autodescription.docTitles().on( 'keydown keyup paste', autodescription.dynamicPlaceholder );
1263
 
1264
  // Move click on dynamic additions to focus input behind.
1265
- jQuery( '#autodescription-title-placeholder' ).on( 'click', autodescription.selectTitleInput );
1266
 
1267
  // Dismiss notices.
1268
- jQuery( '.autodescription-dismiss' ).on( 'click', autodescription.dismissNotice );
1269
 
1270
  // AJAX counter
1271
- jQuery( '.theseoframework-counter' ).on( 'click', autodescription.counterUpdate );
1272
 
1273
  }
1274
 
1
  /**
2
+ * This file holds The SEO Framework plugin's JS code.
3
  * Serve JavaScript as an addition, not as a means.
4
  *
5
  * @author Sybre Waaijer https://cyberwire.nl/
49
  */
50
  window[ 'autodescription' ] = {
51
 
52
+ /**
53
+ * Determines if the settings have been changed since visit.
54
+ * @param {Boolean} settingsChanged
55
+ */
56
  settingsChanged: false,
57
 
58
+ /**
59
+ * The current title tagline.
60
+ * @param {String} titleTagline
61
+ */
62
  titleTagline : autodescriptionL10n['titleTagline'],
63
 
64
+ /**
65
+ * @since 2.7.0
66
+ * @param {String} nonce The AJAX nonce
67
+ */
68
+ nonce : autodescriptionL10n['nonce'],
69
+
70
  /**
71
  * Mixed string and int (i10n is string, JS is int).
72
+ * @param {String|int} countertype The autodescription.counterType
73
  */
74
  counterType : autodescriptionL10n['counterType'],
75
 
76
+ /**
77
+ * The current character counter additions class.
78
+ * @param {String} additionsClass
79
+ */
80
  additionsClass : '',
81
 
82
+ /**
83
+ * The current title/description separator.
84
+ * @param {String} titleSeparator
85
+ * @param {String} descriptionSeparator
86
+ */
87
+ titleSeparator : autodescriptionL10n['titleSeparator'],
88
+ descriptionSeparator : autodescriptionL10n['descriptionSeparator'],
89
+
90
  /**
91
  * Cached doctitle function.
92
  *
165
  }
166
 
167
  if ( $length < 100 || $length >= 175 ) {
168
+ $counterClass = 'tsf-count-bad';
169
  $name = autodescription.getCounterName( 'bad' );
170
  } else if ( $length < 137 || ( $length > 155 && $length < 175 ) ) {
171
+ $counterClass = 'tsf-count-okay';
172
  $name = autodescription.getCounterName( 'okay' );
173
  } else {
174
+ $counterClass = 'tsf-count-good';
175
  $name = autodescription.getCounterName( 'good' );
176
  }
177
 
255
  }
256
 
257
  if ( $length < 25 || $length >= 75 ) {
258
+ $counterClass = 'tsf-count-bad';
259
  $name = autodescription.getCounterName( 'bad' );
260
  } else if ( $length < 42 || ( $length > 55 && $length < 75 ) ) {
261
+ $counterClass = 'tsf-count-okay';
262
  $name = autodescription.getCounterName( 'okay' );
263
  } else {
264
+ $counterClass = 'tsf-count-good';
265
  $name = autodescription.getCounterName( 'good' );
266
  }
267
 
298
  return str;
299
  },
300
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  /**
302
  * Dynamic Title separator replacement in metabox
303
  *
312
  var $sep = jQuery( ".autodescription-sep-js" ),
313
  $val = jQuery( event.target ).val();
314
 
315
+ //* Update cache.
316
+ autodescription.titleSeparator = $val;
317
+
318
  if ( 'pipe' === $val ) {
319
  $sep.text( " | " );
320
  } else if ( 'dash' === $val ) {
357
  statusBarHover: function() {
358
  'use strict';
359
 
360
+ var $wrap = jQuery( '.tsf-seo-bar-inner-wrap' ).find( 'a' );
361
 
362
+ $wrap.on( 'mouseenter', autodescription.statusBarHoverEnter );
363
+ $wrap.on( 'mousemove', autodescription.statusBarHoverMove );
364
+ $wrap.on( 'mouseleave', autodescription.statusBarHoverLeave );
365
 
366
  },
367
 
379
  $thisDesc = $this.attr( 'data-desc' );
380
 
381
  if ( $thisDesc !== undefined && 0 === $this.find( 'div' ).length ) {
382
+ $this.append( '<div class="tsf-explanation-desc">' + $thisDesc + '<div></div></div>' );
383
 
384
+ var $thisHeight = $this.find( 'div.tsf-explanation-desc' ).height() + 28;
385
 
386
+ $this.find( 'div.tsf-explanation-desc' ).css( 'top', ( $this.position().top - $thisHeight ) + 'px' );
387
  }
388
  },
389
 
400
 
401
  var $this = jQuery( event.target ),
402
  $pagex = event.pageX,
403
+ $mousex = $pagex - jQuery( '.tsf-seo-bar-inner-wrap' ).offset().left - 11, // 22px width of arrow / 2 = 11 middle
404
+ $balloon = $this.find( '.tsf-explanation-desc' ),
405
  $arrow = $balloon.find( 'div' );
406
 
407
  if ( $mousex < 1 ) {
429
  statusBarHoverLeave: function() {
430
  'use strict';
431
 
432
+ jQuery( this ).find( 'div.tsf-explanation-desc' ).remove();
433
  },
434
 
435
  /**
444
  'use strict';
445
 
446
  var $this = jQuery( event.target ),
447
+ $desc = jQuery('.tsf-seo-bar-inner-wrap a');
448
 
449
  if ( ! $this.closest( $desc ).length )
450
+ $desc.find( 'div.tsf-explanation-desc' ).remove();
451
  },
452
 
453
  /**
472
  $other = jQuery( '.' + $name + '-content' );
473
 
474
  if ( typeof $content !== 'undefined' ) {
475
+ $other.removeClass( 'tsf-active-tab-content' );
476
+ $content.addClass( 'tsf-active-tab-content' );
477
  }
478
  }
 
479
  },
480
 
481
  /**
490
  'use strict';
491
 
492
  var $this = jQuery( event.target ),
493
+ $tag = jQuery( '.tsf-custom-blogname-js' );
494
 
495
  if ( $this.is( ':checked' ) ) {
496
  $tag.css( 'display', 'inline' );
515
  'use strict';
516
 
517
  var $this = jQuery( event.target ),
518
+ $tagDesc = jQuery( '#tsf-on-blogname-js' );
519
 
520
  if ( $this.is(':checked') ) {
521
  $tagDesc.css( 'display', 'inline' );
536
  'use strict';
537
 
538
  var $this = jQuery( event.target ).val(),
539
+ $titleExampleLeft = jQuery( '.tsf-title-additions-example-left' ),
540
+ $titleExampleRight = jQuery( '.tsf-title-additions-example-right' );
541
 
542
  if ( 'right' === $this ) {
543
  $titleExampleLeft.css( 'display', 'none' );
546
  $titleExampleLeft.css( 'display', 'inline' );
547
  $titleExampleRight.css( 'display', 'none' );
548
  }
 
549
  },
550
 
551
  /**
560
  'use strict';
561
 
562
  var $this = jQuery( event.target ),
563
+ $prefix = jQuery( '.tsf-title-prefix-example' );
564
 
565
  if ( $this.is(':checked') ) {
566
  $prefix.css( 'display', 'none' );
567
  } else {
568
  $prefix.css( 'display', 'inline' );
569
  }
 
570
  },
571
 
572
  /**
581
  'use strict';
582
 
583
  var $this = jQuery( event.target ),
584
+ $tagDesc = jQuery( '#tsf-description-additions-js' );
585
 
586
  if ( $this.is(':checked') ) {
587
  $tagDesc.css( 'display', 'inline' );
602
  taglineToggleOnload: function( event ) {
603
  'use strict';
604
 
605
+ var $tagTitle = jQuery( '#tsf-title-tagline-toggle :input' ),
606
+ $title = jQuery( '.tsf-custom-blogname-js' ),
607
+ $tagDescAdditions = jQuery( '#tsf-description-additions-toggle :input' ),
608
+ $descAdditions = jQuery( '#tsf-description-additions-js' ),
609
+ $tagDescBlogname = jQuery( '#tsf-description-onblogname-toggle :input' ),
610
+ $descBlogname = jQuery( '#tsf-on-blogname-js' ),
611
+ $tagTitleAdditions = jQuery( '#tsf-title-additions-toggle :input' ),
612
+ $titleAdditions = jQuery( '.tsf-title-additions-js' );
613
 
614
  if ( $tagTitle.is( ':checked' ) ) {
615
  $title.css( 'display', 'inline' );
672
  'use strict';
673
 
674
  var $val = jQuery( event.target ).val(),
675
+ $floatTag = jQuery( '.tsf-custom-tagline-js' ),
676
  $target = jQuery( '#autodescription-site-settings\\[homepage_title\\]' ),
677
+ $leftRight = jQuery( '#tsf-home-title-location input:checked' ).val(),
678
  $toggle = jQuery( '#autodescription-site-settings\\[homepage_tagline\\]' ),
679
  $title = autodescriptionL10n['siteTitle'],
680
  $placeholder = $title,
681
  $description = autodescriptionL10n['blogDescription'],
682
+ $sep = autodescription.getSep( 'title' );
 
683
 
684
  if ( $toggle.is( ':checked' ) ) {
685
 
686
  if ( $val.length !== 0 ) {
687
+ $description = $val;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
688
  }
689
 
690
  if ( $leftRight.length !== 0 && 'left' === $leftRight ) {
691
+ $placeholder = $title + ' ' + $sep + ' ' + $description;
692
  } else {
693
+ $placeholder = $description + ' ' + $sep + ' ' + $title;
694
  }
695
 
696
  }
697
 
698
+ $floatTag.text( $description );
699
  $target.attr( "placeholder", $placeholder );
700
 
701
  // Notify tagline has changed.
702
+ autodescription.docTitles().trigger( 'input', autodescription.updateCharacterCountTitle );
703
  },
704
 
705
  /**
712
  taglinePropTrigger: function() {
713
  'use strict';
714
 
715
+ jQuery( "#autodescription-site-settings\\[homepage_title_tagline\\]" ).trigger( 'input', autodescription.taglineProp );
716
  },
717
 
718
  /**
726
  'use strict';
727
 
728
  var $this = jQuery( event.target ),
729
+ $tagDesc = jQuery( '.tsf-title-additions-js' );
730
 
731
  if ( $this.is( ':checked' ) ) {
732
  $tagDesc.css( 'display', 'none' );
745
  attachUnsavedChangesListener: function() {
746
  'use strict';
747
 
748
+ jQuery( '.tsf-metaboxes :input, #tsf-inpost-box .inside :input' ).not( '.tsf-tab :input' ).change( function() {
749
  autodescription.registerChange();
750
  });
751
 
752
+ jQuery( '.tsf-metaboxes input[type=text], .tsf-metaboxes textarea, #tsf-inpost-box .inside input[type=text], #tsf-inpost-box .inside textarea' ).not( '.tsf-nav-tab-wrapper :input' ).on( 'input', function() {
753
  autodescription.registerChange();
754
  });
755
 
756
+ window.onbeforeunload = function() {
757
  if ( autodescription.settingsChanged ) {
758
  return autodescriptionL10n['saveAlert'];
759
  }
760
  };
761
 
762
+ jQuery( '.tsf-metaboxes input[type="submit"], #publishing-action input[type="submit"], #save-action input[type="submit"], a.submitdelete' ).click( function() {
763
  window.onbeforeunload = null;
764
  });
765
  },
806
  'use strict';
807
 
808
  var $hasAdditions = autodescriptionL10n['titleAdditions'].length,
809
+ $placeholder = jQuery( '#tsf-title-placeholder' );
810
 
811
  // If check is defined, we're on SEO settings page.
812
  if ( 0 === $hasAdditions ) {
818
  }
819
 
820
  var $after = false,
821
+ $check = jQuery( '#tsf-home-title-location input:checked' ).val(),
822
  $rtl = autodescriptionL10n['isRTL'],
823
  $additions = '';
824
 
864
  }
865
  }
866
 
867
+ var $tagbox = jQuery( '#tsf-title-tagline-toggle :input' );
868
 
869
  if ( typeof $tagbox !== "undefined" && $tagbox.length > 0 && ! $tagbox.is( ':checked' ) ) {
870
  //* We're on SEO Settings Page now, and tagline has been disabled.
876
 
877
  var $this = jQuery( event.target ),
878
  $inputVal = $this.val(),
879
+ $offsetTest = jQuery( "#tsf-title-offset" ),
880
  $offsetWidth = 0,
881
  $heightPad = ( $this.outerHeight( true ) - $this.height() ) / 2,
882
  $horPad = ( $this.outerWidth() - $this.width() ) / 2,
883
  $leftOffset = ( $this.outerWidth( true ) - $this.width() ) / 2,
884
  $taglineVal = jQuery( "#autodescription-site-settings\\[homepage_title_tagline\\]" ).val(),
885
  $pos = 'left',
886
+ $separator = autodescription.getSep( 'title' );
887
 
888
  if ( '1' === $rtl ) {
889
  $pos = 'right';
1005
 
1006
  if ( typeof $input.val() !== "undefined" ) {
1007
  if ( $input.val().length > 0 ) {
1008
+ $input.trigger( 'input', autodescription.dynamicPlaceholder );
1009
  } else {
1010
+ $input.trigger( 'input', autodescription.updateCharacterCountTitle );
1011
  }
1012
  }
 
1013
  },
1014
 
1015
  /**
1024
 
1025
  var $input = autodescription.docDescriptions();
1026
 
1027
+ $input.trigger( 'input', autodescription.updateCharacterCountDescription );
1028
  },
1029
 
1030
 
1040
 
1041
  var $input = autodescription.docTitles();
1042
 
1043
+ $input.trigger( 'input', autodescription.updateCharacterCountTitle );
1044
  },
1045
 
1046
  /**
1058
  },
1059
 
1060
  /**
1061
+ * Dismissible notices. Uses class .tsf-notice.
1062
  *
1063
  * @since 2.6.0
1064
  *
1070
 
1071
  var $this = jQuery( event.target );
1072
 
1073
+ $this.parents( '.tsf-notice' ).slideUp( 200, function() {
1074
  $this.remove();
1075
  });
1076
 
1077
  },
1078
 
1079
+ /**
1080
+ * Visualizes AJAX loading time through target class change.
1081
+ *
1082
+ * @since 2.7.0
1083
+ *
1084
+ * @function
1085
+ * @param {String} target
1086
+ */
1087
+ setAjaxLoader: function( target ) {
1088
+ 'use strict';
1089
+
1090
+ jQuery( target ).toggleClass( 'tsf-loading' );
1091
+ },
1092
+
1093
+ /**
1094
+ * Adjusts class loaders on Ajax response.
1095
+ *
1096
+ * @since 2.7.0
1097
+ *
1098
+ * @function
1099
+ * @param {String} target
1100
+ * @param {Boolean} success
1101
+ */
1102
+ unsetAjaxLoader: function( target, success ) {
1103
+ 'use strict';
1104
+
1105
+ var $newclass = 'tsf-success',
1106
+ $fade = 2500;
1107
+
1108
+ if ( ! success ) {
1109
+ $newclass = 'tsf-error';
1110
+ $fade = 5000;
1111
+ }
1112
+
1113
+ jQuery( target ).removeClass( 'tsf-loading' ).addClass( $newclass ).fadeOut( $fade );
1114
+ },
1115
+
1116
+ /**
1117
+ * Cleans and resets Ajax wrapper class and contents to default.
1118
+ * Also stops any animation and resets fadeout to beginning.
1119
+ *
1120
+ * @since 2.7.0
1121
+ *
1122
+ * @function
1123
+ * @param {String} target
1124
+ */
1125
+ resetAjaxLoader: function( target ) {
1126
+ 'use strict';
1127
+
1128
+ jQuery( target ).stop().empty().attr( 'class', 'tsf-ajax' ).css( 'opacity', '1' ).removeAttr( 'style' );
1129
+ },
1130
+
1131
  /**
1132
  * Updates the counter type.
1133
  *
1134
  * @since 2.6.0
1135
  *
1136
  * @function
1137
+ * @param {jQuery.event} event
1138
  */
1139
+ counterUpdate: function( event ) {
1140
  'use strict';
1141
 
1142
  // Count up, reset to 0 if needed. We have 4 options: 0, 1, 2, 3
1144
  if ( autodescription.counterType > 3 )
1145
  autodescription.counterType = 0;
1146
 
1147
+ //* Update counters locally.
1148
+ autodescription.additionsClassInit();
 
1149
 
1150
+ var $target = '.tsf-counter .tsf-ajax',
1151
+ $status = 0;
1152
+
1153
+ //* Reset ajax loader
1154
+ autodescription.resetAjaxLoader( $target );
1155
+
1156
+ //* Set ajax loader.
1157
+ autodescription.setAjaxLoader( $target );
1158
+
1159
+ //* Setup external update.
1160
+ var settings = {
1161
+ method: 'POST',
1162
+ url: ajaxurl,
1163
+ datatype: 'json',
1164
+ data: {
1165
+ 'action' : 'the_seo_framework_update_counter',
1166
+ 'nonce' : autodescription.nonce,
1167
+ 'val' : autodescription.counterType,
1168
+ },
1169
+ async: true,
1170
+ success: function( response ) {
1171
+
1172
+ response = jQuery.parseJSON( response );
1173
+
1174
+ //* I could do value check, but that will simply lag behind. Unless an annoying execution delay is added.
1175
+ if ( 'success' === response.type )
1176
+ $status = 1;
1177
+
1178
+ autodescription.counterUpdatedResponse( $target, $status );
1179
+ },
1180
+ }
1181
+
1182
+ jQuery.ajax( settings );
1183
+ },
1184
+
1185
+ /**
1186
+ * Visualizes the AJAX response to the user.
1187
+ *
1188
+ * @since 2.7.0
1189
+ *
1190
+ * @function
1191
+ * @param {String} target
1192
+ * @param {Integer} success
1193
+ */
1194
+ counterUpdatedResponse: function( target, success ) {
1195
+ 'use strict';
1196
+
1197
+ switch ( success ) {
1198
+ case 0:
1199
+ autodescription.unsetAjaxLoader( target, false );
1200
+ break;
1201
+ case 1:
1202
+ autodescription.unsetAjaxLoader( target, true );
1203
+ break;
1204
+ default:
1205
+ autodescription.resetAjaxLoader( target );
1206
+ break;
1207
+ }
1208
 
 
1209
  },
1210
 
1211
  /**
1222
  /**
1223
  * Mixed string and int (i10n is string, JS is int).
1224
  * @param {String|int} $counterType
1225
+ * @param {Boolean} $settingsChanged
1226
  */
1227
+ var $counterType = autodescription.counterType,
1228
+ $settingsChanged = autodescription.settingsChanged;
1229
 
1230
  if ( 1 == $counterType ) {
1231
  autodescription.additionsClass = 'tsf-counter-one';
1242
  }
1243
 
1244
  autodescription.updateCounters();
1245
+
1246
+ // Reset settingschanges to previous value.
1247
+ autodescription.settingsChanged = $settingsChanged;
1248
  },
1249
 
1250
  /**
1268
  * @function
1269
  *
1270
  * @param {String|null} type
1271
+ * @return {String} name Human readable counter name.
1272
  */
1273
  getCounterName: function( type ) {
1274
  'use strict';
1275
 
1276
+ var name = autodescriptionL10n[ type ];
1277
 
1278
  return name;
1279
  },
1280
 
1281
+ /**
1282
+ * Returns converted HTML title/description separator.
1283
+ *
1284
+ * @since 2.7.0
1285
+ * @function
1286
+ *
1287
+ * @param {String} type
1288
+ * @return {String} sep The converted separator.
1289
+ */
1290
+ getSep: function( type ) {
1291
+
1292
+ if ( 'title' === type ) {
1293
+ var sep = autodescription.titleSeparator;
1294
+ } else {
1295
+ var sep = autodescription.descriptionSeparator;
1296
+ }
1297
+
1298
+ if ( 'pipe' === sep || '|' === sep ) {
1299
+ sep = ( "|" );
1300
+ } else if ( 'dash' === sep || '-' === sep ) {
1301
+ sep = ( "-" );
1302
+ } else if ( sep.charCodeAt(0) < 123 ) {
1303
+ //* Checked for UTF-8 conversion.
1304
+ // Create a memory div to store the html in, convert to text to append in $placeholder
1305
+ sep = jQuery( '<div/>' ).html( "&" + sep + ";" ).text();
1306
+ }
1307
+
1308
+ return sep;
1309
+ },
1310
+
1311
  /**
1312
  * Initialises all aspects of the scripts.
1313
  *
1317
  * keeps any screen jumping from occuring later on.
1318
  *
1319
  * @since 2.2.4
1320
+ * @since 2.7.0 jQuery object is now passed.
1321
  *
1322
+ * @param {Object} jQ jQuery
1323
  * @function
1324
  */
1325
+ ready: function( jQ ) {
1326
  'use strict';
1327
 
1328
+ // Move the page updates notices below the tsf-top-wrap.
1329
+ jQ( 'div.updated, div.error, div.notice-warning' ).insertAfter( 'div.tsf-top-wrap' );
1330
 
1331
  // Set up additions classes.
1332
+ jQ( document.body ).ready( autodescription.additionsClassInit );
1333
 
1334
  // Toggle Dynamic Title Placeholder onLoad, also toggles doing it right colors.
1335
+ jQ( document.body ).ready( autodescription.dynamicPlaceholderOnLoad );
 
 
 
 
1336
 
1337
  // Check if the Title Tagline or Description Additions should be removed when page is loaded.
1338
+ jQ( document.body ).ready( autodescription.taglineToggleOnload );
1339
 
1340
  // Initialize the status bar hover balloon.
1341
+ jQ( document.body ).ready( autodescription.statusBarHover );
1342
 
1343
  // Initialize status bar removal hover for touch screens.
1344
+ jQ( document.body ).on( 'click touchstart MSPointerDown', autodescription.removeDesc );
1345
 
1346
  // #== Before Change listener
1347
 
1349
  autodescription.attachUnsavedChangesListener();
1350
 
1351
  // Deregister changes.
1352
+ jQ( document.body ).ready( autodescription.onLoadUnregisterChange );
1353
 
1354
  // #== After Change listener
1355
 
1356
  // Bind character counters.
1357
+ autodescription.docDescriptions().on( 'input', autodescription.updateCharacterCountDescription );
1358
+ autodescription.docTitles().on( 'input', autodescription.updateCharacterCountTitle );
1359
 
1360
  // Allow the title separator to be changed dynamically.
1361
+ jQ( '#tsf-title-separator input' ).on( 'click', autodescription.separatorSwitch );
1362
  // Allow description separator to be changed dynamically.
1363
+ jQ( '#tsf-description-separator input' ).on( 'click', autodescription.separatorSwitchDesc );
1364
 
1365
  // Bind reset confirmation.
1366
+ jQ( '.autodescription-js-confirm-reset' ).on( 'click.autodescription.autodescription_confirm_reset', autodescription.confirmedReset );
1367
 
1368
  // Toggle Tabs in the SEO settings page.
1369
+ jQ( '.tsf-tab' ).on( 'click', autodescription.tabToggle );
1370
 
1371
  // Toggle Title tagline aditions removal.
1372
+ jQ( '#tsf-title-tagline-toggle :input' ).on( 'click', autodescription.taglineToggle );
1373
  // Toggle Title additions location.
1374
+ jQ( '#tsf-title-location input' ).on( 'click', autodescription.titleLocationToggle );
1375
  // Toggle Title prefixes display.
1376
+ jQ( '#title-prefixes-toggle :input' ).on( 'click', autodescription.titlePrefixToggle );
1377
 
1378
  // Toggle Description additions removal.
1379
+ jQ( '#tsf-description-onblogname-toggle :input' ).on( 'click', autodescription.taglineToggleDesc );
1380
+ jQ( '#tsf-description-additions-toggle :input' ).on( 'click', autodescription.additionsToggleDesc );
1381
 
1382
  // Change Home Page Title Example prop on input changes.
1383
+ jQ( '#autodescription-site-settings\\[homepage_title\\]' ).on( 'input', autodescription.titleProp );
1384
+ jQ( '#tsf-home-title-location :input, #tsf-title-tagline-toggle :input, #tsf-title-separator input' ).on( 'click', autodescription.taglinePropTrigger );
1385
+ jQ( '#autodescription-site-settings\\[homepage_title_tagline\\]' ).on( 'input', autodescription.taglineProp );
1386
 
1387
  // Make sure the titleProp is correctly rendered when revealed after being hidden.
1388
+ jQ( '#homepage-tab-general' ).on( 'change', autodescription.taglinePropTrigger );
1389
 
1390
  // Change Global Title Example prop on input changes.
1391
+ jQ( '#autodescription-site-settings\\[title_rem_additions\\]' ).on( 'click', autodescription.titleToggle );
1392
 
1393
  // Dynamic Placeholder, acts on keydown for a11y, although more cpu intensive. Acts on keyup for perfect output.
1394
+ autodescription.docTitles().on( 'input', autodescription.dynamicPlaceholder );
1395
 
1396
  // Move click on dynamic additions to focus input behind.
1397
+ jQ( '#tsf-title-placeholder' ).on( 'click', autodescription.selectTitleInput );
1398
 
1399
  // Dismiss notices.
1400
+ jQ( '.tsf-dismiss' ).on( 'click', autodescription.dismissNotice );
1401
 
1402
  // AJAX counter
1403
+ jQ( '.tsf-counter' ).on( 'click', autodescription.counterUpdate );
1404
 
1405
  }
1406
 
lib/js/autodescription.min.js CHANGED
@@ -1,24 +1,25 @@
1
- window.autodescription={i:!1,h:autodescriptionL10n.titleTagline,a:autodescriptionL10n.counterType,c:"",b:function(){return jQuery("#autodescription_title, #autodescription-meta\\[doctitle\\], #autodescription-site-settings\\[homepage_title\\]")},l:function(){return jQuery("#autodescription_description, #autodescription-meta\\[description\\], #autodescription-site-settings\\[homepage_description\\]")},confirm:function(a){return confirm(a)},B:function(a){var b=jQuery(a.target),c=b.val().length,b=b.attr("placeholder").length;
2
- a=jQuery("#"+autodescription.o(a.target.id)+"_chars");var e=autodescription.c,g=autodescription.a,d="",k="",h="";0===c&&(c=b);100>c||175<=c?(d="ad-count-bad",k=autodescription.f("bad")):137>c||155<c&&175>c?(d="ad-count-okay",k=autodescription.f("okay")):(d="ad-count-good",k=autodescription.f("good"));e&&(d+=" "+e);g&&1!=g?2==g?h=k:3==g&&(h=c.toString()+" - "+k):h=c.toString();a.html(h).removeClass().addClass(d)},g:function(a){var b=jQuery(a.target),c=autodescriptionL10n.titleAdditions.length,e=autodescriptionL10n.blogDescription.length,
3
- g=autodescriptionL10n.siteTitle.length,d=b.val().length,k=b.attr("placeholder").length,h=jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").val(),b=3;a=jQuery("#"+autodescription.o(a.target.id)+"_chars");var f=0,n=autodescription.c,p=autodescription.a,l="",m="",q="";autodescription.h||(b=c=0);0===d&&(0!==g?d=g:f=k);0!==d&&(0!==c&&"undefined"!==typeof h&&(c=h.length,c=0!==c?c:e),f=0===c?d:d+b+c);25>f||75<=f?(l="ad-count-bad",m=autodescription.f("bad")):42>f||55<f&&75>f?(l="ad-count-okay",
4
- m=autodescription.f("okay")):(l="ad-count-good",m=autodescription.f("good"));n&&(l+=" "+n);p&&1!=p?2==p?q=m:3==p&&(q=f.toString()+" - "+m):q=f.toString();a.html(q).removeClass().addClass(l)},o:function(a){return a?a.replace(/([\[\]\/])/g,"\\$1"):a},J:function(a){a&&a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return a},N:function(a){var b=jQuery(".autodescription-sep-js");a=jQuery(a.target).val();"pipe"===a?b.text(" | "):"dash"===a?b.text(" - "):b.html(" &"+a+"; ")},O:function(a){var b=
5
- jQuery("#autodescription-descsep-js");a=jQuery(a.target).val();"pipe"===a?b.text(" | "):"dash"===a?b.text(" - "):b.html(" &"+a+"; ")},statusBarHover:function(){var a=jQuery(".ad-bar-wrap").find("a");a.on("mouseenter",autodescription.P);a.on("mousemove",autodescription.S);a.on("mouseleave",autodescription.R)},P:function(){var a=jQuery(this),b=a.attr("data-desc");void 0!==b&&0===a.find("div").length&&(a.append('<div class="explanation-desc">'+b+"<div></div></div>"),b=a.find("div.explanation-desc").height()+
6
- 28,a.find("div.explanation-desc").css("top",a.position().top-b+"px"))},S:function(a){var b=jQuery(a.target);a=a.pageX;var c=a-jQuery(".ad-bar-wrap").offset().left-11,e=b.find(".explanation-desc"),b=e.find("div");if(1>c)b.css("left","0px");else if(void 0!==e.offset()){var g=e.width(),e=e.offset().left+g+11;a>e?b.css("left",g+"px"):b.css("left",c+"px")}},R:function(){jQuery(this).find("div.explanation-desc").remove()},L:function(a){a=jQuery(a.target);var b=jQuery(".ad-bar-wrap a");a.closest(b).length||
7
- b.find("div.explanation-desc").remove()},T:function(a){var b=jQuery(a.target).attr("id");a=jQuery(a.target).attr("name");"undefined"!==typeof b&&(b=jQuery("#"+b+"-content"),a=jQuery("."+a+"-content"),"undefined"!==typeof b&&(a.removeClass("seoframework-active-tab-content"),b.addClass("seoframework-active-tab-content")))},U:function(a){a=jQuery(a.target);var b=jQuery(".custom-blogname-js");a.is(":checked")?(b.css("display","inline"),autodescription.h=!0):(b.css("display","none"),autodescription.h=
8
- !1);autodescription.b().trigger("keyup",autodescription.g)},V:function(a){a=jQuery(a.target);var b=jQuery("#on-blogname-js");a.is(":checked")?b.css("display","inline"):b.css("display","none")},X:function(a){a=jQuery(a.target).val();var b=jQuery(".title-additions-example-left"),c=jQuery(".title-additions-example-right");"right"===a?(b.css("display","none"),c.css("display","inline")):(b.css("display","inline"),c.css("display","none"))},Y:function(a){a=jQuery(a.target);var b=jQuery(".title-prefix-example");
9
- a.is(":checked")?b.css("display","none"):b.css("display","inline")},C:function(a){a=jQuery(a.target);var b=jQuery("#description-additions-js");a.is(":checked")?b.css("display","inline"):b.css("display","none")},W:function(){var a=jQuery("#title-tagline-toggle :input"),b=jQuery(".custom-blogname-js"),c=jQuery("#description-additions-toggle :input"),e=jQuery("#description-additions-js"),g=jQuery("#description-onblogname-toggle :input"),d=jQuery("#on-blogname-js"),k=jQuery("#title-additions-toggle :input"),
10
- h=jQuery(".title-additions-js");a.is(":checked")?b.css("display","inline"):b.css("display","none");c.is(":checked")?e.css("display","inline"):e.css("display","none");g.is(":checked")?d.css("display","inline"):d.css("display","none");k.is(":checked")?h.css("display","none"):h.css("display","inline")},Z:function(a){a=jQuery(a.target).val();var b=jQuery(".custom-title-js");0===a.length?b.text(autodescriptionL10n.siteTitle):b.text(a)},u:function(a){a=jQuery(a.target).val();var b=jQuery(".custom-tagline-js"),
11
- c=jQuery("#autodescription-site-settings\\[homepage_title\\]"),e=jQuery("#home-title-location input:checked").val(),g=jQuery("#autodescription-site-settings\\[homepage_tagline\\]"),d=autodescriptionL10n.siteTitle,k=d,h=autodescriptionL10n.blogDescription,f=jQuery("#title-separator input:checked").val(),n=autodescriptionL10n.titleSeparator;g.is(":checked")&&(0!==a.length&&(a=autodescription.J(a),h=jQuery("<div/>").text(a).html()),0!==f.length&&(n="pipe"===f?"|":"dash"===f?"-":jQuery("<div/>").html("&"+
12
- f+";").text()),k=0!==e.length&&"left"===e?d+" "+n+" "+h:h+" "+n+" "+d);b.html(h);c.attr("placeholder",k);autodescription.b().trigger("keyup",autodescription.g)},v:function(){jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").trigger("keyup",autodescription.u)},aa:function(){var a=jQuery(event.target),b=jQuery(".title-additions-js");a.is(":checked")?b.css("display","none"):b.css("display","inline")},D:function(){jQuery("div.autodescription-metaboxes :input, div#theseoframework-inpost-box .inside :input").not(".seoframework-tab :input").change(function(){autodescription.s()});
13
- jQuery("div.autodescription-metaboxes input[type=text], div.autodescription-metaboxes textarea, div#theseoframework-inpost-box .inside input[type=text], div#theseoframework-inpost-box .inside textarea").not(".nav-tab-wrapper :input").on("keyup",function(){autodescription.s()});window.onbeforeunload=function(){if(autodescription.i)return autodescriptionL10n.saveAlert};jQuery('div.autodescription-metaboxes input[type="submit"], div#publishing-action input[type="submit"], div#save-action input[type="submit"], a.submitdelete').click(function(){window.onbeforeunload=
14
- null})},s:function(){autodescription.i=!0},F:function(){return confirm(autodescriptionL10n.confirmReset)},m:function(a){var b=autodescriptionL10n.titleAdditions.length,c=jQuery("#autodescription-title-placeholder");if(0===b)return a=jQuery(a.target),a.css("text-indent","initial"),c.empty();var b=!1,e=jQuery("#home-title-location input:checked").val(),g=autodescriptionL10n.isRTL,d="";"undefined"!==typeof e&&0!==e.length?"1"===g?"right"===e&&(b=!0):"left"===e&&(b=!0):(d=autodescriptionL10n.titleLocation,
15
- e=autodescription.h,"1"===autodescriptionL10n.isHome?"1"===e&&("1"===g?"right"===d&&(b=!0):"left"===d&&(b=!0)):"1"===g?"left"===d&&(b=!0):"right"===d&&(b=!0));d=jQuery("#title-tagline-toggle :input");if("undefined"!==typeof d&&0<d.length&&!d.is(":checked"))a=jQuery(a.target),a.css("text-indent","initial"),c.css("display","none");else{a=jQuery(a.target);var k=a.val(),h=jQuery("#autodescription-title-offset"),f=0,n=(a.outerHeight(!0)-a.height())/2,p=(a.outerWidth()-a.width())/2,e=(a.outerWidth(!0)-
16
- a.width())/2,f=jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").val(),l="left",m=autodescriptionL10n.titleSeparator;"1"===g&&(l="right");"undefined"!==typeof f&&0===f.length&&(f=autodescriptionL10n.blogDescription);b?(d=m+" "+autodescriptionL10n.titleAdditions,"undefined"!==typeof f&&0<f.length&&(d=m+" "+f),a.css("text-indent","initial")):(d=autodescriptionL10n.titleAdditions+" "+m,"undefined"!==typeof f&&0<f.length&&(d=f+" "+m));h.text(k);h.css({fontFamily:a.css("fontFamily"),
17
- fontWeight:a.css("fontWeight"),letterSpacing:a.css("letterSpacing"),fontSize:a.css("fontSize")});f=h.width();g=a.width()-p-f;0>g&&(g=0);c.css({display:a.css("display"),lineHeight:a.css("lineHeight"),paddingTop:n+"px",paddingBottom:n+"px",fontFamily:a.css("fontFamily"),fontWeight:a.css("fontWeight"),fontSize:a.css("fontSize"),letterSpacing:a.css("letterSpacing"),maxWidth:g+"px"});"undefined"===typeof k||1>k.length?(b||a.css("text-indent","initial"),c.empty()):(c.text(d),a.outerWidth()>e&&(b?c.css(l,
18
- p+e+h.width()+"px"):(b=p+c.width(),0>b&&(b=0),c.css(l,e+"px"),a.css("text-indent",b+"px"))))}},M:function(){var a=autodescription.b();a.focus();if(a.setSelectionRange){var b=2*a.val().length;a.setSelectionRange(b,b)}else a.val(a.val()).focus()},I:function(){var a=autodescription.b();"undefined"!==typeof a.val()&&(0<a.val().length?a.trigger("keyup",autodescription.m):a.trigger("keyup",autodescription.g))},w:function(){autodescription.l().trigger("keyup",autodescription.B)},A:function(){autodescription.b().trigger("keyup",
19
- autodescription.g)},K:function(){autodescription.i=!1},H:function(a){var b=jQuery(a.target);b.parents(".seo-notice").slideUp(200,function(){b.remove()})},G:function(){autodescription.a+=1;3<autodescription.a&&(autodescription.a=0);jQuery.post(ajaxurl,{action:"the_seo_framework_update_counter"});autodescription.j()},j:function(){var a=autodescription.a;1==a?(autodescription.c="tsf-counter-one",autodescription.a=1):2==a?(autodescription.c="tsf-counter-two",autodescription.a=2):3==a?(autodescription.c=
20
- "tsf-counter-three",autodescription.a=3):(autodescription.c="tsf-counter-zero",autodescription.a=0);autodescription.ba()},ba:function(){autodescription.A();autodescription.w()},f:function(a){return autodescriptionL10n[a]},ready:function(){jQuery("div.updated, div.error, div.notice-warning").insertAfter("div.top-wrap");jQuery(document.body).ready(autodescription.j);jQuery(document.body).ready(autodescription.I);jQuery(document.body).ready(autodescription.A);jQuery(document.body).ready(autodescription.w);
21
- jQuery(document.body).ready(autodescription.W);jQuery(document.body).ready(autodescription.statusBarHover);jQuery(document.body).on("click touchstart MSPointerDown",autodescription.L);autodescription.D();jQuery(document.body).ready(autodescription.K);autodescription.l().on("keydown keyup paste",autodescription.B);autodescription.b().on("keydown keyup paste",autodescription.g);jQuery("#title-separator input").on("click",autodescription.N);jQuery("#description-separator input").on("click",autodescription.O);
22
- jQuery(".autodescription-js-confirm-reset").on("click.autodescription.autodescription_confirm_reset",autodescription.F);jQuery(".seoframework-tab").on("click",autodescription.T);jQuery("#title-tagline-toggle :input").on("click",autodescription.U);jQuery("#title-location input").on("click",autodescription.X);jQuery("#title-prefixes-toggle :input").on("click",autodescription.Y);jQuery("#description-onblogname-toggle :input").on("click",autodescription.V);jQuery("#description-additions-toggle :input").on("click",
23
- autodescription.C);jQuery("#autodescription-site-settings\\[homepage_title\\]").on("keydown keyup paste",autodescription.Z);jQuery("#home-title-location :input, #title-tagline-toggle :input, #title-separator input").on("click",autodescription.v);jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").on("keydown keyup paste",autodescription.u);jQuery("#homepage-tab-general").on("change",autodescription.v);jQuery("#autodescription-site-settings\\[title_rem_additions\\]").on("click",autodescription.aa);
24
- autodescription.b().on("keydown keyup paste",autodescription.m);jQuery("#autodescription-title-placeholder").on("click",autodescription.M);jQuery(".autodescription-dismiss").on("click",autodescription.H);jQuery(".theseoframework-counter").on("click",autodescription.G)}};jQuery(autodescription.ready);
 
1
+ window.autodescription={g:!1,i:autodescriptionL10n.titleTagline,N:autodescriptionL10n.nonce,a:autodescriptionL10n.counterType,c:"",B:autodescriptionL10n.titleSeparator,K:autodescriptionL10n.descriptionSeparator,b:function(){return jQuery("#autodescription_title, #autodescription-meta\\[doctitle\\], #autodescription-site-settings\\[homepage_title\\]")},l:function(){return jQuery("#autodescription_description, #autodescription-meta\\[description\\], #autodescription-site-settings\\[homepage_description\\]")},
2
+ confirm:function(a){return confirm(a)},D:function(a){var b=jQuery(a.target),d=b.val().length,c=b.attr("placeholder").length;a=jQuery("#"+autodescription.o(a.target.id)+"_chars");var b=autodescription.c,f=autodescription.a,e,h="";0===d&&(d=c);100>d||175<=d?(c="tsf-count-bad",e=autodescription.f("bad")):137>d||155<d&&175>d?(c="tsf-count-okay",e=autodescription.f("okay")):(c="tsf-count-good",e=autodescription.f("good"));b&&(c+=" "+b);f&&1!=f?2==f?h=e:3==f&&(h=d.toString()+" - "+e):h=d.toString();a.html(h).removeClass().addClass(c)},
3
+ h:function(a){var b=jQuery(a.target),d=autodescriptionL10n.titleAdditions.length,c=autodescriptionL10n.blogDescription.length,f=autodescriptionL10n.siteTitle.length,e=b.val().length,h=b.attr("placeholder").length,k=jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").val(),g=3;a=jQuery("#"+autodescription.o(a.target.id)+"_chars");var l=0,b=autodescription.c,n=autodescription.a,m="";autodescription.i||(g=d=0);0===e&&(0!==f?e=f:l=h);0!==e&&(0!==d&&"undefined"!==typeof k&&(d=k.length,
4
+ d=0!==d?d:c),l=0===d?e:e+g+d);25>l||75<=l?(c="tsf-count-bad",e=autodescription.f("bad")):42>l||55<l&&75>l?(c="tsf-count-okay",e=autodescription.f("okay")):(c="tsf-count-good",e=autodescription.f("good"));b&&(c+=" "+b);n&&1!=n?2==n?m=e:3==n&&(m=l.toString()+" - "+e):m=l.toString();a.html(m).removeClass().addClass(c)},o:function(a){return a?a.replace(/([\[\]\/])/g,"\\$1"):a},S:function(a){var b=jQuery(".autodescription-sep-js");a=jQuery(a.target).val();autodescription.B=a;"pipe"===a?b.text(" | "):"dash"===
5
+ a?b.text(" - "):b.html(" &"+a+"; ")},T:function(a){var b=jQuery("#autodescription-descsep-js");a=jQuery(a.target).val();"pipe"===a?b.text(" | "):"dash"===a?b.text(" - "):b.html(" &"+a+"; ")},statusBarHover:function(){var a=jQuery(".tsf-seo-bar-inner-wrap").find("a");a.on("mouseenter",autodescription.V);a.on("mousemove",autodescription.X);a.on("mouseleave",autodescription.W)},V:function(){var a=jQuery(this),b=a.attr("data-desc");void 0!==b&&0===a.find("div").length&&(a.append('<div class="tsf-explanation-desc">'+
6
+ b+"<div></div></div>"),b=a.find("div.tsf-explanation-desc").height()+28,a.find("div.tsf-explanation-desc").css("top",a.position().top-b+"px"))},X:function(a){var b=jQuery(a.target);a=a.pageX;var d=a-jQuery(".tsf-seo-bar-inner-wrap").offset().left-11,c=b.find(".tsf-explanation-desc"),b=c.find("div");if(1>d)b.css("left","0px");else if(void 0!==c.offset()){var f=c.width(),c=c.offset().left+f+11;a>c?b.css("left",f+"px"):b.css("left",d+"px")}},W:function(){jQuery(this).find("div.tsf-explanation-desc").remove()},
7
+ P:function(a){a=jQuery(a.target);var b=jQuery(".tsf-seo-bar-inner-wrap a");a.closest(b).length||b.find("div.tsf-explanation-desc").remove()},Y:function(a){var b=jQuery(a.target).attr("id");a=jQuery(a.target).attr("name");"undefined"!==typeof b&&(b=jQuery("#"+b+"-content"),a=jQuery("."+a+"-content"),"undefined"!==typeof b&&(a.removeClass("tsf-active-tab-content"),b.addClass("tsf-active-tab-content")))},Z:function(a){a=jQuery(a.target);var b=jQuery(".tsf-custom-blogname-js");a.is(":checked")?(b.css("display",
8
+ "inline"),autodescription.i=!0):(b.css("display","none"),autodescription.i=!1);autodescription.b().trigger("keyup",autodescription.h)},aa:function(a){a=jQuery(a.target);var b=jQuery("#tsf-on-blogname-js");a.is(":checked")?b.css("display","inline"):b.css("display","none")},ca:function(a){a=jQuery(a.target).val();var b=jQuery(".tsf-title-additions-example-left"),d=jQuery(".tsf-title-additions-example-right");"right"===a?(b.css("display","none"),d.css("display","inline")):(b.css("display","inline"),
9
+ d.css("display","none"))},da:function(a){a=jQuery(a.target);var b=jQuery(".tsf-title-prefix-example");a.is(":checked")?b.css("display","none"):b.css("display","inline")},F:function(a){a=jQuery(a.target);var b=jQuery("#tsf-description-additions-js");a.is(":checked")?b.css("display","inline"):b.css("display","none")},ba:function(){var a=jQuery("#tsf-title-tagline-toggle :input"),b=jQuery(".tsf-custom-blogname-js"),d=jQuery("#tsf-description-additions-toggle :input"),c=jQuery("#tsf-description-additions-js"),
10
+ f=jQuery("#tsf-description-onblogname-toggle :input"),e=jQuery("#tsf-on-blogname-js"),h=jQuery("#tsf-title-additions-toggle :input"),k=jQuery(".tsf-title-additions-js");a.is(":checked")?b.css("display","inline"):b.css("display","none");d.is(":checked")?c.css("display","inline"):c.css("display","none");f.is(":checked")?e.css("display","inline"):e.css("display","none");h.is(":checked")?k.css("display","none"):k.css("display","inline")},ea:function(a){a=jQuery(a.target).val();var b=jQuery(".custom-title-js");
11
+ 0===a.length?b.text(autodescriptionL10n.siteTitle):b.text(a)},w:function(a){a=jQuery(a.target).val();var b=jQuery(".tsf-custom-tagline-js"),d=jQuery("#autodescription-site-settings\\[homepage_title\\]"),c=jQuery("#tsf-home-title-location input:checked").val(),f=jQuery("#autodescription-site-settings\\[homepage_tagline\\]"),e=autodescriptionL10n.siteTitle,h=e,k=autodescriptionL10n.blogDescription,g=autodescription.s("title");f.is(":checked")&&(0!==a.length&&(k=a),h=0!==c.length&&"left"===c?e+" "+g+
12
+ " "+k:k+" "+g+" "+e);b.text(k);d.attr("placeholder",h);autodescription.b().trigger("input",autodescription.h)},A:function(){jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").trigger("input",autodescription.w)},fa:function(){var a=jQuery(event.target),b=jQuery(".tsf-title-additions-js");a.is(":checked")?b.css("display","none"):b.css("display","inline")},G:function(){jQuery(".tsf-metaboxes :input, #tsf-inpost-box .inside :input").not(".tsf-tab :input").change(function(){autodescription.u()});
13
+ jQuery(".tsf-metaboxes input[type=text], .tsf-metaboxes textarea, #tsf-inpost-box .inside input[type=text], #tsf-inpost-box .inside textarea").not(".tsf-nav-tab-wrapper :input").on("input",function(){autodescription.u()});window.onbeforeunload=function(){if(autodescription.g)return autodescriptionL10n.saveAlert};jQuery('.tsf-metaboxes input[type="submit"], #publishing-action input[type="submit"], #save-action input[type="submit"], a.submitdelete').click(function(){window.onbeforeunload=null})},u:function(){autodescription.g=
14
+ !0},H:function(){return confirm(autodescriptionL10n.confirmReset)},m:function(a){var b=autodescriptionL10n.titleAdditions.length,d=jQuery("#tsf-title-placeholder");if(0===b)return a=jQuery(a.target),a.css("text-indent","initial"),d.empty();var b=!1,c=jQuery("#tsf-home-title-location input:checked").val(),f=autodescriptionL10n.isRTL;if("undefined"!==typeof c&&0!==c.length)"1"===f?"right"===c&&(b=!0):"left"===c&&(b=!0);else{var c=autodescriptionL10n.titleLocation,e=autodescription.i;"1"===autodescriptionL10n.isHome?
15
+ "1"===e&&("1"===f?"right"===c&&(b=!0):"left"===c&&(b=!0)):"1"===f?"left"===c&&(b=!0):"right"===c&&(b=!0)}c=jQuery("#tsf-title-tagline-toggle :input");if("undefined"!==typeof c&&0<c.length&&!c.is(":checked"))a=jQuery(a.target),a.css("text-indent","initial"),d.css("display","none");else{a=jQuery(a.target);var h=a.val(),k=jQuery("#tsf-title-offset"),g,l=(a.outerHeight(!0)-a.height())/2,n=(a.outerWidth()-a.width())/2,c=(a.outerWidth(!0)-a.width())/2;g=jQuery("#autodescription-site-settings\\[homepage_title_tagline\\]").val();
16
+ var e="left",m=autodescription.s("title");"1"===f&&(e="right");"undefined"!==typeof g&&0===g.length&&(g=autodescriptionL10n.blogDescription);b?(f=m+" "+autodescriptionL10n.titleAdditions,"undefined"!==typeof g&&0<g.length&&(f=m+" "+g),a.css("text-indent","initial")):(f=autodescriptionL10n.titleAdditions+" "+m,"undefined"!==typeof g&&0<g.length&&(f=g+" "+m));k.text(h);k.css({fontFamily:a.css("fontFamily"),fontWeight:a.css("fontWeight"),letterSpacing:a.css("letterSpacing"),fontSize:a.css("fontSize")});
17
+ g=k.width();g=a.width()-n-g;0>g&&(g=0);d.css({display:a.css("display"),lineHeight:a.css("lineHeight"),paddingTop:l+"px",paddingBottom:l+"px",fontFamily:a.css("fontFamily"),fontWeight:a.css("fontWeight"),fontSize:a.css("fontSize"),letterSpacing:a.css("letterSpacing"),maxWidth:g+"px"});"undefined"===typeof h||1>h.length?(b||a.css("text-indent","initial"),d.empty()):(d.text(f),a.outerWidth()>c&&(b?d.css(e,n+c+k.width()+"px"):(b=n+d.width(),0>b&&(b=0),d.css(e,c+"px"),a.css("text-indent",b+"px"))))}},
18
+ R:function(){var a=autodescription.b();a.focus();if(a.setSelectionRange){var b=2*a.val().length;a.setSelectionRange(b,b)}else a.val(a.val()).focus()},M:function(){var a=autodescription.b();"undefined"!==typeof a.val()&&(0<a.val().length?a.trigger("input",autodescription.m):a.trigger("input",autodescription.h))},ga:function(){autodescription.l().trigger("input",autodescription.D)},ha:function(){autodescription.b().trigger("input",autodescription.h)},O:function(){autodescription.g=!1},L:function(a){var b=
19
+ jQuery(a.target);b.parents(".tsf-notice").slideUp(200,function(){b.remove()})},U:function(a){jQuery(a).toggleClass("tsf-loading")},C:function(a,b){var d="tsf-success",c=2500;b||(d="tsf-error",c=5E3);jQuery(a).removeClass("tsf-loading").addClass(d).fadeOut(c)},v:function(a){jQuery(a).stop().empty().attr("class","tsf-ajax").css("opacity","1").removeAttr("style")},I:function(){autodescription.a+=1;3<autodescription.a&&(autodescription.a=0);autodescription.j();var a=0;autodescription.v(".tsf-counter .tsf-ajax");
20
+ autodescription.U(".tsf-counter .tsf-ajax");jQuery.ajax({method:"POST",url:ajaxurl,ja:"json",data:{action:"the_seo_framework_update_counter",nonce:autodescription.N,val:autodescription.a},async:!0,success:function(b){b=jQuery.parseJSON(b);"success"===b.type&&(a=1);autodescription.J(".tsf-counter .tsf-ajax",a)}})},J:function(a,b){switch(b){case 0:autodescription.C(a,!1);break;case 1:autodescription.C(a,!0);break;default:autodescription.v(a)}},j:function(){var a=autodescription.a,b=autodescription.g;
21
+ 1==a?(autodescription.c="tsf-counter-one",autodescription.a=1):2==a?(autodescription.c="tsf-counter-two",autodescription.a=2):3==a?(autodescription.c="tsf-counter-three",autodescription.a=3):(autodescription.c="tsf-counter-zero",autodescription.a=0);autodescription.ia();autodescription.g=b},ia:function(){autodescription.ha();autodescription.ga()},f:function(a){return autodescriptionL10n[a]},s:function(a){a="title"===a?autodescription.B:autodescription.K;"pipe"===a||"|"===a?a="|":"dash"===a||"-"===
22
+ a?a="-":123>a.charCodeAt(0)&&(a=jQuery("<div/>").html("&"+a+";").text());return a},ready:function(a){a("div.updated, div.error, div.notice-warning").insertAfter("div.tsf-top-wrap");a(document.body).ready(autodescription.j);a(document.body).ready(autodescription.M);a(document.body).ready(autodescription.ba);a(document.body).ready(autodescription.statusBarHover);a(document.body).on("click touchstart MSPointerDown",autodescription.P);autodescription.G();a(document.body).ready(autodescription.O);autodescription.l().on("input",
23
+ autodescription.D);autodescription.b().on("input",autodescription.h);a("#tsf-title-separator input").on("click",autodescription.S);a("#tsf-description-separator input").on("click",autodescription.T);a(".autodescription-js-confirm-reset").on("click.autodescription.autodescription_confirm_reset",autodescription.H);a(".tsf-tab").on("click",autodescription.Y);a("#tsf-title-tagline-toggle :input").on("click",autodescription.Z);a("#tsf-title-location input").on("click",autodescription.ca);a("#title-prefixes-toggle :input").on("click",
24
+ autodescription.da);a("#tsf-description-onblogname-toggle :input").on("click",autodescription.aa);a("#tsf-description-additions-toggle :input").on("click",autodescription.F);a("#autodescription-site-settings\\[homepage_title\\]").on("input",autodescription.ea);a("#tsf-home-title-location :input, #tsf-title-tagline-toggle :input, #tsf-title-separator input").on("click",autodescription.A);a("#autodescription-site-settings\\[homepage_title_tagline\\]").on("input",autodescription.w);a("#homepage-tab-general").on("change",
25
+ autodescription.A);a("#autodescription-site-settings\\[title_rem_additions\\]").on("click",autodescription.fa);autodescription.b().on("input",autodescription.m);a("#tsf-title-placeholder").on("click",autodescription.R);a(".tsf-dismiss").on("click",autodescription.L);a(".tsf-counter").on("click",autodescription.I)}};jQuery(autodescription.ready);
load.class.php CHANGED
@@ -16,6 +16,28 @@
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  add_action( 'plugins_loaded', 'the_seo_framework_init', 5 );
20
  /**
21
  * Load The_SEO_Framework_Load class
@@ -29,6 +51,7 @@ add_action( 'plugins_loaded', 'the_seo_framework_init', 5 );
29
  * @since 2.2.5
30
  */
31
  function the_seo_framework_init() {
 
32
  //* Cache the class. Do not run everything more than once.
33
  static $the_seo_framework = null;
34
 
@@ -40,19 +63,14 @@ function the_seo_framework_init() {
40
  }
41
 
42
  /**
43
- * Allow this plugin to load through filter
44
- *
45
- * Applies the_seo_framework_load filters.
46
  *
47
- * @return bool allow loading of plugin
48
- *
49
- * @since 2.1.0
50
- * @staticvar bool $loaded
51
- *
52
- * New function name.
53
  * @since 2.3.7
 
 
54
  *
55
  * @action plugins_loaded
 
56
  */
57
  function the_seo_framework_load() {
58
 
@@ -65,37 +83,31 @@ function the_seo_framework_load() {
65
  }
66
 
67
  /**
68
- * Load plugin files
69
  * @uses THE_SEO_FRAMEWORK_DIR_PATH_FUNCT
70
  * @uses THE_SEO_FRAMEWORK_DIR_PATH_CLASS
71
  *
72
- * @benchmarked require_once (file inclusion) takes less than 0.0001s.
73
- *
74
  * @since 2.1.6
75
  */
76
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'compat.php' );
77
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'optionsapi.php' );
78
- //require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'benchmark.php' );
79
 
80
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'core.class.php' );
81
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'debug.class.php' );
82
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'compat.class.php' );
83
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'query.class.php' );
84
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'init.class.php' );
85
- require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'admininit.class.php' );
86
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'render.class.php' );
87
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'detect.class.php' );
88
-
89
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'postdata.class.php' );
90
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'termdata.class.php' );
91
-
92
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate.class.php' );
93
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-description.class.php' );
94
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-title.class.php' );
95
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-url.class.php' );
96
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-image.class.php' );
97
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-ldjson.class.php' );
98
-
99
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'search.class.php' );
100
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'doingitright.class.php' );
101
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'inpost.class.php' );
@@ -130,6 +142,23 @@ class The_SEO_Framework_Load extends The_SEO_Framework_Deprecated {
130
  public $the_seo_framework_use_transients = true;
131
  public $script_debug = false;
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  /**
134
  * Constructor, setup debug vars and then load parent constructor.
135
  */
@@ -203,7 +232,7 @@ class The_SEO_Framework_Load extends The_SEO_Framework_Deprecated {
203
  if ( is_object( $class ) && is_string( $method ) ) {
204
  $class = get_class( $class );
205
 
206
- if ( $class === get_class( $this ) ) {
207
  if ( method_exists( $this, $method ) ) {
208
  if ( empty( $args ) ) {
209
  // In-Object calling.
@@ -213,7 +242,7 @@ class The_SEO_Framework_Load extends The_SEO_Framework_Deprecated {
213
  $output = call_user_func_array( array( $this, $method ), $args );
214
  }
215
  } else {
216
- $this->_doing_it_wrong( (string) $class . '::' . (string) $method, __( "Class or Method not found.", 'autodescription' ), $version );
217
  }
218
  } else {
219
  if ( method_exists( $class, $method ) ) {
@@ -223,10 +252,10 @@ class The_SEO_Framework_Load extends The_SEO_Framework_Deprecated {
223
  $output = call_user_func_array( array( $class, $method ), $args );
224
  }
225
  } else {
226
- $this->_doing_it_wrong( (string) $class . '::' . (string) $method, __( "Class or Method not found.", 'autodescription' ), $version );
227
  }
228
  }
229
- } else if ( is_string( $class ) && is_string( $method ) ) {
230
  //* This could be combined with the one above.
231
  if ( method_exists( $class, $method ) ) {
232
  if ( empty( $args ) ) {
@@ -235,9 +264,9 @@ class The_SEO_Framework_Load extends The_SEO_Framework_Deprecated {
235
  $output = call_user_func_array( array( $class, $method ), $args );
236
  }
237
  } else {
238
- $this->_doing_it_wrong( (string) $class . '::' . (string) $method, __( "Class or Method not found.", 'autodescription' ), $version );
239
  }
240
- } else if ( is_string( $class ) ) {
241
  //* Class is function.
242
  $func = $class;
243
 
@@ -247,10 +276,9 @@ class The_SEO_Framework_Load extends The_SEO_Framework_Deprecated {
247
  $output = call_user_func_array( $func, $args );
248
  }
249
  } else {
250
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, __( "Function needs to be called as a string.", 'autodescription' ), $version );
251
  }
252
 
253
  return $output;
254
  }
255
-
256
  }
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
  */
18
 
19
+ defined( 'ABSPATH' ) or die;
20
+
21
+ add_action( 'admin_init', 'the_seo_framework_upgrade', 5 );
22
+ /**
23
+ * Determines whether the plugin needs an option upgrade.
24
+ *
25
+ * @action admin_init
26
+ * @priority 5
27
+ *
28
+ * @since 2.7.0
29
+ */
30
+ function the_seo_framework_upgrade() {
31
+
32
+ if ( false === the_seo_framework_active() )
33
+ return;
34
+
35
+ if ( get_option( 'the_seo_framework_upgraded_db_version' ) >= THE_SEO_FRAMEWORK_DB_VERSION )
36
+ return;
37
+
38
+ require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'upgrade.php' );
39
+ }
40
+
41
  add_action( 'plugins_loaded', 'the_seo_framework_init', 5 );
42
  /**
43
  * Load The_SEO_Framework_Load class
51
  * @since 2.2.5
52
  */
53
  function the_seo_framework_init() {
54
+
55
  //* Cache the class. Do not run everything more than once.
56
  static $the_seo_framework = null;
57
 
63
  }
64
 
65
  /**
66
+ * Determines whether this plugin should load.
 
 
67
  *
 
 
 
 
 
 
68
  * @since 2.3.7
69
+ * @staticvar bool $loaded
70
+ * Applies filters 'the_seo_framework_load' : bool
71
  *
72
  * @action plugins_loaded
73
+ * @return bool Whether to allow loading of plugin.
74
  */
75
  function the_seo_framework_load() {
76
 
83
  }
84
 
85
  /**
86
+ * Load plugin files.
87
  * @uses THE_SEO_FRAMEWORK_DIR_PATH_FUNCT
88
  * @uses THE_SEO_FRAMEWORK_DIR_PATH_CLASS
89
  *
 
 
90
  * @since 2.1.6
91
  */
92
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'compat.php' );
93
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'optionsapi.php' );
 
94
 
95
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'core.class.php' );
96
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'debug.class.php' );
97
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'compat.class.php' );
98
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'query.class.php' );
99
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'init.class.php' );
100
+ require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'admin-init.class.php' );
101
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'render.class.php' );
102
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'detect.class.php' );
 
103
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'postdata.class.php' );
104
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'termdata.class.php' );
 
105
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate.class.php' );
106
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-description.class.php' );
107
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-title.class.php' );
108
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-url.class.php' );
109
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-image.class.php' );
110
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'generate-ldjson.class.php' );
 
111
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'search.class.php' );
112
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'doingitright.class.php' );
113
  require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'inpost.class.php' );
142
  public $the_seo_framework_use_transients = true;
143
  public $script_debug = false;
144
 
145
+ /**
146
+ * Unserializing instances of this class is forbidden.
147
+ */
148
+ private function __wakeup() { }
149
+
150
+ /**
151
+ * Cloning of this class is forbidden.
152
+ */
153
+ private function __clone() { }
154
+
155
+ /**
156
+ * Handle unapproachable invoked methods.
157
+ */
158
+ public function __call( $name, $arguments ) {
159
+ parent::__call( $name, $arguments );
160
+ }
161
+
162
  /**
163
  * Constructor, setup debug vars and then load parent constructor.
164
  */
232
  if ( is_object( $class ) && is_string( $method ) ) {
233
  $class = get_class( $class );
234
 
235
+ if ( get_class( $this ) === $class ) {
236
  if ( method_exists( $this, $method ) ) {
237
  if ( empty( $args ) ) {
238
  // In-Object calling.
242
  $output = call_user_func_array( array( $this, $method ), $args );
243
  }
244
  } else {
245
+ $this->_doing_it_wrong( $class . '::' . $method, __( 'Class or Method not found.', 'autodescription' ), $version );
246
  }
247
  } else {
248
  if ( method_exists( $class, $method ) ) {
252
  $output = call_user_func_array( array( $class, $method ), $args );
253
  }
254
  } else {
255
+ $this->_doing_it_wrong( $class . '::' . $method, __( 'Class or Method not found.', 'autodescription' ), $version );
256
  }
257
  }
258
+ } elseif ( is_string( $class ) && is_string( $method ) ) {
259
  //* This could be combined with the one above.
260
  if ( method_exists( $class, $method ) ) {
261
  if ( empty( $args ) ) {
264
  $output = call_user_func_array( array( $class, $method ), $args );
265
  }
266
  } else {
267
+ $this->_doing_it_wrong( $class . '::' . $method, __( 'Class or Method not found.', 'autodescription' ), $version );
268
  }
269
+ } elseif ( is_string( $class ) ) {
270
  //* Class is function.
271
  $func = $class;
272
 
276
  $output = call_user_func_array( $func, $args );
277
  }
278
  } else {
279
+ $this->_doing_it_wrong( __METHOD__, __( 'Function needs to be called as a string.', 'autodescription' ), $version );
280
  }
281
 
282
  return $output;
283
  }
 
284
  }
patch/2.6.6.patch DELETED
@@ -1,3633 +0,0 @@
1
- Index: autodescription.php
2
- ===================================================================
3
- --- autodescription.php (revision 1433521)
4
- +++ autodescription.php (working copy)
5
- @@ -3,7 +3,7 @@
6
- * Plugin Name: The SEO Framework
7
- * Plugin URI: https://wordpress.org/plugins/autodescription/
8
- * Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
9
- - * Version: 2.6.5.1
10
- + * Version: 2.6.5.1dev6
11
- * Author: Sybre Waaijer
12
- * Author URI: https://cyberwire.nl/
13
- * License: GPLv3
14
- @@ -119,5 +119,41 @@
15
- * Calls functions statically.
16
- * @since 2.2.9
17
- */
18
- -register_activation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, array( 'The_SEO_Framework_Load', 'flush_rewrite_rules_activation' ) );
19
- -register_deactivation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, array( 'The_SEO_Framework_Load', 'flush_rewrite_rules_deactivation' ) );
20
- +register_activation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, 'the_seo_framework_flush_rewrite_rules_activation' );
21
- +register_deactivation_hook( THE_SEO_FRAMEWORK_PLUGIN_BASE_FILE, 'the_seo_framework_flush_rewrite_rules_deactivation' );
22
- +
23
- +/**
24
- + * Add and Flush rewrite rules on plugin activation.
25
- + *
26
- + * @global object $wp_rewrite
27
- + *
28
- + * @since 2.6.6
29
- + * @access private
30
- + */
31
- +function the_seo_framework_flush_rewrite_rules_activation() {
32
- + global $wp_rewrite;
33
- +
34
- + $the_seo_framework = the_seo_framework();
35
- + $the_seo_framework->rewrite_rule_sitemap( true );
36
- +
37
- + $wp_rewrite->init();
38
- + $wp_rewrite->flush_rules( true );
39
- +}
40
- +
41
- +/**
42
- + * Flush rewrite rules on plugin deactivation.
43
- + *
44
- + * @global object $wp_rewrite
45
- + *
46
- + * @since 2.6.6
47
- + * @access private
48
- + */
49
- +function the_seo_framework_flush_rewrite_rules_deactivation() {
50
- + global $wp_rewrite;
51
- +
52
- + $wp_rewrite->init();
53
- +
54
- + unset( $wp_rewrite->extra_rules_top['sitemap\.xml$'] );
55
- +
56
- + $wp_rewrite->flush_rules( true );
57
- +}
58
- Index: inc/classes/adminpages.class.php
59
- ===================================================================
60
- --- inc/classes/adminpages.class.php (revision 1418924)
61
- +++ inc/classes/adminpages.class.php (working copy)
62
- @@ -506,11 +506,11 @@
63
-
64
- if ( isset( $_REQUEST['settings-updated'] ) && 'true' === $_REQUEST['settings-updated'] )
65
- echo $this->generate_dismissible_notice( $this->page_defaults['saved_notice_text'], 'updated' );
66
- - else if ( isset( $_REQUEST['reset'] ) && 'true' === $_REQUEST['reset'] )
67
- + elseif ( isset( $_REQUEST['reset'] ) && 'true' === $_REQUEST['reset'] )
68
- echo $this->generate_dismissible_notice( $this->page_defaults['reset_notice_text'], 'warning' );
69
- - else if ( isset( $_REQUEST['error'] ) && 'true' === $_REQUEST['error'] )
70
- + elseif ( isset( $_REQUEST['error'] ) && 'true' === $_REQUEST['error'] )
71
- echo $this->generate_dismissible_notice( $this->page_defaults['error_notice_text'], 'error' );
72
- - else if ( isset( $_REQUEST['seo-updated'] ) && 'true' === $_REQUEST['seo-updated'] )
73
- + elseif ( isset( $_REQUEST['seo-updated'] ) && 'true' === $_REQUEST['seo-updated'] )
74
- echo $this->generate_dismissible_notice( $this->page_defaults['plugin_update_text'], 'updated' );
75
-
76
- }
77
- Index: inc/classes/compat.class.php
78
- ===================================================================
79
- --- inc/classes/compat.class.php (revision 1418924)
80
- +++ inc/classes/compat.class.php (working copy)
81
- @@ -64,9 +64,9 @@
82
- * Removes the Genesis SEO meta boxes on the SEO Settings page
83
- *
84
- * @since 2.2.4
85
- + *
86
- * @param array $plugins, overwritten as this filter will fire the
87
- * detection, regardless of other SEO plugins.
88
- - *
89
- * @return array Plugins to detect.
90
- */
91
- public function no_more_genesis_seo( $plugins ) {
92
- Index: inc/classes/core.class.php
93
- ===================================================================
94
- --- inc/classes/core.class.php (revision 1418924)
95
- +++ inc/classes/core.class.php (working copy)
96
- @@ -26,7 +26,7 @@
97
- class AutoDescription_Core {
98
-
99
- /**
100
- - * Constructor, just be there for me when I need you.
101
- + * Constructor. Loads actions and filters.
102
- * Latest Class. Doesn't have parent.
103
- */
104
- public function __construct() {
105
- @@ -281,16 +281,13 @@
106
-
107
- /**
108
- * Object cache set wrapper.
109
- - * Applies filters 'the_seo_framework_use_object_cache' : Disable object
110
- - * caching for this plugin, when applicable.
111
- *
112
- + * @since 2.4.3
113
- + *
114
- * @param string $key The Object cache key.
115
- * @param mixed $data The Object cache data.
116
- * @param int $expire The Object cache expire time.
117
- * @param string $group The Object cache group.
118
- - *
119
- - * @since 2.4.3
120
- - *
121
- * @return bool true on set, false when disabled.
122
- */
123
- public function object_cache_set( $key, $data, $expire = 0, $group = 'the_seo_framework' ) {
124
- @@ -303,8 +300,6 @@
125
-
126
- /**
127
- * Object cache get wrapper.
128
- - * Applies filters 'the_seo_framework_use_object_cache' : Disable object
129
- - * caching for this plugin, when applicable.
130
- *
131
- * @param string $key The Object cache key.
132
- * @param string $group The Object cache group.
133
- @@ -328,14 +323,10 @@
134
- * @NOTE only to show improvement with large arrays. Might slow down with small arrays.
135
- * @NOTE can't do type checks. Always assume the comparing value is a string.
136
- *
137
- - * @uses array_flip()
138
- - * @uses isset()
139
- - *
140
- * @since 2.5.2
141
- *
142
- * @param string|array $needle The needle(s) to search for
143
- * @param array $array The single dimensional array to search in.
144
- - *
145
- * @return bool true if value is in array.
146
- */
147
- public function in_array( $needle, $array ) {
148
- @@ -358,9 +349,9 @@
149
- /**
150
- * Checks if the string input is exactly '1'.
151
- *
152
- + * @since 2.6.0
153
- + *
154
- * @param string $value The value to check.
155
- - *
156
- - * @since 2.6.0
157
- * @return bool true if value is '1'
158
- */
159
- public function is_checked( $value ) {
160
- @@ -374,9 +365,9 @@
161
- /**
162
- * Checks if the option is used and checked.
163
- *
164
- + * @since 2.6.0
165
- + *
166
- * @param string $option The option name.
167
- - *
168
- - * @since 2.6.0
169
- * @return bool Option is checked.
170
- */
171
- public function is_option_checked( $option ) {
172
- @@ -392,8 +383,8 @@
173
- /**
174
- * Checks if blog is public through WordPress core settings.
175
- *
176
- + * @since 2.6.0
177
- * @staticvar bool $cache
178
- - * @since 2.6.0
179
- *
180
- * @return bool True is blog is public.
181
- */
182
- @@ -415,7 +406,6 @@
183
- * Multisite Only.
184
- *
185
- * @since 2.6.0
186
- - *
187
- * @global object $current_blog. NULL on single site.
188
- *
189
- * @return bool Current blog is spam.
190
- @@ -433,8 +423,8 @@
191
- * Whether to lowercase the noun or keep it UCfirst.
192
- * Depending if language is German.
193
- *
194
- + * @since 2.6.0
195
- * @staticvar array $lowercase Contains nouns.
196
- - * @since 2.6.0
197
- *
198
- * @return string The maybe lowercase noun.
199
- */
200
- @@ -449,7 +439,7 @@
201
- }
202
-
203
- /**
204
- - * The minimum role required to
205
- + * Returns the minimum role required to adjust settings.
206
- *
207
- * Applies filter 'the_seo_framework_settings_capability' : string
208
- * This filter changes the minimum role for viewing and editing the plugin's settings.
209
- @@ -520,7 +510,7 @@
210
- */
211
- protected function get_tzstring_from_offset( $offset = 0 ) {
212
-
213
- - $seconds = round( $offset * 60 * 60 );
214
- + $seconds = round( $offset * HOUR_IN_SECONDS );
215
-
216
- //* Try Daylight savings.
217
- $tzstring = timezone_name_from_abbr( '', $seconds, 1 );
218
- Index: inc/classes/debug.class.php
219
- ===================================================================
220
- --- inc/classes/debug.class.php (revision 1433389)
221
- +++ inc/classes/debug.class.php (working copy)
222
- @@ -35,6 +35,15 @@
223
- protected $debug_output = '';
224
-
225
- /**
226
- + * Whether to accumulate data.
227
- + *
228
- + * @since 2.6.5
229
- + *
230
- + * @var bool Whether to add to AutoDescription_Debug::debug_output.
231
- + */
232
- + protected $add_debug_output = true;
233
- +
234
- + /**
235
- * Constructor, load parent constructor and add actions.
236
- */
237
- public function __construct() {
238
- @@ -266,12 +275,33 @@
239
- if ( $this->the_seo_framework_debug_hidden ) {
240
- echo "\r\n<!--\r\n:: THE SEO FRAMEWORK DEBUG :: \r\n" . $this->debug_output . "\r\n:: / THE SEO FRAMEWORK DEBUG ::\r\n-->\r\n";
241
- } else {
242
- +
243
- + $id = $this->get_the_real_ID();
244
- + $mdash = ' &mdash; ';
245
- + $term = $this->is_archive() ? $this->fetch_the_term( $id ) : '';
246
- + $taxonomy = isset( $term->taxonomy ) ? $term->taxonomy : '';
247
- +
248
- + //* This will return 'Page' on all non-archive types (except the home page)
249
- + $type = ! $this->is_archive() && $this->is_front_page( $id ) ? 'Front Page' : $this->get_the_term_name( $term );
250
- + $cache_key = $this->generate_cache_key( $this->get_the_real_ID(), $taxonomy );
251
- +
252
- if ( $this->is_admin() ) {
253
- ?>
254
- - <div style="clear:both;float:left;position:relative;width:calc( 100% - 200px );min-height:700px;padding:0;margin:20px 20px 40px 180px;overflow:hidden;border:1px solid #ccc;border-radius:3px;">
255
- - <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom: 2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">SEO Debug Information</h3>
256
- + <div style="color:#444;font-family:Georgio,sans-serif;font-size:14px;clear:both;float:left;position:relative;width:calc( 100% - 200px );min-height:700px;padding:0;margin:20px 20px 40px 180px;overflow:hidden;border:1px solid #ccc;border-radius:3px;font:'Open Sans',sans-serif">
257
- + <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom:2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">
258
- + SEO Debug Information
259
- + <?php
260
- + if ( $this->is_post_edit() || $this->is_term_edit() ) :
261
- + echo ' :: ';
262
- + echo 'Type: ' . $type;
263
- + echo $mdash . 'ID: ' . $id;
264
- + echo $mdash . 'Cache key: ' . $cache_key;
265
- + endif;
266
- + ?>
267
- + </h3>
268
- <div style="position:absolute;bottom:0;right:0;left:0;top:41px;margin:0;padding:0;background:#fff;border-radius:3px;overflow-x:hidden;">
269
- - <?php echo $this->debug_init_output(); ?>
270
- + <?php echo $this->debug_header_output(); ?>
271
- + <?php echo $this->debug_query_output(); ?>
272
- <?php echo $this->debug_output; ?>
273
- </div>
274
- </div>
275
- @@ -279,12 +309,19 @@
276
- } else {
277
- ?>
278
- <style type="text/css">.wp-ui-notification{color:#fff;background-color:#d54e21}.code.highlight{font-family:Consolas,Monaco,monospace;font-size:14px;}</style>
279
- - <div style="clear:both;float:left;position:relative;width:calc( 100% - 80px );min-height:700px;padding:0;margin:40px;overflow:hidden;border:1px solid #ccc;border-radius:3px;">
280
- - <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom: 2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">
281
- - SEO Debug Information :: Type: <?php echo $this->get_the_term_name( $this->fetch_the_term( $this->get_the_real_ID() ) ); ?> &mdash; ID: <?php echo $this->get_the_real_ID(); ?> &mdash; Is front: <?php echo $this->is_front_page() ? 'Yes' : 'No'; ?>
282
- + <div style="color:#444;font-family:Georgio,sans-serif;font-size:14px;clear:both;float:left;position:relative;width:calc( 100% - 80px );min-height:700px;padding:0;margin:40px;overflow:hidden;border:1px solid #ccc;border-radius:3px;font:'Open Sans',sans-serif">
283
- + <h3 style="font-size:14px;padding:0 12px;margin:0;line-height:39px;border-bottom:2px solid #aaa;position:absolute;z-index:1;width:100%;right:0;left:0;top:0;background:#fff;border-radius:3px 3px 0 0;height:39px;">
284
- + SEO Debug Information
285
- + <?php
286
- + echo ' :: ';
287
- + echo 'Type: ' . $type;
288
- + echo $mdash . 'ID: ' . $id;
289
- + echo $mdash . 'Cache key: ' . $cache_key;
290
- + ?>
291
- </h3>
292
- <div style="position:absolute;bottom:0;right:0;left:0;top:41px;margin:0;padding:0;background:#fff;border-radius:3px;overflow-x:hidden;">
293
- - <?php echo $this->debug_init_output(); ?>
294
- + <?php echo $this->debug_header_output(); ?>
295
- + <?php echo $this->debug_query_output(); ?>
296
- <?php echo $this->debug_output; ?>
297
- </div>
298
- </div>
299
- @@ -296,12 +333,13 @@
300
- }
301
-
302
- /**
303
- - * Return debug values.
304
- + * Parses input values and wraps them in human-readable elements.
305
- *
306
- - * @param mixed $values What to be output.
307
- - *
308
- * @access private
309
- * @since 2.6.0
310
- + *
311
- + * @param mixed $values Values to be parsed.
312
- + * @return string $output The parsed value.
313
- */
314
- public function get_debug_information( $values = null ) {
315
-
316
- @@ -334,6 +372,9 @@
317
- }
318
- }
319
-
320
- + /**
321
- + * @TODO Use var_export()?
322
- + */
323
- if ( is_array( $values ) ) {
324
- $output .= $this->the_seo_framework_debug_hidden ? '' : '<div style="margin:0;padding-left:12px">';
325
- foreach ( $values as $key => $value ) {
326
- @@ -456,20 +497,18 @@
327
- *
328
- * @since 2.6.0
329
- *
330
- + * @access private
331
- + *
332
- * @param string $class The class name.
333
- * @param string $method The function name.
334
- * @param bool $store Whether to store the output in cache for next run to pick up on.
335
- * @param double $debug_key Use $debug_key as variable, it's reserved.
336
- - *
337
- * @param mixed function args.
338
- - *
339
- - * @access private
340
- - *
341
- - * @return void early if debugging is disabled.
342
- + * @return void early if debugging is disabled or when storing cache values.
343
- */
344
- protected function debug_init( $class, $method, $store, $debug_key ) {
345
-
346
- - if ( false === $this->the_seo_framework_debug )
347
- + if ( false === $this->the_seo_framework_debug || false === $this->add_debug_output )
348
- return;
349
-
350
- $output = '';
351
- @@ -673,14 +712,15 @@
352
- *
353
- * @since 2.6.0
354
- *
355
- + * @param bool $set Whether to reset the timer.
356
- * @return float PHP Microtime for code execution.
357
- */
358
- - protected function timer() {
359
- + protected function timer( $reset = false ) {
360
-
361
- static $previous = null;
362
-
363
- - if ( isset( $previous ) ) {
364
- - $output = $previous - microtime( true );
365
- + if ( isset( $previous ) && false === $reset ) {
366
- + $output = microtime( true ) - $previous;
367
- $previous = null;
368
- } else {
369
- $output = $previous = microtime( true );
370
- @@ -691,12 +731,13 @@
371
-
372
- /**
373
- * Wraps header output in front-end code.
374
- + * This won't consider hiding the output.
375
- *
376
- * @since 2.6.5
377
- *
378
- - * @return string Wrapped HTML debug output.
379
- + * @return string Wrapped SEO meta tags output.
380
- */
381
- - protected function debug_init_output() {
382
- + protected function debug_header_output() {
383
-
384
- if ( $this->is_admin() && ! $this->is_term_edit() && ! $this->is_post_edit() && ! $this->is_seo_settings_page() )
385
- return;
386
- @@ -704,8 +745,12 @@
387
- if ( $this->is_seo_settings_page() )
388
- add_filter( 'the_seo_framework_current_object_id', array( $this, 'get_the_front_page_ID' ) );
389
-
390
- - $init_start = microtime( true );
391
- + //* Start timer.
392
- + $this->timer( true );
393
-
394
- + //* Don't register this output.
395
- + $this->add_debug_output = false;
396
- +
397
- $output = $this->the_description()
398
- . $this->og_image()
399
- . $this->og_locale()
400
- @@ -735,13 +780,13 @@
401
- . $this->pint_site_output()
402
- ;
403
-
404
- - $timer = '<div style="display:inline-block;width:100%;padding:20px;border-bottom:1px solid #ccc;">Generated in: ' . number_format( microtime( true ) - $init_start, 5 ) . ' seconds</div>' ;
405
- + $timer = '<div style="display:inline-block;width:100%;padding:20px;border-bottom:1px solid #ccc;">Generated in: ' . number_format( $this->timer(), 5 ) . ' seconds</div>' ;
406
-
407
- $title = $this->is_admin() ? 'Expected SEO Output' : 'Current SEO Output';
408
- $title = '<div style="display:inline-block;width:100%;padding:20px;margin:0 auto;border-bottom:1px solid #ccc;"><h2 style="color:#ddd;font-size:22px;padding:0;margin:0">' . $title . '</h2></div>';
409
-
410
- //* Escape it, replace EOL with breaks, and style everything between quotes (which are ending with space).
411
- - $output = str_replace( PHP_EOL, '<br>', esc_html( $output ) );
412
- + $output = str_replace( PHP_EOL, '<br>' . PHP_EOL, esc_html( $output ) );
413
- $output = preg_replace( "/(&quot;.*?&quot;)(\s)/", '<font color="arnoldschwarzenegger">$1</font> ', $output );
414
-
415
- $output = '<div style="display:inline-block;width:100%;padding:20px;font-family:Consolas,Monaco,monospace;font-size:14px;">' . $output . '</div>';
416
- @@ -750,4 +795,96 @@
417
- return $output;
418
- }
419
-
420
- + /**
421
- + * Wraps query status booleans in human-readable code.
422
- + *
423
- + * @since 2.6.6
424
- + *
425
- + * @return string Wrapped Query State debug output.
426
- + */
427
- + protected function debug_query_output() {
428
- +
429
- + //* Start timer.
430
- + $this->timer( true );
431
- +
432
- + //* Don't register this output.
433
- + $this->add_debug_output = false;
434
- +
435
- + //* Only get true/false values.
436
- + $is_404 = $this->is_404();
437
- + $is_admin = $this->is_admin();
438
- + $is_attachment = $this->is_attachment();
439
- + $is_archive = $this->is_archive();
440
- + $is_term_edit = $this->is_term_edit();
441
- + $is_post_edit = $this->is_post_edit();
442
- + $is_wp_lists_edit = $this->is_wp_lists_edit();
443
- + $is_wp_lists_edit = $this->is_wp_lists_edit();
444
- + $is_author = $this->is_author();
445
- + $is_blog_page = $this->is_blog_page();
446
- + $is_category = $this->is_category();
447
- + $is_date = $this->is_date();
448
- + $is_day = $this->is_day();
449
- + $is_feed = $this->is_feed();
450
- + $is_front_page = $this->is_front_page();
451
- + $is_home = $this->is_home();
452
- + $is_month = $this->is_month();
453
- + $is_page = $this->is_page();
454
- + $is_preview = $this->is_preview();
455
- + $is_search = $this->is_search();
456
- + $is_single = $this->is_single();
457
- + $is_singular = $this->is_singular();
458
- + $is_static_frontpage = $this->is_static_frontpage();
459
- + $is_tag = $this->is_tag();
460
- + $is_tax = $this->is_tax();
461
- + $is_ultimate_member_user_page = $this->is_ultimate_member_user_page();
462
- + $is_wc_shop = $this->is_wc_shop();
463
- + $is_wc_product = $this->is_wc_product();
464
- + $is_year = $this->is_year();
465
- + $is_seo_settings_page = $this->is_seo_settings_page();
466
- +
467
- + //* Get all above vars, split them in two (true and false) and sort them by key names.
468
- + $vars = get_defined_vars();
469
- + $current = array_filter( $vars );
470
- + $not_current = array_diff_key( $vars, $current );
471
- + ksort( $current );
472
- + ksort( $not_current );
473
- +
474
- + $timer = '<div style="display:inline-block;width:100%;padding:20px;border-bottom:1px solid #666;">Generated in: ' . number_format( $this->timer(), 5 ) . ' seconds</div>' ;
475
- +
476
- + $output = '';
477
- + foreach ( $current as $name => $value ) {
478
- + $type = '(' . gettype( $value ) . ')';
479
- + if ( is_bool( $value ) )
480
- + $value = $value ? 'true' : 'false';
481
- + else
482
- + $value = esc_attr( var_export( $value, true ) );
483
- +
484
- + $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>';
485
- + $out = $name . ' => ' . $value;
486
- + $output .= $this->the_seo_framework_debug_hidden ? $out . PHP_EOL : '<span style="background:#dadada">' . $out . '</span>' . PHP_EOL;
487
- + }
488
- +
489
- + foreach ( $not_current as $name => $value ) {
490
- + $type = '(' . gettype( $value ) . ')';
491
- + if ( is_bool( $value ) )
492
- + $value = $value ? 'true' : 'false';
493
- + else
494
- + $value = esc_attr( var_export( $value, true ) );
495
- +
496
- + $value = $this->the_seo_framework_debug_hidden ? $type . ' ' . $value : '<font color="harrisonford">' . $type . ' ' . $value . '</font>';
497
- + $out = $name . ' => ' . $value;
498
- + $output .= $out . PHP_EOL;
499
- + }
500
- +
501
- + $title = $this->is_admin() ? 'Current WordPress Screen + Expected WordPress Query' : 'Current WordPress Query';
502
- + $title = '<div style="display:inline-block;width:100%;padding:20px;margin:0 auto;border-bottom:1px solid #666;"><h2 style="color:#222;font-size:22px;padding:0;margin:0">' . $title . '</h2></div>';
503
- +
504
- + $output = $this->the_seo_framework_debug_hidden ? $output : str_replace( PHP_EOL, '<br>' . PHP_EOL, $output );
505
- +
506
- + $output = '<div style="display:inline-block;width:100%;padding:20px;font-family:Consolas,Monaco,monospace;font-size:14px;">' . $output . '</div>';
507
- + $output = '<div style="display:block;width:100%;background:#fafafa;color:#333;border-bottom:1px solid #666">' . $title . $timer . $output . '</div>';
508
- +
509
- + return $output;
510
- + }
511
- +
512
- }
513
- Index: inc/classes/detect.class.php
514
- ===================================================================
515
- --- inc/classes/detect.class.php (revision 1433389)
516
- +++ inc/classes/detect.class.php (working copy)
517
- @@ -1076,6 +1076,7 @@
518
- * Detect theme title fix extension plugin.
519
- *
520
- * @since 2.6.0
521
- + * @staticvar bool $fixed
522
- *
523
- * @return bool True theme will do it right.
524
- */
525
- @@ -1108,10 +1109,10 @@
526
- }
527
-
528
- /**
529
- - * Whether a page or blog is on front.
530
- + * Determines whether a page or blog is on front.
531
- *
532
- + * @since 2.6.0
533
- * @staticvar bool $pof
534
- - * @since 2.6.0
535
- *
536
- * @return bool
537
- */
538
- Index: inc/classes/doingitright.class.php
539
- ===================================================================
540
- --- inc/classes/doingitright.class.php (revision 1424405)
541
- +++ inc/classes/doingitright.class.php (working copy)
542
- @@ -27,8 +27,7 @@
543
- class AutoDescription_DoingItRight extends AutoDescription_Search {
544
-
545
- /**
546
- - * Constructor, load parent constructor
547
- - *
548
- + * Constructor, load parent constructor.
549
- * Initalizes columns and load post states.
550
- */
551
- public function __construct() {
552
- @@ -47,7 +46,7 @@
553
- /**
554
- * Add post state on edit.php to the page or post that has been altered
555
- *
556
- - * Applies filters `the_seo_framework_allow_states` : boolean
557
- + * Applies filters `the_seo_framework_allow_states` : boolean Whether to allow post states output.
558
- *
559
- * @uses $this->add_post_state
560
- *
561
- @@ -70,10 +69,10 @@
562
- /**
563
- * Adds post states in post/page edit.php query
564
- *
565
- + * @since 2.1.0
566
- + *
567
- * @param array $states The current post states array
568
- * @param object $post The Post Object.
569
- - *
570
- - * @since 2.1.0
571
- */
572
- public function add_post_state( $states = array(), $post ) {
573
-
574
- @@ -110,12 +109,12 @@
575
- /**
576
- * Initializes columns
577
- *
578
- - * Applies filter the_seo_framework_show_seo_column : Show the SEO column in edit.php
579
- + * Applies filter the_seo_framework_show_seo_column : Boolean Show the SEO column in edit.php
580
- *
581
- + * @since 2.1.9
582
- + *
583
- * @param object|empty $screen WP_Screen
584
- * @param bool $doing_ajax Whether we're doing an AJAX response.
585
- - *
586
- - * @since 2.1.9
587
- */
588
- public function init_columns( $screen = '', $doing_ajax = false ) {
589
-
590
- @@ -171,12 +170,12 @@
591
- /**
592
- * Adds SEO column on edit(-tags).php
593
- *
594
- - * @param array $columns The existing columns
595
- + * Also determines where the column should be placed. Prefered before comments, then data, then tags.
596
- + * If neither found, it will add the column to the end.
597
- *
598
- - * @param $offset Determines where the column should be placed. Prefered before comments, then data, then tags.
599
- - * If neither found, it will add the column to the end.
600
- + * @since 2.1.9
601
- *
602
- - * @since 2.1.9
603
- + * @param array $columns The existing columns
604
- * @return array $columns the column data
605
- */
606
- public function add_column( $columns ) {
607
- @@ -223,25 +222,20 @@
608
- }
609
-
610
- /**
611
- - * Adds the SEO Bar.
612
- + * Echo's the SEO Bar.
613
- *
614
- + * @since 2.6.0
615
- + * @staticvar string $type
616
- + *
617
- * @param string $column the current column : If it's a taxonomy, this is empty
618
- * @param int $post_id the post id : If it's a taxonomy, this is the column name
619
- * @param string $tax_id this is empty : If it's a taxonomy, this is the taxonomy id
620
- - *
621
- - * @param string $status the status in html
622
- - *
623
- - * @staticvar string $type_cache
624
- - * @staticvar string $column_cache
625
- - *
626
- - * @since 2.6.0
627
- */
628
- public function seo_bar( $column, $post_id, $tax_id = '' ) {
629
-
630
- - static $type_cache = null;
631
- - static $column_cache = null;
632
- + static $type = null;
633
-
634
- - if ( ! isset( $type_cache ) || ! isset( $column_cache ) ) {
635
- + if ( ! isset( $type ) ) {
636
- $type = get_post_type( $post_id );
637
-
638
- if ( false === $type || '' !== $tax_id ) {
639
- @@ -250,9 +244,6 @@
640
- if ( isset( $screen->taxonomy ) )
641
- $type = $screen->taxonomy;
642
- }
643
- -
644
- - $type_cache = $type;
645
- - $column_cache = $column;
646
- }
647
-
648
- /**
649
- @@ -265,23 +256,18 @@
650
- }
651
-
652
- if ( 'ad_seo' === $column )
653
- - echo $this->post_status( $post_id, $type_cache, true );
654
- + echo $this->post_status( $post_id, $type, true );
655
-
656
- }
657
-
658
- /**
659
- - * Adds SEO column to edit screens.
660
- + * Echo's the SEO column in edit screens on Ajax call.
661
- *
662
- + * @since 2.1.9
663
- + *
664
- * @param string $column the current column : If it's a taxonomy, this is empty
665
- * @param int $post_id the post id : If it's a taxonomy, this is the column name
666
- * @param string $tax_id this is empty : If it's a taxonomy, this is the taxonomy id
667
- - *
668
- - * @param string $status the status in html
669
- - *
670
- - * @staticvar string $type_cache
671
- - * @staticvar string $column_cache
672
- - *
673
- - * @since 2.1.9
674
- */
675
- public function seo_bar_ajax( $column, $post_id, $tax_id = '' ) {
676
-
677
- @@ -294,12 +280,13 @@
678
- if ( '' !== $tax_id ) {
679
- $is_term = true;
680
- $column = $post_id;
681
- + $post_id = $tax_id;
682
- }
683
-
684
- if ( 'ad_seo' === $column ) {
685
- $context = __( 'Refresh to see the SEO Bar status.', 'autodescription' );
686
-
687
- - $ajax_id = $column . $tax_id;
688
- + $ajax_id = $column . $post_id;
689
-
690
- echo $this->post_status_special( $context, '?', 'unknown', $is_term, $ajax_id );
691
- }
692
- @@ -309,13 +296,12 @@
693
- /**
694
- * Wrap a single-line block for the SEO bar, showing special statuses.
695
- *
696
- + * @since 2.6.0
697
- + *
698
- * @param string $context The hover/screenreader context.
699
- * @param string $symbol The single-character symbol.
700
- * @param string $class The SEO block color code. : 'bad', 'okay', 'good', 'unknown'.
701
- * @param int|null $ajax_id The unique Ajax ID to generate a small on-hover script for this ID. May be Arbitrary.
702
- - *
703
- - * @since 2.6.0
704
- - *
705
- * @return string The special block with wrap.
706
- */
707
- protected function post_status_special( $context, $symbol = '?', $color = 'unknown', $is_term = '', $ajax_id = null ) {
708
- @@ -339,14 +325,13 @@
709
- /**
710
- * Renders post status. Caches the output.
711
- *
712
- - * @param int $post_id The Post ID or taxonomy ID
713
- - * @param string $type Is fetched on edit.php, inpost, taxonomies, etc.
714
- - * @param bool $html return the status in html or string
715
- - *
716
- + * @since 2.1.9
717
- * @staticvar string $post_i18n The post type slug.
718
- * @staticvar bool $is_term If we're dealing with TT pages.
719
- *
720
- - * @since 2.1.9
721
- + * @param int $post_id The Post ID or taxonomy ID.
722
- + * @param string $type Is fetched on edit.php, inpost, taxonomies, etc.
723
- + * @param bool $html return the status in html or string.
724
- * @return string $content the post SEO status
725
- */
726
- public function post_status( $post_id = '', $type = 'inpost', $html = true ) {
727
- @@ -442,7 +427,6 @@
728
- * string $width
729
- * string $class
730
- * }
731
- - *
732
- * @return string The SEO Bar block part.
733
- */
734
- protected function wrap_the_seo_bar_block( $args ) {
735
- @@ -459,16 +443,15 @@
736
- /**
737
- * Wrap the SEO bar.
738
- *
739
- + * If Ajax ID is set, a small jQuery script will also be output to reset the
740
- + * DOM element for the status bar hover.
741
- + *
742
- + * @since 2.6.0
743
- * @staticvar string $class
744
- - * @since 2.6.0
745
- *
746
- * @param string $content The SEO Bar content.
747
- * @param bool $is_term Whether the bar is for a term.
748
- * @param int|null $ajax_id The unique Ajax ID to generate a small on-hover script for.
749
- - *
750
- - * If Ajax ID is set, a small jQuery script will also be output to reset the
751
- - * DOM element for the status bar hover.
752
- - *
753
- * @return string The SEO Bar wrapped.
754
- */
755
- protected function get_the_seo_bar_wrap( $content, $is_term, $ajax_id = null ) {
756
- @@ -507,7 +490,6 @@
757
- * 'post_low' => string $post_low,
758
- * 'type' => string $type,
759
- * }
760
- - *
761
- * @return string $content The SEO bar.
762
- */
763
- protected function the_seo_bar_term( $args ) {
764
- @@ -555,7 +537,6 @@
765
- * 'post_low' => $post_low,
766
- * 'type' => $type,
767
- * }
768
- - *
769
- * @return string $content The SEO bar.
770
- */
771
- protected function the_seo_bar_page( $args ) {
772
- @@ -592,11 +573,10 @@
773
- /**
774
- * Fetch the post or term data for The SEO Bar, structured and cached.
775
- *
776
- + * @since 2.6.0
777
- * @staticvar array $data
778
- - * @since 2.6.0
779
- *
780
- * @param array $args The term/post args.
781
- - *
782
- * @return array $data {
783
- * 'title' => $title,
784
- * 'title_is_from_custom_field' => $title_is_from_custom_field,
785
- @@ -625,11 +605,10 @@
786
- /**
787
- * Fetch the term data for The SEO Bar.
788
- *
789
- + * @since 2.6.0
790
- * @staticvar array $data
791
- - * @since 2.6.0
792
- *
793
- * @param array $args The term args.
794
- - *
795
- * @return array $data {
796
- * 'title' => $title,
797
- * 'title_is_from_custom_field' => $title_is_from_custom_field,
798
- @@ -676,12 +655,12 @@
799
-
800
- $description_is_from_custom_field = (bool) $description_custom_field;
801
- if ( $description_is_from_custom_field ) {
802
- - $taxonomy = isset( $term->taxonomy ) && $term->taxonomy ? $term->taxonomy : false;
803
- + $taxonomy = isset( $term->taxonomy ) && $term->taxonomy ? $term->taxonomy : '';
804
- $description_args = $taxonomy ? array( 'id' => $post_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => true ) : array( 'get_custom_field' => true );
805
-
806
- $description = $this->generate_description( '', $description_args );
807
- } else {
808
- - $taxonomy = isset( $term->taxonomy ) && $term->taxonomy ? $term->taxonomy : false;
809
- + $taxonomy = isset( $term->taxonomy ) && $term->taxonomy ? $term->taxonomy : '';
810
- $description_args = $taxonomy ? array( 'id' => $post_id, 'taxonomy' => $term->taxonomy, 'get_custom_field' => false ) : array( 'get_custom_field' => false );
811
-
812
- $description = $this->generate_description( '', $description_args );
813
- @@ -703,11 +682,10 @@
814
- /**
815
- * Fetch the post data for The SEO Bar.
816
- *
817
- + * @since 2.6.0
818
- * @staticvar array $data
819
- - * @since 2.6.0
820
- *
821
- * @param array $args The post args.
822
- - *
823
- * @return array $data {
824
- * 'title' => $title,
825
- * 'title_is_from_custom_field' => $title_is_from_custom_field,
826
- @@ -735,18 +713,16 @@
827
- }
828
-
829
- $title_is_from_custom_field = (bool) $title_custom_field;
830
- - if ( $title_is_from_custom_field ) {
831
- + if ( $title_is_from_custom_field )
832
- $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'page_on_front' => $page_on_front, 'get_custom_field' => true ) );
833
- - } else {
834
- + else
835
- $title = $this->title( '', '', '', array( 'term_id' => $post_id, 'page_on_front' => $page_on_front, 'get_custom_field' => false ) );
836
- - }
837
-
838
- $description_is_from_custom_field = (bool) $description_custom_field;
839
- - if ( $description_is_from_custom_field ) {
840
- + if ( $description_is_from_custom_field )
841
- $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => true ) );
842
- - } else {
843
- + else
844
- $description = $this->generate_description( '', array( 'id' => $post_id, 'get_custom_field' => false ) );
845
- - }
846
-
847
- $nofollow = $this->is_checked( $nofollow );
848
- $noarchive = $this->is_checked( $noarchive );
849
- @@ -764,9 +740,9 @@
850
- /**
851
- * Render the SEO bar title block and notice.
852
- *
853
- - * @param array $args
854
- * @since 2.6.0
855
- *
856
- + * @param array $args
857
- * @return string The SEO Bar Title Block
858
- */
859
- protected function the_seo_bar_title_notice( $args ) {
860
- @@ -846,9 +822,9 @@
861
- /**
862
- * Render the SEO bar description block and notice.
863
- *
864
- - * @param array $args
865
- * @since 2.6.0
866
- *
867
- + * @param array $args
868
- * @return string The SEO Bar Description Block
869
- */
870
- protected function the_seo_bar_description_notice( $args ) {
871
- @@ -908,11 +884,10 @@
872
- /**
873
- * Description Length notices.
874
- *
875
- + * @since 2.6.0
876
- + *
877
- * @param int $desc_len The Title length
878
- * @param string $class The current color class.
879
- - *
880
- - * @since 2.6.0
881
- - *
882
- * @return array {
883
- * notice => The notice,
884
- * class => The class,
885
- @@ -958,11 +933,10 @@
886
- * Calculates the word count and returns a warning with the words used.
887
- * Only when count is over 3.
888
- *
889
- + * @since 2.6.0
890
- + *
891
- * @param string $description The Description with maybe words too many.
892
- * @param string $class The current color class.
893
- - *
894
- - * @since 2.6.0
895
- - *
896
- * @return string The warning notice.
897
- */
898
- protected function get_the_seo_bar_description_words_warning( $description, $class ) {
899
- @@ -1058,9 +1032,9 @@
900
- /**
901
- * Render the SEO bar index block and notice.
902
- *
903
- - * @param array $args
904
- * @since 2.6.0
905
- *
906
- + * @param array $args
907
- * @return string The SEO Bar Index Block
908
- */
909
- protected function the_seo_bar_index_notice( $args ) {
910
- @@ -1165,7 +1139,6 @@
911
- * @staticvar bool $cache
912
- *
913
- * @param string $type : 'noindex', 'nofollow', 'noarchive'
914
- - *
915
- * @return bool
916
- */
917
- protected function the_seo_bar_archive_robots_options( $type ) {
918
- @@ -1196,9 +1169,9 @@
919
- /**
920
- * Render the SEO bar follow block and notice.
921
- *
922
- - * @param array $args
923
- * @since 2.6.0
924
- *
925
- + * @param array $args
926
- * @return string The SEO Bar Follow Block
927
- */
928
- protected function the_seo_bar_follow_notice( $args ) {
929
- @@ -1304,9 +1277,9 @@
930
- /**
931
- * Render the SEO bar archive block and notice.
932
- *
933
- - * @param array $args
934
- * @since 2.6.0
935
- *
936
- + * @param array $args
937
- * @return string The SEO Bar Follow Block
938
- */
939
- protected function the_seo_bar_archive_notice( $args ) {
940
- @@ -1412,9 +1385,9 @@
941
- /**
942
- * Render the SEO bar redirect block and notice.
943
- *
944
- - * @param array $args
945
- * @since 2.6.0
946
- *
947
- + * @param array $args
948
- * @return string The SEO Bar Redirect Block
949
- */
950
- protected function the_seo_bar_redirect_notice( $args ) {
951
- @@ -1455,6 +1428,8 @@
952
- /**
953
- * Render the SEO bar when the page/term is blocked.
954
- *
955
- + * @since 2.6.0
956
- + *
957
- * @param array $args {
958
- * $is_term => bool,
959
- * $redirect => bool,
960
- @@ -1461,9 +1436,6 @@
961
- * $noindex => bool,
962
- * $post_i18n => string
963
- * }
964
- - *
965
- - * @since 2.6.0
966
- - *
967
- * @return string The SEO Bar
968
- */
969
- protected function the_seo_bar_blocked( $args ) {
970
- @@ -1549,7 +1521,6 @@
971
- *
972
- * @param int $tit_len The Title length
973
- * @param string $class The Current Title notification class.
974
- - *
975
- * @return array {
976
- * string $notice => The notice,
977
- * string $class => The class,
978
- Index: inc/classes/generate-description.class.php
979
- ===================================================================
980
- --- inc/classes/generate-description.class.php (revision 1427876)
981
- +++ inc/classes/generate-description.class.php (working copy)
982
- @@ -26,7 +26,7 @@
983
- class AutoDescription_Generate_Description extends AutoDescription_Generate {
984
-
985
- /**
986
- - * Whether we're parsing the manual Excerpt for the automated description.
987
- + * Determines whether we're parsing the manual content Excerpt for the automated description.
988
- *
989
- * @since 2.6.0
990
- *
991
- @@ -35,7 +35,7 @@
992
- protected $using_manual_excerpt = false;
993
-
994
- /**
995
- - * Constructor, load parent constructor
996
- + * Constructor, loads parent constructor.
997
- */
998
- public function __construct() {
999
- parent::__construct();
1000
- @@ -42,9 +42,11 @@
1001
- }
1002
-
1003
- /**
1004
- - * Create description
1005
- + * Creates description. Base function.
1006
- *
1007
- - * @param string $description the description.
1008
- + * @since 1.0.0
1009
- + *
1010
- + * @param string $description The optional description to simply parse.
1011
- * @param array $args description args : {
1012
- * @param int $id the term or page id.
1013
- * @param string $taxonomy taxonomy name.
1014
- @@ -52,9 +54,6 @@
1015
- * @param bool $get_custom_field Do not fetch custom title when false.
1016
- * @param bool $social Generate Social Description when true.
1017
- * }
1018
- - *
1019
- - * @since 1.0.0
1020
- - *
1021
- * @return string The description
1022
- */
1023
- public function generate_description( $description = '', $args = array() ) {
1024
- @@ -78,9 +77,16 @@
1025
- $description = $this->generate_description_from_id( $args, false );
1026
-
1027
- /**
1028
- - * Beautify.
1029
- - * @since 2.3.4
1030
- + * Applies filters 'the_seo_framework_do_shortcodes_in_description' : Boolean
1031
- + * @since 2.6.6
1032
- */
1033
- + if ( apply_filters( 'the_seo_framework_do_shortcodes_in_description', false ) )
1034
- + $description = do_shortcode( $description );
1035
- +
1036
- + /**
1037
- + * Sanitize.
1038
- + * @since 2.3.4 Beautifies too.
1039
- + */
1040
- $description = $this->escape_description( $description );
1041
-
1042
- return $description;
1043
- @@ -89,10 +95,9 @@
1044
- /**
1045
- * Escapes and beautifies description.
1046
- *
1047
- - * @param string $description The description to escape and beautify.
1048
- - *
1049
- * @since 2.5.2
1050
- *
1051
- + * @param string $description The description to escape and beautify.
1052
- * @return string Escaped and beautified description.
1053
- */
1054
- public function escape_description( $description = '' ) {
1055
- @@ -107,11 +112,9 @@
1056
- }
1057
-
1058
- /**
1059
- - * Parse and sanitize description args.
1060
- + * Parses and sanitizes description arguments.
1061
- *
1062
- - * @param array $args required The passed arguments.
1063
- - * @param array $defaults The default arguments.
1064
- - * @param bool $get_defaults Return the default arguments. Ignoring $args.
1065
- + * @since 2.5.0
1066
- *
1067
- * @applies filters the_seo_framework_description_args : {
1068
- * @param int $id the term or page id.
1069
- @@ -121,7 +124,9 @@
1070
- * @param bool $social Generate Social Description when true.
1071
- * }
1072
- *
1073
- - * @since 2.5.0
1074
- + * @param array $args required The passed arguments.
1075
- + * @param array $defaults The default arguments.
1076
- + * @param bool $get_defaults Return the default arguments. Ignoring $args.
1077
- * @return array $args parsed args.
1078
- */
1079
- public function parse_description_args( $args = array(), $defaults = array(), $get_defaults = false ) {
1080
- @@ -154,7 +159,7 @@
1081
- }
1082
-
1083
- /**
1084
- - * Reparse description args.
1085
- + * Reparses description args.
1086
- *
1087
- * @param array $args required The passed arguments.
1088
- *
1089
- @@ -181,8 +186,10 @@
1090
- }
1091
-
1092
- /**
1093
- - * Create description
1094
- + * Creates description from custom fields.
1095
- *
1096
- + * @since 2.4.1
1097
- + *
1098
- * @param array $args description args : {
1099
- * @param int $id the term or page id.
1100
- * @param string $taxonomy taxonomy name.
1101
- @@ -189,9 +196,6 @@
1102
- * @param bool $is_home We're generating for the home page.
1103
- * }
1104
- * @param bool $escape Escape the output if true.
1105
- - *
1106
- - * @since 2.4.1
1107
- - *
1108
- * @return string|mixed The description, might be unsafe for html output.
1109
- */
1110
- public function description_from_custom_field( $args = array(), $escape = true ) {
1111
- @@ -205,14 +209,13 @@
1112
- //* HomePage Description.
1113
- $description = $this->get_custom_homepage_description( $args );
1114
-
1115
- - //* Singular Description.
1116
- - if ( empty( $description ) && false === $this->is_archive() )
1117
- - $description = $this->get_custom_singular_description( $args['id'] );
1118
- + if ( empty( $description ) ) {
1119
- + if ( $this->is_archive() )
1120
- + $description = $this->get_custom_archive_description( $args );
1121
- + else
1122
- + $description = $this->get_custom_singular_description( $args['id'] );
1123
- + }
1124
-
1125
- - //* Archive Description.
1126
- - if ( empty( $description ) && $this->is_archive() )
1127
- - $description = $this->get_custom_archive_description( $args );
1128
- -
1129
- if ( $escape && $description )
1130
- $description = $this->escape_description( $description );
1131
-
1132
- @@ -220,15 +223,13 @@
1133
- }
1134
-
1135
- /**
1136
- - * Fetch HomePage Description from custom field.
1137
- + * Fetches HomePage Description from custom field.
1138
- *
1139
- + * @since 2.6.0
1140
- * @access protected
1141
- * Use $this->description_from_custom_field() instead.
1142
- *
1143
- * @param array $args Description args.
1144
- - *
1145
- - * @since 2.6.0
1146
- - *
1147
- * @return string The Description
1148
- */
1149
- protected function get_custom_homepage_description( $args ) {
1150
- @@ -244,15 +245,13 @@
1151
- }
1152
-
1153
- /**
1154
- - * Fetch Singular Description from custom field.
1155
- + * Fetches Singular Description from custom field.
1156
- *
1157
- + * @since 2.6.0
1158
- * @access protected
1159
- * Use $this->description_from_custom_field() instead.
1160
- *
1161
- * @param int $id The page ID.
1162
- - *
1163
- - * @since 2.6.0
1164
- - *
1165
- * @return string The Description
1166
- */
1167
- protected function get_custom_singular_description( $id ) {
1168
- @@ -270,13 +269,11 @@
1169
- /**
1170
- * Fetch Archive Description from custom field.
1171
- *
1172
- + * @since 2.6.0
1173
- * @access protected
1174
- * Use $this->description_from_custom_field() instead.
1175
- *
1176
- * @param array $args
1177
- - *
1178
- - * @since 2.6.0
1179
- - *
1180
- * @return string The Description
1181
- */
1182
- protected function get_custom_archive_description( $args ) {
1183
- @@ -313,7 +310,7 @@
1184
- }
1185
-
1186
- /**
1187
- - * Generate description from content.
1188
- + * Generates description from content while parsing filters.
1189
- *
1190
- * @since 2.3.3
1191
- *
1192
- @@ -325,7 +322,6 @@
1193
- * @param bool $social Generate Social Description when true.
1194
- * }
1195
- * @param bool $escape Escape output when true.
1196
- - *
1197
- * @return string $output The description.
1198
- */
1199
- public function generate_description_from_id( $args = array(), $escape = true ) {
1200
- @@ -352,9 +348,10 @@
1201
- }
1202
-
1203
- /**
1204
- - * Generate description from content
1205
- + * Generates description from content.
1206
- *
1207
- * @since 2.6.0
1208
- + * @staticvar string $title
1209
- *
1210
- * @param array $args description args : {
1211
- * @param int $id the term or page id.
1212
- @@ -364,9 +361,6 @@
1213
- * @param bool $social Generate Social Description when true.
1214
- * }
1215
- * @param bool $escape Whether to escape the description.
1216
- - *
1217
- - * @staticvar string $title
1218
- - *
1219
- * @return string The description.
1220
- */
1221
- protected function generate_the_description( $args, $escape = true ) {
1222
- @@ -400,11 +394,8 @@
1223
-
1224
- /**
1225
- * Cache the generated description within a transient.
1226
- - *
1227
- * @since 2.3.3
1228
- - *
1229
- - * Put inside a different function.
1230
- - * @since 2.3.4
1231
- + * @since 2.3.4 Put inside a different function.
1232
- */
1233
- $excerpt = $this->get_transient( $this->auto_description_transient );
1234
- if ( false === $excerpt ) {
1235
- @@ -434,10 +425,8 @@
1236
- /**
1237
- * Transient expiration: 1 week.
1238
- * Keep the description for at most 1 week.
1239
- - *
1240
- - * 60s * 60m * 24h * 7d
1241
- */
1242
- - $expiration = 60 * 60 * 24 * 7;
1243
- + $expiration = WEEK_IN_SECONDS;
1244
-
1245
- $this->set_transient( $this->auto_description_transient, $excerpt, $expiration );
1246
- }
1247
- @@ -487,12 +476,11 @@
1248
- }
1249
-
1250
- /**
1251
- - * Generate the home page description.
1252
- + * Generates the home page description.
1253
- *
1254
- - * @param bool $custom_field whether to check the Custom Field.
1255
- - *
1256
- * @since 2.6.0
1257
- *
1258
- + * @param bool $custom_field whether to check the Custom Field.
1259
- * @return string The description.
1260
- */
1261
- public function generate_home_page_description( $custom_field = true ) {
1262
- @@ -520,15 +508,14 @@
1263
- }
1264
-
1265
- /**
1266
- - * Whether to add description additions. (╯°□°)╯︵ ┻━┻
1267
- + * Determines whether to add description additions. (╯°□°)╯︵ ┻━┻
1268
- *
1269
- + * @since 2.6.0
1270
- * @staticvar bool $cache
1271
- - * @since 2.6.0
1272
- *
1273
- * @param int $id The current page or post ID.
1274
- * @param object|emptystring $term The current Term.
1275
- - *
1276
- - * @return bool
1277
- + * @return bool Whether to add description additions.
1278
- */
1279
- public function add_description_additions( $id = '', $term = '' ) {
1280
-
1281
- @@ -554,14 +541,12 @@
1282
- }
1283
-
1284
- /**
1285
- - * Get Description Separator.
1286
- + * Gets Description Separator.
1287
- *
1288
- - * Applies filters the_seo_framework_description_separator
1289
- + * Applies filters 'the_seo_framework_description_separator' : string
1290
- * @since 2.3.9
1291
- + * @staticvar string $sep
1292
- *
1293
- - * @staticvar $sep
1294
- - * @since 2.6.0
1295
- - *
1296
- * @return string The Separator
1297
- */
1298
- public function get_description_separator() {
1299
- @@ -575,18 +560,16 @@
1300
- }
1301
-
1302
- /**
1303
- - * Generate description additions.
1304
- + * Generates description additions.
1305
- *
1306
- * @since 2.6.0
1307
- + * @staticvar array $title string of titles.
1308
- + * @staticvar string $on
1309
- * @access private
1310
- *
1311
- * @param int $id The post or term ID
1312
- * @param object|empty $term The term object
1313
- * @param bool $ignore Whether to ignore options and filters.
1314
- - *
1315
- - * @staticvar array $title string of titles.
1316
- - * @staticvar string $on
1317
- - *
1318
- * @return array : {
1319
- * $title => The title
1320
- * $on => The word separator
1321
- @@ -638,12 +621,11 @@
1322
- /**
1323
- * Generates the Title for description.
1324
- *
1325
- + * @since 2.5.2
1326
- + *
1327
- * @param int $id The page ID.
1328
- * @param void|object $term The term object.
1329
- * @param bool $page_on_front If front page.
1330
- - *
1331
- - * @since 2.5.2
1332
- - *
1333
- * @return string The description title.
1334
- */
1335
- public function generate_description_title( $id = '', $term = '', $page_on_front = false ) {
1336
- @@ -700,18 +682,16 @@
1337
- }
1338
-
1339
- /**
1340
- - * Generate the excerpt.
1341
- + * Generates the excerpt.
1342
- + * @NOTE Supply calculated $max_char_length to reflect actual output.
1343
- *
1344
- - * @param int|string $page_id required : The Page ID
1345
- - * @param object|null $term The Taxonomy Term.
1346
- - * @param int $max_char_length The maximum excerpt char length.
1347
- - *
1348
- * @since 2.3.4
1349
- - *
1350
- * @staticvar array $excerpt_cache Holds the excerpt
1351
- * @staticvar array $excerptlength_cache Holds the excerpt length
1352
- *
1353
- - * Please note that this does not reflect the actual output becaue the $max_char_length isn't calculated on direct call.
1354
- + * @param int|string $page_id required : The Page ID
1355
- + * @param object|null $term The Taxonomy Term.
1356
- + * @param int $max_char_length The maximum excerpt char length.
1357
- */
1358
- public function generate_excerpt( $page_id, $term = '', $max_char_length = 154 ) {
1359
-
1360
- @@ -727,9 +707,9 @@
1361
- $excerpt = $this->get_excerpt_by_id( '', $page_id );
1362
- } else if ( $term && is_object( $term ) ) {
1363
- //* We're on a taxonomy now.
1364
- - $excerpt = empty( $term->description ) ? $this->get_excerpt_by_id( '', '', $page_id ) : $term->description;
1365
- + $excerpt = empty( $term->description ) ? $this->get_excerpt_by_id( '', '', $page_id ) : $this->s_description( $term->description );
1366
- } else if ( $this->is_author() ) {
1367
- - $excerpt = get_the_author_meta( 'description', (int) get_query_var( 'author' ) );
1368
- + $excerpt = $this->s_description( get_the_author_meta( 'description', (int) get_query_var( 'author' ) ) );
1369
- } else {
1370
- $excerpt = '';
1371
- }
1372
- @@ -758,17 +738,16 @@
1373
- }
1374
-
1375
- /**
1376
- - * Trim the excerpt.
1377
- + * Trims the excerpt by word and determines sentence stops.
1378
- *
1379
- + * @since 2.6.0
1380
- + *
1381
- * @param string $excerpt The untrimmed excerpt.
1382
- * @param int $excerpt_length The current excerpt length.
1383
- * @param int $max_char_length At what point to shave off the excerpt.
1384
- - *
1385
- - * @since 2.6.0
1386
- - *
1387
- * @return string The trimmed excerpt.
1388
- */
1389
- - protected function trim_excerpt( $excerpt, $excerpt_length, $max_char_length ) {
1390
- + public function trim_excerpt( $excerpt, $excerpt_length, $max_char_length ) {
1391
-
1392
- if ( $excerpt_length > $max_char_length ) {
1393
-
1394
- @@ -814,7 +793,7 @@
1395
- }
1396
- }
1397
-
1398
- - //* Remove comma's and spaces.
1399
- + //* Remove trailing/leading comma's and spaces.
1400
- $excerpt = trim( $excerpt, ' ,' );
1401
-
1402
- //* Fetch last character.
1403
- @@ -827,7 +806,7 @@
1404
-
1405
- }
1406
-
1407
- - return $excerpt;
1408
- + return trim( $excerpt );
1409
- }
1410
-
1411
- }
1412
- Index: inc/classes/generate-image.class.php
1413
- ===================================================================
1414
- --- inc/classes/generate-image.class.php (revision 1418924)
1415
- +++ inc/classes/generate-image.class.php (working copy)
1416
- @@ -26,7 +26,7 @@
1417
- class AutoDescription_Generate_Image extends AutoDescription_Generate_Url {
1418
-
1419
- /**
1420
- - * Constructor, load parent constructor
1421
- + * Constructor, loads parent constructor.
1422
- */
1423
- public function __construct() {
1424
- parent::__construct();
1425
- @@ -33,24 +33,18 @@
1426
- }
1427
-
1428
- /**
1429
- - * Fetches og:image
1430
- + * Fetches og:image URL.
1431
- *
1432
- - * @uses get_header_image
1433
- + * @since 2.5.2 Applies filters string the_seo_framework_og_image_after_featured
1434
- + * @since 2.5.2 Applies filters string the_seo_framework_og_image_after_header
1435
- *
1436
- - * @param string $post_id the post ID
1437
- - * @param string $image output url for image
1438
- - * @param bool $escape Whether to escape the image url
1439
- - *
1440
- - * @since 2.2.1
1441
- - *
1442
- - * Applies filters string the_seo_framework_og_image_after_featured
1443
- - * Applies filters string the_seo_framework_og_image_after_header
1444
- - * @since 2.5.2
1445
- - *
1446
- - * @todo create options and upload area.
1447
- - * @priority medium 2.8.0+
1448
- * @todo listen to attached images within post.
1449
- * @priority medium 2.7.0+
1450
- + *
1451
- + * @param string $post_id The post ID.
1452
- + * @param array $args The image arguments.
1453
- + * @param bool $escape Whether to escape the image URL.
1454
- + * @return string the Open Graph Image URL.
1455
- */
1456
- public function get_image( $post_id = '', $args = array(), $escape = true ) {
1457
-
1458
- @@ -60,29 +54,15 @@
1459
- if ( empty( $post_id ) )
1460
- return '';
1461
-
1462
- - $default_args = $this->parse_image_args( '', '', true );
1463
- -
1464
- /**
1465
- - * Parse args.
1466
- + * Backwards compat with parse args.
1467
- * @since 2.5.0
1468
- */
1469
- - if ( ! is_array( $args ) ) {
1470
- - //* Old style parameters are used. Doing it wrong.
1471
- - $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.5.0' );
1472
- - $args = $default_args;
1473
- - } else if ( $args ) {
1474
- - $args = $this->parse_image_args( $args, $default_args );
1475
- - } else {
1476
- - $args = $default_args;
1477
- - }
1478
- -
1479
- - /**
1480
- - * Backwards compat with parse args
1481
- - * @since 2.5.0
1482
- - */
1483
- if ( ! isset( $args['post_id'] ) )
1484
- $args['post_id'] = $post_id;
1485
-
1486
- + $args = $this->reparse_image_args( $args );
1487
- +
1488
- //* 0. Image from argument.
1489
- $image = $args['image'];
1490
-
1491
- @@ -122,11 +102,9 @@
1492
- /**
1493
- * Parse and sanitize image args.
1494
- *
1495
- - * @param array $args required The passed arguments.
1496
- - * @param array $defaults The default arguments.
1497
- - * @param bool $get_defaults Return the default arguments. Ignoring $args.
1498
- + * @since 2.5.0
1499
- *
1500
- - * Applies filters the_seo_framework_og_image_args : {
1501
- + * @since 2.0.1 Applies filters the_seo_framework_og_image_args : {
1502
- * @param string image The image url
1503
- * @param mixed size The image size
1504
- * @param bool icon Fetch Image icon
1505
- @@ -141,7 +119,9 @@
1506
- * }
1507
- * The image set in the filter will always be used as fallback
1508
- *
1509
- - * @since 2.5.0
1510
- + * @param array $args required The passed arguments.
1511
- + * @param array $defaults The default arguments.
1512
- + * @param bool $get_defaults Return the default arguments. Ignoring $args.
1513
- * @return array $args parsed args.
1514
- */
1515
- public function parse_image_args( $args = array(), $defaults = array(), $get_defaults = false ) {
1516
- @@ -157,7 +137,6 @@
1517
- 'disallowed' => array(),
1518
- );
1519
-
1520
- - //* @since 2.0.1
1521
- $defaults = (array) apply_filters( 'the_seo_framework_og_image_args', $defaults, $args );
1522
- }
1523
-
1524
- @@ -177,18 +156,47 @@
1525
- }
1526
-
1527
- /**
1528
- + * Reparses image args.
1529
- + *
1530
- + * @since 2.6.6
1531
- + *
1532
- + * @param array $args required The passed arguments.
1533
- + * @return array $args parsed args.
1534
- + */
1535
- + public function reparse_image_args( $args = array() ) {
1536
- +
1537
- + $default_args = $this->parse_image_args( '', '', true );
1538
- +
1539
- + if ( is_array( $args ) ) {
1540
- + if ( empty( $args ) ) {
1541
- + $args = $default_args;
1542
- + } else {
1543
- + $args = $this->parse_image_args( $args, $default_args );
1544
- + }
1545
- + } else {
1546
- + //* Old style parameters are used. Doing it wrong.
1547
- + $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'Use $args = array() for parameters.', '2.5.0' );
1548
- + $args = $default_args;
1549
- + }
1550
- +
1551
- + return $args;
1552
- + }
1553
- +
1554
- + /**
1555
- * Fetches image from post thumbnail.
1556
- * Resizes the image between 1500px if bigger. Then it saves the image and
1557
- * Keeps dimensions relative.
1558
- *
1559
- - * @param array $args Image arguments.
1560
- - *
1561
- * @since 2.3.0
1562
- *
1563
- + * @param array $args Image arguments.
1564
- * @return string|null the image url.
1565
- */
1566
- - public function get_image_from_post_thumbnail( $args ) {
1567
- + public function get_image_from_post_thumbnail( $args = array() ) {
1568
-
1569
- + if ( empty( $args ) )
1570
- + $args = $this->reparse_image_args( $args );
1571
- +
1572
- if ( ! isset( $args['post_id'] ) )
1573
- $args['post_id'] = $this->get_the_real_ID();
1574
-
1575
- @@ -202,12 +210,10 @@
1576
- /**
1577
- * Fetches images id's from WooCommerce gallery
1578
- *
1579
- + * @since 2.5.0
1580
- * @staticvar array $ids The image ids
1581
- *
1582
- * @param array $args Image arguments.
1583
- - *
1584
- - * @since 2.5.0
1585
- - *
1586
- * @return array The image URL's.
1587
- */
1588
- public function get_image_from_woocommerce_gallery() {
1589
- @@ -231,18 +237,16 @@
1590
- }
1591
-
1592
- /**
1593
- - * Parses OG image to correct size
1594
- + * Parses OG image to correct size.
1595
- *
1596
- + * @since 2.5.0
1597
- * @staticvar string $called Checks if image ID has already been fetched (to prevent duplicate output on WooCommerce).
1598
- *
1599
- - * @param int $id The attachment ID.
1600
- - * @param array $args The image args
1601
- - *
1602
- - * @since 2.5.0
1603
- - *
1604
- * @todo create formula to fetch transient.
1605
- * @priority high 2.7.0
1606
- *
1607
- + * @param int $id The attachment ID.
1608
- + * @param array $args The image args
1609
- * @return string|empty Parsed image url or empty if already called
1610
- */
1611
- public function parse_og_image( $id, $args = array() ) {
1612
- @@ -257,7 +261,7 @@
1613
- return '';
1614
-
1615
- if ( empty( $args ) )
1616
- - $args = $this->parse_image_args( '', '', true );
1617
- + $args = $this->reparse_image_args( $args );
1618
-
1619
- $src = wp_get_attachment_image_src( $id, $args['size'], $args['icon'], $args['attr'] );
1620
-
1621
- @@ -293,21 +297,18 @@
1622
-
1623
- $i_file_file_name = pathinfo( $i_file_path, PATHINFO_FILENAME );
1624
-
1625
- - //* Yes I know, I should use generate_filename, but it's slower.
1626
- + //* Yes I know, I should use generate_filename(), but it's slower.
1627
- //* Will look at that later. This is already 100 lines of correctly working code.
1628
- $new_image_dirfile = $i_file_dir_name . $i_file_file_name . '-' . $w . 'x' . $h . '.' . $i_file_ext;
1629
-
1630
- - /**
1631
- - * Generate image URL.
1632
- - */
1633
- + //* Generate image URL.
1634
- $upload_dir = wp_upload_dir();
1635
- $upload_url = $upload_dir['baseurl'];
1636
- $upload_basedir = $upload_dir['basedir'];
1637
- - $new_image_url = str_ireplace( $upload_basedir, '', $new_image_dirfile );
1638
- - $new_image_url = $upload_url . $new_image_url;
1639
-
1640
- //* We've got our image path.
1641
- - $i = $new_image_url;
1642
- + $i = str_ireplace( $upload_basedir, '', $new_image_dirfile );
1643
- + $i = $upload_url . $i;
1644
-
1645
- // Generate file if it doesn't exists yet.
1646
- if ( ! file_exists( $new_image_dirfile ) ) {
1647
- @@ -332,9 +333,9 @@
1648
- /**
1649
- * Fetches site icon brought in WordPress 4.3.0
1650
- *
1651
- - * @param string $size The icon size, accepts 'full' and pixel values
1652
- * @since 2.2.1
1653
- *
1654
- + * @param string $size The icon size, accepts 'full' and pixel values
1655
- * @return string url site icon, not escaped.
1656
- */
1657
- public function site_icon( $size = 'full' ) {
1658
- Index: inc/classes/generate-ldjson.class.php
1659
- ===================================================================
1660
- --- inc/classes/generate-ldjson.class.php (revision 1433521)
1661
- +++ inc/classes/generate-ldjson.class.php (working copy)
1662
- @@ -47,7 +47,7 @@
1663
-
1664
- $this->setup_ld_json_transient( $this->get_the_real_ID() );
1665
-
1666
- - if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, true, $debug_key = microtime(true), array( 'LD Json transient' => $this->ld_json_transient, 'Is output' => (bool) $this->get_transient( $this->ld_json_transient ) ) );
1667
- + if ( $this->the_seo_framework_debug ) $this->debug_init( __CLASS__, __FUNCTION__, false, $debug_key = microtime(true), array( 'LD Json transient' => $this->ld_json_transient, 'Output from transient' => false !== $this->get_transient( $this->ld_json_transient ) ) );
1668
-
1669
- $output = $this->get_transient( $this->ld_json_transient );
1670
- if ( false === $output ) {
1671
- @@ -80,11 +80,9 @@
1672
-
1673
- /**
1674
- * Transient expiration: 1 week.
1675
- - * Keep the description for at most 1 week.
1676
- - *
1677
- - * 60s * 60m * 24h * 7d
1678
- + * Keep the script for at most 1 week.
1679
- */
1680
- - $expiration = 60 * 60 * 24 * 7;
1681
- + $expiration = WEEK_IN_SECONDS;
1682
-
1683
- $this->set_transient( $this->ld_json_transient, $output, $expiration );
1684
- }
1685
- Index: inc/classes/generate-title.class.php
1686
- ===================================================================
1687
- --- inc/classes/generate-title.class.php (revision 1433389)
1688
- +++ inc/classes/generate-title.class.php (working copy)
1689
- @@ -527,6 +527,13 @@
1690
-
1691
- $title = $this->do_title_pro_filter( $title, $args, false );
1692
-
1693
- + /**
1694
- + * Applies filters 'the_seo_framework_do_shortcodes_in_title' : Boolean
1695
- + * @since 2.6.6
1696
- + */
1697
- + if ( apply_filters( 'the_seo_framework_do_shortcodes_in_title', false ) )
1698
- + $title = do_shortcode( $title );
1699
- +
1700
- if ( $args['escape'] )
1701
- $title = $this->escape_title( $title );
1702
-
1703
- @@ -765,7 +772,7 @@
1704
- if ( $args['get_custom_field'] && isset( $term ) ) {
1705
- $title = empty( $term->admeta['doctitle'] ) ? $title : wp_kses_stripslashes( wp_kses_decode_entities( $term->admeta['doctitle'] ) );
1706
-
1707
- - $flag = $this->is_checked( $term->admeta['saved_flag'] );
1708
- + $flag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] );
1709
- if ( false === $flag && empty( $title ) && isset( $term->meta['doctitle'] ) )
1710
- $title = empty( $term->meta['doctitle'] ) ? $title : wp_kses_stripslashes( wp_kses_decode_entities( $term->meta['doctitle'] ) );
1711
- }
1712
- Index: inc/classes/generate-url.class.php
1713
- ===================================================================
1714
- --- inc/classes/generate-url.class.php (revision 1433389)
1715
- +++ inc/classes/generate-url.class.php (working copy)
1716
- @@ -1123,7 +1123,7 @@
1717
- if ( $output_singular_paged ) {
1718
-
1719
- $page = $this->page();
1720
- - $numpages = substr_count( $this->get_post_content( $this->get_the_real_ID() ), '<!--nextpage-->' ) + 1;
1721
- + $numpages = substr_count( $this->get_post_content( $post_id ), '<!--nextpage-->' ) + 1;
1722
-
1723
- if ( ! $page )
1724
- $page = 1;
1725
- Index: inc/classes/generate.class.php
1726
- ===================================================================
1727
- --- inc/classes/generate.class.php (revision 1418924)
1728
- +++ inc/classes/generate.class.php (working copy)
1729
- @@ -101,7 +101,7 @@
1730
- $meta['noarchive'] = empty( $meta['noarchive'] ) && $this->is_option_checked( 'tag_noindex' ) ? 'noarchive' : $meta['noarchive'];
1731
- }
1732
-
1733
- - $flag = '0' !== $term->admeta['saved_flag'] ? true : false;
1734
- + $flag = isset( $term->admeta['saved_flag'] ) && $this->is_checked( $term->admeta['saved_flag'] );
1735
-
1736
- if ( false === $flag && isset( $term->meta ) ) {
1737
- //* Genesis support.
1738
- Index: inc/classes/init.class.php
1739
- ===================================================================
1740
- --- inc/classes/init.class.php (revision 1433389)
1741
- +++ inc/classes/init.class.php (working copy)
1742
- @@ -35,9 +35,7 @@
1743
- protected $use_object_cache = true;
1744
-
1745
- /**
1746
- - * Constructor. Init actions.
1747
- - *
1748
- - * @since 2.1.6
1749
- + * Constructor. Initializes actions and loads parent constructor.
1750
- */
1751
- public function __construct() {
1752
- parent::__construct();
1753
- @@ -55,7 +53,7 @@
1754
- }
1755
-
1756
- /**
1757
- - * Run the plugin
1758
- + * Runs the plugin on the front-end.
1759
- *
1760
- * @since 1.0.0
1761
- */
1762
- @@ -75,7 +73,7 @@
1763
- }
1764
-
1765
- /**
1766
- - * Initialize front-end actions.
1767
- + * Initializes front-end actions.
1768
- *
1769
- * @since 2.5.2
1770
- */
1771
- @@ -99,7 +97,7 @@
1772
- }
1773
-
1774
- /**
1775
- - * Initialize front-end filters.
1776
- + * Runs front-end filters.
1777
- *
1778
- * @since 2.5.2
1779
- */
1780
- @@ -118,9 +116,8 @@
1781
- add_filter( 'woo_title', array( $this, 'title_from_cache'), 99 );
1782
-
1783
- /**
1784
- + * Applies filters 'the_seo_framework_manipulate_title' : boolean
1785
- * Disables the title tag manipulation on old themes.
1786
- - * Applies filters the_seo_framework_manipulate_title
1787
- - *
1788
- * @since 2.4.1
1789
- */
1790
- if ( (bool) apply_filters( 'the_seo_framework_manipulate_title', true ) ) {
1791
- @@ -131,16 +128,14 @@
1792
- }
1793
-
1794
- /**
1795
- - * Header actions.
1796
- + * Runs header actions.
1797
- *
1798
- + * @since 2.2.6
1799
- * @uses The_SEO_Framework_Load::call_function()
1800
- *
1801
- * @param string|array $args the arguments that will be passed
1802
- * @param bool $before if the header actions should be before or after the SEO Frameworks output
1803
- - *
1804
- - * @since 2.2.6
1805
- - *
1806
- - * @return string|null
1807
- + * @return string|empty The filter output.
1808
- */
1809
- public function header_actions( $args = '', $before = true ) {
1810
-
1811
- @@ -172,33 +167,9 @@
1812
- }
1813
-
1814
- /**
1815
- - * Output the header meta and script
1816
- + * Echos the header meta and scripts.
1817
- *
1818
- * @since 1.0.0
1819
- - *
1820
- - * @param blog_id : the blog id
1821
- - *
1822
- - * Applies filters the_seo_framework_pre : Adds content before
1823
- - * : @param before
1824
- - * : cached
1825
- - * Applies filters the_seo_framework_pro : Adds content after
1826
- - * : @param after
1827
- - * : cached
1828
- - * Applies filters the_seo_framework_generator_tag : String generator tag content
1829
- - * Applies filters the_seo_framework_indicator : True to show indicator in html
1830
- - *
1831
- - * @uses hmpl_ad_description()
1832
- - * @uses $this->og_image()
1833
- - * @uses $this->og_locale()
1834
- - * @uses $this->og_type()
1835
- - * @uses $this->og_title()
1836
- - * @uses $this->og_description()
1837
- - * @uses $this->og_url()
1838
- - * @uses $this->og_sitename()
1839
- - * @uses $this->ld_json()
1840
- - * @uses $this->canonical()
1841
- - *
1842
- - * Echos output.
1843
- */
1844
- public function html_output() {
1845
-
1846
- @@ -237,6 +208,11 @@
1847
-
1848
- $robots = $this->robots();
1849
-
1850
- + /**
1851
- + * Applies filters 'the_seo_framework_pre' : string
1852
- + * Adds content before the output.
1853
- + * @since 2.6.0
1854
- + */
1855
- $before = (string) apply_filters( 'the_seo_framework_pre', '' );
1856
-
1857
- $before_actions = $this->header_actions( '', true );
1858
- @@ -287,10 +263,17 @@
1859
-
1860
- $after_actions = $this->header_actions( '', false );
1861
-
1862
- + /**
1863
- + * Applies filters 'the_seo_framework_pro' : string
1864
- + * Adds content before the output.
1865
- + * @since 2.6.0
1866
- + */
1867
- $after = (string) apply_filters( 'the_seo_framework_pro', '' );
1868
-
1869
- /**
1870
- - * @see https://wordpress.org/plugins/generator-the-seo-framework/
1871
- + * Applies filters 'the_seo_framework_generator_tag' : String generator tag content.
1872
- + * @since 2.0.1
1873
- + * @see https://wordpress.org/plugins/generator-the-seo-framework/ For an alternative.
1874
- */
1875
- $generator = (string) apply_filters( 'the_seo_framework_generator_tag', '' );
1876
-
1877
- @@ -302,6 +285,11 @@
1878
- $this->object_cache_set( $cache_key, $output, 86400 );
1879
- }
1880
-
1881
- + /**
1882
- + * Applies filters 'the_seo_framework_indicator' : Boolean
1883
- + * Whether to show the indicator in HTML.
1884
- + * @since 2.0.0
1885
- + */
1886
- $indicator = (bool) apply_filters( 'the_seo_framework_indicator', true );
1887
-
1888
- $indicatorbefore = '';
1889
- @@ -308,7 +296,19 @@
1890
- $indicatorafter = '';
1891
-
1892
- if ( $indicator ) {
1893
- +
1894
- + /**
1895
- + * Applies filters 'the_seo_framework_indicator_timing' : Boolean
1896
- + * Whether to show the hidden generation time in HTML.
1897
- + * @since 2.4.0
1898
- + */
1899
- $timer = (bool) apply_filters( 'the_seo_framework_indicator_timing', true );
1900
- +
1901
- + /**
1902
- + * Applies filters 'sybre_waaijer_<3' : Boolean
1903
- + * Whether to show the hidden author name in HTML.
1904
- + * @since 2.4.0
1905
- + */
1906
- $sybre = (bool) apply_filters( 'sybre_waaijer_<3', true );
1907
-
1908
- $start = __( 'Start The Seo Framework', 'autodescription' );
1909
- @@ -337,15 +337,16 @@
1910
- }
1911
-
1912
- /**
1913
- - * Redirect singular page to an alternate URL.
1914
- - * Called outside html_output
1915
- + * Redirects singular page to an alternate URL.
1916
- *
1917
- * @since 2.0.9
1918
- + *
1919
- + * @return void early on non-singular pages.
1920
- */
1921
- public function custom_field_redirect() {
1922
-
1923
- //* Prevent redirect from options on uneditable pages.
1924
- - if ( ! $this->is_singular() )
1925
- + if ( ! $this->is_singular() || $this->is_admin() )
1926
- return;
1927
-
1928
- $url = $this->get_custom_field( 'redirect' );
1929
- @@ -353,25 +354,15 @@
1930
- if ( $url ) {
1931
-
1932
- $allow_external = $this->allow_external_redirect();
1933
- + $scheme = null;
1934
-
1935
- - /**
1936
- - * If the URL is made relative, prevent scheme issues
1937
- - *
1938
- - * Removes http:// and https://
1939
- - *
1940
- - * esc_url_raw uses is_ssl() to make the url valid again :)
1941
- - */
1942
- - if ( true !== $allow_external ) {
1943
- - $pattern = '/'
1944
- - . '(((http)(s)?)\:)' // 1: http: https:
1945
- - . '(\/\/)' // 2: slash slash
1946
- - . '/s'
1947
- - ;
1948
- -
1949
- - $url = preg_replace( $pattern, '', $url );
1950
- + if ( false === $allow_external ) {
1951
- + $url = $this->set_url_scheme( $url, 'relative' );
1952
- + $url = $this->add_url_host( $url );
1953
- + $scheme = is_ssl() ? 'https' : 'http';
1954
- }
1955
-
1956
- - wp_redirect( esc_url_raw( $url ), 301 );
1957
- + wp_redirect( esc_url_raw( $url, $scheme ), 301 );
1958
- exit;
1959
- }
1960
-
1961
- Index: inc/classes/inpost.class.php
1962
- ===================================================================
1963
- --- inc/classes/inpost.class.php (revision 1433389)
1964
- +++ inc/classes/inpost.class.php (working copy)
1965
- @@ -23,7 +23,7 @@
1966
- *
1967
- * @since 2.2.2
1968
- */
1969
- -class AutoDescription_Inpost extends AutoDescription_PageOptions {
1970
- +class AutoDescription_Inpost extends AutoDescription_DoingItRight {
1971
-
1972
- /**
1973
- * Add inpost SEO Bar through a filter.
1974
- @@ -630,11 +630,6 @@
1975
- ?>
1976
- <a href="https://support.google.com/webmasters/answer/79812?hl=<?php echo $language; ?>" target="_blank" title="<?php printf( __( 'Tell Search Engines not to save a cached copy of this %s', 'autodescription' ), $type ); ?>">[?]</a>
1977
- </label>
1978
- -
1979
- - <?php // Saved flag, if set then it won't fetch for genesis meta anymore ?>
1980
- - <label class="hidden" for="autodescription_saved_flag">
1981
- - <input name="autodescription[saved_flag]" id="autodescription[saved_flag]" type="checkbox" value="1" checked='checked' />
1982
- - </label>
1983
- </p>
1984
-
1985
- <p><strong><?php _e( 'Local Search Settings', 'autodescription' ); ?></strong></p>
1986
- Index: inc/classes/postdata.class.php
1987
- ===================================================================
1988
- --- inc/classes/postdata.class.php (revision 1418924)
1989
- +++ inc/classes/postdata.class.php (working copy)
1990
- @@ -30,11 +30,118 @@
1991
- */
1992
- public function __construct() {
1993
- parent::__construct();
1994
- +
1995
- + add_action( 'save_post', array( $this, 'inpost_seo_save' ), 1, 2 );
1996
- }
1997
-
1998
- /**
1999
- - * Get or parse the excerpt of the post
2000
- + * Save the SEO settings when we save a post or page.
2001
- + * Some values get sanitized, the rest are pulled from identically named subkeys in the $_POST['autodescription'] array.
2002
- *
2003
- + * @uses $this->save_custom_fields() Perform checks and saves post meta / custom field data to a post or page.
2004
- + *
2005
- + * @since 2.0.0
2006
- + *
2007
- + * @param integer $post_id Post ID.
2008
- + * @param stdClass $post Post object.
2009
- + * @return mixed Returns post id if permissions incorrect, null if doing autosave, ajax or future post, false if update
2010
- + * or delete failed, and true on success.
2011
- + */
2012
- + public function inpost_seo_save( $post_id, $post ) {
2013
- +
2014
- + if ( ! isset( $_POST['autodescription'] ) )
2015
- + return;
2016
- +
2017
- + //* Merge user submitted options with fallback defaults
2018
- + $data = wp_parse_args( $_POST['autodescription'], array(
2019
- + '_genesis_title' => '',
2020
- + '_genesis_description' => '',
2021
- + '_genesis_canonical_uri' => '',
2022
- + 'redirect' => '',
2023
- + '_genesis_noindex' => 0,
2024
- + '_genesis_nofollow' => 0,
2025
- + '_genesis_noarchive' => 0,
2026
- + 'exclude_local_search' => 0,
2027
- + ) );
2028
- +
2029
- + foreach ( (array) $data as $key => $value ) {
2030
- + //* Sanitize the title
2031
- + if ( '_genesis_title' === $key )
2032
- + $data[$key] = trim( strip_tags( $value ) );
2033
- +
2034
- + //* Sanitize the description
2035
- + if ( '_genesis_description' === $key )
2036
- + $data[$key] = $this->s_description( $value );
2037
- +
2038
- + //* Sanitize the URL. Make sure it's an absolute URL
2039
- + if ( 'redirect' === $key )
2040
- + $data[$key] = $this->s_redirect_url( $value );
2041
- +
2042
- + }
2043
- +
2044
- + $this->save_custom_fields( $data, 'inpost_seo_save', 'hmpl_ad_inpost_seo_nonce', $post );
2045
- + }
2046
- +
2047
- + /**
2048
- + * Save post meta / custom field data for a post or page.
2049
- + *
2050
- + * It verifies the nonce, then checks we're not doing autosave, ajax or a future post request. It then checks the
2051
- + * current user's permissions, before finally* either updating the post meta, or deleting the field if the value was not
2052
- + * truthy.
2053
- + *
2054
- + * By passing an array of fields => values from the same metabox (and therefore same nonce) into the $data argument,
2055
- + * repeated checks against the nonce, request and permissions are avoided.
2056
- + *
2057
- + * @since 2.0.0
2058
- + *
2059
- + * @thanks StudioPress (http://www.studiopress.com/) for some code.
2060
- + *
2061
- + * @param array $data Key/Value pairs of data to save in '_field_name' => 'value' format.
2062
- + * @param string $nonce_action Nonce action for use with wp_verify_nonce().
2063
- + * @param string $nonce_name Name of the nonce to check for permissions.
2064
- + * @param WP_Post|integer $post Post object or ID.
2065
- + * @return mixed Return null if permissions incorrect, doing autosave, ajax or future post, false if update or delete
2066
- + * failed, and true on success.
2067
- + */
2068
- + public function save_custom_fields( array $data, $nonce_action, $nonce_name, $post ) {
2069
- +
2070
- + //* Verify the nonce
2071
- + if ( ! isset( $_POST[ $nonce_name ] ) || ! wp_verify_nonce( $_POST[ $nonce_name ], $nonce_action ) )
2072
- + return;
2073
- +
2074
- + //* Don't try to save the data under autosave, ajax, or future post.
2075
- + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
2076
- + return;
2077
- + if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
2078
- + return;
2079
- + if ( defined( 'DOING_CRON' ) && DOING_CRON )
2080
- + return;
2081
- +
2082
- + //* Grab the post object
2083
- + $post = get_post( $post );
2084
- +
2085
- + //* Don't save if WP is creating a revision (same as DOING_AUTOSAVE?)
2086
- + if ( 'revision' === get_post_type( $post ) )
2087
- + return;
2088
- +
2089
- + //* Check that the user is allowed to edit the post
2090
- + if ( ! current_user_can( 'edit_post', $post->ID ) )
2091
- + return;
2092
- +
2093
- + //* Cycle through $data, insert value or delete field
2094
- + foreach ( (array) $data as $field => $value ) {
2095
- + //* Save $value, or delete if the $value is empty
2096
- + if ( $value )
2097
- + update_post_meta( $post->ID, $field, $value );
2098
- + else
2099
- + delete_post_meta( $post->ID, $field );
2100
- + }
2101
- +
2102
- + }
2103
- +
2104
- + /**
2105
- + * Fetches or parses the excerpt of the post
2106
- + *
2107
- * @since 1.0.0
2108
- *
2109
- * @param string $excerpt the Excerpt
2110
- @@ -58,36 +165,27 @@
2111
- return '';
2112
-
2113
- $excerpt = wp_strip_all_tags( strip_shortcodes( $excerpt ) );
2114
- - $excerpt = str_replace( array( "\r\n", "\r", "\n" ), "\n", $excerpt );
2115
-
2116
- - $lines = explode( "\n", $excerpt );
2117
- - $new_lines = array();
2118
- + $output = $this->s_description( $excerpt );
2119
-
2120
- - //* Remove line breaks
2121
- - foreach ( $lines as $i => $line ) {
2122
- - //* Don't add empty lines or paragraphs
2123
- - if ( $line && '&nbsp;' !== $line )
2124
- - $new_lines[] = trim( $line ) . ' ';
2125
- - }
2126
- -
2127
- - $output = implode( $new_lines );
2128
- -
2129
- - return (string) $output;
2130
- + return $output;
2131
- }
2132
-
2133
- /**
2134
- - * Generate excerpt.
2135
- + * Fetches excerpt from post excerpt or fetches the full post content.
2136
- + * Determines if a page builder is used to return an empty string.
2137
- + * Does not sanitize output.
2138
- *
2139
- * @since 2.5.2
2140
- + * @since 2.6.6 Detects Page builders.
2141
- *
2142
- * @param int $the_id The Post ID.
2143
- - * @param int $tt_id The Taxonomy Term ID
2144
- - *
2145
- + * @param int $tt_id The Taxonomy Term ID.
2146
- * @return string|empty excerpt.
2147
- */
2148
- public function fetch_excerpt( $the_id = '', $tt_id = '' ) {
2149
-
2150
- - $post = $this->fetch_post_by_id( $the_id, $tt_id );
2151
- + $post = $this->fetch_post_by_id( $the_id, $tt_id, OBJECT );
2152
-
2153
- if ( empty( $post ) )
2154
- return '';
2155
- @@ -96,10 +194,11 @@
2156
- * Fetch custom excerpt, if not empty, from the post_excerpt field.
2157
- * @since 2.5.2
2158
- */
2159
- - if ( isset( $post['post_excerpt'] ) && $post['post_excerpt'] ) {
2160
- - $excerpt = $post['post_excerpt'];
2161
- - } else if ( isset( $post['post_content'] ) ) {
2162
- - $excerpt = $post['post_content'];
2163
- + if ( isset( $post->post_excerpt ) && $post->post_excerpt ) {
2164
- + $excerpt = $post->post_excerpt;
2165
- + } else if ( isset( $post->post_content ) ) {
2166
- + $uses_builder = $this->uses_page_builder( $post->ID );
2167
- + $excerpt = $uses_builder ? '' : $post->post_content;
2168
- } else {
2169
- $excerpt = '';
2170
- }
2171
- @@ -112,13 +211,14 @@
2172
- * Also returns latest post from blog or archive if applicable.
2173
- *
2174
- * @since 2.6.0
2175
- + * @since 2.6.6 Added $output parameter.
2176
- *
2177
- * @param int $the_id The Post ID.
2178
- * @param int $tt_id The Taxonomy Term ID
2179
- - *
2180
- + * @param mixed $output The value type to return. Accepts OBJECT, ARRAY_A, or ARRAY_N
2181
- * @return empty|array The Post Array.
2182
- */
2183
- - protected function fetch_post_by_id( $the_id = '', $tt_id = '' ) {
2184
- + protected function fetch_post_by_id( $the_id = '', $tt_id = '', $output = ARRAY_A ) {
2185
-
2186
- if ( '' === $the_id && '' === $tt_id ) {
2187
- $the_id = $this->get_the_real_ID();
2188
- @@ -128,11 +228,8 @@
2189
- }
2190
-
2191
- /**
2192
- - * Use the 2nd parameter.
2193
- - * @since 2.2.8
2194
- - *
2195
- - * Now casts to array
2196
- - * @since 2.3.3
2197
- + * @since 2.2.8 Use the 2nd parameter.
2198
- + * @since 2.3.3 Now casts to array
2199
- */
2200
- if ( '' !== $the_id ) {
2201
- if ( $this->is_blog_page( $the_id ) ) {
2202
- @@ -150,12 +247,11 @@
2203
-
2204
- $post = get_posts( $args );
2205
- } else {
2206
- - $post = get_post( $the_id, ARRAY_A );
2207
- + $post = get_post( $the_id );
2208
- }
2209
- } else if ( '' !== $tt_id ) {
2210
- /**
2211
- - * Match the descriptions in admin as on the front end.
2212
- - * @since 2.3.3
2213
- + * @since 2.3.3 Match the descriptions in admin as on the front end.
2214
- */
2215
- $args = array(
2216
- 'posts_per_page' => 1,
2217
- @@ -169,26 +265,34 @@
2218
-
2219
- $post = get_posts( $args );
2220
- } else {
2221
- - $post = get_post( $the_id, ARRAY_A );
2222
- + $post = get_post( $the_id );
2223
- }
2224
-
2225
- /**
2226
- - * Cast last found post object to array and put it in $post.
2227
- - * @since 2.3.3
2228
- + * @since 2.6.5 Transform post array to object (on Archives).
2229
- */
2230
- - if ( isset( $post[0] ) && is_object( $post[0] ) ) {
2231
- - $object = $post[0];
2232
- - $post = (array) $object;
2233
- - }
2234
- + if ( is_array( $post ) && isset( $post[0] ) && is_object( $post[0] ) )
2235
- + $post = $post[0];
2236
-
2237
- - // Something went wrong, nothing to be found. Return empty.
2238
- - if ( empty( $post ) || ! is_array( $post ) )
2239
- + //* Something went wrong, nothing to be found. Return empty.
2240
- + if ( empty( $post ) )
2241
- return '';
2242
-
2243
- //* Stop getting something that doesn't exists. E.g. 404
2244
- - if ( isset( $post['ID'] ) && 0 === $post['ID'] )
2245
- + if ( isset( $post->ID ) && 0 === $post->ID )
2246
- return '';
2247
-
2248
- + /**
2249
- + * @since 2.6.6
2250
- + */
2251
- + if ( ARRAY_A === $output || ARRAY_N === $output ) {
2252
- + $_post = WP_Post::get_instance( $post );
2253
- + $post = $_post->to_array();
2254
- +
2255
- + if ( ARRAY_N === $output )
2256
- + $post = array_values( $post );
2257
- + }
2258
- +
2259
- return $post;
2260
- }
2261
-
2262
- @@ -195,11 +299,12 @@
2263
- /**
2264
- * Fetch latest public post ID.
2265
- *
2266
- + * @since 2.4.3
2267
- * @staticvar int $page_id
2268
- * @global object $wpdb
2269
- * @global int $blog_id
2270
- *
2271
- - * @since 2.4.3
2272
- + * @return int Latest Post ID.
2273
- */
2274
- public function get_latest_post_id() {
2275
- global $wpdb, $blog_id;
2276
- @@ -235,7 +340,7 @@
2277
- '', 1 );
2278
-
2279
- $page_id = (int) $wpdb->get_var( $sql );
2280
- - $this->object_cache_set( $latest_posts_key, $page_id, 86400 );
2281
- + $this->object_cache_set( $latest_posts_key, $page_id, DAY_IN_SECONDS );
2282
- }
2283
-
2284
- return $page_id;
2285
- @@ -246,25 +351,71 @@
2286
- *
2287
- * @since 2.6.0
2288
- *
2289
- - * @param int $id.
2290
- - *
2291
- + * @param int $id The post ID.
2292
- * @return string The post content.
2293
- */
2294
- public function get_post_content( $id = 0 ) {
2295
-
2296
- - if ( empty( $id ) ) {
2297
- - global $wp_query;
2298
- + $id = $id ? $id : $this->get_the_real_ID();
2299
-
2300
- - if ( isset( $wp_query->post->post_content ) )
2301
- - return $wp_query->post->post_content;
2302
- - } else {
2303
- - $content = get_post_field( 'post_content', $id );
2304
- + $content = get_post_field( 'post_content', $id );
2305
-
2306
- - if ( is_string( $content ) )
2307
- - return $content;
2308
- - }
2309
- + if ( is_string( $content ) )
2310
- + return $content;
2311
-
2312
- return '';
2313
- }
2314
-
2315
- + /**
2316
- + * Determines whether the post has a page builder attached to it.
2317
- + * Doesn't use plugin detection features as some builders might be incorporated within themes.
2318
- + *
2319
- + * Detects the following builders:
2320
- + * - Divi Builder by Elegant Themes
2321
- + * - Visual Composer by WPBakery
2322
- + * - Page Builder by SiteOrigin
2323
- + * - Beaver Builder by Fastline Media
2324
- + *
2325
- + * @since 2.6.6
2326
- + *
2327
- + * @param int $post_id
2328
- + * @return boolean
2329
- + */
2330
- + public function uses_page_builder( $post_id ) {
2331
- +
2332
- + $meta = get_post_meta( $post_id );
2333
- +
2334
- + /**
2335
- + * Applies filters 'the_seo_framework_detect_page_builder' : boolean
2336
- + * Determines whether a page builder has been detected.
2337
- + * @since 2.6.6
2338
- + *
2339
- + * @param boolean The current state.
2340
- + * @param int $post_id The current Post ID.
2341
- + * @param array $meta The current post meta.
2342
- + */
2343
- + $detected = (bool) apply_filters( 'the_seo_framework_detect_page_builder', false, $post_id, $meta );
2344
- +
2345
- + if ( $detected )
2346
- + return true;
2347
- +
2348
- + if ( empty( $meta ) )
2349
- + return false;
2350
- +
2351
- + if ( isset( $meta['_et_pb_use_builder'][0] ) && 'on' === $meta['_et_pb_use_builder'][0] && defined( 'ET_BUILDER_VERSION' ) )
2352
- + //* Divi Builder by Elegant Themes
2353
- + return true;
2354
- + elseif ( isset( $meta['_wpb_vc_js_status'][0] ) && 'true' === $meta['_wpb_vc_js_status'][0] && defined( 'WPB_VC_VERSION' ) )
2355
- + //* Visual Composer by WPBakery
2356
- + return true;
2357
- + elseif ( isset( $meta['panels_data'][0] ) && '' !== $meta['panels_data'][0] && defined( 'SITEORIGIN_PANELS_VERSION' ) )
2358
- + //* Page Builder by SiteOrigin
2359
- + return true;
2360
- + elseif ( isset( $meta['_fl_builder_enabled'][0] ) && '1' === $meta['_fl_builder_enabled'][0] && defined( 'FL_BUILDER_VERSION' ) )
2361
- + //* Beaver Builder by Fastline Media
2362
- + return true;
2363
- +
2364
- + return false;
2365
- + }
2366
- +
2367
- }
2368
- Index: inc/classes/query.class.php
2369
- ===================================================================
2370
- --- inc/classes/query.class.php (revision 1433389)
2371
- +++ inc/classes/query.class.php (working copy)
2372
- @@ -96,6 +96,10 @@
2373
- //* Never get this when this is an archive. It will always return the wrong value.
2374
- if ( empty( $id ) && false === is_archive() && false === is_home() )
2375
- $id = get_the_ID();
2376
- +
2377
- + //* Determine the Archive ID on term edit.
2378
- + if ( empty( $id ) && $is_admin && $this->is_archive_admin() )
2379
- + $id = $this->get_admin_term_id();
2380
- }
2381
-
2382
- /**
2383
- @@ -151,10 +155,37 @@
2384
- }
2385
-
2386
- /**
2387
- + * Fetches the Term ID on admin pages.
2388
- + *
2389
- + * @since 2.6.0
2390
- + * @since 2.6.6 Moved from class AutoDescription_TermData.
2391
- + * @staticvar int $term_id The Term ID.
2392
- + *
2393
- + * @return int Term ID.
2394
- + */
2395
- + public function get_admin_term_id() {
2396
- +
2397
- + static $term_id = null;
2398
- +
2399
- + if ( isset( $term_id ) )
2400
- + return $term_id;
2401
- +
2402
- + if ( isset( $_REQUEST['tag_ID'] ) && $_REQUEST['tag_ID'] ) {
2403
- + //* WordPress 4.5+
2404
- + $term_id = $_REQUEST['tag_ID'];
2405
- + } else if ( isset( $_REQUEST['term_id'] ) && $_REQUEST['term_id'] ) {
2406
- + //* Older WordPress versions.
2407
- + $term_id = $_REQUEST['term_id'];
2408
- + }
2409
- +
2410
- + return $term_id = $term_id ? absint( $term_id ) : 0;
2411
- + }
2412
- +
2413
- + /**
2414
- * Detects 404.
2415
- *
2416
- + * @since 2.6.0
2417
- * @staticvar bool $cache
2418
- - * @since 2.6.0
2419
- *
2420
- * @return bool
2421
- */
2422
- @@ -172,10 +203,10 @@
2423
- }
2424
-
2425
- /**
2426
- - * Detects admin.
2427
- + * Detects admin screen.
2428
- *
2429
- + * @since 2.6.0
2430
- * @staticvar bool $cache
2431
- - * @since 2.6.0
2432
- *
2433
- * @return bool
2434
- */
2435
- @@ -195,8 +226,8 @@
2436
- /**
2437
- * Detects attachment page.
2438
- *
2439
- + * @since 2.6.0
2440
- * @staticvar bool $cache
2441
- - * @since 2.6.0
2442
- * @uses $this->is_singular()
2443
- *
2444
- * @param int|string|array|object $attachment Attachment ID, title, slug, or array of such.
2445
- @@ -219,9 +250,11 @@
2446
- /**
2447
- * Detects archive pages. Also in admin.
2448
- *
2449
- + * @since 2.6.0
2450
- * @staticvar bool $cache
2451
- - * @since 2.6.0
2452
- *
2453
- + * @global object $wp_query
2454
- + *
2455
- * @return bool
2456
- */
2457
- public function is_archive() {
2458
- @@ -234,25 +267,24 @@
2459
- if ( isset( $cache ) && $this->can_cache_query() )
2460
- return $cache;
2461
-
2462
- - global $wp_query;
2463
- -
2464
- if ( is_archive() && false === $this->is_singular() )
2465
- return $cache = true;
2466
-
2467
- - global $wp_query;
2468
- + if ( $this->can_cache_query() && false === $this->is_singular() ) {
2469
- + global $wp_query;
2470
-
2471
- - if ( $this->can_cache_query() && false === $this->is_singular() )
2472
- if ( $wp_query->is_post_type_archive || $wp_query->is_date || $wp_query->is_author || $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax )
2473
- return $cache = true;
2474
- + }
2475
-
2476
- return $cache = false;
2477
- }
2478
-
2479
- /**
2480
- - * Extends default WordPress is_archive and made available in admin.
2481
- + * Extends default WordPress is_archive() and determines screen in admin.
2482
- *
2483
- + * @since 2.6.0
2484
- * @staticvar bool $cache
2485
- - * @since 2.6.0
2486
- *
2487
- * @global object $current_screen
2488
- *
2489
- @@ -276,9 +308,8 @@
2490
- /**
2491
- * Detects Term edit screen in WP Admin.
2492
- *
2493
- + * @since 2.6.0
2494
- * @staticvar bool $cache
2495
- - * @since 2.6.0
2496
- - *
2497
- * @global object $current_screen
2498
- *
2499
- * @return bool We're on Term Edit screen.
2500
- @@ -306,9 +337,8 @@
2501
- /**
2502
- * Detects Post edit screen in WP Admin.
2503
- *
2504
- + * @since 2.6.0
2505
- * @staticvar bool $cache
2506
- - * @since 2.6.0
2507
- - *
2508
- * @global object $current_screen
2509
- *
2510
- * @return bool We're on Post Edit screen.
2511
- @@ -331,9 +361,8 @@
2512
- /**
2513
- * Detects Post or Archive Lists in Admin.
2514
- *
2515
- + * @since 2.6.0
2516
- * @staticvar bool $cache
2517
- - * @since 2.6.0
2518
- - *
2519
- * @global object $current_screen
2520
- *
2521
- * @return bool We're on the edit screen.
2522
- @@ -357,8 +386,8 @@
2523
- /**
2524
- * Detects author archives.
2525
- *
2526
- + * @since 2.6.0
2527
- * @staticvar bool $cache
2528
- - * @since 2.6.0
2529
- * @uses $this->is_archive()
2530
- *
2531
- * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
2532
- @@ -381,12 +410,10 @@
2533
- /**
2534
- * Detect the separated blog page.
2535
- *
2536
- - * @param int $id the Page ID.
2537
- - *
2538
- * @since 2.3.4
2539
- - *
2540
- * @staticvar bool $is_blog_page
2541
- *
2542
- + * @param int $id the Page ID.
2543
- * @return bool true if is blog page. Always false if blog page is homepage.
2544
- */
2545
- public function is_blog_page( $id = '' ) {
2546
- @@ -414,12 +441,11 @@
2547
- /**
2548
- * Detects category archives.
2549
- *
2550
- + * @since 2.6.0
2551
- * @staticvar bool $cache
2552
- - * @since 2.6.0
2553
- * @uses $this->is_archive()
2554
- *
2555
- * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
2556
- - *
2557
- * @return bool
2558
- */
2559
- public function is_category( $category = '' ) {
2560
- @@ -439,11 +465,10 @@
2561
- }
2562
-
2563
- /**
2564
- - * Extends default WordPress is_category and made available in admin.
2565
- + * Extends default WordPress is_category() and determines screen in admin.
2566
- *
2567
- + * @since 2.6.0
2568
- * @staticvar bool $cache
2569
- - * @since 2.6.0
2570
- - *
2571
- * @global object $current_screen
2572
- *
2573
- * @return bool Post Type is category
2574
- @@ -458,6 +483,7 @@
2575
- global $current_screen;
2576
-
2577
- if ( $this->is_archive_admin() && isset( $current_screen->taxonomy ) ) {
2578
- +
2579
- $tax = $current_screen->taxonomy;
2580
- $len = strlen( $tax );
2581
-
2582
- @@ -474,8 +500,8 @@
2583
- /**
2584
- * Detects date archives.
2585
- *
2586
- + * @since 2.6.0
2587
- * @staticvar bool $cache
2588
- - * @since 2.6.0
2589
- * @uses $this->is_archive()
2590
- *
2591
- * @return bool
2592
- @@ -518,11 +544,10 @@
2593
- /**
2594
- * Detects feed.
2595
- *
2596
- + * @since 2.6.0
2597
- * @staticvar bool $cache
2598
- - * @since 2.6.0
2599
- *
2600
- * @param string|array $feeds Optional feed types to check.
2601
- - *
2602
- * @return bool
2603
- */
2604
- public function is_feed( $feeds = '' ) {
2605
- @@ -529,7 +554,7 @@
2606
-
2607
- static $cache = array();
2608
-
2609
- - if ( isset( $cache[$feeds] ) && $this->can_cache_query() )
2610
- + if ( is_string( $feeds ) && isset( $cache[$feeds] ) && $this->can_cache_query() )
2611
- return $cache[$feeds];
2612
-
2613
- if ( is_feed( $feeds ) )
2614
- @@ -541,11 +566,10 @@
2615
- /**
2616
- * Detects front page.
2617
- *
2618
- + * @since 2.6.0
2619
- * @staticvar bool $cache
2620
- - * @since 2.6.0
2621
- *
2622
- * @param int $id The page or Post ID.
2623
- - *
2624
- * @return bool
2625
- */
2626
- public function is_front_page( $id = 0 ) {
2627
- @@ -582,8 +606,8 @@
2628
- /**
2629
- * Detects home page.
2630
- *
2631
- + * @since 2.6.0
2632
- * @staticvar bool $cache
2633
- - * @since 2.6.0
2634
- *
2635
- * @return bool
2636
- */
2637
- @@ -603,8 +627,8 @@
2638
- /**
2639
- * Detects month archives.
2640
- *
2641
- + * @since 2.6.0
2642
- * @staticvar bool $cache
2643
- - * @since 2.6.0
2644
- * @uses $this->is_date()
2645
- *
2646
- * @return bool
2647
- @@ -625,12 +649,11 @@
2648
- /**
2649
- * Detects pages.
2650
- *
2651
- + * @since 2.6.0
2652
- * @staticvar bool $cache
2653
- - * @since 2.6.0
2654
- * @uses $this->is_singular()
2655
- *
2656
- * @param int|string|array $page Optional. Page ID, title, slug, or array of such. Default empty.
2657
- - *
2658
- * @return bool
2659
- */
2660
- public function is_page( $page = '' ) {
2661
- @@ -656,11 +679,9 @@
2662
- *
2663
- * @since 2.6.0
2664
- * @see $this->is_page()
2665
- - *
2666
- * @global object $current_screen;
2667
- *
2668
- * @param int|string|array $page Optional. Page ID, title, slug, or array of such. Default empty.
2669
- - *
2670
- * @return bool
2671
- */
2672
- public function is_page_admin( $page = '' ) {
2673
- @@ -675,8 +696,8 @@
2674
- /**
2675
- * Detects preview.
2676
- *
2677
- + * @since 2.6.0
2678
- * @staticvar bool $cache
2679
- - * @since 2.6.0
2680
- *
2681
- * @return bool
2682
- */
2683
- @@ -696,8 +717,8 @@
2684
- /**
2685
- * Detects preview.
2686
- *
2687
- + * @since 2.6.0
2688
- * @staticvar bool $cache
2689
- - * @since 2.6.0
2690
- *
2691
- * @return bool
2692
- */
2693
- @@ -717,12 +738,11 @@
2694
- /**
2695
- * Detects posts.
2696
- *
2697
- + * @since 2.6.0
2698
- * @staticvar bool $cache
2699
- - * @since 2.6.0
2700
- * @uses $this->is_singular()
2701
- *
2702
- * @param int|string|array $post Optional. Post ID, title, slug, or array of such. Default empty.
2703
- - *
2704
- * @return bool
2705
- */
2706
- public function is_single( $post = '' ) {
2707
- @@ -747,12 +767,10 @@
2708
- * Detects posts within the admin area.
2709
- *
2710
- * @since 2.6.0
2711
- + * @global object $current_screen
2712
- * @see $this->is_single()
2713
- *
2714
- - * @global object $current_screen;
2715
- - *
2716
- * @param int|string|array $post Optional. Page ID, title, slug, or array of such. Default empty.
2717
- - *
2718
- * @return bool
2719
- */
2720
- public function is_single_admin( $post = '' ) {
2721
- @@ -765,20 +783,15 @@
2722
- }
2723
-
2724
- /**
2725
- - * Replaces and expands default WordPress is_singular.
2726
- + * Determines if the current page is singular is holds singular items within the admin screen.
2727
- + * Replaces and expands default WordPress is_singular().
2728
- *
2729
- + * @since 2.5.2
2730
- + * @staticvar bool $cache
2731
- * @uses $this->is_blog_page()
2732
- * @uses $this->is_wc_shop()
2733
- - * @uses $this->is_single()
2734
- - * @uses $this->is_page()
2735
- - * @uses $this->is_attachment()
2736
- *
2737
- * @param string|array $post_types Optional. Post type or array of post types. Default empty.
2738
- - *
2739
- - * @staticvar bool $cache
2740
- - *
2741
- - * @since 2.5.2
2742
- - *
2743
- * @return bool Post Type is singular
2744
- */
2745
- public function is_singular( $post_types = '' ) {
2746
- @@ -812,12 +825,10 @@
2747
- }
2748
-
2749
- /**
2750
- - * Extends default WordPress is_singular and made available in admin.
2751
- + * Determines if the page is singular within the admin screen.
2752
- *
2753
- + * @since 2.5.2
2754
- * @staticvar bool $cache
2755
- - *
2756
- - * @since 2.5.2
2757
- - *
2758
- * @global object $current_screen
2759
- *
2760
- * @return bool Post Type is singular
2761
- @@ -838,15 +849,13 @@
2762
- }
2763
-
2764
- /**
2765
- - * Detect the static front page.
2766
- + * Detects the static front page.
2767
- *
2768
- - * @param int $id the Page ID.
2769
- - *
2770
- + * @since 2.3.8
2771
- * @staticvar array $cache
2772
- - * @since 2.3.8
2773
- *
2774
- - * @return bool true if is blog page. Always false if blog page is homepage.
2775
- - * False early when false as ID is entered.
2776
- + * @param int $id the Page ID to check. If empty, the current ID will be fetched.
2777
- + * @return bool true if is blog page. Always false if the homepage is a blog.
2778
- */
2779
- public function is_static_frontpage( $id = '' ) {
2780
-
2781
- @@ -878,7 +887,6 @@
2782
- * @uses $this->is_archive()
2783
- *
2784
- * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
2785
- - *
2786
- * @return bool
2787
- */
2788
- public function is_tag( $tag = '' ) {
2789
- @@ -899,11 +907,10 @@
2790
- }
2791
-
2792
- /**
2793
- - * Extends default WordPress is_tag and made available in admin.
2794
- + * Determines if the page is a tag within the admin screen.
2795
- *
2796
- + * @since 2.6.0
2797
- * @staticvar bool $cache
2798
- - * @since 2.6.0
2799
- - *
2800
- * @global object $current_screen
2801
- *
2802
- * @return bool Post Type is category
2803
- @@ -928,13 +935,12 @@
2804
- /**
2805
- * Detects taxonomy archives.
2806
- *
2807
- + * @since 2.6.0
2808
- * @staticvar bool $cache
2809
- - * @since 2.6.0
2810
- * @uses $this->is_archive()
2811
- *
2812
- * @param string|array $taxonomy Optional. Taxonomy slug or slugs.
2813
- * @param int|string|array $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
2814
- - *
2815
- * @return bool
2816
- */
2817
- public function is_tax( $taxonomy = '', $term = '' ) {
2818
- @@ -951,13 +957,14 @@
2819
- }
2820
-
2821
- /**
2822
- - * Is Ulimate Member user page.
2823
- - * Check for function accessibility: um_user, um_is_core_page, um_get_requested_user
2824
- + * Determines if the page is a Ulimate Member's plugin User page.
2825
- + * Checks for function availability: um_user, um_is_core_page, um_get_requested_user
2826
- *
2827
- + * @since 2.5.2
2828
- * @staticvar bool $cache
2829
- * @uses $this->can_i_use()
2830
- *
2831
- - * @since 2.5.2
2832
- + * @return bool Whether we're on a Ultimate Member page.
2833
- */
2834
- public function is_ultimate_member_user_page() {
2835
-
2836
- @@ -972,11 +979,12 @@
2837
- }
2838
-
2839
- /**
2840
- - * Check for WooCommerce shop page.
2841
- + * Determines if the page is the WooCommerce plugin Shop page.
2842
- *
2843
- + * @since 2.5.2
2844
- * @staticvar bool $cache
2845
- *
2846
- - * @since 2.5.2
2847
- + * @return bool True if on the WooCommerce shop page.
2848
- */
2849
- public function is_wc_shop() {
2850
-
2851
- @@ -993,11 +1001,12 @@
2852
- }
2853
-
2854
- /**
2855
- - * Check for WooCommerce product page.
2856
- + * Determines if the page is the WooCommerce plugin Product page.
2857
- *
2858
- + * @since 2.5.2
2859
- * @staticvar bool $cache
2860
- *
2861
- - * @since 2.5.2
2862
- + * @return bool True if on a WooCommerce Product page.
2863
- */
2864
- public function is_wc_product() {
2865
-
2866
- @@ -1016,8 +1025,8 @@
2867
- /**
2868
- * Detects year archives.
2869
- *
2870
- + * @since 2.6.0
2871
- * @staticvar bool $cache
2872
- - * @since 2.6.0
2873
- * @uses $this->is_date()
2874
- *
2875
- * @return bool
2876
- @@ -1036,10 +1045,10 @@
2877
- }
2878
-
2879
- /**
2880
- - * Whether we're on the SEO settings page.
2881
- + * Determines whether we're on the SEO settings page.
2882
- *
2883
- + * @since 2.6.0
2884
- * @staticvar bool $cache
2885
- - * @since 2.6.0
2886
- *
2887
- * @return bool
2888
- */
2889
- @@ -1054,13 +1063,13 @@
2890
- }
2891
-
2892
- /**
2893
- - * The amount of pages.
2894
- - * Fetches global $page through Query Var.
2895
- + * Fetches the amount of pages on the screen.
2896
- + * Fetches global $page through Query Var to prevent conflicts.
2897
- *
2898
- + * @since 2.6.0
2899
- * @staticvar int $page
2900
- - * @since 2.6.0
2901
- *
2902
- - * @return int $page
2903
- + * @return int $page Always a positive number.
2904
- */
2905
- public function page() {
2906
-
2907
- @@ -1075,11 +1084,11 @@
2908
- }
2909
-
2910
- /**
2911
- - * The number of the current page.
2912
- + * Fetches the number of the current page.
2913
- * Fetches global $paged through Query Var. Determines
2914
- *
2915
- + * @since 2.6.0
2916
- * @staticvar int $paged
2917
- - * @since 2.6.0
2918
- *
2919
- * @return int $paged
2920
- */
2921
- Index: inc/classes/sanitize.class.php
2922
- ===================================================================
2923
- --- inc/classes/sanitize.class.php (revision 1433389)
2924
- +++ inc/classes/sanitize.class.php (working copy)
2925
- @@ -519,6 +519,7 @@
2926
- * Returns a one-line sanitized description
2927
- *
2928
- * @since 2.5.0
2929
- + * @since 2.6.6 Removes duplicated spaces.
2930
- *
2931
- * @param string $new_value The Description.
2932
- * @return string One line sanitized description.
2933
- @@ -539,6 +540,13 @@
2934
-
2935
- $description = trim( implode( $new_lines ) );
2936
-
2937
- + $i = 0;
2938
- + //* Run twice at most, to catch uneven multiple spaces.
2939
- + do {
2940
- + $description = str_replace( ' ', ' ', $description );
2941
- + $i++;
2942
- + } while ( strpos( $description, ' ' ) && $i <= 2 );
2943
- +
2944
- return (string) strip_tags( $description );
2945
- }
2946
-
2947
- @@ -665,9 +673,7 @@
2948
-
2949
- /**
2950
- * Returns a 1 or 0, for all truthy / falsy values.
2951
- - *
2952
- * Uses double casting. First, we cast to bool, then to integer.
2953
- - *
2954
- * Also flushes the sitemap.
2955
- *
2956
- * @since 2.2.9
2957
- Index: inc/classes/sitemaps.class.php
2958
- ===================================================================
2959
- --- inc/classes/sitemaps.class.php (revision 1433389)
2960
- +++ inc/classes/sitemaps.class.php (working copy)
2961
- @@ -316,10 +316,8 @@
2962
- /**
2963
- * Transient expiration: 1 week.
2964
- * Keep the sitemap for at most 1 week.
2965
- - *
2966
- - * 60s * 60m * 24h * 7d
2967
- */
2968
- - $expiration = 60 * 60 * 24 * 7;
2969
- + $expiration = WEEK_IN_SECONDS;
2970
-
2971
- $this->set_transient( $this->sitemap_transient, $sitemap_content, $expiration );
2972
- }
2973
- @@ -741,12 +739,10 @@
2974
- * Limit the pinging to a maximum of 1 per hour.
2975
- * Transient expiration. 1 hour.
2976
- *
2977
- - * 60s * 60m
2978
- - *
2979
- * Applies filters the_seo_framework_sitemap_throttle_s
2980
- * @since 2.5.1
2981
- */
2982
- - $expiration = (int) apply_filters( 'the_seo_framework_sitemap_throttle_s', 60 * 60 );
2983
- + $expiration = (int) apply_filters( 'the_seo_framework_sitemap_throttle_s', HOUR_IN_SECONDS );
2984
-
2985
- //* @NOTE: Using legacy set_transient to prevent ping spam.
2986
- set_transient( $transient, $throttle, $expiration );
2987
- @@ -876,43 +872,6 @@
2988
- }
2989
-
2990
- /**
2991
- - * Add and Flush rewrite rules on plugin activation.
2992
- - *
2993
- - * @since 2.2.9
2994
- - * @access private
2995
- - *
2996
- - * Do not return anything. Just be here. Thanks.
2997
- - */
2998
- - public static function flush_rewrite_rules_activation() {
2999
- - global $wp_rewrite;
3000
- -
3001
- - //* This function is called statically.
3002
- - $the_seo_framework = the_seo_framework();
3003
- - $the_seo_framework->rewrite_rule_sitemap( true );
3004
- -
3005
- - $wp_rewrite->init();
3006
- - $wp_rewrite->flush_rules( true );
3007
- - }
3008
- -
3009
- - /**
3010
- - * Flush rewrite rules on plugin deactivation.
3011
- - *
3012
- - * @since 2.2.9
3013
- - * @access private
3014
- - *
3015
- - * Do not return anything. Just be here. Thanks.
3016
- - */
3017
- - public static function flush_rewrite_rules_deactivation() {
3018
- - global $wp_rewrite;
3019
- -
3020
- - $wp_rewrite->init();
3021
- -
3022
- - unset( $wp_rewrite->extra_rules_top['sitemap\.xml$'] );
3023
- -
3024
- - $wp_rewrite->flush_rules( true );
3025
- - }
3026
- -
3027
- - /**
3028
- * Initialize and flush rewrite rules.
3029
- *
3030
- * @since 2.6.0
3031
- Index: inc/classes/siteoptions.class.php
3032
- ===================================================================
3033
- --- inc/classes/siteoptions.class.php (revision 1433389)
3034
- +++ inc/classes/siteoptions.class.php (working copy)
3035
- @@ -416,9 +416,6 @@
3036
- if ( update_option( $this->settings_field, $options ) && $updated && $this->load_options ) {
3037
- $this->pre_output_site_updated_plugin_notice();
3038
- }
3039
- -
3040
- - //* Flush rewrite rules at shutdown.
3041
- - $this->enqueue_rewrite_flush_other( true );
3042
- }
3043
-
3044
- /**
3045
- Index: inc/classes/termdata.class.php
3046
- ===================================================================
3047
- --- inc/classes/termdata.class.php (revision 1418924)
3048
- +++ inc/classes/termdata.class.php (working copy)
3049
- @@ -26,13 +26,206 @@
3050
- class AutoDescription_TermData extends AutoDescription_PostData {
3051
-
3052
- /**
3053
- - * Constructor, load parent constructor
3054
- + * Constructor, load parent constructor.
3055
- */
3056
- public function __construct() {
3057
- parent::__construct();
3058
- +
3059
- + add_action( 'current_screen', array( $this, 'init_term_filters' ), 999 );
3060
- + add_action( 'get_header', array( $this, 'init_term_filters' ), 999 );
3061
- +
3062
- + add_action( 'edit_term', array( $this, 'taxonomy_seo_save' ), 10, 2 );
3063
- + add_action( 'delete_term', array( $this, 'term_meta_delete' ), 10, 2 );
3064
- }
3065
-
3066
- /**
3067
- + * Initializes term filters after wp_query or currentscreen has been set.
3068
- + *
3069
- + * @since 2.6.6
3070
- + * @staticvar boolean $run Whether this function has already run.
3071
- + * @access private
3072
- + *
3073
- + * @return void early if already run.
3074
- + */
3075
- + public function init_term_filters() {
3076
- +
3077
- + static $run = null;
3078
- +
3079
- + if ( isset( $run ) )
3080
- + return;
3081
- +
3082
- + add_filter( 'get_term', array( $this, 'get_term_filter' ), 10, 2 );
3083
- + add_filter( 'get_terms', array( $this, 'get_terms_filter' ), 10, 2 );
3084
- +
3085
- + $run = true;
3086
- +
3087
- + }
3088
- +
3089
- + /**
3090
- + * Add term meta data into options table of the term.
3091
- + * Adds separated database options for terms, as the terms table doesn't allow for addition.
3092
- + *
3093
- + * Applies filters array the_seo_framework_term_meta_defaults : Array of default term SEO options
3094
- + * Applies filters mixed the_seo_framework_term_meta_{field} : Override filter for specifics.
3095
- + * Applies filters array the_seo_framework_term_meta : Override output for term or taxonomy.
3096
- + *
3097
- + * @since 2.1.8
3098
- + *
3099
- + * @todo Use WordPress 4.4.0 get_term_meta() / update_term_meta()
3100
- + * @priority OMG WTF BBQ 2.6.x / Genesis 2.3.0
3101
- + * @see @link http://www.studiopress.com/important-announcement-for-genesis-plugin-developers/
3102
- + * @link https://core.trac.wordpress.org/browser/tags/4.5/src/wp-includes/taxonomy.php#L1814
3103
- + * @todo still use arrays in get_term_meta() / update_term_meta() ?
3104
- + * @NOTE Keep WP 3.8 compat.
3105
- + *
3106
- + * @param object $term Database row object.
3107
- + * @param string $taxonomy Taxonomy name that $term is part of.
3108
- + * @return object $term Database row object.
3109
- + */
3110
- + public function get_term_filter( $term, $taxonomy ) {
3111
- +
3112
- + //* Do nothing, if $term is not an object.
3113
- + if ( ! is_object( $term ) )
3114
- + return $term;
3115
- +
3116
- + //* We can't set query vars just yet.
3117
- + if ( false === $this->can_cache_query() )
3118
- + return $term;
3119
- +
3120
- + /**
3121
- + * No need to process this data outside of the Terms' scope.
3122
- + * @since 2.6.0
3123
- + */
3124
- + if ( false === $this->is_admin() && false === $this->is_archive() )
3125
- + return $term;
3126
- +
3127
- + /**
3128
- + * No need to process this after the data has already been output.
3129
- + * @since 2.6.0
3130
- + */
3131
- + if ( did_action( 'the_seo_framework_do_after_output' ) )
3132
- + return $term;
3133
- +
3134
- + /**
3135
- + * Do nothing if called in the context of creating a term via an Ajax call to prevent data conflict.
3136
- + * @since ???
3137
- + *
3138
- + * @since 2.6.0 delay did_action call as it's a heavy array call.
3139
- + */
3140
- + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && did_action( 'wp_ajax_add-tag' ) )
3141
- + return $term;
3142
- +
3143
- + $db = get_option( 'autodescription-term-meta' );
3144
- + $term_meta = isset( $db[$term->term_id] ) ? $db[$term->term_id] : array();
3145
- +
3146
- + $args = (array) apply_filters( 'the_seo_framework_term_meta_defaults', array(
3147
- + 'doctitle' => '',
3148
- + 'description' => '',
3149
- + 'noindex' => 0,
3150
- + 'nofollow' => 0,
3151
- + 'noarchive' => 0,
3152
- + 'saved_flag' => 0, // Don't touch, used to prevent data conflict with Genesis.
3153
- + ) );
3154
- +
3155
- + $term->admeta = wp_parse_args( $term_meta, $args );
3156
- +
3157
- + //* Sanitize term meta
3158
- + foreach ( $term->admeta as $field => $value ) {
3159
- +
3160
- + /**
3161
- + * Trim and sanitize the title beforehand.
3162
- + * @since 2.5.0
3163
- + */
3164
- + if ( 'doctitle' === $field )
3165
- + $value = trim( strip_tags( $value ) );
3166
- +
3167
- + /**
3168
- + * Trim and sanitize the description beforehand.
3169
- + * @since 2.5.0
3170
- + */
3171
- + if ( 'description' === $field )
3172
- + $value = $this->s_description( $value );
3173
- +
3174
- + /**
3175
- + * @param object $term The Term object.
3176
- + * @param string $taxonomy The Taxonomy name.
3177
- + */
3178
- + $term->admeta[$field] = (string) apply_filters( "the_seo_framework_term_meta_{$field}", stripslashes( wp_kses_decode_entities( $value ) ), $term, $taxonomy );
3179
- + }
3180
- +
3181
- + /**
3182
- + * @param object $term The Term object.
3183
- + * @param array $taxonomy The Taxonomy name.
3184
- + */
3185
- + $term->admeta = (array) apply_filters( 'the_seo_framework_term_meta', $term->admeta, $term, $taxonomy );
3186
- +
3187
- + return $term;
3188
- + }
3189
- +
3190
- + /**
3191
- + * Add AutoDescription term-meta data to functions that return multiple terms.
3192
- + *
3193
- + * @since 2.0.0
3194
- + *
3195
- + * @param array $terms Database row objects.
3196
- + * @param string $taxonomy Taxonomy name that $terms are part of.
3197
- + * @return array $terms Database row objects.
3198
- + */
3199
- + public function get_terms_filter( array $terms, $taxonomy ) {
3200
- +
3201
- + foreach( $terms as $term )
3202
- + $term = $this->get_term_filter( $term, $taxonomy );
3203
- +
3204
- + return $terms;
3205
- + }
3206
- +
3207
- + /**
3208
- + * Save taxonomy meta data.
3209
- + * Fires when a user edits and saves a taxonomy.
3210
- + *
3211
- + * @since 2.1.8
3212
- + *
3213
- + * @param integer $term_id Term ID.
3214
- + * @param integer $tt_id Term Taxonomy ID.
3215
- + * @return void Early on AJAX call.
3216
- + */
3217
- + public function taxonomy_seo_save( $term_id, $tt_id ) {
3218
- +
3219
- + if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3220
- + return;
3221
- +
3222
- + $term_meta = (array) get_option( 'autodescription-term-meta' );
3223
- +
3224
- + $term_meta[$term_id] = isset( $_POST['autodescription-meta'] ) ? (array) $_POST['autodescription-meta'] : array();
3225
- +
3226
- + //* Pass through wp_kses if not super admin.
3227
- + if ( ! current_user_can( 'unfiltered_html' ) && isset( $term_meta[$term_id]['archive_description'] ) )
3228
- + $term_meta[$term_id]['archive_description'] = wp_kses( $term_meta[$term_id]['archive_description'] );
3229
- +
3230
- + update_option( 'autodescription-term-meta', $term_meta );
3231
- +
3232
- + }
3233
- +
3234
- + /**
3235
- + * Delete term meta data.
3236
- + * Fires when a user deletes a term.
3237
- + *
3238
- + * @since 2.1.8
3239
- + *
3240
- + * @param integer $term_id Term ID.
3241
- + * @param integer $tt_id Taxonomy Term ID.
3242
- + */
3243
- + public function term_meta_delete( $term_id, $tt_id ) {
3244
- +
3245
- + $term_meta = (array) get_option( 'autodescription-term-meta' );
3246
- +
3247
- + unset( $term_meta[$term_id] );
3248
- +
3249
- + update_option( 'autodescription-term-meta', (array) $term_meta );
3250
- +
3251
- + }
3252
- +
3253
- + /**
3254
- * Fetch set Term data.
3255
- *
3256
- * @param object|null $term The TT object, if it isn't set, one is fetched.
3257
- @@ -85,7 +278,6 @@
3258
- * @access private
3259
- *
3260
- * @param int $id The possible taxonomy Term ID.
3261
- - *
3262
- * @return null|object The Term object.
3263
- */
3264
- public function fetch_the_term( $id = '' ) {
3265
- @@ -100,13 +292,11 @@
3266
- return false;
3267
-
3268
- if ( $this->is_admin() ) {
3269
- - if ( 'term.php' === $this->page_hook ) {
3270
- - global $current_screen;
3271
- + global $current_screen;
3272
-
3273
- - if ( isset( $current_screen->taxonomy ) ) {
3274
- - $term_id = $id ? $id : $this->get_admin_term_id();
3275
- - $term[$id] = get_term_by( 'id', $term_id, $current_screen->taxonomy );
3276
- - }
3277
- + if ( isset( $current_screen->taxonomy ) ) {
3278
- + $term_id = $id ? $id : $this->get_admin_term_id();
3279
- + $term[$id] = get_term_by( 'id', $term_id, $current_screen->taxonomy );
3280
- }
3281
- } else {
3282
- if ( $this->is_category() || $this->is_tag() ) {
3283
- @@ -125,12 +315,10 @@
3284
- /**
3285
- * Fetch Tax labels
3286
- *
3287
- - * @param string $tax_type the Taxonomy type.
3288
- - *
3289
- * @since 2.3.1
3290
- - *
3291
- * @staticvar object $labels
3292
- *
3293
- + * @param string $tax_type the Taxonomy type.
3294
- * @return object|null with all the labels as member variables
3295
- */
3296
- public function get_tax_labels( $tax_type ) {
3297
- @@ -153,7 +341,6 @@
3298
- * Get the current screen term labels.
3299
- *
3300
- * @since 2.6.0
3301
- - *
3302
- * @staticvar string $term_name : Caution: This function only runs once per screen and doesn't check the term type more than once.
3303
- *
3304
- * @param object $term The Taxonomy Term object.
3305
- @@ -160,7 +347,6 @@
3306
- * @param bool $singular Whether to fetch a singular or plural name.
3307
- * @param bool $fallback Whether to fallback on a generic name.
3308
- * @param bool $use_cache Whether to read from cache.
3309
- - *
3310
- * @return string the Term name.
3311
- */
3312
- protected function get_the_term_name( $term, $singular = true, $fallback = true, $use_cache = true ) {
3313
- @@ -228,28 +414,4 @@
3314
- return $term_name[$singular] = '';
3315
- }
3316
-
3317
- - /**
3318
- - * Fetch the Admin Term ID. For WordPress 4.5 up and below.
3319
- - *
3320
- - * @since 2.6.0
3321
- - * @staticvar int $term_id The Term ID.
3322
- - *
3323
- - * @return int Term ID.
3324
- - */
3325
- - public function get_admin_term_id() {
3326
- -
3327
- - static $term_id = null;
3328
- -
3329
- - if ( isset( $term_id ) )
3330
- - return $term_id;
3331
- -
3332
- - if ( isset( $_REQUEST['tag_ID'] ) && $_REQUEST['tag_ID'] ) {
3333
- - $term_id = $_REQUEST['tag_ID'];
3334
- - } else if ( isset( $_REQUEST['term_id'] ) && $_REQUEST['term_id'] ) {
3335
- - $term_id = $_REQUEST['term_id'];
3336
- - }
3337
- -
3338
- - return $term_id = $term_id ? abs( (int) $term_id ) : 0;
3339
- - }
3340
- -
3341
- }
3342
- Index: inc/classes/transients.class.php
3343
- ===================================================================
3344
- --- inc/classes/transients.class.php (revision 1433521)
3345
- +++ inc/classes/transients.class.php (working copy)
3346
- @@ -138,8 +138,10 @@
3347
- }
3348
-
3349
- /**
3350
- - * Setup vars for transients.
3351
- + * Setup vars for general site transients.
3352
- *
3353
- + * @global int $blog_id
3354
- + *
3355
- * @since 2.3.3
3356
- */
3357
- public function setup_transient_names() {
3358
- @@ -158,11 +160,11 @@
3359
- /**
3360
- * Setup vars for transients which require $page_id.
3361
- *
3362
- + * @since 2.3.3
3363
- + *
3364
- * @param int|string|bool $page_id the Taxonomy or Post ID. If false it will generate for the blog page.
3365
- * @param string $taxonomy The taxonomy name.
3366
- * @param strgin $type The Post Type
3367
- - *
3368
- - * @since 2.3.3
3369
- */
3370
- public function setup_auto_description_transient( $page_id, $taxonomy = '', $type = null ) {
3371
-
3372
- @@ -174,7 +176,7 @@
3373
- *
3374
- * @since 2.3.4
3375
- */
3376
- - $revision = '0';
3377
- + $revision = '1';
3378
-
3379
- $additions = $this->add_description_additions( $page_id, $taxonomy );
3380
-
3381
- @@ -190,11 +192,11 @@
3382
- /**
3383
- * Setup vars for transients which require $page_id.
3384
- *
3385
- + * @since 2.3.3
3386
- + *
3387
- * @param int|string|bool $page_id the Taxonomy or Post ID. If false it will generate for the blog page.
3388
- * @param string $taxonomy The taxonomy name.
3389
- * @param string|null $type The post type.
3390
- - *
3391
- - * @since 2.3.3
3392
- */
3393
- public function setup_ld_json_transient( $page_id, $taxonomy = '', $type = null ) {
3394
-
3395
- @@ -220,19 +222,15 @@
3396
- /**
3397
- * Generate transient key based on query vars.
3398
- *
3399
- - * @param int|string|bool $page_id the Taxonomy or Post ID.
3400
- - * @param string $taxonomy The Taxonomy name.
3401
- - * @param string $type The Post Type
3402
- - *
3403
- - * @staticvar array $cached_id : contains cache strings.
3404
- - *
3405
- * @global int $blog_id;
3406
- *
3407
- * @since 2.3.3
3408
- + * @since 2.6.0 Refactored.
3409
- + * @staticvar array $cached_id : contains cache strings.
3410
- *
3411
- - * @refactored
3412
- - * @since 2.6.0
3413
- - *
3414
- + * @param int|string|bool $page_id the Taxonomy or Post ID.
3415
- + * @param string $taxonomy The Taxonomy name.
3416
- + * @param string $type The Post Type
3417
- * @return string The generated page id key.
3418
- */
3419
- public function generate_cache_key( $page_id, $taxonomy = '', $type = null ) {
3420
- @@ -253,7 +251,7 @@
3421
- //* Author page.
3422
- $the_id = 'author_' . $page_id;
3423
- } else if ( 'frontpage' === $type ) {
3424
- - //* Home Page.
3425
- + //* Front/HomePage.
3426
- $the_id = $this->generate_front_page_cache_key();
3427
- } else {
3428
- $this->_doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, __( 'Third parameter must be a known type.', 'autodescription' ), '2.6.5' );
3429
- @@ -260,10 +258,9 @@
3430
- $the_id = esc_sql( $type . '_' . $page_id . '_' . $t );
3431
- }
3432
- } else if ( $this->is_404() ) {
3433
- - //* 404.
3434
- $the_id = '_404_';
3435
- } else if ( ( $this->is_front_page( $page_id ) ) || ( $this->is_admin() && $this->is_menu_page( $this->pagehook ) ) ) {
3436
- - //* Fetch Home key.
3437
- + //* Front/HomePage.
3438
- $the_id = $this->generate_front_page_cache_key();
3439
- } else if ( $this->is_blog_page( $page_id ) ) {
3440
- $the_id = 'blog_' . $page_id;
3441
- @@ -455,7 +452,6 @@
3442
- * @since 2.2.9
3443
- *
3444
- * @param int $post_id The Post ID that has been updated.
3445
- - *
3446
- * @return bool|null True when sitemap is flushed. False on revision. Null
3447
- * when sitemaps are deactivated.
3448
- */
3449
- @@ -540,10 +536,9 @@
3450
- * Delete transient for the automatic description for blog on save request.
3451
- * Returns old option, since that's passed for sanitation within WP Core.
3452
- *
3453
- - * @param string $old_option The previous blog description option.
3454
- - *
3455
- * @since 2.3.3
3456
- *
3457
- + * @param string $old_option The previous blog description option.
3458
- * @return string Previous option.
3459
- */
3460
- public function delete_auto_description_blog_transient( $old_option ) {
3461
- @@ -558,12 +553,11 @@
3462
- /**
3463
- * Delete transient for the automatic description on requests.
3464
- *
3465
- + * @since 2.3.3
3466
- + *
3467
- * @param mixed $page_id The page ID or identifier.
3468
- * @param string $taxonomy The tt name.
3469
- * @param string $type The Post Type
3470
- - *
3471
- - * @since 2.3.3
3472
- - *
3473
- * @return bool true
3474
- */
3475
- public function delete_auto_description_transient( $page_id, $taxonomy = '', $type = null ) {
3476
- @@ -578,12 +572,11 @@
3477
- /**
3478
- * Delete transient for the LD+Json scripts on requests.
3479
- *
3480
- + * @since 2.4.2
3481
- + *
3482
- * @param mixed $page_id The page ID or identifier.
3483
- * @param string $taxonomy The tt name.
3484
- * @param string|null $type The post type.
3485
- - *
3486
- - * @since 2.4.2
3487
- - *
3488
- * @return bool true
3489
- */
3490
- public function delete_ld_json_transient( $page_id, $taxonomy = '', $type = null ) {
3491
- @@ -635,7 +628,7 @@
3492
- * Expiration time, 3 days.
3493
- * 60s * 60m * 24d * 3d
3494
- */
3495
- - $expiration = 60 * 60 * 24 * 3;
3496
- + $expiration = DAY_IN_SECONDS * 3;
3497
-
3498
- set_transient( $this->theme_doing_it_right_transient, $dir, $expiration );
3499
- }
3500
- @@ -645,8 +638,8 @@
3501
- /**
3502
- * Flushes the home page LD+Json transient.
3503
- *
3504
- - * @staticvar bool $flushed
3505
- * @since 2.6.0
3506
- + * @staticvar bool $flushed Prevents second flush.
3507
- *
3508
- * @return bool Whether it's flushed on current call.
3509
- */
3510
- Index: inc/deprecated/deprecated.class.php
3511
- ===================================================================
3512
- --- inc/deprecated/deprecated.class.php (revision 1433389)
3513
- +++ inc/deprecated/deprecated.class.php (working copy)
3514
- @@ -707,4 +707,23 @@
3515
- return $path;
3516
- }
3517
-
3518
- + /**
3519
- + * Doing it Wrong The SEO Framework version wrapper.
3520
- + *
3521
- + * @since 2.3.0
3522
- + *
3523
- + * @deprecated
3524
- + * @since 2.6.5
3525
- + *
3526
- + * @return string The SEO Framework version.
3527
- + */
3528
- + public function the_seo_framework_version( $version = '' ) {
3529
- +
3530
- + $this->_deprecated_function( 'AutoDescription_Load::' . __FUNCTION__, '', '2.6.6' );
3531
- +
3532
- + $output = $version ? sprintf( __( '%s of The SEO Framework', 'autodescription' ), esc_attr( $version ) ) : '';
3533
- +
3534
- + return $output;
3535
- + }
3536
- +
3537
- }
3538
- Index: load.class.php
3539
- ===================================================================
3540
- --- load.class.php (revision 1427876)
3541
- +++ load.class.php (working copy)
3542
- @@ -98,7 +98,6 @@
3543
-
3544
- require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'search.class.php' );
3545
- require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'doingitright.class.php' );
3546
- -require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'pageoptions.class.php' );
3547
- require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'inpost.class.php' );
3548
- require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'adminpages.class.php' );
3549
- require_once( THE_SEO_FRAMEWORK_DIR_PATH_CLASS . 'sanitize.class.php' );
3550
- @@ -111,7 +110,7 @@
3551
- require_once( THE_SEO_FRAMEWORK_DIR_PATH . 'inc/deprecated/deprecated.class.php' );
3552
-
3553
- /**
3554
- - * God class.
3555
- + * Facade class.
3556
- *
3557
- * Extending upon parent classes.
3558
- *
3559
- @@ -124,13 +123,12 @@
3560
- *
3561
- * @since 2.2.9
3562
- *
3563
- - * @var bool The SEO Framework Debug/Profile constants is/are defined.
3564
- + * @var bool The SEO Framework Debug/Profile states.
3565
- */
3566
- public $the_seo_framework_debug = false;
3567
- public $the_seo_framework_debug_hidden = false;
3568
- public $the_seo_fr