The SEO Framework - Version 3.0.3

Version Description

  • Diligence =

Release date:

  • December 6th, 2017

Summarized:

  • This update implements a workaround for an issue with bbPress, and various UI bugs have been fixed as well.

View the detailed log.

Download this release

Release Info

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

Code changes from version 3.0.2 to 3.0.3

autodescription.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://theseoframework.com/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
6
- * Version: 3.0.2
7
* Author: Sybre Waaijer
8
* Author URI: https://theseoframework.com/
9
* License: GPLv3
@@ -51,7 +51,7 @@ defined( 'ABSPATH' ) or die;
51
*
52
* @since 1.0.0
53
*/
54
- define( 'THE_SEO_FRAMEWORK_VERSION', '3.0.2' );
55
56
/**
57
* The plugin Database version.
3
* Plugin Name: The SEO Framework
4
* Plugin URI: https://theseoframework.com/
5
* Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.
6
+ * Version: 3.0.3
7
* Author: Sybre Waaijer
8
* Author URI: https://theseoframework.com/
9
* License: GPLv3
51
*
52
* @since 1.0.0
53
*/
54
+ define( 'THE_SEO_FRAMEWORK_VERSION', '3.0.3' );
55
56
/**
57
* The plugin Database version.
inc/classes/admin-pages.class.php CHANGED
@@ -471,18 +471,20 @@ class Admin_Pages extends Inpost {
471
}
472
473
/**
474
- * Return a chechbox wrapper.
475
*
476
* @since 2.6.0
477
* @since 2.7.0 Added escape parameter. Defaults to true.
478
*
479
- * @param string $field_id The option ID. Must be within the Autodescription settings.
480
- * @param string $label The checkbox description label.
481
* @param string $description Addition description to place beneath the checkbox.
482
- * @param bool $escape Whether to escape the label and description.
483
* @return string HTML checkbox output.
484
*/
485
- public function make_checkbox( $field_id = '', $label = '', $description = '', $escape = true ) {
486
487
if ( $escape ) {
488
$description = \esc_html( $description );
@@ -492,12 +494,16 @@ class Admin_Pages extends Inpost {
492
$description = $description ? '<p class="description tsf-option-spacer">' . $description . '</p>' : '';
493
494
$output = '<span class="tsf-toblock">'
495
- . '<label for="' . $this->get_field_id( $field_id ) . '">'
496
. '<input '
497
. 'type="checkbox" '
498
. 'name="' . $this->get_field_name( $field_id ) . '" '
499
. 'id="' . $this->get_field_id( $field_id ) . '" '
500
- . $this->get_is_conditional_checked( $field_id ) . ' '
501
. 'value="1" '
502
. \checked( $this->get_field_value( $field_id ), true, false ) .
503
' />'
471
}
472
473
/**
474
+ * Returns a chechbox wrapper.
475
*
476
* @since 2.6.0
477
* @since 2.7.0 Added escape parameter. Defaults to true.
478
+ * @since 3.0.3 Added $disabled parameter. Defaults to false.
479
*
480
+ * @param string $field_id The option ID. Must be within the Autodescription settings.
481
+ * @param string $label The checkbox description label.
482
* @param string $description Addition description to place beneath the checkbox.
483
+ * @param bool $escape Whether to escape the label and description.
484
+ * @param bool $disabled Whether to disable the input.
485
* @return string HTML checkbox output.
486
*/
487
+ public function make_checkbox( $field_id = '', $label = '', $description = '', $escape = true, $disabled = false ) {
488
489
if ( $escape ) {
490
$description = \esc_html( $description );
494
$description = $description ? '<p class="description tsf-option-spacer">' . $description . '</p>' : '';
495
496
$output = '<span class="tsf-toblock">'
497
+ . '<label for="'
498
+ . $this->get_field_id( $field_id ) . '" '
499
+ . ( $disabled ? 'class=tsf-disabled ' : '' )
500
+ . '>'
501
. '<input '
502
. 'type="checkbox" '
503
+ . ( $disabled ? 'class=tsf-disabled disabled ' : '' )
504
. 'name="' . $this->get_field_name( $field_id ) . '" '
505
. 'id="' . $this->get_field_id( $field_id ) . '" '
506
+ . ( $disabled ? '' : $this->get_is_conditional_checked( $field_id ) . ' ' )
507
. 'value="1" '
508
. \checked( $this->get_field_value( $field_id ), true, false ) .
509
' />'
inc/classes/deprecated.class.php CHANGED
@@ -1,2012 +1,2012 @@
1
- <?php
2
- /**
3
- * @package The_SEO_Framework\Classes\Deprecated
4
- */
5
- namespace The_SEO_Framework;
6
-
7
- defined( 'ABSPATH' ) or die;
8
-
9
- /**
10
- * The SEO Framework plugin
11
- * Copyright (C) 2015 - 2017 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
- *
13
- * This program is free software: you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License version 3 as published
15
- * by the Free Software Foundation.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU General Public License
23
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
- */
25
-
26
- defined( 'ABSPATH' ) or die;
27
-
28
- /**
29
- * Class The_SEO_Framework\Deprecated
30
- *
31
- * Contains all deprecated functions.
32
- *
33
- * @since 2.8.0
34
- */
35
- final class Deprecated {
36
-
37
- /**
38
- * Constructor. Does nothing.
39
- */
40
- public function __construct() { }
41
-
42
- /**
43
- * HomePage Metabox General Tab Output.
44
- *
45
- * @since 2.6.0
46
- * @see $this->homepage_metabox() Callback for HomePage Settings box.
47
- *
48
- * @deprecated
49
- * @since 2.7.0
50
- */
51
- public function homepage_metabox_general() {
52
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Metaboxes::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Metaboxes::homepage_metabox_general_tab()' );
53
- \the_seo_framework()->get_view( 'metaboxes/homepage-metabox', array(), 'general' );
54
- }
55
-
56
- /**
57
- * HomePage Metabox Additions Tab Output.
58
- *
59
- * @since 2.6.0
60
- * @see $this->homepage_metabox() Callback for HomePage Settings box.
61
- *
62
- * @deprecated
63
- * @since 2.7.0
64
- */
65
- public function homepage_metabox_additions() {
66
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Metaboxes::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Metaboxes::homepage_metabox_additions_tab()' );
67
- \the_seo_framework()->get_view( 'metaboxes/homepage-metabox', array(), 'additions' );
68
- }
69
-
70
- /**
71
- * HomePage Metabox Robots Tab Output
72
- *
73
- * @since 2.6.0
74
- * @see $this->homepage_metabox() Callback for HomePage Settings box.
75
- *
76
- * @deprecated
77
- * @since 2.7.0
78
- */
79
- public function homepage_metabox_robots() {
80
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Metaboxes::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Metaboxes::homepage_metabox_robots_tab()' );
81
- \the_seo_framework()->get_view( 'metaboxes/homepage-metabox', array(), 'robots' );
82
- }
83
-
84
- /**
85
- * Delete transient for the automatic description for blog on save request.
86
- * Returns old option, since that's passed for sanitation within WP Core.
87
- *
88
- * @since 2.3.3
89
- *
90
- * @deprecated
91
- * @since 2.7.0
92
- *
93
- * @param string $old_option The previous blog description option.
94
- * @return string Previous option.
95
- */
96
- public function delete_auto_description_blog_transient( $old_option ) {
97
-
98
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Transients::delete_auto_description_frontpage_transient()' );
99
-
100
- \the_seo_framework()->delete_auto_description_transient( \the_seo_framework()->get_the_front_page_ID(), '', 'frontpage' );
101
-
102
- return $old_option;
103
- }
104
-
105
- /**
106
- * Add term meta data into options table of the term.
107
- * Adds separated database options for terms, as the terms table doesn't allow for addition.
108
- *
109
- * Applies filters array the_seo_framework_term_meta_defaults : Array of default term SEO options
110
- * Applies filters mixed the_seo_framework_term_meta_{field} : Override filter for specifics.
111
- * Applies filters array the_seo_framework_term_meta : Override output for term or taxonomy.
112
- *
113
- * @since 2.1.8
114
- *
115
- * @deprecated silently.
116
- * @since WordPress 4.4.0
117
- * @since The SEO Framework 2.7.0
118
- * @since 2.8.0: Deprecated visually.
119
- *
120
- * @param object $term Database row object.
121
- * @param string $taxonomy Taxonomy name that $term is part of.
122
- * @return object $term Database row object.
123
- */
124
- public function get_term_filter( $term, $taxonomy ) {
125
-
126
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "get_term_meta()"' );
127
-
128
- return false;
129
- }
130
-
131
- /**
132
- * Adds The SEO Framework term meta data to functions that return multiple terms.
133
- *
134
- * @since 2.0.0
135
- *
136
- * @deprecated silently.
137
- * @since WordPress 4.4.0
138
- * @since The SEO Framework 2.7.0
139
- * @since 2.8.0: Deprecated visually.
140
- *
141
- * @param array $terms Database row objects.
142
- * @param string $taxonomy Taxonomy name that $terms are part of.
143
- * @return array $terms Database row objects.
144
- */
145
- public function get_terms_filter( array $terms, $taxonomy ) {
146
-
147
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "get_term_meta()"' );
148
-
149
- return false;
150
- }
151
-
152
- /**
153
- * Save taxonomy meta data.
154
- * Fires when a user edits and saves a taxonomy.
155
- *
156
- * @since 2.1.8
157
- *
158
- * @deprecated silently.
159
- * @since WordPress 4.4.0
160
- * @since The SEO Framework 2.7.0
161
- * @since 2.8.0: Deprecated visually.
162
- *
163
- * @param integer $term_id Term ID.
164
- * @param integer $tt_id Term Taxonomy ID.
165
- * @return void Early on AJAX call.
166
- */
167
- public function taxonomy_seo_save( $term_id, $tt_id ) {
168
-
169
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "update_term_meta()"' );
170
-
171
- return false;
172
- }
173
-
174
- /**
175
- * Delete term meta data.
176
- * Fires when a user deletes a term.
177
- *
178
- * @since 2.1.8
179
- *
180
- * @deprecated silently.
181
- * @since WordPress 4.4.0
182
- * @since The SEO Framework 2.7.0
183
- * @since 2.8.0: Deprecated visually.
184
- *
185
- * @param integer $term_id Term ID.
186
- * @param integer $tt_id Taxonomy Term ID.
187
- */
188
- public function term_meta_delete( $term_id, $tt_id ) {
189
-
190
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "delete_term_meta()"' );
191
-
192
- return false;
193
- }
194
-
195
- /**
196
- * Faster way of doing an in_array search compared to default PHP behavior.
197
- * @NOTE only to show improvement with large arrays. Might slow down with small arrays.
198
- * @NOTE can't do type checks. Always assume the comparing value is a string.
199
- *
200
- * @since 2.5.2
201
- * @since 2.7.0 Deprecated.
202
- * @deprecated
203
- *
204
- * @param string|array $needle The needle(s) to search for
205
- * @param array $array The single dimensional array to search in.
206
- * @return bool true if value is in array.
207
- */
208
- public function in_array( $needle, $array, $strict = true ) {
209
-
210
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Core::' . __FUNCTION__, '2.7.0', 'in_array()' );
211
-
212
- $array = array_flip( $array );
213
-
214
- if ( is_string( $needle ) ) {
215
- if ( isset( $array[ $needle ] ) )
216
- return true;
217
- } elseif ( is_array( $needle ) ) {
218
- foreach ( $needle as $str ) {
219
- if ( isset( $array[ $str ] ) )
220
- return true;
221
- }
222
- }
223
-
224
- return false;
225
- }
226
-
227
- /**
228
- * Fetches posts with exclude_local_search option on
229
- *
230
- * @since 2.1.7
231
- * @since 2.7.0 Deprecated.
232
- * @deprecated
233
- *
234
- * @return array Excluded Post IDs
235
- */
236
- public function exclude_search_ids() {
237
-
238
- \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Search::' . __FUNCTION__, '2.7.0', 'the_seo_framework()->get_excluded_search_ids()' );
239
-
240
- return $this->get_excluded_search_ids();
241
- }
242
-
243
- /**
244
- * Fetches posts with exclude_local_search option on.
245
- *
246
- * @since 2.1.7
247
- * @since 2.7.0 No longer used for performance reasons.
248
- * @uses $this->exclude_search_ids()
249
- * @deprecated
250
- * @since 2.8.0 deprecated.
251
- *
252
- * @param array $query The possible search query.
253
- * @return void Early if no search query is found.
254
- */
255
- public function search_filter( $query ) {
256
-
257
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->search_filter()', '2.8.0' );
258
-
259
- // Don't exclude pages in wp-admin.
260
- if ( $query->is_search && false === \the_seo_framework()->is_admin() ) {
261
-
262
- $q = $query->query;
263
- //* Only interact with an actual Search Query.
264
- if ( false === isset( $q['s'] ) )
265
- return;
266
-
267
- //* Get excluded IDs.
268
- $protected_posts = $this->get_excluded_search_ids();
269
- if ( $protected_posts ) {
270
- $get = $query->get( 'post__not_in' );
271
-
272
- //* Merge user defined query.
273
- if ( is_array( $get ) && ! empty( $get ) )
274
- $protected_posts = array_merge( $protected_posts, $get );
275
-
276
- $query->set( 'post__not_in', $protected_posts );
277
- }
278
-
279
- // Parse all ID's, even beyond the first page.
280
- $query->set( 'no_found_rows', false );
281
- }
282
- }
283
-
284
- /**
285
- * Fetches posts with exclude_local_search option on.
286
- *
287
- * @since 2.7.0
288
- * @since 2.7.0 No longer used.
289
- * @global int $blog_id
290
- * @deprecated
291
- *
292
- * @return array Excluded Post IDs
293
- */
294
- public function get_excluded_search_ids() {
295
-
296
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->get_excluded_search_ids()', '2.7.0' );
297
-
298
- global $blog_id;
299
-
300
- $cache_key = 'exclude_search_ids_' . $blog_id . '_' . \get_locale();
301
-
302
- $post_ids = \the_seo_framework()->object_cache_get( $cache_key );
303
- if ( false === $post_ids ) {
304
- $post_ids = array();
305
-
306
- $args = array(
307
- 'post_type' => 'any',
308
- 'numberposts' => -1,
309
- 'posts_per_page' => -1,
310
- 'order' => 'DESC',
311
- 'post_status' => 'publish',
312
- 'meta_key' => 'exclude_local_search',
313
- 'meta_value' => 1,
314
- 'meta_compare' => '=',
315
- 'cache_results' => true,
316
- 'suppress_filters' => false,
317
- );
318
- $get_posts = new \WP_Query;
319
- $excluded_posts = $get_posts->query( $args );
320
- unset( $get_posts );
321
-
322
- if ( $excluded_posts )
323
- $post_ids = \wp_list_pluck( $excluded_posts, 'ID' );
324
-
325
- \the_seo_framework()->object_cache_set( $cache_key, $post_ids, 86400 );
326
- }
327
-
328
- // return an array of exclude post IDs
329
- return $post_ids;
330
- }
331
-
332
- /**
333
- * Registers option sanitation filter
334
- *
335
- * @since 2.2.2
336
- * @since 2.7.0 : No longer used internally.
337
- * @since 2.8.0 : Deprecated
338
- * @deprecated
339
- *
340
- * @param string $filter The filter to call (see The_SEO_Framework_Site_Options::$available_filters for options)
341
- * @param string $option The WordPress option name
342
- * @param string|array $suboption Optional. The suboption or suboptions you want to filter
343
- * @return true on completion.
344
- */
345
- public function autodescription_add_option_filter( $filter, $option, $suboption = null ) {
346
-
347
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->add_option_filter()', '2.8.0' );
348
-
349
- return \the_seo_framework()->add_option_filter( $filter, $option, $suboption );
350
- }
351
-
352
- /**
353
- * Register each of the settings with a sanitization filter type.
354
- *
355
- * @since 2.2.2
356
- * @since 2.8.0 Deprecated.
357
- * @uses method add_filter() Assign filter to array of settings.
358
- * @see The_SEO_Framework_Sanitize::add_filter() Add sanitization filters to options.
359
- */
360
- public function sanitizer_filters() {
361
-
362
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->sanitizer_filters()', '2.8.0', 'the_seo_framework()->init_sanitizer_filters()' );
363
-
364
- \the_seo_framework()->init_sanitizer_filters();
365
- }
366
-
367
- /**
368
- * Fetches site icon brought in WordPress 4.3.0
369
- *
370
- * @since 2.2.1
371
- * @since 2.8.0: Deprecated.
372
- * @deprecated
373
- *
374
- * @param string $size The icon size, accepts 'full' and pixel values.
375
- * @param bool $set_og_dimensions Whether to set size for OG image. Always falls back to the current post ID.
376
- * @return string URL site icon, not escaped.
377
- */
378
- public function site_icon( $size = 'full', $set_og_dimensions = false ) {
379
-
380
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->site_icon()', '2.8.0', 'the_seo_framework()->get_site_icon()' );
381
-
382
- return the_seo_framework()->get_site_icon( $size, $set_og_dimensions );
383
- }
384
-
385
- /**
386
- * Delete transient on post save.
387
- *
388
- * @since 2.2.9
389
- * @since 2.8.0 : Deprecated
390
- * @deprecated
391
- *
392
- * @param int $post_id The Post ID that has been updated.
393
- * @return bool|null True when sitemap is flushed. False on revision. Null
394
- * when sitemaps are deactivated.
395
- */
396
- public function delete_transients_post( $post_id ) {
397
-
398
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->delete_transients_post()', '2.8.0', 'the_seo_framework()->delete_post_cache()' );
399
-
400
- return \the_seo_framework()->delete_post_cache( $post_id );
401
- }
402
-
403
- /**
404
- * Delete transient on profile save.
405
- *
406
- * @since 2.6.4
407
- * @since 2.8.0 : Deprecated
408
- * @deprecated
409
- *
410
- * @param int $user_id The User ID that has been updated.
411
- */
412
- public function delete_transients_author( $user_id ) {
413
-
414
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->delete_transients_author()', '2.8.0', 'the_seo_framework()->delete_author_cache()' );
415
-
416
- return \the_seo_framework()->delete_author_cache( $user_id );
417
- }
418
-
419
- /**
420
- * Flushes the home page LD+Json transient.
421
- *
422
- * @since 2.6.0
423
- * @since 2.8.0 deprecated.
424
- * @staticvar bool $flushed Prevents second flush.
425
- * @deprecated
426
- *
427
- * @return bool Whether it's flushed on current call.
428
- */
429
- public function delete_front_ld_json_transient() {
430
-
431
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->delete_front_ld_json_transient()', '2.8.0', 'the_seo_framework()->delete_cache( \'front\' )' );
432
-
433
- static $flushed = null;
434
-
435
- if ( isset( $flushed ) )
436
- return false;
437
-
438
- if ( ! \the_seo_framework()->is_option_checked( 'cache_meta_schema' ) )
439
- return $flushed = false;
440
-
441
- $front_id = \the_seo_framework()->get_the_front_page_ID();
442
-
443
- \the_seo_framework()->delete_ld_json_transient( $front_id, '', 'frontpage' );
444
-
445
- return $flushed = true;
446
- }
447
-
448
- /**
449
- * Determines whether we can use the new WordPress core term meta functionality.
450
- *
451
- * @since 2.7.0
452
- * @since 2.8.0: Deprecated. WordPress 4.4+ is now required.
453
- * @staticvar bool $cache
454
- * @deprecated
455
- *
456
- * @return bool True when WordPress is at version 4.4 or higher and has an
457
- * accordingly upgraded database.
458
- */
459
- public function can_get_term_meta() {
460
-
461
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->can_get_term_meta()', '2.8.0' );
462
-
463
- static $cache = null;
464
-
465
- if ( isset( $cache ) )
466
- return $cache;
467
-
468
- return $cache = \get_option( 'db_version' ) >= 34370 && \get_option( 'the_seo_framework_upgraded_db_version' ) >= '2700' && \the_seo_framework()->wp_version( '4.3.999', '>' );
469
- }
470
-
471
- /**
472
- * Fetches term metadata array for the inpost term metabox.
473
- *
474
- * @since 2.7.0
475
- * @since 2.8.0: Deprecated. WordPress 4.4+ is now required.
476
- * @deprecated
477
- *
478
- * @param object $term The TT object. Must be assigned.
479
- * @return array The SEO Framework TT data.
480
- */
481
- protected function get_old_term_data( $term ) {
482
-
483
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->get_old_term_data()', '2.8.0' );
484
-
485
- $data = array();
486
-
487
- $data['title'] = isset( $term->admeta['doctitle'] ) ? $term->admeta['doctitle'] : '';
488
- $data['description'] = isset( $term->admeta['description'] ) ? $term->admeta['description'] : '';
489
- $data['noindex'] = isset( $term->admeta['noindex'] ) ? $term->admeta['noindex'] : '';
490
- $data['nofollow'] = isset( $term->admeta['nofollow'] ) ? $term->admeta['nofollow'] : '';
491
- $data['noarchive'] = isset( $term->admeta['noarchive'] ) ? $term->admeta['noarchive'] : '';
492
- $flag = isset( $term->admeta['saved_flag'] ) ? (bool) $term->admeta['saved_flag'] : false;
493
-
494
- //* Genesis data fetch. This will override our options with Genesis options on save.
495
- if ( false === $flag && isset( $term->meta ) ) {
496
- $data['title'] = empty( $data['title'] ) && isset( $term->meta['doctitle'] ) ? $term->meta['doctitle'] : $data['noindex'];
497
- $data['description'] = empty( $data['description'] ) && isset( $term->meta['description'] ) ? $term->meta['description'] : $data['description'];
498
- $data['noindex'] = empty( $data['noindex'] ) && isset( $term->meta['noindex'] ) ? $term->meta['noindex'] : $data['noindex'];
499
- $data['nofollow'] = empty( $data['nofollow'] ) && isset( $term->meta['nofollow'] ) ? $term->meta['nofollow'] : $data['nofollow'];
500
- $data['noarchive'] = empty( $data['noarchive'] ) && isset( $term->meta['noarchive'] ) ? $term->meta['noarchive'] : $data['noarchive'];
501
- }
502
-
503
- return $data;
504
- }
505
-
506
- /**
507
- * Fetches og:image URL.
508
- *
509
- * @since 2.2.2
510
- * @since 2.2.8 : Added theme icon detection.
511
- * @since 2.5.2 : Added args filters.
512
- * @since 2.8.0 : 1. Added theme logo detection.
513
- * 2. Added inpost image selection detection.
514
- * @since 2.8.2 : 1. Now returns something on post ID 0.
515
- * 2. Added SEO settings fallback image selection detection.
516
- * @since 2.9.0 : 1. Added 'skip_fallback' option to arguments.
517
- * 2. Added 'escape' option to arguments.
518
- * 3. First parameter is now arguments. Fallback for integer is added.
519
- * 4. Second parameter is now deprecated.
520
- * 5. Deprecated.
521
- * @deprecated Use get_social_image instead.
522
- *
523
- * @param int|array $args The image arguments.
524
- * Was: $post_id.
525
- * Warning: Integer usage is only used for backwards compat.
526
- * @param array $depr_args, Deprecated;
527
- * Was $args The image arguments.
528
- * @param bool $escape Whether to escape the image URL.
529
- * Deprecated: You should use $args['escape'].
530
- * @return string the image URL.
531
- */
532
- public function get_image( $args = array(), $depr_args = '', $depr_escape = true ) {
533
-
534
- $tsf = \the_seo_framework();
535
-
536
- $tsf->_deprecated_function( 'the_seo_framework()->get_image()', '2.9.0', 'the_seo_framework()->get_social_image()' );
537
-
538
- if ( is_int( $args ) || is_array( $depr_args ) ) {
539
- $tsf->_doing_it_wrong( __METHOD__, 'First parameter is now used for arguments. Second parameter is deprecated.', '2.9.0' );
540
-
541
- $post_id = $args;
542
- $args = array();
543
-
544
- /**
545
- * Backwards compat with parse args.
546
- * @since 2.5.0
547
- */
548
- if ( ! isset( $depr_args['post_id'] ) ) {
549
- $args['post_id'] = $post_id ?: ( $tsf->is_singular( $post_id ) ? $tsf->get_the_real_ID() : 0 );
550
- }
551
-
552
- if ( is_array( $depr_args ) ) {
553
- $args = \wp_parse_args( $depr_args, $args );
554
- }
555
- }
556
-
557
- if ( false === $depr_escape ) {
558
- $tsf->_doing_it_wrong( __METHOD__, 'Third parameter has been deprecated. Use `$args["escape"] => false` instead.', '2.9.0' );
559
- $args['escape'] = false;
560
- }
561
-
562
- $args = $tsf->reparse_image_args( $args );
563
-
564
- //* 0. Image from argument.
565
- pre_0 : {
566
- if ( $image = $args['image'] )
567
- goto end;
568
- }
569
-
570
- //* Check if there are no disallowed arguments.
571
- $all_allowed = empty( $args['disallowed'] );
572
-
573
- //* 1. Fetch image from homepage SEO meta upload.
574
- if ( $all_allowed || false === in_array( 'homemeta', $args['disallowed'], true ) ) {
575
- if ( $image = $tsf->get_social_image_url_from_home_meta( $args['post_id'], true ) )
576
- goto end;
577
- }
578
-
579
- if ( $args['post_id'] ) {
580
- //* 2. Fetch image from SEO meta upload.
581
- if ( $all_allowed || false === in_array( 'postmeta', $args['disallowed'], true ) ) {
582
- if ( $image = $tsf->get_social_image_url_from_post_meta( $args['post_id'], true ) )
583
- goto end;
584
- }
585
-
586
- //* 3. Fetch image from featured.
587
- if ( $all_allowed || false === in_array( 'featured', $args['disallowed'], true ) ) {
588
- if ( $image = $tsf->get_image_from_post_thumbnail( $args, true ) )
589
- goto end;
590
- }
591
- }
592
-
593
- if ( $args['skip_fallback'] )
594
- goto end;
595
-
596
- //* 4. Fetch image from SEO settings
597
- if ( $all_allowed || false === in_array( 'option', $args['disallowed'], true ) ) {
598
- if ( $image = $tsf->get_social_image_url_from_seo_settings( true ) )
599
- goto end;
600
- }
601
-
602
- //* 5. Fetch image from fallback filter 1
603
- /**
604
- * Applies filters 'the_seo_framework_og_image_after_featured' : string
605
- * @since 2.5.2
606
- */
607
- fallback_1 : {
608
- if ( $image = (string) \apply_filters( 'the_seo_framework_og_image_after_featured', '', $args['post_id'] ) )
609
- goto end;
610
- }
611
-
612
- //* 6. Fallback: Get header image if exists
613
- if ( ( $all_allowed || false === in_array( 'header', $args['disallowed'], true ) ) && \current_theme_supports( 'custom-header', 'default-image' ) ) {
614
- if ( $image = $tsf->get_header_image( true ) )
615
- goto end;
616
- }
617
-
618
- //* 7. Fetch image from fallback filter 2
619
- /**
620
- * Applies filters 'the_seo_framework_og_image_after_header' : string
621
- * @since 2.5.2
622
- */
623
- fallback_2 : {
624
- if ( $image = (string) \apply_filters( 'the_seo_framework_og_image_after_header', '', $args['post_id'] ) )
625
- goto end;
626
- }
627
-
628
- //* 8. Get the WP 4.5 Site Logo
629
- if ( ( $all_allowed || false === in_array( 'logo', $args['disallowed'], true ) ) && $tsf->can_use_logo() ) {
630
- if ( $image = $tsf->get_site_logo( true ) )
631
- goto end;
632
- }
633
-
634
- //* 9. Get the WP 4.3 Site Icon
635
- if ( $all_allowed || false === in_array( 'icon', $args['disallowed'], true ) ) {
636
- if ( $image = $tsf->get_site_icon( 'full', true ) )
637
- goto end;
638
- }
639
-
640
- end :;
641
-
642
- if ( $args['escape'] && $image )
643
- $image = \esc_url( $image );
644
-
645
- return (string) $image;
646
- }
647
-
648
- /**
649
- * Fetches image from post thumbnail.
650
- * Resizes the image between 4096px if bigger. Then it saves the image and
651
- * Keeps dimensions relative.
652
- *
653
- * @since 2.3.0
654
- * @since 2.9.0 Changed parameters.
655
- * @since 2.9.0 Deprecated.
656
- * @since 2.9.3 Now supports 4K, rather than 1500px.
657
- * @deprecated
658
- *
659
- * @param array $args The image args.
660
- * Was: int $id The post/page ID.
661
- * @param bool $set_og_dimensions Whether to set Open Graph image dimensions.
662
- * Was: array $depr_args Deprecated. Image arguments.
663
- * @return string|null the image url.
664
- */
665
- public function get_image_from_post_thumbnail( $args = array(), $set_og_dimensions = false ) {
666
-
667
- $tsf = \the_seo_framework();
668
-
669
- $tsf->_deprecated_function( 'the_seo_framework()->get_image_from_post_thumbnail()', '2.9.0', 'the_seo_framework()->get_social_image_url_from_post_thumbnail()' );
670
-
671
- if ( is_array( $set_og_dimensions ) ) {
672
- $tsf->_doing_it_wrong( __METHOD__, 'First parameter are now arguments, second parameter is for setting og dimensions.', '2.9.0' );
673
- $args = $set_og_dimensions;
674
- $set_og_dimensions = false;
675
- }
676
-
677
- $args = $tsf->reparse_image_args( $args );
678
-
679
- $id = \get_post_thumbnail_id( $args['post_id'] );
680
-
681
- $args['get_the_real_ID'] = true;
682
-
683
- $image = $id ? $tsf->parse_og_image( $id, $args, $set_og_dimensions ) : '';
684
-
685
- return $image;
686
- }
687
-
688
- /**
689
- * Detects front page.
690
- *
691
- * Returns true on SEO settings page if ID is 0.
692
- *
693
- * @since 2.6.0
694
- * @since 2.9.0: Deprecated.
695
- * @deprecated
696
- *
697
- * @param int $id The Page or Post ID.
698
- * @return bool
699
- */
700
- public function is_front_page( $id = 0 ) {
701
-
702
- $tsf = \the_seo_framework();
703
-
704
- $tsf->_deprecated_function( 'the_seo_framework()->is_front_page()', '2.9.0', 'the_seo_framework()->is_real_front_page() or the_seo_framework()->is_front_page_by_id()' );
705
-
706
- static $cache = array();
707
-
708
- if ( null !== $cache = $tsf->get_query_cache( __METHOD__, null, $id ) )
709
- return $cache;
710
-
711
- $is_front_page = false;
712
-
713
- if ( \is_front_page() && empty( $id ) )
714
- $is_front_page = true;
715
-
716
- //* Elegant Themes Support. Yay.
717
- if ( false === $is_front_page && empty( $id ) && $tsf->is_home() ) {
718
- $sof = \get_option( 'show_on_front' );
719
-
720
- if ( 'page' !== $sof && 'posts' !== $sof )
721
- $is_front_page = true;
722
- }
723
-
724
- //* Compare against $id
725
- if ( false === $is_front_page && $id ) {
726
- $sof = \get_option( 'show_on_front' );
727
-
728
- if ( 'page' === $sof && (int) \get_option( 'page_on_front' ) === $id )
729
- $is_front_page = true;
730
-
731
- if ( 'posts' === $sof && (int) \get_option( 'page_for_posts' ) === $id )
732
- $is_front_page = true;
733
- } elseif ( empty( $id ) && $tsf->is_seo_settings_page() ) {
734
- $is_front_page = true;
735
- }
736
-
737
- $tsf->set_query_cache(
738
- __METHOD__,
739
- $is_front_page,
740
- $id
741
- );
742
-
743
- return $is_front_page;
744
- }
745
-
746
- /**
747
- * Returns http://schema.org json encoded context URL.
748
- *
749
- * @staticvar string $context
750
- * @since 2.6.0
751
- * @since 2.9.3 Deprecated.
752
- * @deprecated
753
- *
754
- * @return string The json encoded context url.
755
- */
756
- public function schema_context() {
757
-
758
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_context()', '2.9.3' );
759
-
760
- static $context;
761
-
762
- if ( isset( $context ) )
763
- return $context;
764
-
765
- return $context = json_encode( 'http://schema.org' );
766
- }
767
-
768
-
769
- /**
770
- * Returns 'WebSite' json encoded type name.
771
- *
772
- * @staticvar string $context
773
- * @since 2.6.0
774
- * @since 2.9.3 Deprecated.
775
- * @deprecated
776
- *
777
- * @return string The json encoded type name.
778
- */
779
- public function schema_type() {
780
-
781
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_type()', '2.9.3' );
782
-
783
- static $type;
784
-
785
- if ( isset( $type ) )
786
- return $type;
787
-
788
- return $type = json_encode( 'WebSite' );
789
- }
790
-
791
- /**
792
- * Returns json encoded home url.
793
- *
794
- * @staticvar string $url
795
- * @since 2.6.0
796
- * @since 2.9.3 Deprecated.
797
- * @deprecated
798
- *
799
- * @return string The json encoded home url.
800
- */
801
- public function schema_home_url() {
802
-
803
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_home_url()', '2.9.3' );
804
-
805
- static $type;
806
-
807
- if ( isset( $type ) )
808
- return $type;
809
-
810
- return $type = json_encode( \the_seo_framework()->the_home_url_from_cache() );
811
- }
812
-
813
- /**
814
- * Returns json encoded blogname.
815
- *
816
- * @staticvar string $name
817
- * @since 2.6.0
818
- * @since 2.9.3 Deprecated.
819
- * @deprecated
820
- *
821
- * @return string The json encoded blogname.
822
- */
823
- public function schema_blog_name() {
824
-
825
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_blog_name()', '2.9.3' );
826
-
827
- static $name;
828
-
829
- if ( isset( $name ) )
830
- return $name;
831
-
832
- return $name = json_encode( \the_seo_framework()->get_blogname() );
833
- }
834
-
835
- /**
836
- * Returns 'BreadcrumbList' json encoded type name.
837
- *
838
- * @staticvar string $crumblist
839
- * @since 2.6.0
840
- * @since 2.9.3 Deprecated.
841
- * @deprecated
842
- *
843
- * @return string The json encoded 'BreadcrumbList'.
844
- */
845
- public function schema_breadcrumblist() {
846
-
847
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_breadcrumblist()', '2.9.3' );
848
-
849
- static $crumblist;
850
-
851
- if ( isset( $crumblist ) )
852
- return $crumblist;
853
-
854
- return $crumblist = json_encode( 'BreadcrumbList' );
855
- }
856
-
857
- /**
858
- * Returns 'ListItem' json encoded type name.
859
- *
860
- * @staticvar string $listitem
861
- * @since 2.6.0
862
- * @since 2.9.3 Deprecated.
863
- * @deprecated
864
- *
865
- * @return string The json encoded 'ListItem'.
866
- */
867
- public function schema_listitem() {
868
-
869
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_listitem()', '2.9.3' );
870
-
871
- static $listitem;
872
-
873
- if ( isset( $listitem ) )
874
- return $listitem;
875
-
876
- return $listitem = json_encode( 'ListItem' );
877
- }
878
-
879
- /**
880
- * Returns 'image' json encoded value.
881
- *
882
- * @staticvar array $images
883
- * @since 2.7.0
884
- * @since 2.9.0 : 1. No longer uses image from cache, instead: it skips fallback images.
885
- * 2. Can now fetch home-page as blog set image.
886
- * @since 2.9.3 Deprecated.
887
- * @deprecated
888
- *
889
- * @param int|string $id The page, post, product or term ID.
890
- * @param bool $singular Whether the ID is singular.
891
- */
892
- public function schema_image( $id = 0, $singular = false ) {
893
-
894
- $tsf = \the_seo_framework();
895
-
896
- $tsf->_deprecated_function( 'the_seo_framework()->schema_image()', '2.9.3' );
897
-
898
- static $images = array();
899
-
900
- $id = (int) $id;
901
-
902
- if ( isset( $images[ $id ][ $singular ] ) )
903
- return $images[ $id ][ $singular ];
904
-
905
- $image = '';
906
-
907
- if ( $singular ) {
908
- if ( $id === $tsf->get_the_front_page_ID() ) {
909
- if ( $tsf->has_page_on_front() ) {
910
- $image_args = array(
911
- 'post_id' => $id,
912
- 'skip_fallback' => true,
913
- );
914
- } else {
915
- $image_args = array(
916
- 'post_id' => $id,
917
- 'skip_fallback' => true,
918
- 'disallowed' => array(
919
- 'postmeta',
920
- 'featured',
921
- ),
922
- );
923
- }
924
- } else {
925
- $image_args = array(
926
- 'post_id' => $id,
927
- 'skip_fallback' => true,
928
- 'disallowed' => array(
929
- 'homemeta'
930
- ),
931
- );
932
- }
933
- $image = $tsf->get_social_image( $image_args );
934
- } else {
935
- //* Placeholder.
936
- $image = '';
937
- }
938
-
939
- /**
940
- * Applies filters 'the_seo_framework_ld_json_breadcrumb_image' : string
941
- * @since 2.7.0
942
- * @param string $image The current image.
943
- * @param int $id The page, post, product or term ID.
944
- * @param bool $singular Whether the ID is singular.
945
- */
946
- $image = \apply_filters( 'the_seo_framework_ld_json_breadcrumb_image', $image, $id, $singular );
947
-
948
- return $images[ $id ][ $singular ] = json_encode( \esc_url_raw( $image ) );
949
- }
950
-
951
- /**
952
- * Generate LD+Json search helper.
953
- *
954
- * @since 2.2.8
955
- * @since 2.9.3 Deprecated.
956
- * @deprecated
957
- *
958
- * @return escaped LD+json search helper string.
959
- */
960
- public function ld_json_search() {
961
-
962
- $tsf = \the_seo_framework();
963
-
964
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_search()', '2.9.3' );
965
-
966
- if ( false === $tsf->enable_ld_json_searchbox() )
967
- return '';
968
-
969
- $context = $this->schema_context();
970
- $webtype = $this->schema_type();
971
- $url = $this->schema_home_url();
972
- $name = $this->schema_blog_name();
973
- $actiontype = json_encode( 'SearchAction' );
974
-
975
- /**
976
- * Applies filters 'the_seo_framework_ld_json_search_url' : string
977
- * @since 2.7.0
978
- * @param string $search_url The default WordPress search URL without query parameters.
979
- */
980
- $search_url = (string) \apply_filters( 'the_seo_framework_ld_json_search_url', $tsf->the_home_url_from_cache( true ) . '?s=' );
981
-
982
- // Remove trailing quote and add it back.
983
- $target = mb_substr( json_encode( $search_url ), 0, -1 ) . '{search_term_string}"';
984
-
985
- $queryaction = json_encode( 'required name=search_term_string' );
986
-
987
- $json = sprintf( '{"@context":%s,"@type":%s,"url":%s,"name":%s,"potentialAction":{"@type":%s,"target":%s,"query-input":%s}}', $context, $webtype, $url, $name, $actiontype, $target, $queryaction );
988
-
989
- $output = '';
990
-
991
- if ( $json )
992
- $output = '<script type="application/ld+json">' . $json . '</script>' . "\r\n";
993
-
994
- return $output;
995
- }
996
-
997
- /**
998
- * Generate Site Name LD+Json script.
999
- *
1000
- * @since 2.6.0
1001
- * @since 2.9.3 Deprecated.
1002
- * @deprecated
1003
- *
1004
- * @return string The LD+JSon Site Name script.
1005
- */
1006
- public function ld_json_name() {
1007
-
1008
- $tsf = \the_seo_framework();
1009
-
1010
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_name()', '2.9.3' );
1011
-
1012
- $context = $this->schema_context();
1013
- $webtype = $this->schema_type();
1014
- $url = $this->schema_home_url();
1015
- $name = $this->schema_blog_name();
1016
- $alternate = '';
1017
-
1018
- $blogname = $tsf->get_blogname();
1019
- $knowledge_name = $tsf->get_option( 'knowledge_name' );
1020
-
1021
- if ( $knowledge_name && $knowledge_name !== $blogname ) {
1022
- $alternate = json_encode( \esc_html( $knowledge_name ) );
1023
- }
1024
-
1025
- if ( $alternate ) {
1026
- $json = sprintf( '{"@context":%s,"@type":%s,"name":%s,"alternateName":%s,"url":%s}', $context, $webtype, $name, $alternate, $url );
1027
- } else {
1028
- $json = sprintf( '{"@context":%s,"@type":%s,"name":%s,"url":%s}', $context, $webtype, $name, $url );
1029
- }
1030
-
1031
- $output = '';
1032
- if ( $json )
1033
- $output = '<script type="application/ld+json">' . $json . '</script>' . "\r\n";
1034
-
1035
- return $output;
1036
- }
1037
-
1038
- /**
1039
- * Return LD+Json Knowledge Graph helper.
1040
- *
1041
- * @since 2.2.8
1042
- * @since 2.9.2 : Now grabs home URL from cache.
1043
- * @since 2.9.3 Deprecated.
1044
- * @deprecated
1045
- *
1046
- * @return string LD+json Knowledge Graph helper.
1047
- */
1048
- public function ld_json_knowledge() {
1049
-
1050
- $tsf = \the_seo_framework();
1051
-
1052
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_name()', '2.9.3', 'the_seo_framework()->get_ld_json_links()' );
1053
-
1054
- return $tsf->get_ld_json_links();
1055
- }
1056
-
1057
- /**
1058
- * Generate LD+Json breadcrumb helper.
1059
- *
1060
- * @since 2.4.2
1061
- * @since 2.9.3 Deprecated.
1062
- * @deprecated
1063
- *
1064
- * @return escaped LD+json search helper string.
1065
- */
1066
- public function ld_json_breadcrumbs() {
1067
-
1068
- $tsf = \the_seo_framework();
1069
-
1070
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_breadcrumbs()', '2.9.3', 'the_seo_framework()->get_ld_json_breadcrumbs()' );
1071
-
1072
- return $tsf->get_ld_json_breadcrumbs();
1073
- }
1074
-
1075
- /**
1076
- * Generate post breadcrumb.
1077
- *
1078
- * @since 2.6.0
1079
- * @since 2.9.0 Now uses $this->ld_json_breadcrumbs_use_seo_title()
1080
- * @since 2.9.3 Deprecated.
1081
- * @deprecated
1082
- *
1083
- * @return string $output The breadcrumb script.
1084
- */
1085
- public function ld_json_breadcrumbs_post() {
1086
-
1087
- $tsf = \the_seo_framework();
1088
-
1089
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_breadcrumbs_post()', '2.9.3', 'the_seo_framework()->get_ld_json_breadcrumbs_post()' );
1090
-
1091
- return $tsf->get_ld_json_breadcrumbs_post();
1092
- }
1093
-
1094
- /**
1095
- * Generate page breadcrumb.
1096
- *
1097
- * @since 2.6.0
1098
- * @since 2.9.0 Now uses $this->ld_json_breadcrumbs_use_seo_title()
1099
- * @since 2.9.3 Deprecated.
1100
- * @deprecated
1101
- *
1102
- * @return string $output The breadcrumb script.
1103
- */
1104
- public function ld_json_breadcrumbs_page() {
1105
-
1106
- $tsf = \the_seo_framework();
1107
-
1108
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_breadcrumbs_page()', '2.9.3', 'the_seo_framework()->get_ld_json_breadcrumbs_page()' );
1109
-
1110
- return $tsf->get_ld_json_breadcrumbs_page();
1111
- }
1112
-
1113
- /**
1114
- * Return home page item for LD Json Breadcrumbs.
1115
- *
1116
- * @since 2.4.2
1117
- * @since 2.9.0 Now uses $this->ld_json_breadcrumbs_use_seo_title()
1118
- * @since 2.9.3 Deprecated.
1119
- * @deprecated
1120
- * @staticvar string $first_item.
1121
- *
1122
- * @param string|null $item_type the breadcrumb item type.
1123
- * @return string Home Breadcrumb item
1124
- */
1125
- public function ld_json_breadcrumb_first( $item_type = null ) {
1126
-
1127
- $tsf = \the_seo_framework();
1128
-
1129
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_breadcrumb_first()', '2.9.3' );
1130
-
1131
- static $first_item = null;
1132
-
1133
- if ( isset( $first_item ) )
1134
- return $first_item;
1135
-
1136
- if ( is_null( $item_type ) )
1137
- $item_type = json_encode( 'ListItem' );
1138
-
1139
- $id = json_encode( $tsf->the_home_url_from_cache() );
1140
-
1141
- if ( $tsf->ld_json_breadcrumbs_use_seo_title() ) {
1142
-
1143
- $home_title = $tsf->get_option( 'homepage_title' );
1144
-
1145
- if ( $home_title ) {
1146
- $custom_name = $home_title;
1147
- } elseif ( $tsf->has_page_on_front() ) {
1148
- $home_id = (int) \get_option( 'page_on_front' );
1149
-
1150
- $custom_name = $tsf->get_custom_field( '_genesis_title', $home_id ) ?: $tsf->get_blogname();
1151
- } else {
1152
- $custom_name = $tsf->get_blogname();
1153
- }
1154
- } else {
1155
- $custom_name = $tsf->get_blogname();
1156
- }
1157
-
1158
- $custom_name = json_encode( $custom_name );
1159
- $image = $this->schema_image( $tsf->get_the_front_page_ID(), true );
1160
-
1161
- $breadcrumb = array(
1162
- 'type' => $item_type,
1163
- 'pos' => '1',
1164
- 'id' => $id,
1165
- 'name' => $custom_name,
1166
- 'image' => $image,
1167
- );
1168
-
1169
- return $first_item = $tsf->make_breadcrumb( $breadcrumb, true );
1170
- }
1171
-
1172
- /**
1173
- * Return current page item for LD Json Breadcrumbs.
1174
- *
1175
- * @since 2.4.2
1176
- * @since 2.9.0 Now uses $this->ld_json_breadcrumbs_use_seo_title()
1177
- * @since 2.9.3 Deprecated.
1178
- * @deprecated
1179
- * @staticvar string $last_item.
1180
- * @staticvar string $type The breadcrumb item type.
1181
- * @staticvar string $id The current post/page/archive url.
1182
- * @staticvar string $name The current post/page/archive title.
1183
- *
1184
- * @param string $item_type the breadcrumb item type.
1185
- * @param int $pos Last known position.
1186
- * @param int $post_id The current Post ID
1187
- * @return string Last Breadcrumb item
1188
- */
1189
- public function ld_json_breadcrumb_last( $item_type = null, $pos = null, $post_id = null ) {
1190
-
1191
- $tsf = \the_seo_framework();
1192
-
1193
- $tsf->_deprecated_function( 'the_seo_framework()->ld_json_breadcrumb_last()', '2.9.3' );
1194
-
1195
- /**
1196
- * 2 (becomes 3) holds mostly true for single term items.
1197
- * This shouldn't run anyway. Pos should always be provided.
1198
- */
1199
- if ( is_null( $pos ) )
1200
- $pos = 2;
1201
-
1202
- //* Add current page.
1203
- $pos = $pos + 1;
1204
-
1205
- if ( is_null( $item_type ) ) {
1206
- static $type = null;
1207
-
1208
- if ( ! isset( $type ) )
1209
- $type = json_encode( 'ListItem' );
1210
-
1211
- $item_type = $type;
1212
- }
1213
-
1214
- if ( empty( $post_id ) )
1215
- $post_id = $tsf->get_the_real_ID();
1216
-
1217
- static $id = null;
1218
- static $name = null;
1219
-
1220
- if ( ! isset( $id ) )
1221
- $id = json_encode( $tsf->the_url_from_cache() );
1222
-
1223
- $title_args = array(
1224
- 'term_id' => $post_id,
1225
- 'placeholder' => true,
1226
- 'meta' => true,
1227
- 'notagline' => true,
1228
- 'description_title' => true,
1229
- 'get_custom_field' => false,
1230
- );
1231
-
1232
- if ( ! isset( $name ) ) {
1233
- if ( $tsf->ld_json_breadcrumbs_use_seo_title() ) {
1234
- $name = $tsf->get_custom_field( '_genesis_title', $post_id ) ?: $tsf->title( '', '', '', $title_args );
1235
- } else {
1236
- $name = $tsf->title( '', '', '', $title_args );
1237
- }
1238
- $name = json_encode( $name );
1239
- }
1240
-
1241
- $image = $this->schema_image( $post_id, true );
1242
-
1243
- $breadcrumb = array(
1244
- 'type' => $item_type,
1245
- 'pos' => (string) $pos,
1246
- 'id' => $id,
1247
- 'name' => $name,
1248
- 'image' => $image,
1249
- );
1250
-
1251
- return $this->make_breadcrumb( $breadcrumb, false );
1252
- }
1253
-
1254
- /**
1255
- * Builds a breadcrumb.
1256
- *
1257
- * @since 2.6.0
1258
- * @since 2.9.0 : No longer outputs image if it's not present.
1259
- * @since 2.9.3 Deprecated.
1260
- * @deprecated
1261
- *
1262
- * @param array $item : {
1263
- * 'type',
1264
- * 'pos',
1265
- * 'id',
1266
- * 'name'
1267
- * }
1268
- * @param bool $comma Whether to add a trailing comma.
1269
- * @return string The LD+Json breadcrumb.
1270
- */
1271
- public function make_breadcrumb( $item, $comma = true ) {
1272
-
1273
- $tsf = \the_seo_framework();
1274
-
1275
- $tsf->_deprecated_function( 'the_seo_framework()->make_breadcrumb()', '2.9.3' );
1276
-
1277
- $comma = $comma ? ',' : '';
1278
-
1279
- if ( $item['image'] && '""' !== $item['image'] ) {
1280
- $retval = sprintf( '{"@type":%s,"position":%s,"item":{"@id":%s,"name":%s,"image":%s}}%s', $item['type'], $item['pos'], $item['id'], $item['name'], $item['image'], $comma );
1281
- } else {
1282
- $retval = sprintf( '{"@type":%s,"position":%s,"item":{"@id":%s,"name":%s}}%s', $item['type'], $item['pos'], $item['id'], $item['name'], $comma );
1283
- }
1284
-
1285
- return $retval;
1286
- }
1287
-
1288
- /**
1289
- * Fetch set Term data.
1290
- *
1291
- * @since 2.6.0
1292
- * @since 2.7.0 Handles term object differently for upgraded database.
1293
- * @since 3.0.0 Deprecated.
1294
- *
1295
- * @deprecated.
1296
- *
1297
- * @param object|null $term The TT object, if it isn't set, one is fetched.
1298
- * @param int $term_id The term object.
1299
- * @return array The SEO Framework TT data.
1300
- */
1301
- public function get_term_data( $term = null, $term_id = 0 ) {
1302
-
1303
- $tsf = \the_seo_framework();
1304
-
1305
- $tsf->_deprecated_function( 'the_seo_framework()->get_term_data( $term, $term_id )', '3.0.0', 'the_seo_framework()->get_term_meta( $term_id )' );
1306
-
1307
- if ( is_null( $term ) )
1308
- $term = $tsf->fetch_the_term( $term_id );
1309
-
1310
- if ( isset( $term->term_id ) )
1311
- return $tsf->get_term_meta( $term->term_id );
1312
-
1313
- //* Return null if no term can be set.
1314
- return null;
1315
- }
1316
-
1317
- /**
1318
- * Creates canonical URL.
1319
- *
1320
- * @since 2.0.0
1321
- * @since 2.4.2 : Refactored arguments
1322
- * @since 2.8.0 : No longer tolerates $id as Post object.
1323
- * @since 2.9.0 : When using 'home => true' args parameter, the home path is added when set.
1324
- * @since 2.9.2 Added filter usage cache.
1325
- * @since 3.0.0 Deprecated.
1326
- * @deprecated
1327
- * @staticvar array $_has_filters
1328
- *
1329
- * @param string $url the url
1330
- * @param array $args : accepted args : {
1331
- * @param bool $paged Return current page URL without pagination if false
1332
- * @param bool $paged_plural Whether to add pagination for the second or later page.
1333
- * @param bool $from_option Get the canonical uri option
1334
- * @param object $post The Post Object.
1335
- * @param bool $external Whether to fetch the current WP Request or get the permalink by Post Object.
1336
- * @param bool $is_term Fetch url for term.
1337
- * @param object $term The term object.
1338
- * @param bool $home Fetch home URL.
1339
- * @param bool $forceslash Fetch home URL and slash it, always.
1340
- * @param int $id The Page or Term ID.
1341
- * }
1342
- * @return string Escape url.
1343
- */
1344
- public function the_url( $url = '', $args = array() ) {
1345
-
1346
- $tsf = \the_seo_framework();
1347
-
1348
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->the_url()', '3.0.0', 'the_seo_framework()->get_canonical_url()' );
1349
-
1350
- $args = $tsf->reparse_url_args( $args );
1351
-
1352
- /**
1353
- * Fetch permalink if Feed.
1354
- * @since 2.5.2
1355
- */
1356
- if ( $tsf->is_feed() )
1357
- $url = \get_permalink();
1358
-
1359
- //* Reset cache.
1360
- $tsf->url_slashit = true;
1361
- $tsf->unset_current_subdomain();
1362
- $tsf->current_host = '';
1363
-
1364
- $path = '';
1365
- $scheme = '';
1366
- $slashit = true;
1367
-
1368
- if ( false === $args['home'] && empty( $url ) ) {
1369
- /**
1370
- * Get URL from options.
1371
- * @since 2.2.9
1372
- */
1373
- if ( $args['get_custom_field'] && $tsf->is_singular() ) {
1374
- $custom_url = $tsf->get_custom_field( '_genesis_canonical_uri' );
1375
-
1376
- if ( $custom_url ) {
1377
- $url = $custom_url;
1378
- $tsf->url_slashit = false;
1379
- $parsed_url = \wp_parse_url( $custom_url );
1380
- $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] : 'http';
1381
- }
1382
- }
1383
-
1384
- if ( empty( $url ) )
1385
- $path = $tsf->generate_url_path( $args );
1386
- } elseif ( $args['home'] ) {
1387
- $path = $tsf->get_home_path();
1388
- }
1389
-
1390
- static $_has_filters = null;
1391
- if ( null === $_has_filters ) {
1392
- $_has_filters = array();
1393
- $_has_filters['the_seo_framework_url_path'] = \has_filter( 'the_seo_framework_url_path' );
1394
- $_has_filters['the_seo_framework_url_output_args'] = \has_filter( 'the_seo_framework_url_output_args' );
1395
- }
1396
-
1397
- if ( $_has_filters['the_seo_framework_url_path'] ) {
1398
- /**
1399
- * Applies filters 'the_seo_framework_url_path' : array
1400
- *
1401
- * @since 2.8.0
1402
- *
1403
- * @param string $path the URL path.
1404
- * @param int $id The current post, page or term ID.
1405
- * @param bool $external Whether the call is made from outside the current ID scope. Like from the Sitemap.
1406
- */
1407
- $path = (string) \apply_filters( 'the_seo_framework_url_path', $path, $args['id'], $args['external'] );
1408
- }
1409
-
1410
- if ( $_has_filters['the_seo_framework_url_output_args'] ) {
1411
- /**
1412
- * Applies filters 'the_seo_framework_sanitize_redirect_url' : array
1413
- *
1414
- * @since 2.8.0
1415
- *
1416
- * @param array : { 'url' => The full URL built from $path, 'scheme' => The preferred scheme }
1417
- * @param string $path the URL path.
1418
- * @param int $id The current post, page or term ID.
1419
- * @param bool $external Whether the call is made from outside the current ID scope. Like from the Sitemap.
1420
- */
1421
- $url_filter = (array) \apply_filters( 'the_seo_framework_url_output_args', array(), $path, $args['id'], $args['external'] );
1422
-
1423
- if ( $url_filter ) {
1424
- $url = $url_filter['url'];
1425
- $scheme = $url_filter['scheme'];
1426
- }
1427
- }
1428
-
1429
- //* Non-custom URL
1430
- if ( empty( $url ) ) {
1431
- //* Reset cache if request is for the home URL.
1432
- if ( $args['home'] )
1433
- $tsf->unset_current_subdomain();
1434
-
1435
- $url = $tsf->add_url_host( $path );
1436
- $scheme = '';
1437
-
1438
- $url = $tsf->add_url_subdomain( $url );
1439
- }
1440
-
1441
- $scheme = $scheme ?: $tsf->get_preferred_scheme();
1442
-
1443
- $url = $tsf->set_url_scheme( $url, $scheme );
1444
-
1445
- if ( $tsf->url_slashit ) {
1446
- if ( $args['forceslash'] ) {
1447
- $url = \trailingslashit( $url );
1448
- } elseif ( $slashit ) {
1449
- $url = \user_trailingslashit( $url );
1450
- }
1451
- }
1452
-
1453
- if ( $tsf->pretty_permalinks ) {
1454
- $url = \esc_url( $url, array( 'http', 'https' ) );
1455
- } else {
1456
- //* Keep the &'s more readable.
1457
- $url = \esc_url_raw( $url, array( 'http', 'https' ) );
1458
- }
1459
-
1460
- return $url;
1461
- }
1462
-
1463
- /**
1464
- * Parse and sanitize url args.
1465
- *
1466
- * @since 2.4.2
1467
- * @since 2.9.2 Added filter usage cache.
1468
- * @since 3.0.0 Deprecated.
1469
- * @deprecated
1470
- * @staticvar bool $_has_filter
1471
- *
1472
- * @param array $args required The passed arguments.
1473
- * @param array $defaults The default arguments.
1474
- * @param bool $get_defaults Return the default arguments. Ignoring $args.
1475
- * @return array $args parsed args.
1476
- */
1477
- public function parse_url_args( $args = array(), $defaults = array(), $get_defaults = false ) {
1478
-
1479
- $tsf = \the_seo_framework();
1480
-
1481
- $tsf->_deprecated_function( 'the_seo_framework()->parse_url_args()', '3.0.0' );
1482
-
1483
- //* Passing back the defaults reduces the memory usage.
1484
- if ( empty( $defaults ) ) :
1485
- $defaults = array(
1486
- 'paged' => false,
1487
- 'paged_plural' => true,
1488
- 'get_custom_field' => true,
1489
- 'external' => false,
1490
- 'is_term' => false,
1491
- 'post' => null,
1492
- 'term' => null,
1493
- 'home' => false,
1494
- 'forceslash' => false,
1495
- 'id' => $tsf->get_the_real_ID(),
1496
- );
1497
-
1498
- static $_has_filter = null;
1499
- if ( null === $_has_filter )
1500
- $_has_filter = \has_filter( 'the_seo_framework_url_args' );
1501
-
1502
- if ( $_has_filter ) {
1503
- /**
1504
- * @applies filters the_seo_framework_url_args : {
1505
- * @param bool $paged Return current page URL without pagination if false
1506
- * @param bool $paged_plural Whether to add pagination for the second or later page.
1507
- * @param bool $from_option Get the canonical uri option
1508
- * @param object $post The Post Object.
1509
- * @param bool $external Whether to fetch the current WP Request or get the permalink by Post Object.
1510
- * @param bool $is_term Fetch url for term.
1511
- * @param object $term The term object.
1512
- * @param bool $home Fetch home URL.
1513
- * @param bool $forceslash Fetch home URL and slash it, always.
1514
- * @param int $id The Page or Term ID.
1515
- * }
1516
- *
1517
- * @since 2.5.0
1518
- * @since 3.0.0 Deprecated
1519
- * @deprecated
1520
- *
1521
- * @param array $defaults The url defaults.
1522
- * @param array $args The input args.
1523
- */
1524
- $defaults = (array) \apply_filters( 'the_seo_framework_url_args', $defaults, $args );
1525
- }
1526
- endif;
1527
-
1528
- //* Return early if it's only a default args request.
1529
- if ( $get_defaults )
1530
- return $defaults;
1531
-
1532
- //* Array merge doesn't support sanitation. We're simply type casting here.
1533
- $args['paged'] = isset( $args['paged'] ) ? (bool) $args['paged'] : $defaults['paged'];
1534
- $args['paged_plural'] = isset( $args['paged_plural'] ) ? (bool) $args['paged_plural'] : $defaults['paged_plural'];
1535
- $args['get_custom_field'] = isset( $args['get_custom_field'] ) ? (bool) $args['get_custom_field'] : $defaults['get_custom_field'];
1536
- $args['external'] = isset( $args['external'] ) ? (bool) $args['external'] : $defaults['external'];
1537
- $args['is_term'] = isset( $args['is_term'] ) ? (bool) $args['is_term'] : $defaults['is_term'];
1538
- $args['post'] = isset( $args['post'] ) ? (object) $args['post'] : $defaults['post'];
1539
- $args['term'] = isset( $args['term'] ) ? (object) $args['term'] : $defaults['term'];
1540
- $args['home'] = isset( $args['home'] ) ? (bool) $args['home'] : $defaults['home'];
1541
- $args['forceslash'] = isset( $args['forceslash'] ) ? (bool) $args['forceslash'] : $defaults['forceslash'];
1542
- $args['id'] = isset( $args['id'] ) ? (int) $args['id'] : $defaults['id'];
1543
-
1544
- return $args;
1545
- }
1546
-
1547
- /**
1548
- * Reparse URL args.
1549
- *
1550
- * @since 2.6.2
1551
- * @since 2.9.2 Now passes args to filter.
1552
- * @since 3.0.0 Deprecated.
1553
- * @deprecated
1554
- *
1555
- * @param array $args required The passed arguments.
1556
- * @return array $args parsed args.
1557
- */
1558
- public function reparse_url_args( $args = array() ) {
1559
-
1560
- $tsf = \the_seo_framework();
1561
-
1562
- $tsf->_deprecated_function( 'the_seo_framework()->reparse_url_args()', '3.0.0' );
1563
-
1564
- $default_args = $tsf->parse_url_args( $args, '', true );
1565
-
1566
- if ( is_array( $args ) ) {
1567
- if ( empty( $args ) ) {
1568
- $args = $default_args;
1569
- } else {
1570
- $args = $tsf->parse_url_args( $args, $default_args );
1571
- }
1572
- } else {
1573
- //* Old style parameters are used. Doing it wrong.
1574
- $tsf->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.4.2' );
1575
- $args = $default_args;
1576
- }
1577
-
1578
- return $args;
1579
- }
1580
-
1581
- /**
1582
- * Generate URL from arguments.
1583
- *
1584
- * @since 2.6.0
1585
- * @since 3.0.0 Deprecated.
1586
- * @deprecated
1587
- * @NOTE: Handles full path, including home directory.
1588
- *
1589
- * @param array $args the URL args.
1590
- * @return string $path
1591
- */
1592
- public function generate_url_path( $args = array() ) {
1593
-
1594
- $tsf = \the_seo_framework();
1595
-
1596
- $tsf->_deprecated_function( 'the_seo_framework()->generate_url_path()', '3.0.0' );
1597
-
1598
- $args = $tsf->reparse_url_args( $args );
1599
-
1600
- if ( $tsf->is_archive() || $args['is_term'] ) :
1601
-
1602
- $term = $args['term'];
1603
-
1604
- //* Term or Taxonomy.
1605
- if ( ! isset( $term ) )
1606
- $term = \get_queried_object();
1607
-
1608
- if ( isset( $term->taxonomy ) ) {
1609
- //* Registered Terms and Taxonomies.
1610
- $path = $tsf->get_relative_term_url( $term, $args );
1611
- } elseif ( ! $args['external'] && isset( $GLOBALS['wp']->request ) ) {
1612
- //* Everything else.
1613
- $_url = \trailingslashit( \get_option( 'home' ) ) . $GLOBALS['wp']->request;
1614
- $path = $tsf->set_url_scheme( $_url, 'relative' );
1615
- } else {
1616
- //* Nothing to see here...
1617
- $path = '';
1618
- }
1619
- elseif ( $tsf->is_search() ) :
1620
- $_url = \get_search_link();
1621
- $path = $tsf->set_url_scheme( $_url, 'relative' );
1622
- else :
1623
- /**
1624
- * Reworked to use the $args['id'] check based on get_the_real_ID.
1625
- * @since 2.6.0 & 2.6.2
1626
- */
1627
- $post_id = isset( $args['post']->ID ) ? $args['post']->ID : $args['id'];
1628
-
1629
- if ( $tsf->pretty_permalinks && $post_id && $tsf->is_singular( $post_id ) ) {
1630
- $post = \get_post( $post_id );
1631
-
1632
- //* Don't slash draft links.
1633
- if ( isset( $post->post_status ) && ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status ) )
1634
- $tsf->url_slashit = false;
1635
- }
1636
-
1637
- $path = $tsf->build_singular_relative_url( $post_id, $args );
1638
- endif;
1639
-
1640
- return $path;
1641
- }
1642
-
1643
- /**
1644
- * Generates relative URL for the Homepage and Singular Posts.
1645
- *
1646
- * @since 2.6.5
1647
- * @NOTE: Handles full path, including home directory.
1648
- * @since 2.8.0: Continues on empty post ID. Handles it as HomePage.
1649
- * @since 3.0.0 Deprecated.
1650
- * @deprecated
1651
- *
1652
- * @param int $post_id The ID.
1653
- * @param array $args The URL arguments.
1654
- * @return string relative Post or Page url.
1655
- */
1656
- public function build_singular_relative_url( $post_id = null, $args = array() ) {
1657
-
1658
- $tsf = \the_seo_framework();
1659
-
1660
- $tsf->_deprecated_function( 'the_seo_framework()->build_singular_relative_url()', '3.0.0' );
1661
-
1662
- if ( empty( $post_id ) ) {
1663
- //* We can't fetch the post ID when there's an external request.
1664
- if ( $args['external'] ) {
1665
- $post_id = 0;
1666
- } else {
1667
- $post_id = $tsf->get_the_real_ID();
1668
- }
1669
- }
1670
-
1671
- $args = $tsf->reparse_url_args( $args );
1672
-
1673
- if ( $args['external'] || ! $tsf->is_real_front_page() || ! $tsf->is_front_page_by_id( $post_id ) ) {
1674
- $url = \get_permalink( $post_id );
1675
- } elseif ( $tsf->is_real_front_page() || $tsf->is_front_page_by_id( $post_id ) ) {
1676
- $url = \get_home_url();
1677
- } elseif ( ! $args['external'] ) {
1678
- if ( isset( $GLOBALS['wp']->request ) )
1679
- $url = \trailingslashit( \get_home_url() ) . $GLOBALS['wp']->request;
1680
- }
1681
-
1682
- //* No permalink found.
1683
- if ( ! isset( $url ) )
1684
- return '';
1685
-
1686
- $paged = false;
1687
-
1688
- if ( false === $args['external'] ) {
1689
- $paged = $tsf->is_singular() ? $tsf->page() : $tsf->paged();
1690
- $paged = $tsf->maybe_get_paged( $paged, $args['paged'], $args['paged_plural'] );
1691
- }
1692
-
1693
- if ( $paged ) {
1694
- if ( $tsf->pretty_permalinks ) {
1695
- if ( $tsf->is_singular() ) {
1696
- $url = \trailingslashit( $url ) . $paged;
1697
- } else {
1698
- $url = \trailingslashit( $url ) . 'page/' . $paged;
1699
- }
1700
- } else {
1701
- if ( $tsf->is_singular() ) {
1702
- $url = \add_query_arg( 'page', $paged, $url );
1703
- } else {
1704
- $url = \add_query_arg( 'paged', $paged, $url );
1705
- }
1706
- }
1707
- }
1708
-
1709
- return $tsf->set_url_scheme( $url, 'relative' );
1710
- }
1711
-
1712
- /**
1713
- * Generates relative URL for current term.
1714
- *
1715
- * @since 2.4.2
1716
- * @since 2.7.0 Added home directory to output.
1717
- * @since 3.0.0 Deprecated.
1718
- * @deprecated
1719
- * @global object $wp_rewrite
1720
- * @NOTE: Handles full path, including home directory.
1721
- *
1722
- * @param object $term The term object.
1723
- * @param array|bool $args {
1724
- * 'external' : Whether to fetch the WP Request or get the permalink by Post Object.
1725
- * 'paged' : Whether to add pagination for all types.
1726
- * 'paged_plural' : Whether to add pagination for the second or later page.
1727
- * }
1728
- * @return string Relative term or taxonomy URL.
1729
- */
1730
- public function get_relative_term_url( $term = null, $args = array() ) {
1731
-
1732
- $tsf = \the_seo_framework();
1733
-
1734
- $tsf->_deprecated_function( 'the_seo_framework()->get_relative_term_url()', '3.0.0' );
1735
-
1736
- global $wp_rewrite;
1737
-
1738
- if ( ! is_array( $args ) ) {
1739
- /**
1740
- * @since 2.6.0
1741
- * '$args = array()' replaced '$no_request = false'.
1742
- */
1743
- $tsf->_doing_it_wrong( __METHOD__, 'Use $args = array() for parameters.', '2.6.0' );
1744
-
1745
- $no_request = (bool) $args;
1746
- $args = $tsf->parse_url_args( '', '', true );
1747
- $args['external'] = $no_request;
1748
- }
1749
-
1750
- // We can't fetch the Term object within sitemaps.
1751
- if ( $args['external'] && is_null( $term ) )
1752
- return '';
1753
-
1754
- if ( is_null( $term ) )
1755
- $term = \get_queried_object();
1756
-
1757
- $taxonomy = $term->taxonomy;
1758
- $path = $wp_rewrite->get_extra_permastruct( $taxonomy );
1759
-
1760
- $slug = $term->slug;
1761
- $t = \get_taxonomy( $taxonomy );
1762
-
1763
- $paged = $tsf->maybe_get_paged( $tsf->paged(), $args['paged'], $args['paged_plural'] );
1764
-
1765
- if ( empty( $path ) ) :
1766
- //* Default permalink structure.
1767
-
1768
- if ( 'category' === $taxonomy ) {
1769
- $path = '?cat=' . $term->term_id;
1770
- } elseif ( isset( $t->query_var ) && '' !== $t->query_var ) {
1771
- $path = '?' . $t->query_var . '=' . $slug;
1772
- } else {
1773
- $path = '?taxonomy=' . $taxonomy . '&term=' . $slug;
1774
- }
1775
-
1776
- if ( $paged )
1777
- $path .= '&paged=' . $paged;
1778
-
1779
- //* Don't slash it.
1780
- $tsf->url_slashit = false;
1781
-
1782
- else :
1783
- if ( $t->rewrite['hierarchical'] ) {
1784
- $hierarchical_slugs = array();
1785
- $ancestors = \get_ancestors( $term->term_id, $taxonomy, 'taxonomy' );
1786
-
1787
- foreach ( (array) $ancestors as $ancestor ) {
1788
- $ancestor_term = \get_term( $ancestor, $taxonomy );
1789
- $hierarchical_slugs[] = $ancestor_term->slug;
1790
- }
1791
-
1792
- $hierarchical_slugs = array_reverse( $hierarchical_slugs );
1793
- $hierarchical_slugs[] = $slug;
1794
-
1795
- $path = str_replace( "%$taxonomy%", implode( '/', $hierarchical_slugs ), $path );
1796
- } else {
1797
- $path = str_replace( "%$taxonomy%", $slug, $path );
1798
- }
1799
-
1800
- if ( $paged )
1801
- $path = \trailingslashit( $path ) . 'page/' . $paged;
1802
-
1803
- $path = \user_trailingslashit( $path, 'category' );
1804
- endif;
1805
-
1806
- //* Add plausible domain subdirectories.
1807
- $url = \trailingslashit( \get_option( 'home' ) ) . ltrim( $path, ' \\/' );
1808
- $path = $tsf->set_url_scheme( $url, 'relative' );
1809
-
1810
- return $path;
1811
- }
1812
-
1813
- /**
1814
- * Adds subdomain to input URL.
1815
- *
1816
- * @since 2.6.5
1817
- * @since 3.0.0 Deprecated.
1818
- * @deprecated
1819
- *
1820
- * @param string $url The current URL without subdomain.
1821
- * @return string $url Fully qualified URL with possible subdomain.
1822
- */
1823
- public function add_url_subdomain( $url = '' ) {
1824
-
1825
- $tsf = \the_seo_framework();
1826
- $tsf->_deprecated_function( 'the_seo_framework()->add_url_subdomain()', '3.0.0' );
1827
-
1828
- $url = $tsf->make_fully_qualified_url( $url );
1829
-
1830
- //* Add subdomain, if set.
1831
- if ( $subdomain = $tsf->get_current_subdomain() ) {
1832
- $parsed_url = \wp_parse_url( $url );
1833
- $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] : 'http';
1834
- $url = str_replace( $scheme . '://', '', $url );
1835
-
1836
- //* Put it together.
1837
- $url = $scheme . '://' . $subdomain . '.' . $url;
1838
- }
1839
-
1840
- return $url;
1841
- }
1842
-
1843
- /**
1844
- * Fetches current subdomain set by $this->set_current_subdomain();
1845
- *
1846
- * @since 2.7.0
1847
- * @since 3.0.0 Deprecated.
1848
- * @deprecated
1849
- * @staticvar string $subdomain
1850
- *
1851
- * @param null|string $set Whether to set a new subdomain.
1852
- * @param bool $unset Whether to remove subdomain from cache.
1853
- * @return string|bool The set subdomain, false if none is set.
1854
- */
1855
- public function get_current_subdomain( $set = null, $unset = false ) {
1856
-
1857
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->get_current_subdomain()', '3.0.0' );
1858
-
1859
- static $subdomain = null;
1860
-
1861
- if ( isset( $set ) )
1862
- $subdomain = \esc_html( $set );
1863
-
1864
- if ( $unset )
1865
- unset( $subdomain );
1866
-
1867
- if ( isset( $subdomain ) )
1868
- return $subdomain;
1869
-
1870
- return false;
1871
- }
1872
-
1873
- /**
1874
- * Sets current working subdomain.
1875
- *
1876
- * @since 2.7.0
1877
- * @since 3.0.0 Deprecated.
1878
- * @deprecated
1879
- *
1880
- * @param string $subdomain The current subdomain.
1881
- * @return string The set subdomain.
1882
- */
1883
- public function set_current_subdomain( $subdomain = '' ) {
1884
-
1885
- $tsf = \the_seo_framework();
1886
-
1887
- $tsf->_deprecated_function( 'the_seo_framework()->unset_current_subdomain()', '3.0.0' );
1888
-
1889
- return $tsf->get_current_subdomain( $subdomain );
1890
- }
1891
-
1892
- /**
1893
- * Unsets current working subdomain.
1894
- *
1895
- * @since 2.7.0
1896
- * @since 3.0.0 Deprecated.
1897
- * @deprecated
1898
- */
1899
- public function unset_current_subdomain() {
1900
-
1901
- $tsf = \the_seo_framework();
1902
-
1903
- $tsf->_deprecated_function( 'the_seo_framework()->unset_current_subdomain()', '3.0.0' );
1904
-
1905
- $tsf->get_current_subdomain( null, true );
1906
- }
1907
-
1908
- /**
1909
- * Create full valid URL with parsed host.
1910
- * Don't forget to use set_url_scheme() afterwards.
1911
- *
1912
- * Note: will return $path if no host can be found.
1913
- *
1914
- * @since 2.6.5
1915
- * @since 3.0.0 Deprecated.
1916
- * @deprecated
1917
- *
1918
- * @param string $path Current path.
1919
- * @return string Full valid URL with http host.
1920
- */
1921
- public function add_url_host( $path = '' ) {
1922
-
1923
- $tsf = \the_seo_framework();
1924
-
1925
- $tsf->_deprecated_function( 'the_seo_framework()->add_url_host()', '3.0.0' );
1926
-
1927
- $host = $tsf->current_host ?: $tsf->get_home_host();
1928
-
1929
- $scheme = $host ? 'http://' : '';
1930
-
1931
- return $url = $scheme . \trailingslashit( $host ) . ltrim( $path, ' \\/' );
1932
- }
1933
-
1934
- /**
1935
- * Fetches home URL subdirectory path. Like "wordpress.org/plugins/".
1936
- *
1937
- * @since 2.7.0
1938
- * @since 3.0.0 Deprecated.
1939
- * @deprecated
1940
- * @staticvar string $cache
1941
- *
1942
- * @return string The home URL path.
1943
- */
1944
- public function get_home_path() {
1945
-
1946
- \the_seo_framework()->_deprecated_function( 'the_seo_framework()->get_home_path()', '3.0.0' );
1947
-
1948
- static $cache = null;
1949
-
1950
- if ( isset( $cache ) )
1951
- return $cache;
1952
-
1953
- $path = '';
1954
-
1955
- $parsed_url = \wp_parse_url( \get_option( 'home' ) );
1956
-
1957
- if ( ! empty( $parsed_url['path'] ) && $path = ltrim( $parsed_url['path'], ' \\/' ) )
1958
- $path = '/' . $path;
1959
-
1960
- return $cache = $path;
1961
- }
1962
-
1963
- /**
1964
- * Cache current URL in static variable
1965
- * Must be called inside the loop
1966
- *
1967
- * @since 2.2.2
1968
- * @since 3.0.0 Deprecated.
1969
- * @deprecated
1970
- * @staticvar array $url_cache
1971
- *
1972
- * @param string $url the url
1973
- * @param int $post_id the page id, if empty it will fetch the requested ID, else the page uri
1974
- * @param bool $paged Return current page URL with pagination
1975
- * @param bool $from_option Get the canonical uri option
1976
- * @param bool $paged_plural Whether to allow pagination on second or later pages.
1977
- * @return string The url
1978
- */
1979
- public function the_url_from_cache( $url = '', $post_id = null, $paged = false, $from_option = true, $paged_plural = true ) {
1980
-
1981
- $tsf = \the_seo_framework();
1982
- $tsf->_deprecated_function( 'the_seo_framework()->the_url_from_cache()', '3.0.0', `the_seo_framework()->get_current_canonical_url()` );
1983
-
1984
- return $tsf->get_current_canonical_url();
1985
- }
1986
-
1987
- /**
1988
- * Cache home URL in static variable
1989
- *
1990
- * @since 2.5.0
1991
- * @since 2.9.0 Now returns subdirectory installations paths too.
1992
- * @since 3.0.0 1: Now no longer regenerates home URL when parameters differ.
1993
- * 2: Deprecated.
1994
- * @deprecated
1995
- * @staticvar string $url
1996
- *
1997
- * @param bool $force_slash Force slash
1998
- * @return string The url
1999
- */
2000
- public function the_home_url_from_cache( $force_slash = false ) {
2001
-
2002
- $tsf = \the_seo_framework();
2003
- $tsf->_deprecated_function( 'the_seo_framework()->the_home_url_from_cache()', '3.0.0', 'the_seo_framework()->get_homepage_permalink()' );
2004
-
2005
- static $url;
2006
-
2007
- if ( ! $url )
2008
- $url = $tsf->get_homepage_permalink();
2009
-
2010
- return $force_slash ? \trailingslashit( $url ) : $url;
2011
- }
2012
- }
<
1
+ <?php
2
+ /**
3
+ * @package The_SEO_Framework\Classes\Deprecated
4
+ */
5
+ namespace The_SEO_Framework;
6
+
7
+ defined( 'ABSPATH' ) or die;
8
+
9
+ /**
10
+ * The SEO Framework plugin
11
+ * Copyright (C) 2015 - 2017 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
+ *
13
+ * This program is free software: you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License version 3 as published
15
+ * by the Free Software Foundation.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ */
25
+
26
+ defined( 'ABSPATH' ) or die;
27
+
28
+ /**
29
+ * Class The_SEO_Framework\Deprecated
30
+ *
31
+ * Contains all deprecated functions.
32
+ *
33
+ * @since 2.8.0
34
+ */
35
+ final class Deprecated {
36
+
37
+ /**
38
+ * Constructor. Does nothing.
39
+ */
40
+ public function __construct() { }
41
+
42
+ /**
43
+ * HomePage Metabox General Tab Output.
44
+ *
45
+ * @since 2.6.0
46
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
47
+ *
48
+ * @deprecated
49
+ * @since 2.7.0
50
+ */
51
+ public function homepage_metabox_general() {
52
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Metaboxes::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Metaboxes::homepage_metabox_general_tab()' );
53
+ \the_seo_framework()->get_view( 'metaboxes/homepage-metabox', array(), 'general' );
54
+ }
55
+
56
+ /**
57
+ * HomePage Metabox Additions Tab Output.
58
+ *
59
+ * @since 2.6.0
60
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
61
+ *
62
+ * @deprecated
63
+ * @since 2.7.0
64
+ */
65
+ public function homepage_metabox_additions() {
66
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Metaboxes::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Metaboxes::homepage_metabox_additions_tab()' );
67
+ \the_seo_framework()->get_view( 'metaboxes/homepage-metabox', array(), 'additions' );
68
+ }
69
+
70
+ /**
71
+ * HomePage Metabox Robots Tab Output
72
+ *
73
+ * @since 2.6.0
74
+ * @see $this->homepage_metabox() Callback for HomePage Settings box.
75
+ *
76
+ * @deprecated
77
+ * @since 2.7.0
78
+ */
79
+ public function homepage_metabox_robots() {
80
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Metaboxes::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Metaboxes::homepage_metabox_robots_tab()' );
81
+ \the_seo_framework()->get_view( 'metaboxes/homepage-metabox', array(), 'robots' );
82
+ }
83
+
84
+ /**
85
+ * Delete transient for the automatic description for blog on save request.
86
+ * Returns old option, since that's passed for sanitation within WP Core.
87
+ *
88
+ * @since 2.3.3
89
+ *
90
+ * @deprecated
91
+ * @since 2.7.0
92
+ *
93
+ * @param string $old_option The previous blog description option.
94
+ * @return string Previous option.
95
+ */
96
+ public function delete_auto_description_blog_transient( $old_option ) {
97
+
98
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'The_SEO_Framework_Transients::delete_auto_description_frontpage_transient()' );
99
+
100
+ \the_seo_framework()->delete_auto_description_transient( \the_seo_framework()->get_the_front_page_ID(), '', 'frontpage' );
101
+
102
+ return $old_option;
103
+ }
104
+
105
+ /**
106
+ * Add term meta data into options table of the term.
107
+ * Adds separated database options for terms, as the terms table doesn't allow for addition.
108
+ *
109
+ * Applies filters array the_seo_framework_term_meta_defaults : Array of default term SEO options
110
+ * Applies filters mixed the_seo_framework_term_meta_{field} : Override filter for specifics.
111
+ * Applies filters array the_seo_framework_term_meta : Override output for term or taxonomy.
112
+ *
113
+ * @since 2.1.8
114
+ *
115
+ * @deprecated silently.
116
+ * @since WordPress 4.4.0
117
+ * @since The SEO Framework 2.7.0
118
+ * @since 2.8.0: Deprecated visually.
119
+ *
120
+ * @param object $term Database row object.
121
+ * @param string $taxonomy Taxonomy name that $term is part of.
122
+ * @return object $term Database row object.
123
+ */
124
+ public function get_term_filter( $term, $taxonomy ) {
125
+
126
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "get_term_meta()"' );
127
+
128
+ return false;
129
+ }
130
+
131
+ /**
132
+ * Adds The SEO Framework term meta data to functions that return multiple terms.
133
+ *
134
+ * @since 2.0.0
135
+ *
136
+ * @deprecated silently.
137
+ * @since WordPress 4.4.0
138
+ * @since The SEO Framework 2.7.0
139
+ * @since 2.8.0: Deprecated visually.
140
+ *
141
+ * @param array $terms Database row objects.
142
+ * @param string $taxonomy Taxonomy name that $terms are part of.
143
+ * @return array $terms Database row objects.
144
+ */
145
+ public function get_terms_filter( array $terms, $taxonomy ) {
146
+
147
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "get_term_meta()"' );
148
+
149
+ return false;
150
+ }
151
+
152
+ /**
153
+ * Save taxonomy meta data.
154
+ * Fires when a user edits and saves a taxonomy.
155
+ *
156
+ * @since 2.1.8
157
+ *
158
+ * @deprecated silently.
159
+ * @since WordPress 4.4.0
160
+ * @since The SEO Framework 2.7.0
161
+ * @since 2.8.0: Deprecated visually.
162
+ *
163
+ * @param integer $term_id Term ID.
164
+ * @param integer $tt_id Term Taxonomy ID.
165
+ * @return void Early on AJAX call.
166
+ */
167
+ public function taxonomy_seo_save( $term_id, $tt_id ) {
168
+
169
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "update_term_meta()"' );
170
+
171
+ return false;
172
+ }
173
+
174
+ /**
175
+ * Delete term meta data.
176
+ * Fires when a user deletes a term.
177
+ *
178
+ * @since 2.1.8
179
+ *
180
+ * @deprecated silently.
181
+ * @since WordPress 4.4.0
182
+ * @since The SEO Framework 2.7.0
183
+ * @since 2.8.0: Deprecated visually.
184
+ *
185
+ * @param integer $term_id Term ID.
186
+ * @param integer $tt_id Taxonomy Term ID.
187
+ */
188
+ public function term_meta_delete( $term_id, $tt_id ) {
189
+
190
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Transients::' . __FUNCTION__, '2.7.0', 'WordPress Core "delete_term_meta()"' );
191
+
192
+ return false;
193
+ }
194
+
195
+ /**
196
+ * Faster way of doing an in_array search compared to default PHP behavior.
197
+ * @NOTE only to show improvement with large arrays. Might slow down with small arrays.
198
+ * @NOTE can't do type checks. Always assume the comparing value is a string.
199
+ *
200
+ * @since 2.5.2
201
+ * @since 2.7.0 Deprecated.
202
+ * @deprecated
203
+ *
204
+ * @param string|array $needle The needle(s) to search for
205
+ * @param array $array The single dimensional array to search in.
206
+ * @return bool true if value is in array.
207
+ */
208
+ public function in_array( $needle, $array, $strict = true ) {
209
+
210
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Core::' . __FUNCTION__, '2.7.0', 'in_array()' );
211
+
212
+ $array = array_flip( $array );
213
+
214
+ if ( is_string( $needle ) ) {
215
+ if ( isset( $array[ $needle ] ) )
216
+ return true;
217
+ } elseif ( is_array( $needle ) ) {
218
+ foreach ( $needle as $str ) {
219
+ if ( isset( $array[ $str ] ) )
220
+ return true;
221
+ }
222
+ }
223
+
224
+ return false;
225
+ }
226
+
227
+ /**
228
+ * Fetches posts with exclude_local_search option on
229
+ *
230
+ * @since 2.1.7
231
+ * @since 2.7.0 Deprecated.
232
+ * @deprecated
233
+ *
234
+ * @return array Excluded Post IDs
235
+ */
236
+ public function exclude_search_ids() {
237
+
238
+ \the_seo_framework()->_deprecated_function( 'The_SEO_Framework_Search::' . __FUNCTION__, '2.7.0', 'the_seo_framework()->get_excluded_search_ids()' );
239
+
240
+ return $this->get_excluded_search_ids();
241
+ }
242
+
243
+ /**
244
+ * Fetches posts with exclude_local_search option on.
245
+ *
246
+ * @since 2.1.7
247
+ * @since 2.7.0 No longer used for performance reasons.
248
+ * @uses $this->exclude_search_ids()
249
+ * @deprecated
250
+ * @since 2.8.0 deprecated.
251
+ *
252
+ * @param array $query The possible search query.
253
+ * @return void Early if no search query is found.
254
+ */
255
+ public function search_filter( $query ) {
256
+
257
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->search_filter()', '2.8.0' );
258
+
259
+ // Don't exclude pages in wp-admin.
260
+ if ( $query->is_search && false === \the_seo_framework()->is_admin() ) {
261
+
262
+ $q = $query->query;
263
+ //* Only interact with an actual Search Query.
264
+ if ( false === isset( $q['s'] ) )
265
+ return;
266
+
267
+ //* Get excluded IDs.
268
+ $protected_posts = $this->get_excluded_search_ids();
269
+ if ( $protected_posts ) {
270
+ $get = $query->get( 'post__not_in' );
271
+
272
+ //* Merge user defined query.
273
+ if ( is_array( $get ) && ! empty( $get ) )
274
+ $protected_posts = array_merge( $protected_posts, $get );
275
+
276
+ $query->set( 'post__not_in', $protected_posts );
277
+ }
278
+
279
+ // Parse all ID's, even beyond the first page.
280
+ $query->set( 'no_found_rows', false );
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Fetches posts with exclude_local_search option on.
286
+ *
287
+ * @since 2.7.0
288
+ * @since 2.7.0 No longer used.
289
+ * @global int $blog_id
290
+ * @deprecated
291
+ *
292
+ * @return array Excluded Post IDs
293
+ */
294
+ public function get_excluded_search_ids() {
295
+
296
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->get_excluded_search_ids()', '2.7.0' );
297
+
298
+ global $blog_id;
299
+
300
+ $cache_key = 'exclude_search_ids_' . $blog_id . '_' . \get_locale();
301
+
302
+ $post_ids = \the_seo_framework()->object_cache_get( $cache_key );
303
+ if ( false === $post_ids ) {
304
+ $post_ids = array();
305
+
306
+ $args = array(
307
+ 'post_type' => 'any',
308
+ 'numberposts' => -1,
309
+ 'posts_per_page' => -1,
310
+ 'order' => 'DESC',
311
+ 'post_status' => 'publish',
312
+ 'meta_key' => 'exclude_local_search',
313
+ 'meta_value' => 1,
314
+ 'meta_compare' => '=',
315
+ 'cache_results' => true,
316
+ 'suppress_filters' => false,
317
+ );
318
+ $get_posts = new \WP_Query;
319
+ $excluded_posts = $get_posts->query( $args );
320
+ unset( $get_posts );
321
+
322
+ if ( $excluded_posts )
323
+ $post_ids = \wp_list_pluck( $excluded_posts, 'ID' );
324
+
325
+ \the_seo_framework()->object_cache_set( $cache_key, $post_ids, 86400 );
326
+ }
327
+
328
+ // return an array of exclude post IDs
329
+ return $post_ids;
330
+ }
331
+
332
+ /**
333
+ * Registers option sanitation filter
334
+ *
335
+ * @since 2.2.2
336
+ * @since 2.7.0 : No longer used internally.
337
+ * @since 2.8.0 : Deprecated
338
+ * @deprecated
339
+ *
340
+ * @param string $filter The filter to call (see The_SEO_Framework_Site_Options::$available_filters for options)
341
+ * @param string $option The WordPress option name
342
+ * @param string|array $suboption Optional. The suboption or suboptions you want to filter
343
+ * @return true on completion.
344
+ */
345
+ public function autodescription_add_option_filter( $filter, $option, $suboption = null ) {
346
+
347
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->add_option_filter()', '2.8.0' );
348
+
349
+ return \the_seo_framework()->add_option_filter( $filter, $option, $suboption );
350
+ }
351
+
352
+ /**
353
+ * Register each of the settings with a sanitization filter type.
354
+ *
355
+ * @since 2.2.2
356
+ * @since 2.8.0 Deprecated.
357
+ * @uses method add_filter() Assign filter to array of settings.
358
+ * @see The_SEO_Framework_Sanitize::add_filter() Add sanitization filters to options.
359
+ */
360
+ public function sanitizer_filters() {
361
+
362
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->sanitizer_filters()', '2.8.0', 'the_seo_framework()->init_sanitizer_filters()' );
363
+
364
+ \the_seo_framework()->init_sanitizer_filters();
365
+ }
366
+
367
+ /**
368
+ * Fetches site icon brought in WordPress 4.3.0
369
+ *
370
+ * @since 2.2.1
371
+ * @since 2.8.0: Deprecated.
372
+ * @deprecated
373
+ *
374
+ * @param string $size The icon size, accepts 'full' and pixel values.
375
+ * @param bool $set_og_dimensions Whether to set size for OG image. Always falls back to the current post ID.
376
+ * @return string URL site icon, not escaped.
377
+ */
378
+ public function site_icon( $size = 'full', $set_og_dimensions = false ) {
379
+
380
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->site_icon()', '2.8.0', 'the_seo_framework()->get_site_icon()' );
381
+
382
+ return the_seo_framework()->get_site_icon( $size, $set_og_dimensions );
383
+ }
384
+
385
+ /**
386
+ * Delete transient on post save.
387
+ *
388
+ * @since 2.2.9
389
+ * @since 2.8.0 : Deprecated
390
+ * @deprecated
391
+ *
392
+ * @param int $post_id The Post ID that has been updated.
393
+ * @return bool|null True when sitemap is flushed. False on revision. Null
394
+ * when sitemaps are deactivated.
395
+ */
396
+ public function delete_transients_post( $post_id ) {
397
+
398
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->delete_transients_post()', '2.8.0', 'the_seo_framework()->delete_post_cache()' );
399
+
400
+ return \the_seo_framework()->delete_post_cache( $post_id );
401
+ }
402
+
403
+ /**
404
+ * Delete transient on profile save.
405
+ *
406
+ * @since 2.6.4
407
+ * @since 2.8.0 : Deprecated
408
+ * @deprecated
409
+ *
410
+ * @param int $user_id The User ID that has been updated.
411
+ */
412
+ public function delete_transients_author( $user_id ) {
413
+
414
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->delete_transients_author()', '2.8.0', 'the_seo_framework()->delete_author_cache()' );
415
+
416
+ return \the_seo_framework()->delete_author_cache( $user_id );
417
+ }
418
+
419
+ /**
420
+ * Flushes the home page LD+Json transient.
421
+ *
422
+ * @since 2.6.0
423
+ * @since 2.8.0 deprecated.
424
+ * @staticvar bool $flushed Prevents second flush.
425
+ * @deprecated
426
+ *
427
+ * @return bool Whether it's flushed on current call.
428
+ */
429
+ public function delete_front_ld_json_transient() {
430
+
431
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->delete_front_ld_json_transient()', '2.8.0', 'the_seo_framework()->delete_cache( \'front\' )' );
432
+
433
+ static $flushed = null;
434
+
435
+ if ( isset( $flushed ) )
436
+ return false;
437
+
438
+ if ( ! \the_seo_framework()->is_option_checked( 'cache_meta_schema' ) )
439
+ return $flushed = false;
440
+
441
+ $front_id = \the_seo_framework()->get_the_front_page_ID();
442
+
443
+ \the_seo_framework()->delete_ld_json_transient( $front_id, '', 'frontpage' );
444
+
445
+ return $flushed = true;
446
+ }
447
+
448
+ /**
449
+ * Determines whether we can use the new WordPress core term meta functionality.
450
+ *
451
+ * @since 2.7.0
452
+ * @since 2.8.0: Deprecated. WordPress 4.4+ is now required.
453
+ * @staticvar bool $cache
454
+ * @deprecated
455
+ *
456
+ * @return bool True when WordPress is at version 4.4 or higher and has an
457
+ * accordingly upgraded database.
458
+ */
459
+ public function can_get_term_meta() {
460
+
461
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->can_get_term_meta()', '2.8.0' );
462
+
463
+ static $cache = null;
464
+
465
+ if ( isset( $cache ) )
466
+ return $cache;
467
+
468
+ return $cache = \get_option( 'db_version' ) >= 34370 && \get_option( 'the_seo_framework_upgraded_db_version' ) >= '2700' && \the_seo_framework()->wp_version( '4.3.999', '>' );
469
+ }
470
+
471
+ /**
472
+ * Fetches term metadata array for the inpost term metabox.
473
+ *
474
+ * @since 2.7.0
475
+ * @since 2.8.0: Deprecated. WordPress 4.4+ is now required.
476
+ * @deprecated
477
+ *
478
+ * @param object $term The TT object. Must be assigned.
479
+ * @return array The SEO Framework TT data.
480
+ */
481
+ protected function get_old_term_data( $term ) {
482
+
483
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->get_old_term_data()', '2.8.0' );
484
+
485
+ $data = array();
486
+
487
+ $data['title'] = isset( $term->admeta['doctitle'] ) ? $term->admeta['doctitle'] : '';
488
+ $data['description'] = isset( $term->admeta['description'] ) ? $term->admeta['description'] : '';
489
+ $data['noindex'] = isset( $term->admeta['noindex'] ) ? $term->admeta['noindex'] : '';
490
+ $data['nofollow'] = isset( $term->admeta['nofollow'] ) ? $term->admeta['nofollow'] : '';
491
+ $data['noarchive'] = isset( $term->admeta['noarchive'] ) ? $term->admeta['noarchive'] : '';
492
+ $flag = isset( $term->admeta['saved_flag'] ) ? (bool) $term->admeta['saved_flag'] : false;
493
+
494
+ //* Genesis data fetch. This will override our options with Genesis options on save.
495
+ if ( false === $flag && isset( $term->meta ) ) {
496
+ $data['title'] = empty( $data['title'] ) && isset( $term->meta['doctitle'] ) ? $term->meta['doctitle'] : $data['noindex'];
497
+ $data['description'] = empty( $data['description'] ) && isset( $term->meta['description'] ) ? $term->meta['description'] : $data['description'];
498
+ $data['noindex'] = empty( $data['noindex'] ) && isset( $term->meta['noindex'] ) ? $term->meta['noindex'] : $data['noindex'];
499
+ $data['nofollow'] = empty( $data['nofollow'] ) && isset( $term->meta['nofollow'] ) ? $term->meta['nofollow'] : $data['nofollow'];
500
+ $data['noarchive'] = empty( $data['noarchive'] ) && isset( $term->meta['noarchive'] ) ? $term->meta['noarchive'] : $data['noarchive'];
501
+ }
502
+
503
+ return $data;
504
+ }
505
+
506
+ /**
507
+ * Fetches og:image URL.
508
+ *
509
+ * @since 2.2.2
510
+ * @since 2.2.8 : Added theme icon detection.
511
+ * @since 2.5.2 : Added args filters.
512
+ * @since 2.8.0 : 1. Added theme logo detection.
513
+ * 2. Added inpost image selection detection.
514
+ * @since 2.8.2 : 1. Now returns something on post ID 0.
515
+ * 2. Added SEO settings fallback image selection detection.
516
+ * @since 2.9.0 : 1. Added 'skip_fallback' option to arguments.
517
+ * 2. Added 'escape' option to arguments.
518
+ * 3. First parameter is now arguments. Fallback for integer is added.
519
+ * 4. Second parameter is now deprecated.
520
+ * 5. Deprecated.
521
+ * @deprecated Use get_social_image instead.
522
+ *
523
+ * @param int|array $args The image arguments.
524
+ * Was: $post_id.
525
+ * Warning: Integer usage is only used for backwards compat.
526
+ * @param array $depr_args, Deprecated;
527
+ * Was $args The image arguments.
528
+ * @param bool $escape Whether to escape the image URL.
529
+ * Deprecated: You should use $args['escape'].
530
+ * @return string the image URL.
531
+ */
532
+ public function get_image( $args = array(), $depr_args = '', $depr_escape = true ) {
533
+
534
+ $tsf = \the_seo_framework();
535
+
536
+ $tsf->_deprecated_function( 'the_seo_framework()->get_image()', '2.9.0', 'the_seo_framework()->get_social_image()' );
537
+
538
+ if ( is_int( $args ) || is_array( $depr_args ) ) {
539
+ $tsf->_doing_it_wrong( __METHOD__, 'First parameter is now used for arguments. Second parameter is deprecated.', '2.9.0' );
540
+
541
+ $post_id = $args;
542
+ $args = array();
543
+
544
+ /**
545
+ * Backwards compat with parse args.
546
+ * @since 2.5.0
547
+ */
548
+ if ( ! isset( $depr_args['post_id'] ) ) {
549
+ $args['post_id'] = $post_id ?: ( $tsf->is_singular( $post_id ) ? $tsf->get_the_real_ID() : 0 );
550
+ }
551
+
552
+ if ( is_array( $depr_args ) ) {
553
+ $args = \wp_parse_args( $depr_args, $args );
554
+ }
555
+ }
556
+
557
+ if ( false === $depr_escape ) {
558
+ $tsf->_doing_it_wrong( __METHOD__, 'Third parameter has been deprecated. Use `$args["escape"] => false` instead.', '2.9.0' );
559
+ $args['escape'] = false;
560
+ }
561
+
562
+ $args = $tsf->reparse_image_args( $args );
563
+
564
+ //* 0. Image from argument.
565
+ pre_0 : {
566
+ if ( $image = $args['image'] )
567
+ goto end;
568
+ }
569
+
570
+ //* Check if there are no disallowed arguments.
571
+ $all_allowed = empty( $args['disallowed'] );
572
+
573
+ //* 1. Fetch image from homepage SEO meta upload.
574
+ if ( $all_allowed || false === in_array( 'homemeta', $args['disallowed'], true ) ) {
575
+ if ( $image = $tsf->get_social_image_url_from_home_meta( $args['post_id'], true ) )
576
+ goto end;
577
+ }
578
+
579
+ if ( $args['post_id'] ) {
580
+ //* 2. Fetch image from SEO meta upload.
581
+ if ( $all_allowed || false === in_array( 'postmeta', $args['disallowed'], true ) ) {
582
+ if ( $image = $tsf->get_social_image_url_from_post_meta( $args['post_id'], true ) )
583
+ goto end;
584
+ }
585
+
586
+ //* 3. Fetch image from featured.
587
+ if ( $all_allowed || false === in_array( 'featured', $args['disallowed'], true ) ) {
588
+ if ( $image = $tsf->get_image_from_post_thumbnail( $args, true ) )
589
+ goto end;
590
+ }
591
+ }
592
+
593
+ if ( $args['skip_fallback'] )
594
+ goto end;
595
+
596
+ //* 4. Fetch image from SEO settings
597
+ if ( $all_allowed || false === in_array( 'option', $args['disallowed'], true ) ) {
598
+ if ( $image = $tsf->get_social_image_url_from_seo_settings( true ) )
599
+ goto end;
600
+ }
601
+
602
+ //* 5. Fetch image from fallback filter 1
603
+ /**
604
+ * Applies filters 'the_seo_framework_og_image_after_featured' : string
605
+ * @since 2.5.2
606
+ */
607
+ fallback_1 : {
608
+ if ( $image = (string) \apply_filters( 'the_seo_framework_og_image_after_featured', '', $args['post_id'] ) )
609
+ goto end;
610
+ }
611
+
612
+ //* 6. Fallback: Get header image if exists
613
+ if ( ( $all_allowed || false === in_array( 'header', $args['disallowed'], true ) ) && \current_theme_supports( 'custom-header', 'default-image' ) ) {
614
+ if ( $image = $tsf->get_header_image( true ) )
615
+ goto end;
616
+ }
617
+
618
+ //* 7. Fetch image from fallback filter 2
619
+ /**
620
+ * Applies filters 'the_seo_framework_og_image_after_header' : string
621
+ * @since 2.5.2
622
+ */
623
+ fallback_2 : {
624
+ if ( $image = (string) \apply_filters( 'the_seo_framework_og_image_after_header', '', $args['post_id'] ) )
625
+ goto end;
626
+ }
627
+
628
+ //* 8. Get the WP 4.5 Site Logo
629
+ if ( ( $all_allowed || false === in_array( 'logo', $args['disallowed'], true ) ) && $tsf->can_use_logo() ) {
630
+ if ( $image = $tsf->get_site_logo( true ) )
631
+ goto end;
632
+ }
633
+
634
+ //* 9. Get the WP 4.3 Site Icon
635
+ if ( $all_allowed || false === in_array( 'icon', $args['disallowed'], true ) ) {
636
+ if ( $image = $tsf->get_site_icon( 'full', true ) )
637
+ goto end;
638
+ }
639
+
640
+ end :;
641
+
642
+ if ( $args['escape'] && $image )
643
+ $image = \esc_url( $image );
644
+
645
+ return (string) $image;
646
+ }
647
+
648
+ /**
649
+ * Fetches image from post thumbnail.
650
+ * Resizes the image between 4096px if bigger. Then it saves the image and
651
+ * Keeps dimensions relative.
652
+ *
653
+ * @since 2.3.0
654
+ * @since 2.9.0 Changed parameters.
655
+ * @since 2.9.0 Deprecated.
656
+ * @since 2.9.3 Now supports 4K, rather than 1500px.
657
+ * @deprecated
658
+ *
659
+ * @param array $args The image args.
660
+ * Was: int $id The post/page ID.
661
+ * @param bool $set_og_dimensions Whether to set Open Graph image dimensions.
662
+ * Was: array $depr_args Deprecated. Image arguments.
663
+ * @return string|null the image url.
664
+ */
665
+ public function get_image_from_post_thumbnail( $args = array(), $set_og_dimensions = false ) {
666
+
667
+ $tsf = \the_seo_framework();
668
+
669
+ $tsf->_deprecated_function( 'the_seo_framework()->get_image_from_post_thumbnail()', '2.9.0', 'the_seo_framework()->get_social_image_url_from_post_thumbnail()' );
670
+
671
+ if ( is_array( $set_og_dimensions ) ) {
672
+ $tsf->_doing_it_wrong( __METHOD__, 'First parameter are now arguments, second parameter is for setting og dimensions.', '2.9.0' );
673
+ $args = $set_og_dimensions;
674
+ $set_og_dimensions = false;
675
+ }
676
+
677
+ $args = $tsf->reparse_image_args( $args );
678
+
679
+ $id = \get_post_thumbnail_id( $args['post_id'] );
680
+
681
+ $args['get_the_real_ID'] = true;
682
+
683
+ $image = $id ? $tsf->parse_og_image( $id, $args, $set_og_dimensions ) : '';
684
+
685
+ return $image;
686
+ }
687
+
688
+ /**
689
+ * Detects front page.
690
+ *
691
+ * Returns true on SEO settings page if ID is 0.
692
+ *
693
+ * @since 2.6.0
694
+ * @since 2.9.0: Deprecated.
695
+ * @deprecated
696
+ *
697
+ * @param int $id The Page or Post ID.
698
+ * @return bool
699
+ */
700
+ public function is_front_page( $id = 0 ) {
701
+
702
+ $tsf = \the_seo_framework();
703
+
704
+ $tsf->_deprecated_function( 'the_seo_framework()->is_front_page()', '2.9.0', 'the_seo_framework()->is_real_front_page() or the_seo_framework()->is_front_page_by_id()' );
705
+
706
+ static $cache = array();
707
+
708
+ if ( null !== $cache = $tsf->get_query_cache( __METHOD__, null, $id ) )
709
+ return $cache;
710
+
711
+ $is_front_page = false;
712
+
713
+ if ( \is_front_page() && empty( $id ) )
714
+ $is_front_page = true;
715
+
716
+ //* Elegant Themes Support. Yay.
717
+ if ( false === $is_front_page && empty( $id ) && $tsf->is_home() ) {
718
+ $sof = \get_option( 'show_on_front' );
719
+
720
+ if ( 'page' !== $sof && 'posts' !== $sof )
721
+ $is_front_page = true;
722
+ }
723
+
724
+ //* Compare against $id
725
+ if ( false === $is_front_page && $id ) {
726
+ $sof = \get_option( 'show_on_front' );
727
+
728
+ if ( 'page' === $sof && (int) \get_option( 'page_on_front' ) === $id )
729
+ $is_front_page = true;
730
+
731
+ if ( 'posts' === $sof && (int) \get_option( 'page_for_posts' ) === $id )
732
+ $is_front_page = true;
733
+ } elseif ( empty( $id ) && $tsf->is_seo_settings_page() ) {
734
+ $is_front_page = true;
735
+ }
736
+
737
+ $tsf->set_query_cache(
738
+ __METHOD__,
739
+ $is_front_page,
740
+ $id
741
+ );
742
+
743
+ return $is_front_page;
744
+ }
745
+
746
+ /**
747
+ * Returns http://schema.org json encoded context URL.
748
+ *
749
+ * @staticvar string $context
750
+ * @since 2.6.0
751
+ * @since 2.9.3 Deprecated.
752
+ * @deprecated
753
+ *
754
+ * @return string The json encoded context url.
755
+ */
756
+ public function schema_context() {
757
+
758
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_context()', '2.9.3' );
759
+
760
+ static $context;
761
+
762
+ if ( isset( $context ) )
763
+ return $context;
764
+
765
+ return $context = json_encode( 'http://schema.org' );
766
+ }
767
+
768
+
769
+ /**
770
+ * Returns 'WebSite' json encoded type name.
771
+ *
772
+ * @staticvar string $context
773
+ * @since 2.6.0
774
+ * @since 2.9.3 Deprecated.
775
+ * @deprecated
776
+ *
777
+ * @return string The json encoded type name.
778
+ */
779
+ public function schema_type() {
780
+
781
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_type()', '2.9.3' );
782
+
783
+ static $type;
784
+
785
+ if ( isset( $type ) )
786
+ return $type;
787
+
788
+ return $type = json_encode( 'WebSite' );
789
+ }
790
+
791
+ /**
792
+ * Returns json encoded home url.
793
+ *
794
+ * @staticvar string $url
795
+ * @since 2.6.0
796
+ * @since 2.9.3 Deprecated.
797
+ * @deprecated
798
+ *
799
+ * @return string The json encoded home url.
800
+ */
801
+ public function schema_home_url() {
802
+
803
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_home_url()', '2.9.3' );
804
+
805
+ static $type;
806
+
807
+ if ( isset( $type ) )
808
+ return $type;
809
+
810
+ return $type = json_encode( \the_seo_framework()->the_home_url_from_cache() );
811
+ }
812
+
813
+ /**
814
+ * Returns json encoded blogname.
815
+ *
816
+ * @staticvar string $name
817
+ * @since 2.6.0
818
+ * @since 2.9.3 Deprecated.
819
+ * @deprecated
820
+ *
821
+ * @return string The json encoded blogname.
822
+ */
823
+ public function schema_blog_name() {
824
+
825
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_blog_name()', '2.9.3' );
826
+
827
+ static $name;
828
+
829
+ if ( isset( $name ) )
830
+ return $name;
831
+
832
+ return $name = json_encode( \the_seo_framework()->get_blogname() );
833
+ }
834
+
835
+ /**
836
+ * Returns 'BreadcrumbList' json encoded type name.
837
+ *
838
+ * @staticvar string $crumblist
839
+ * @since 2.6.0
840
+ * @since 2.9.3 Deprecated.
841
+ * @deprecated
842
+ *
843
+ * @return string The json encoded 'BreadcrumbList'.
844
+ */
845
+ public function schema_breadcrumblist() {
846
+
847
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_breadcrumblist()', '2.9.3' );
848
+
849
+ static $crumblist;
850
+
851
+ if ( isset( $crumblist ) )
852
+ return $crumblist;
853
+
854
+ return $crumblist = json_encode( 'BreadcrumbList' );
855
+ }
856
+
857
+ /**
858
+ * Returns 'ListItem' json encoded type name.
859
+ *
860
+ * @staticvar string $listitem
861
+ * @since 2.6.0
862
+ * @since 2.9.3 Deprecated.
863
+ * @deprecated
864
+ *
865
+ * @return string The json encoded 'ListItem'.
866
+ */
867
+ public function schema_listitem() {
868
+
869
+ \the_seo_framework()->_deprecated_function( 'the_seo_framework()->schema_listitem()', '2.9.3' );
870
+
871
+ static $listitem;
872
+
873
+ if ( isset( $listitem ) )
874
+ return $listitem;
875
+
876
+ return $listitem = json_encode( 'ListItem' );
877
+ }
878
+
879
+ /**
880
+ * Returns 'image' json encoded value.
881
+ *
882
+ * @staticvar array $images
883
+ * @since 2.7.0
884
+ * @since 2.9.0 : 1. No longer uses image from cache, instead: it skips fallback images.
885
+ * 2. Can now fetch home-page as blog set image.
886
+ * @since 2.9.3 Deprecated.
887
+ * @deprecated
888
+ *
889
+ * @param int|string $id The page, post, product or term ID.
890
+ * @param bool $singular Whether the ID is singular.
891
+ */
892
+ public function schema_image( $id = 0, $singular = false ) {
893
+
894
+ $tsf = \the_seo_framework();
895
+
896
+ $tsf->_deprecated_function( 'the_seo_framework()->schema_image()', '2.9.3' );
897
+
898
+ static $images = array();
899
+
900
+ $id = (int) $id;
901
+
902
+ if ( isset( $images[ $id ][ $singular ] ) )
903
+ return $images[ $id ][ $singular ];
904
+
905
+ $image = '';
906
+
907
+ if ( $singular ) {
908
+ if ( $id === $tsf->get_the_front_page_ID() ) {
909
+ if ( $tsf->has_page_on_front() ) {
910
+ $image_args = array(
911
+ 'post_id' => $id,
912
+ 'skip_fallback' => true,
913
+ );
914
+ } else {
915
+ $image_args = array(
916
+ 'post_id' => $id,
917
+ 'skip_fallback' => true,
918
+ 'disallowed' => array(
919
+ 'postmeta',
920
+ 'featured',
921
+ ),
922
+ );
923
+ }
924
+ } else {
925
+ $image_args = array(
926
+ 'post_id' => $id,
927
+ 'skip_fallback' => true,
928
+ 'disallowed' => array(
929
+ 'homemeta'
930
+ ),
931
+ );
932
+ }
933
+ $image = $tsf->get_social_image( $image_args );
934
+ } else {
935
+ //* Placeholder.
936
+ $image = '';
937
+ }
938
+
939
+ /**
940
+ * Applies filters 'the_seo_framework_ld_json_breadcrumb_image' : string
941
+ * @since 2.7.0
942
+ * @param string $image The current image.
943
+ * @param int $id The page, post, product or term ID.
944
+ * @param bool $singular Whether the ID is singular.
945
+ */
946
+ $image = \apply_filters( 'the_seo_framework_ld_json_breadcrumb_image', $image, $id, $singular );
947
+
948
+ return $images[ $id ][ $singular ] = json_encode( \esc_url_raw( $image ) );
949
+ }
950
+
951
+ /**
952
+ * Generate LD+Json search helper.
953
+ *
954
+ * @since 2.2.8
955
+ * @since 2.9.3 Deprecated.
956
+ * @deprecated
957
+ *
958
+ * @return escaped LD+json search helper string.
959
+ */
960
+ public function ld_json_search() {
961
+
962
+ $tsf = \the_seo_framework();
963
+
964
+ $tsf->_deprecated_function( 'the_seo_framework()->ld_json_search()', '2.9.3' );
965
+
966
+ if ( false === $tsf->enable_ld_json_searchbox() )
967
+ return '';
968
+
969
+ $context = $this->schema_context();
970
+ $webtype = $this->schema_type();
971
+ $url = $this->schema_home_url();
972
+ $name = $this->schema_blog_name();
973
+ $actiontype = json_encode( 'SearchAction' );
974
+
975
+ /**
976
+ * Applies filters 'the_seo_framework_ld_json_search_url' : string
977
+ * @since 2.7.0
978
+ * @param string $search_url The default WordPress search URL without query parameters.
979
+ */
980
+ $search_url = (string) \apply_filters( 'the_seo_framework_ld_json_search_url', $tsf->the_home_url_from_cache( true ) . '?s=' );
981
+
982
+ // Remove trailing quote and add it back.
983
+ $target = mb_substr( json_encode( $search_url ), 0, -1 ) . '{search_term_string}"';
984
+
985
+ $queryaction = json_encode( 'required name=search_term_string' );
986
+
987
+ $json = sprintf( '{"@context":%s,"@type":%s,"url":%s,"name":%s,"potentialAction":{"@type":%s,"target":%s,"query-input":%s}}', $context, $webtype, $url, $name, $actiontype, $target, $queryaction );
988
+
989
+ $output = '';
990
+
991
+ if ( $json )
992
+ $output = '<script type="application/ld+json">' . $json . '</script>' . "\r\n";
993
+
994
+ return $output;
995
+ }
996
+
997
+ /**
998
+ * Generate Site Name LD+Json script.
999
+ *
1000
+ * @since 2.6.0
1001
+ * @since 2.9.3 Deprecated.
1002
+ * @deprecated
1003
+ *
1004
+ * @return string The LD+JSon Site Name script.
1005
+ */
1006
+ public function ld_json_name() {
1007
+
1008
+ $tsf = \the_seo_framework();
1009
+
1010
+ $tsf->_deprecated_function( 'the_seo_framework()->ld_json_name()', '2.9.3' );
1011
+
1012
+ $context = $this->schema_context();
1013
+ $webtype = $this->schema_type();
1014
+ $url = $this->schema_home_url();
1015
+ $name = $this->schema_blog_name();
1016
+ $alternate = '';
1017
+
1018
+ $blogname = $tsf->get_blogname();
1019
+ $knowledge_name = $tsf->get_option( 'knowledge_name' );
1020
+
1021
+ if ( $knowledge_name && $knowledge_name !== $blogname ) {
1022
+ $alternate = json_encode( \esc_html( $knowledge_name ) );
1023
+ }
1024
+
1025
+ if ( $alternate ) {
1026
+ $json = sprintf( '{"@context":%s,"@type":%s,"name":%s,"alternateName":%s,"url":%s}', $context, $webtype, $name, $alternate, $url );
1027
+ } else {
1028
+ $json = sprintf( '{"@context":%s,"@type":%s,"name":%s,"url":%s}', $context, $webtype, $name, $url );
1029
+ }
1030
+
1031
+ $output = '';
1032
+ if ( $json )
1033
+ $output = '<script type="application/ld+json">' . $json . '</script>' . "\r\n";
1034
+
1035
+ return $output;
1036
+ }
1037
+
1038
+ /**
1039
+ * Return LD+Json Knowledge Graph helper.
1040
+ *
1041
+ * @since 2.2.8
1042
+ * @since 2.9.2 : Now grabs home URL from cache.
1043
+ * @since 2.9.3 Deprecated.
1044
+ * @deprecated
1045
+ *
1046
+ * @return string LD+json Knowledge Graph helper.
1047
+ */
1048
+ public function ld_json_knowledge() {
1049
+
1050
+ $tsf = \the_seo_framework();
1051
+
1052
+ $tsf->_deprecated_function( 'the_seo_framework()->ld_json_name()', '2.9.3', 'the_seo_framework()->get_ld_json_links()' );
1053
+
1054
+ return $tsf->get_ld_json_links();
1055
+ }
1056
+
1057
+ /**
1058
+ * Generate LD+Json breadcrumb helper.
1059
+ *
1060
+ * @since 2.4.2