WPGlobus – Multilingual Everything! - Version 2.6.3

Version Description

  • (Vendor/Yoast) Fixed issue with empty Open Graph description.
  • (Updater) Missing assets in the ZIP file.
Download this release

Release Info

Developer tivnet
Plugin Icon 128x128 WPGlobus – Multilingual Everything!
Version 2.6.3
Comparing to
See all releases

Code changes from version 2.6.2 to 2.6.3

data/wpglobus-product-info.json CHANGED
@@ -1 +1 @@
1
- {"multilingual-woocommerce-nets-netaxept":{"title":"{:en}Multilingual WooCommerce Nets Netaxept{:}{:ru}\u041c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce Nets Netaxept{:}","_api_new_version":"1.0.3","_api_tested_up_to":"4.9.8"},"wpglobus-menu-visibility":{"title":"WPGlobus Menu Visibility","_api_new_version":"1.2.0","_api_tested_up_to":"4.9.6"},"wpglobus-multi-currency":{"title":"{:en}Multi-Currency for WooCommerce{:}{:ru}WPGlobus - \u041c\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u043b\u044e\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce{:}","_api_new_version":"1.1.1","_api_tested_up_to":"4.9.4"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"2.2.0","_api_tested_up_to":"5.6"},"wpglobus-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"2.1.0","_api_tested_up_to":"5.5"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"2.3.0","_api_tested_up_to":"5.5"},"wpglobus-multilingual-notices":{"title":"{:en}WPGlobus Multilingual Notices{:}{:ru}WPGlobus - \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f{:}","_api_new_version":"2.2.0","_api_tested_up_to":"5.5"},"woocommerce-wpglobus":{"title":"{:en}WPGlobus for WooCommerce{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"4.2.0","_api_tested_up_to":"5.6"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.5.2","_api_tested_up_to":"5.6"},"wpglobus-language-widgets":{"title":"{:en}WPGlobus Language Widgets{:}{:ru}\u042f\u0437\u044b\u043a\u0438 WPGlobus \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432{:}","_api_new_version":"2.0.0","_api_tested_up_to":"5.6.0"}}
1
+ {"multilingual-woocommerce-nets-netaxept":{"title":"{:en}Multilingual WooCommerce Nets Netaxept{:}{:ru}\u041c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce Nets Netaxept{:}","_api_new_version":"1.0.3","_api_tested_up_to":"4.9.8"},"wpglobus-menu-visibility":{"title":"WPGlobus Menu Visibility","_api_new_version":"1.2.0","_api_tested_up_to":"4.9.6"},"wpglobus-multi-currency":{"title":"{:en}Multi-Currency for WooCommerce{:}{:ru}WPGlobus - \u041c\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u043b\u044e\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce{:}","_api_new_version":"1.1.1","_api_tested_up_to":"4.9.4"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"2.2.0","_api_tested_up_to":"5.6"},"wpglobus-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"2.1.0","_api_tested_up_to":"5.5"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"2.3.0","_api_tested_up_to":"5.5"},"wpglobus-multilingual-notices":{"title":"{:en}WPGlobus Multilingual Notices{:}{:ru}WPGlobus - \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f{:}","_api_new_version":"2.2.0","_api_tested_up_to":"5.5"},"woocommerce-wpglobus":{"title":"{:en}WPGlobus for WooCommerce{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"4.2.0","_api_tested_up_to":"5.6"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.5.2","_api_tested_up_to":"5.6"},"wpglobus-language-widgets":{"title":"{:en}WPGlobus Language Widgets{:}{:ru}\u042f\u0437\u044b\u043a\u0438 WPGlobus \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432{:}","_api_new_version":"2.0.0","_api_tested_up_to":"5.6.0"},"wpglobus-for-ultimate-member":{"title":"{:en}WPGlobus for Ultimate Member{:}{:ru}WPGlobus \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Ultimate Member{:}","_api_new_version":"1.1.0","_api_tested_up_to":"5.6"}}
includes/vendor/yoast-seo/class-wpglobus-yoastseo140.php CHANGED
@@ -1,1586 +1,1606 @@
1
- <?php
2
- /**
3
- * File: class-wpglobus-yoastseo140.php
4
- *
5
- * Support of Yoast SEO 14.0
6
- *
7
- * @package WPGlobus\Vendor\YoastSEO
8
- * @since 2.4
9
- * @since 2.5.19 Added support multilingual fields for social tab.
10
- */
11
-
12
- /**
13
- * Class WPGlobus_YoastSEO.
14
- */
15
- class WPGlobus_YoastSEO {
16
-
17
- /**
18
- * Yoast SEO separator.
19
- *
20
- * @var string
21
- */
22
- public static $yoastseo_separator = '';
23
-
24
- /**
25
- * Name of the script.
26
- *
27
- * @var string
28
- */
29
- public static $handle_script = 'wpglobus-yoastseo';
30
-
31
- /**
32
- * Name of the dashboard script.
33
- *
34
- * @since 2.4.5
35
- * @var string
36
- */
37
- public static $handle_script_dashboard = 'wpglobus-yoastseo-dashboard';
38
-
39
- /**
40
- * Name of the premium script.
41
- *
42
- * @since 1.7.2
43
- * @var string
44
- */
45
- public static $handle_script_premium = 'wpglobus-yoastseo-premium';
46
-
47
- /**
48
- * Current version yoast seo.
49
- *
50
- * @since 1.8
51
- * @var string
52
- */
53
- protected static $version = '';
54
-
55
- /**
56
- * Contains wpseo post meta.
57
- *
58
- * @since 2.2.16
59
- * @var null|array
60
- */
61
- protected static $wpseo_meta = null;
62
-
63
- /**
64
- * Contains wpseo taxonomy meta.
65
- *
66
- * @since 2.5.1
67
- * @var null|array
68
- */
69
- protected static $wpseo_taxonomy_meta = null;
70
-
71
- /**
72
- * Contains document title.
73
- *
74
- * @since 2.4.7
75
- * @var null|string
76
- */
77
- protected static $title = null;
78
-
79
- /**
80
- * Plus access.
81
- *
82
- * @since 2.2.20
83
- * @var boolean|string
84
- */
85
- protected static $plus_module = false;
86
-
87
- /**
88
- * Canonical URLs.
89
- *
90
- * @since 2.5.11
91
- * @var array
92
- */
93
- protected static $canonical_url = array();
94
-
95
- /**
96
- * Static "controller"
97
- */
98
- public static function controller($version, $plus_module = false) {
99
-
100
- self::$version = $version;
101
- self::$plus_module = $plus_module;
102
-
103
- if ( is_admin() ) {
104
-
105
- /**
106
- * @since 2.2.20
107
- */
108
- add_action( 'admin_print_scripts', array(
109
- __CLASS__,
110
- 'action__admin_print_scripts'
111
- ) );
112
-
113
- if ( WPGlobus_WP::is_pagenow( 'edit.php' ) ) {
114
-
115
- /**
116
- * To translate Yoast columns on `edit.php` page.
117
- * @since 2.2.16
118
- */
119
- add_filter( 'wpseo_title', array(
120
- __CLASS__,
121
- 'filter__wpseo_title'
122
- ), 5 );
123
-
124
-
125
- add_filter( 'wpseo_metadesc', array(
126
- __CLASS__,
127
- 'filter__wpseo_metadesc'
128
- ), 5 );
129
- }
130
-
131
- } else {
132
-
133
- /**
134
- * Frontend.
135
- */
136
-
137
- /**
138
- * Filter SEO title and meta description on front only, when the page header HTML tags are generated.
139
- * AJAX is probably not required (waiting for a case).
140
- */
141
- // add_filter( 'wpseo_title', array( __CLASS__, 'filter__title' ), PHP_INT_MAX );
142
- /**
143
- * Filter title description.
144
- * @since 2.5.22
145
- */
146
- add_filter( 'wpseo_title', array( __CLASS__, 'filter_front__title' ), PHP_INT_MAX, 2 );
147
-
148
- /**
149
- * Filter meta description.
150
- * @since 2.4
151
- */
152
- add_filter( 'wpseo_metadesc', array( __CLASS__, 'filter_front__description' ), 5, 2 );
153
-
154
- /**
155
- * Open Graph.
156
- * @since 2.4 Open Graph title.
157
- * @since 2.4 Open Graph description.
158
- * @since 2.4 Open Graph URL.
159
- * @since 2.5.19 Open Graph image.
160
- */
161
- add_filter( 'wpseo_opengraph_title', array( __CLASS__, 'filter_front__opengraph_title' ), 5, 2 );
162
- add_filter( 'wpseo_opengraph_desc', array( __CLASS__, 'filter_front__opengraph_description' ), 5, 2 );
163
- add_filter( 'wpseo_opengraph_image', array( __CLASS__, 'filter_front__opengraph_image' ), 5, 2 );
164
- add_filter( 'wpseo_opengraph_url', array( __CLASS__, 'filter_front__localize_url' ), 5, 2 );
165
-
166
- /**
167
- * Twitter.
168
- * @since 2.5.19
169
- */
170
- add_filter( 'wpseo_twitter_title', array( __CLASS__, 'filter_front__twitter_title' ), 5, 2 );
171
- add_filter( 'wpseo_twitter_description', array( __CLASS__, 'filter_front__twitter_description' ), 5, 2 );
172
- add_filter( 'wpseo_twitter_image', array( __CLASS__, 'filter_front__twitter_image' ), 5, 2 );
173
-
174
- /**
175
- * Filter canonical URL and open graph URL.
176
- * @since 2.4
177
- */
178
- add_filter( 'wpseo_canonical', array( __CLASS__, 'filter_front__localize_url' ), 5, 2 );
179
-
180
- /**
181
- * Filter of the rel prev and next URL put out by Yoast SEO.
182
- * @since 2.5.11
183
- */
184
- add_filter( 'wpseo_adjacent_rel_url', array( __CLASS__, 'filter_front__wpseo_adjacent_rel_url' ), 5, 3 );
185
-
186
- /**
187
- * Filter the HTML output of the Yoast SEO breadcrumbs class.
188
- * @since 2.4.2
189
- */
190
- add_filter( 'wpseo_breadcrumb_output', array( __CLASS__, 'filter__breadcrumb_output' ), 5, 2 );
191
-
192
- /**
193
- * @todo check for '_yoast_wpseo_title' meta
194
- * @see <title> view-source:http://test/test-post-seo/
195
- * @see <title> view-source:http://test/ru/test-post-seo/
196
- */
197
- add_filter( 'get_post_metadata', array( __CLASS__, 'filter__get_post_metadata' ), 6, 4 );
198
-
199
- /**
200
- * Filter meta keywords.
201
- * @since 1.8.8
202
- */
203
- add_filter( 'wpseo_metakeywords', array( __CLASS__, 'filter__metakeywords' ), 0 );
204
-
205
- /**
206
- * Filter `wpseo_schema_breadcrumb` generator.
207
- * @since 2.4.7
208
- */
209
- add_filter( 'wpseo_schema_breadcrumb', array( __CLASS__, 'filter__wpseo_schema_breadcrumb' ), 5, 2 );
210
-
211
- /**
212
- * Filter `wpseo_schema_webpage` generator.
213
- * @since 2.4.14
214
- */
215
- add_filter( 'wpseo_schema_webpage', array( __CLASS__, 'filter__wpseo_schema_webpage' ), 5, 2 );
216
- }
217
- }
218
-
219
- /**
220
- * obsolete @since 2.5.22
221
- * Filter Yoast post meta title.
222
- *
223
- * @scope front
224
- * @since 1.9.18
225
- * @since 2.4.7 Handle multilingual title from `postmeta` table.
226
- *
227
- * @param string $title Post title.
228
- *
229
- * @return string.
230
- */
231
- public static function filter__title( $title ) {
232
-
233
- /**
234
- * In some cases we can get $title like {:en}En title{:}{:ru}Ru title{:}{:fr}Fr title{:} - SiteTitle
235
- * so, let's filter.
236
- */
237
- if ( WPGlobus_Core::has_translations($title) ) {
238
-
239
- if ( is_null( self::$title ) ) {
240
- self::$title = $title;
241
- }
242
- return WPGlobus_Core::extract_text( self::$title, WPGlobus::Config()->language );
243
- }
244
-
245
- /**
246
- * We can get title in last saved language (has no multilingual) from @see `wp_yoast_indexable` table.
247
- * So, we need get multilingual title from `postmeta` table.
248
- * @since 2.4.7
249
- */
250
- if ( ! is_null( self::$title ) ) {
251
- return WPGlobus_Core::extract_text( self::$title, WPGlobus::Config()->language );
252
- }
253
-
254
- /** @global wpdb $wpdb */
255
- global $wpdb;
256
-
257
- /** @global WP_Post $post */
258
- global $post;
259
-
260
- /**
261
- * @since 2.4.14 Fixed PHP Notice: Trying to get property 'ID' of non-object.
262
- */
263
- if ( $post instanceof WP_Post && (int) $post->ID > 0 ) {
264
- $query = $wpdb->prepare(
265
- "SELECT meta_value FROM {$wpdb->prefix}postmeta AS m WHERE m.post_id = %s AND m.meta_key = %s",
266
- $post->ID,
267
- '_yoast_wpseo_title'
268
- );
269
-
270
- $meta = $wpdb->get_var($query);
271
- if ( ! empty($meta) && false != mb_strpos($meta, $title) && WPGlobus_Core::has_translations($meta) ) {
272
- self::$title = $meta;
273
- return WPGlobus_Core::extract_text( self::$title, WPGlobus::Config()->language );
274
- }
275
- }
276
-
277
- return $title;
278
- }
279
-
280
- /**
281
- * Filter for changing the Yoast SEO generated Open Graph description.
282
- *
283
- * @see wordpress-seo\src\presenters\open-graph\description-presenter.php
284
- *
285
- * @since 2.5.19
286
- *
287
- * @scope front
288
- * @param string $description The description.
289
- * @param Indexable_Presentation $presentation The presentation of an indexable.
290
- *
291
- * @return string
292
- */
293
- public static function filter_front__opengraph_description( $description, $presentation ) {
294
-
295
- if ( empty( $description ) ) {
296
- return $description;
297
- }
298
-
299
- if ( 'post' == $presentation->model->object_type ) {
300
-
301
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
302
-
303
- if ( ! empty( $meta_cache['_yoast_wpseo_opengraph-description'][0] ) ) {
304
-
305
- $description = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_opengraph-description'][0], WPGlobus::Config()->language );
306
-
307
- if ( $presentation->source instanceof WP_Post ) {
308
- /**
309
- * @see wordpress-seo\inc\wpseo-functions.php
310
- */
311
- $description = wpseo_replace_vars( $description, $presentation->source );
312
- }
313
- }
314
-
315
- } elseif ( 'term' == $presentation->model->object_type ) {
316
-
317
- /**
318
- * Taxonomy.
319
- */
320
- $__desc = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_desc' );
321
-
322
- if ( empty( $__desc ) ) {
323
-
324
- $__template = self::get_option( 'wpseo_titles', 'metadesc-tax-' . $presentation->model->object_sub_type );
325
-
326
- if ( ! empty( $__template ) ) {
327
- $__desc = $__template;
328
- } else {
329
- // @W.I.P if empty `Meta description` from Yoast, then we need output `Description` from Edit taxonomy page.
330
- $__desc = $presentation->source->description;
331
- }
332
-
333
- }
334
-
335
- $description = wpseo_replace_vars( $__desc, $presentation->source );
336
- }
337
-
338
- return $description;
339
- }
340
-
341
- /**
342
- * Filter for changing the Open Graph image.
343
- *
344
- * @see wordpress-seo\src\presenters\open-graph\image-presenter.php
345
- *
346
- * @since 2.5.19
347
- *
348
- * @scope front
349
- * @param string $image_url The URL of the Open Graph image.
350
- * @param Indexable_Presentation $presentation The presentation of an indexable.
351
- *
352
- * @return string
353
- */
354
- public static function filter_front__opengraph_image( $image_url, $presentation ) {
355
-
356
- if ( empty( $image_url) ) {
357
- return $image_url;
358
- }
359
-
360
- if ( 'post' == $presentation->model->object_type ) {
361
-
362
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
363
-
364
- if ( ! empty( $meta_cache['_yoast_wpseo_opengraph-image'][0] ) ) {
365
-
366
- $image_url = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_opengraph-image'][0], WPGlobus::Config()->language );
367
-
368
- if ( $presentation->source instanceof WP_Post ) {
369
- /**
370
- * @see wordpress-seo\inc\wpseo-functions.php
371
- */
372
- $image_url = wpseo_replace_vars( $image_url, $presentation->source );
373
- }
374
- }
375
- }
376
-
377
- return $image_url;
378
- }
379
-
380
- /**
381
- * Filter for changing the Twitter title.
382
- *
383
- * @see wordpress-seo\src\presenters\twitter\title-presenter.php
384
- *
385
- * @since 2.5.19
386
- *
387
- * @scope front
388
- * @param string $title The Twitter title.
389
- * @param Indexable_Presentation $presentation The presentation of an indexable.
390
- *
391
- * @return string
392
- */
393
- public static function filter_front__twitter_title( $title, $presentation ) {
394
-
395
- if ( empty( $title ) ) {
396
- return $title;
397
- }
398
-
399
- if ( 'post' == $presentation->model->object_type ) {
400
-
401
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
402
-
403
- if ( ! empty( $meta_cache['_yoast_wpseo_twitter-title'][0] ) ) {
404
-
405
- $title = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_twitter-title'][0], WPGlobus::Config()->language );
406
-
407
- if ( $presentation->source instanceof WP_Post ) {
408
- /**
409
- * @see wordpress-seo\inc\wpseo-functions.php
410
- */
411
- $title = wpseo_replace_vars( $title, $presentation->source );
412
- }
413
- }
414
- }
415
-
416
- return $title;
417
- }
418
-
419
- /**
420
- * Filter for changing the Twitter description as output in the Twitter card by Yoast SEO.
421
- *
422
- * @see wordpress-seo\src\presenters\twitter\description-presenter.php
423
- *
424
- * @since 2.5.19
425
- *
426
- * @scope front
427
- * @param string $description The description string.
428
- * @param Indexable_Presentation $presentation The presentation of an indexable.
429
- *
430
- * @return string
431
- */
432
- public static function filter_front__twitter_description( $description, $presentation ) {
433
-
434
- if ( empty( $description ) ) {
435
- return $description;
436
- }
437
-
438
- if ( 'post' == $presentation->model->object_type ) {
439
-
440
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
441
-
442
- if ( ! empty( $meta_cache['_yoast_wpseo_twitter-description'][0] ) ) {
443
-
444
- $description = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_twitter-description'][0], WPGlobus::Config()->language );
445
-
446
- if ( $presentation->source instanceof WP_Post ) {
447
- /**
448
- * @see wordpress-seo\inc\wpseo-functions.php
449
- */
450
- $description = wpseo_replace_vars( $description, $presentation->source );
451
- }
452
- }
453
- }
454
-
455
- return $description;
456
- }
457
-
458
- /**
459
- * Filter for changing the Twitter Card image.
460
- *
461
- * @see wordpress-seo\src\presenters\twitter\image-presenter.php
462
- *
463
- * @since 2.5.19
464
- *
465
- * @scope front
466
- * @param string $image Image URL string.
467
- * @param Indexable_Presentation $presentation The presentation of an indexable.
468
- *
469
- * @return string
470
- */
471
- public static function filter_front__twitter_image( $image, $presentation ) {
472
-
473
- if ( empty( $image ) ) {
474
- return $image;
475
- }
476
-
477
- if ( 'post' == $presentation->model->object_type ) {
478
-
479
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
480
-
481
- if ( ! empty( $meta_cache['_yoast_wpseo_twitter-image'][0] ) ) {
482
-
483
- $image = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_twitter-image'][0], WPGlobus::Config()->language );
484
-
485
- if ( $presentation->source instanceof WP_Post ) {
486
- /**
487
- * @see wordpress-seo\inc\wpseo-functions.php
488
- */
489
- $image = wpseo_replace_vars( $image, $presentation->source );
490
- }
491
- }
492
- }
493
-
494
- return $image;
495
- }
496
-
497
- /**
498
- * Filter for changing the Yoast SEO generated title.
499
- *
500
- * @see wordpress-seo\src\presenters\open-graph\title-presenter.php
501
- *
502
- * @since 2.5.19
503
- *
504
- * @scope front
505
- * @param string $title The title.
506
- * @param Indexable_Presentation $presentation The presentation of an indexable.
507
- *
508
- * @return string
509
- */
510
- public static function filter_front__opengraph_title( $title, $presentation ) {
511
-
512
- if ( empty( $title ) ) {
513
- return $title;
514
- }
515
-
516
- if ( 'post' == $presentation->model->object_type ) {
517
-
518
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
519
-
520
- if ( ! empty( $meta_cache['_yoast_wpseo_opengraph-title'][0] ) ) {
521
-
522
- $title = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_opengraph-title'][0], WPGlobus::Config()->language );
523
-
524
- if ( $presentation->source instanceof WP_Post ) {
525
- /**
526
- * @see wordpress-seo\inc\wpseo-functions.php
527
- */
528
- $title = wpseo_replace_vars( $title, $presentation->source );
529
- }
530
-
531
- } else {
532
-
533
- /**
534
- * @since 2.5.23
535
- */
536
- if ( WPGlobus_Core::has_translations( $title ) ) {
537
- $title = WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
538
- }
539
-
540
- }
541
-
542
- } elseif ( 'term' == $presentation->model->object_type ) {
543
-
544
- /**
545
- * Taxonomy.
546
- */
547
- $__title = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_title' );
548
-
549
- if ( empty( $__title ) ) {
550
- $__title = self::get_option( 'wpseo_titles', 'title-tax-' . $presentation->model->object_sub_type );
551
- }
552
-
553
- $title = wpseo_replace_vars( $__title, $presentation->source );
554
- }
555
-
556
- return $title;
557
- }
558
-
559
- /**
560
- * Filter post meta.
561
- *
562
- * @since 1.9.21
563
- * @since 2.1.3
564
- * @see function function get_value() in wordpress-seo\inc\class-wpseo-meta.php
565
- */
566
- public static function filter__get_post_metadata( $check, $object_id, $meta_key, $single ) {
567
-
568
- global $post;
569
-
570
- if ( $single ) {
571
- return $check;
572
- }
573
-
574
- if ( ! is_object($post) ) {
575
- return $check;
576
- }
577
-
578
- if ( $object_id != $post->ID ) {
579
- return $check;
580
- }
581
-
582
- /**
583
- * May be called many times on one page. Let's cache.
584
- */
585
- static $_done = null;
586
- if ( ! is_null($_done) ) {
587
- return $check;
588
- }
589
-
590
- $meta_type = 'post';
591
-
592
- $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
593
-
594
- if ( ! empty($meta_cache['_yoast_wpseo_title'][0]) ) {
595
- $meta_cache['_yoast_wpseo_title'][0] = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_title'][0], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
596
- wp_cache_replace( $object_id, $meta_cache, $meta_type . '_meta' );
597
- }
598
-
599
- /**
600
- * @since 2.2.33
601
- */
602
- if ( ! empty($meta_cache['_yoast_wpseo_focuskw'][0]) ) {
603
- $meta_cache['_yoast_wpseo_focuskw'][0] = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_focuskw'][0], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
604
- wp_cache_replace( $object_id, $meta_cache, $meta_type . '_meta' );
605
- }
606
-
607
- $_done = true;
608
-
609
- return $check;
610
- }
611
-
612
- /**
613
- * Filter Yoast post meta keywords.
614
- *
615
- * @scope front
616
- * @since 1.8.8
617
- *
618
- * @param string $keywords Multilingual keywords.
619
- *
620
- * @return string.
621
- */
622
- public static function filter__metakeywords( $keywords ) {
623
- if ( WPGlobus::Config()->language != WPGlobus::Config()->default_language ) {
624
- return '';
625
- }
626
- return WPGlobus_Core::text_filter($keywords, WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY);
627
- }
628
-
629
- /**
630
- * Filter wpseo meta description.
631
- *
632
- * @see wordpress-seo\src\presenters\meta-description-presenter.php
633
- * @see wordpress-seo\src\presenters\open-graph\description-presenter.php
634
- *
635
- * @since 2.4
636
- * @since 2.5.1 Added support of taxonomies.
637
- *
638
- * @scope front
639
- *
640
- * @param string $meta_description Value from @see `description` field in `wp_yoast_indexable` table.
641
- * @param Indexable_Presentation $presentation The presentation of an indexable.
642
- *
643
- * @return string
644
- */
645
- public static function filter_front__description( $meta_description, $presentation ) {
646
-
647
- /**
648
- * $meta_description is received from `description` field in `wp_yoast_indexable` table.
649
- */
650
-
651
- /**
652
- * Init description.
653
- */
654
- $description = '';
655
-
656
- /**
657
- * Key to define that `wpseo_metadesc` filter was already fired earlier.
658
- */
659
- static $meta_description_presenter_was_fired = false;
660
-
661
- if ( 'post' == $presentation->model->object_type ) {
662
-
663
- /**
664
- * Post.
665
- */
666
- if ( $meta_description_presenter_was_fired ) {
667
- /**
668
- * Set meta description to empty value for `wpseo_opengraph_desc` filter like for empty $meta_description in `wpseo_metadesc` filter.
669
- */
670
- $meta_description = '';
671
- } else {
672
- if ( empty($meta_description) ) {
673
- $meta_description_presenter_was_fired = true;
674
- }
675
- }
676
-
677
- $description = self::get_meta( '_yoast_wpseo_metadesc', $meta_description );
678
-
679
- } elseif ( 'term' == $presentation->model->object_type ) {
680
-
681
- /**
682
- * Taxonomy.
683
- * @since 2.5.1
684
- */
685
- if ( $meta_description_presenter_was_fired ) {
686
-
687
- /**
688
- * This is `wpseo_opengraph_desc` filter with empty yoast description.
689
- * @todo maybe need to use cache for term object.
690
- */
691
- $term = get_term( $presentation->model->object_id );
692
- if ( $term instanceof WP_Term ) {
693
- $description = $term->description;
694
- } else {
695
- $description = '';
696
- }
697
-
698
- } else {
699
-
700
- /**
701
- * @since 2.5.22
702
- */
703
- $description = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_desc' );
704
-
705
- if ( empty($description) ) {
706
- $meta_description_presenter_was_fired = true;
707
- } else {
708
- $description = wpseo_replace_vars( $description, $presentation->source );
709
- }
710
- }
711
- }
712
-
713
- return $description;
714
- }
715
-
716
- /**
717
- * Filter canonical URL and open graph URL put out by Yoast SEO.
718
- *
719
- * @see wordpress-seo\src\presenters\canonical-presenter.php
720
- * @see wordpress-seo\src\presenters\open-graph\url-presenter.php
721
- * @scope front
722
- * @since 2.4
723
- * @since 2.5.1 Added support of taxonomies.
724
- * @since 2.5.10 Added `wpglobus_wpseo_localize_url` filter.
725
- *
726
- * @param string $url The canonical URL or open graph URL.
727
- * @param Indexable_Presentation $presentation The presentation of an indexable.
728
- *
729
- * @return string
730
- */
731
- public static function filter_front__localize_url( $url, $presentation ) {
732
- /**
733
- * URL is received from `permalink` field in `wp_yoast_indexable` table.
734
- */
735
- if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
736
- return $url;
737
- }
738
-
739
- $tag = false;
740
- if ( is_singular() ) {
741
- $tag = 'singular';
742
- } elseif ( is_category() ) {
743
- $tag = 'category';
744
- } elseif ( is_tag() ) {
745
- $tag = 'tag';
746
- } elseif ( is_tax() ) {
747
- $tag = 'tax';
748
- }
749
-
750
- if ( $tag ) {
751
-
752
- $language =WPGlobus::Config()->language;
753
-
754
- self::$canonical_url[ WPGlobus::Config()->default_language ] = $url;
755
-
756
- /**
757
- * Filters for a localized url.
758
- *
759
- * @since 2.5.10
760
- *
761
- * @param string $url Localized URL.
762
- * @param string $language Current language.
763
- * @param string $tag Conditional Tag.
764
- */
765
- self::$canonical_url[ $language ] = apply_filters( 'wpglobus_wpseo_localize_url', WPGlobus_Utils::localize_url( $url, $language ), $language, $tag );
766
-
767
- self::$canonical_url[ $language ] = urldecode( self::$canonical_url[ $language ] );
768
-
769
- return self::$canonical_url[ $language ];
770
- }
771
-
772
- return $url;
773
- }
774
-
775
- /**
776
- * Filtering of the rel `prev` and `next` URL put out by Yoast SEO.
777
- *
778
- * @see wordpress-seo\src\presenters\rel-prev-presenter.php
779
- * @see wordpress-seo\src\presenters\rel-next-presenter.php
780
- * @scope front
781
- *
782
- * @since 2.5.11
783
- *
784
- * @param string $url Link relationship, prev or next.
785
- * @param string $relationship `prev` or `next`.
786
- * @param Indexable_Presentation $presentation The presentation of an indexable.
787
- *
788
- * @return string
789
- */
790
- public static function filter_front__wpseo_adjacent_rel_url( $link, $relationship, $presentation ) {
791
-
792
- if ( empty( $link ) || WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
793
- return $link;
794
- }
795
-
796
- if ( empty( self::$canonical_url ) ) {
797
- return $link;
798
- }
799
-
800
- return str_replace(
801
- self::$canonical_url[ WPGlobus::Config()->default_language ],
802
- self::$canonical_url[ WPGlobus::Config()->language ],
803
- $link
804
- );
805
- }
806
-
807
- /**
808
- * Filter the HTML output of the Yoast SEO breadcrumbs class.
809
- *
810
- * @see wordpress-seo\src\presenters\breadcrumbs-presenter.php
811
- * @scope front
812
- * @since 2.4.2
813
- *
814
- * @param $output The HTML output
815
- * @param Indexable_Presentation $presentation The presentation of an indexable.
816
- *
817
- * @api string $output The HTML output.
818
- *
819
- * @return string
820
- */
821
- public static function filter__breadcrumb_output( $output, $presentation ) {
822
-
823
- /** @global wpdb $wpdb */
824
- global $wpdb;
825
-
826
- $object_type = null;
827
- $object_sub_type = null;
828
- $object_order = null;
829
-
830
- if ( $presentation->source instanceof WP_Post ) {
831
-
832
- $object_type = 'post';
833
- $object_sub_type = $presentation->source->post_type;
834
-
835
- } elseif ( $presentation->source instanceof WP_Term ) {
836
-
837
- $object_type = 'taxonomy';
838
- $object_sub_type = $presentation->source->taxonomy;
839
-
840
- if ( $presentation->source->parent == 0 ) {
841
- $object_order = array($presentation->source->term_id);
842
- } else {
843
- $object_order = get_ancestors($presentation->source->term_id, $object_sub_type);
844
- if ( count($object_order) > 1 ) {
845
- $object_order = array_reverse( $object_order );
846
- }
847
- $object_order[] = $presentation->source->term_id;
848
- }
849
-
850
- }
851
-
852
- $ids = array();
853
- $breadcrumbs = array();
854
- $i = 0;
855
-
856
- foreach( $presentation->breadcrumbs as $order=>$piece ) {
857
-
858
- if ( $order == 0 ) {
859
-
860
- $_piece = '/' . preg_quote($piece['url'], '/') . '/';
861
-
862
- if ( empty( $piece['id'] ) ) {
863
- /**
864
- * If homepage displays as latest posts, then we should force the setting of `Home` for all languages.
865
- */
866
- $output = preg_replace( $_piece, home_url('/'), $output, 1 );
867
- } else {
868
- $output = preg_replace( $_piece, home_url('/'), $output, 1 );
869
- }
870
-
871
- if ( WPGlobus_Core::has_translations($piece['text']) ) {
872
- $_home_text = WPGlobus_Core::text_filter( $piece['text'], WPGlobus::Config()->language, WPGlobus::RETURN_IN_DEFAULT_LANGUAGE );
873
- $output = str_replace( $piece['text'], $_home_text, $output );
874
- }
875
-
876
- } else {
877
-
878
- switch ($object_type) :
879
- case 'post' :
880
- if ( ! empty($piece['id']) ) {
881
- $ids[] = $piece['id'];
882
- $breadcrumbs[ $piece['id'] ] = $piece;
883
- $breadcrumbs[ $piece['id'] ]['object_type'] = $object_type;
884
- $breadcrumbs[ $piece['id'] ]['object_sub_type'] = $object_sub_type;
885
- }
886
- break;
887
- case 'taxonomy' :
888
- $_id = $order;
889
- if ( ! is_null( $object_order ) ) {
890
- $_id = $object_order[$i];
891
- $ids[] = $_id;
892
- }
893
- $breadcrumbs[ $_id ] = $piece;
894
- $breadcrumbs[ $_id ]['object_type'] = $object_type;
895
- $breadcrumbs[ $_id ]['object_sub_type'] = $object_sub_type;
896
- $i++;
897
- break;
898
- endswitch;
899
- }
900
- }
901
-
902
- $query = null;
903
-
904
- if ( ! empty($ids) ) {
905
-
906
- $_ids = implode( ',', $ids );
907
- switch ($object_type) :
908
- case 'post' :
909
- $select = $wpdb->prepare( "SELECT ID, post_title AS ml_title, post_name, post_type FROM $wpdb->posts WHERE ID IN ( %s )", $_ids );
910
- $select = str_replace( "'", '', $select );
911
- break;
912
- case 'taxonomy' :
913
- $select = $wpdb->prepare( "SELECT term_id, name AS ml_title, slug FROM $wpdb->terms WHERE term_id IN ( %s )", $_ids );
914
- $select = str_replace( "'", '', $select );
915
- break;
916
- endswitch;
917
-
918
- $query = $wpdb->get_results( $select, OBJECT_K );
919
-
920
- foreach( $breadcrumbs as $id=>$piece ) {
921
-
922
- $output = str_replace(
923
- array(
924
- $piece['url'],
925
- $piece['text']
926
- ),
927
- array(
928
- WPGlobus_Utils::localize_url( $piece['url'], WPGlobus::Config()->language ),
929
- WPGlobus_Core::text_filter( $query[$id]->ml_title, WPGlobus::Config()->language )
930
- ),
931
- $output
932
- );
933
- }
934
- }
935
-
936
- /**
937
- * @since 2.4.2 @W.I.P
938
- */
939
- //$output = apply_filters( 'wpglobus_wpseo_breadcrumb_output', $output, $breadcrumbs, $query );
940
-
941
- return $output;
942
- }
943
-
944
- /**
945
- * Filter wpseo meta description.
946
- *
947
- * @see wordpress-seo\admin\class-meta-columns.php
948
- * @scope admin
949
- * @since 2.2.16
950
- *
951
- * @param string $metadesc_val Value in default language.
952
- *
953
- * @return string
954
- */
955
- public static function filter__wpseo_metadesc( $metadesc_val ) {
956
-
957
- if ( empty($metadesc_val) ) {
958
- return $metadesc_val;
959
- }
960
-
961
- if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
962
- return $metadesc_val;
963
- }
964
-
965
- return self::get_meta( '_yoast_wpseo_metadesc', $metadesc_val );
966
- }
967
-
968
- /**
969
- * To translate Yoast `column-wpseo-title`.
970
- *
971
- * @see wordpress-seo\admin\class-meta-columns.php
972
- * @scope admin
973
- * @since 2.2.16
974
- *
975
- * @param string $title
976
- *
977
- * @return string
978
- */
979
- public static function filter__wpseo_title( $title ) {
980
- return WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
981
- }
982
-
983
- /**
984
- * Get meta for extra language.
985
- *
986
- * @scope admin
987
- * @since 2.2.16
988
- */
989
- protected static function get_meta( $meta_key, $meta_value = '' ) {
990
-
991
- if ( is_null(self::$wpseo_meta) ) {
992
- self::get_wpseo_meta();
993
- }
994
-
995
- if ( empty( self::$wpseo_meta[ $meta_key ] ) ) {
996
- return '';
997
- }
998
-
999
- /** @global WP_Post $post */
1000
- global $post;
1001
-
1002
- if ( empty( $meta_value ) ) {
1003
-
1004
- /**
1005
- * Try get meta by post ID.
1006
- */
1007
- if ( ! $post instanceof WP_Post ) {
1008
- return '';
1009
- }
1010
- if ( empty( self::$wpseo_meta[$meta_key][$post->ID] ) ) {
1011
- return '';
1012
- }
1013
-
1014
- return WPGlobus_Core::text_filter( self::$wpseo_meta[$meta_key][$post->ID], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
1015
- }
1016
-
1017
- $_return_value = '';
1018
- foreach( self::$wpseo_meta[ $meta_key ] as $_meta_value ) {
1019
- if ( false !== strpos( $_meta_value, $meta_value ) ) {
1020
- $_return_value = WPGlobus_Core::text_filter( $_meta_value, WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
1021
- break;
1022
- }
1023
- }
1024
-
1025
- return $_return_value;
1026
- }
1027
-
1028
- /**
1029
- * Get `_yoast_wpseo_metadesc`, `_yoast_wpseo_focuskw` meta.
1030
- *
1031
- * @scope both
1032
- * @since 2.4
1033
- * @since 2.4.6 Separate the defining of post type for frontend and admin.
1034
- * @since 2.4.14 Revised code.
1035
- */
1036
- protected static function get_wpseo_meta() {
1037
-
1038
- /** @global wpdb $wpdb */
1039
- global $wpdb;
1040
-
1041
- /** @global WP_Post $post */
1042
- global $post;
1043
-
1044
- $post_id = false;
1045
-
1046
- if ( is_admin() ) {
1047
-
1048
- /**
1049
- * Admin.
1050
- */
1051
- if ( ! empty( $_GET['post'] ) ) {
1052
- $post_id = sanitize_text_field( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
1053
- }
1054
-
1055
- } else {
1056
-
1057
- if ( $post instanceof WP_Post ) {
1058
-
1059
- /**
1060
- * Front-end.
1061
- */
1062
- $post_id = $post->ID;
1063
-
1064
- }
1065
- }
1066
-
1067
- if ( $post_id ) {
1068
-
1069
- $query = $wpdb->prepare(
1070
- "SELECT p.ID, p.post_type, pm.meta_key, pm.meta_value FROM {$wpdb->prefix}posts AS p JOIN {$wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id WHERE p.ID = %s AND (pm.meta_key = %s OR pm.meta_key = %s)",
1071
- $post_id,
1072
- '_yoast_wpseo_metadesc',
1073
- '_yoast_wpseo_focuskw'
1074
- );
1075
-
1076
- $metas = $wpdb->get_results( $query, ARRAY_A );
1077
-
1078
- if ( ! empty( $metas ) ) {
1079
- foreach( $metas as $_meta ) {
1080
- if ( ! isset( self::$wpseo_meta[ $_meta['meta_key'] ] ) ) {
1081
- self::$wpseo_meta[ $_meta['meta_key'] ] = array();
1082
- }
1083
- self::$wpseo_meta[ $_meta['meta_key'] ][ $_meta['ID'] ] = $_meta['meta_value'];
1084
- }
1085
- }
1086
- } else {
1087
- // Here we can add code to get meta for multiple posts.
1088
- }
1089
- }
1090
-
1091
- /**
1092
- * Get taxonomy meta from `wpseo_taxonomy_meta` option.
1093
- *
1094
- * @since 2.5.1
1095
- * @since 2.5.22 Added $meta_key parameter to the `get_taxonomy_meta` function.
1096
- * @scope front
1097
- *
1098
- * @param string $object_sub_type The Indexable Object sub type.
1099
- * @param string $object_id The object ID.
1100
- * @param Indexable_Presentation $meta_key The WPSEO meta key.
1101
- *
1102
- * return string | array
1103
- */
1104
- protected static function get_taxonomy_meta( $object_sub_type, $object_id, $meta_key = '' ) {
1105
-
1106
- if ( is_null( self::$wpseo_taxonomy_meta ) ) {
1107
- self::$wpseo_taxonomy_meta = get_option( 'wpseo_taxonomy_meta' );
1108
- }
1109
-
1110
- if ( empty( self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ] ) ) {
1111
- return '';
1112
- }
1113
-
1114
- if ( empty( $meta_key ) ) {
1115
- return self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ];
1116
- }
1117
-
1118
- if ( empty( self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ][ $meta_key ] ) ) {
1119
- return '';
1120
- }
1121
-
1122
- $meta_value = WPGlobus_Core::text_filter(
1123
- self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ][ $meta_key ],
1124
- WPGlobus::Config()->language,
1125
- WPGlobus::RETURN_EMPTY
1126
- );
1127
-
1128
- return $meta_value;
1129
- }
1130
-
1131
- /**
1132
- * Enqueue JS for YoastSEO support.
1133
- *
1134
- * @since 1.4.0
1135
- * @since 2.2.20
1136
- * @since 2.4.5 Add JS script on dashboard.
1137
- */
1138
- public static function action__admin_print_scripts() {
1139
-
1140
- if ( WPGlobus_WP::is_pagenow( 'admin.php' ) ) {
1141
-
1142
- if ( 'wpseo_tools' == WPGlobus_Utils::safe_get('page') && 'bulk-editor' == WPGlobus_Utils::safe_get('tool') ) {
1143
-
1144
- $wrng1 = '<div>' . esc_html__( 'Bulk editing of the multilingual titles and descriptions is not supported by the current version.', 'wpglobus' ) . '</div>';
1145
- $wrng2 = '<div>' . esc_html__( 'Therefore, to avoid any data loss, we do not recommend using this.', 'wpglobus' ) . '</div>';
1146
-
1147
- $i18n = array(
1148
- 'preWarning' => esc_html__( 'WPGlobus warning: ', 'wpglobus' ),
1149
- 'bulkEditorWarning' => $wrng1 . $wrng2,
1150
- );
1151
-
1152
- $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-yoastseo-dashboard' . WPGlobus::SCRIPT_SUFFIX() . '.js';
1153
-
1154
- wp_register_script(
1155
- self::$handle_script_dashboard,
1156
- $src,
1157
- array( 'jquery' ),
1158
- WPGLOBUS_VERSION,
1159
- true
1160
- );
1161
-
1162
- wp_enqueue_script(self::$handle_script_dashboard);
1163
-
1164
- wp_localize_script(
1165
- self::$handle_script_dashboard,
1166
- 'WPGlobusYoastSeoDashboard',
1167
- array(
1168
- 'version' => WPGLOBUS_VERSION,
1169
- 'wpseo_version' => WPSEO_VERSION,
1170
- 'pagenow' => 'admin.php',
1171
- 'page' => WPGlobus_Utils::safe_get('page'),
1172
- 'tool' => WPGlobus_Utils::safe_get('tool'),
1173
- 'i18n' => $i18n
1174
- )
1175
- );
1176
-
1177
- return;
1178
- }
1179
- }
1180
-
1181
- if ( 'off' === WPGlobus::Config()->toggle ) {
1182
- return;
1183
- }
1184
-
1185
- if ( self::disabled_entity() ) {
1186
- return;
1187
- }
1188
-
1189
- /** @global string $pagenow */
1190
- global $pagenow;
1191
-
1192
- $enabled_pages = array(
1193
- 'post.php',
1194
- 'post-new.php',
1195
- 'edit-tags.php',
1196
- 'term.php'
1197
- );
1198
-
1199
- if ( WPGlobus_WP::is_pagenow( $enabled_pages ) ) {
1200
-
1201
- WPGlobus::O()->vendors_scripts['WPSEO'] = true;
1202
-
1203
- if ( defined( 'WPSEO_PREMIUM_PLUGIN_FILE' ) ) {
1204
- /**
1205
- * @see wordpress-seo-premium\wp-seo-premium.php
1206
- */
1207
- WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] = true;
1208
- }
1209
-
1210
- $yoastseo_plus_readability_access = '';
1211
- $yoastseo_plus_readability_inactive = '';
1212
-
1213
- $yoastseo_plus_page_analysis_access = '';
1214
- $yoastseo_plus_page_analysis_inactive = '';
1215
-
1216
- $yoastseo_plus_meta_keywords_access = '';
1217
- $yoastseo_plus_meta_keywords_inactive = '';
1218
-
1219
- $yoastseo_plus_social_access = '';
1220
- $yoastseo_plus_social_inactive = '';
1221
-
1222
- if ( WPGlobus::Config()->builder->is_builder_page() ) {
1223
-
1224
- $_url = '#';
1225
- if ( class_exists('WPGlobusPlus') ) {
1226
- /**
1227
- * @see wpglobus-plus\includes\wpglobus-plus-main.php
1228
- */
1229
- $_url = add_query_arg(
1230
- array(
1231
- 'page' => 'wpglobus-plus-options'
1232
- ),
1233
- admin_url('admin.php')
1234
- );
1235
- }
1236
-
1237
- $yoastseo_plus_readability_access = sprintf(
1238
- esc_html__( 'Please see %1s to get access to Analysis results in %2s with YoastSEO.', '' ),
1239
- '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1240
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1241
- );
1242
- $yoastseo_plus_readability_inactive = sprintf(
1243
- esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Analysis results in %3s with YoastSEO.', '' ),
1244
- '<a href="'.$_url.'">',
1245
- '</a>',
1246
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1247
- );
1248
-
1249
- $yoastseo_plus_page_analysis_access = sprintf(
1250
- esc_html__( 'Please see %1s to get access to Analysis results in %2s with YoastSEO.', '' ),
1251
- '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1252
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1253
- );
1254
- $yoastseo_plus_page_analysis_inactive = sprintf(
1255
- esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Analysis results in %3s with YoastSEO.', '' ),
1256
- '<a href="'.$_url.'">',
1257
- '</a>',
1258
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1259
- );
1260
-
1261
- $yoastseo_plus_meta_keywords_access = sprintf(
1262
- esc_html__( 'Please see %1s to get access to Focus keyphrase in %2s with YoastSEO.', '' ),
1263
- '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1264
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1265
- );
1266
- $yoastseo_plus_meta_keywords_inactive = sprintf(
1267
- esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Focus keyphrase in %1s with YoastSEO.', '' ),
1268
- '<a href="'.$_url.'">',
1269
- '</a>',
1270
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1271
- );
1272
-
1273
- $yoastseo_plus_social_access = sprintf(
1274
- esc_html__( 'Please see %1s to get access to Social Tab content in %2s with YoastSEO.', '' ),
1275
- '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1276
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1277
- );
1278
- $yoastseo_plus_social_inactive = sprintf(
1279
- esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Social Tab content in %1s with YoastSEO.', '' ),
1280
- '<a href="'.$_url.'">',
1281
- '</a>',
1282
- WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1283
- );
1284
- }
1285
-
1286
- $i18n = array(
1287
- 'yoastseo_plus_readability_access' => $yoastseo_plus_readability_access,
1288
- 'yoastseo_plus_readability_inactive' => $yoastseo_plus_readability_inactive,
1289
- 'yoastseo_plus_page_analysis_access' => $yoastseo_plus_page_analysis_access,
1290
- 'yoastseo_plus_page_analysis_inactive' => $yoastseo_plus_page_analysis_inactive,
1291
- 'yoastseo_plus_meta_keywords_access' => $yoastseo_plus_meta_keywords_access,
1292
- 'yoastseo_plus_meta_keywords_inactive' => $yoastseo_plus_meta_keywords_inactive,
1293
- 'yoastseo_plus_social_access' => $yoastseo_plus_social_access,
1294
- 'yoastseo_plus_social_inactive' => $yoastseo_plus_social_inactive
1295
- );
1296
-
1297
- $src_version = false;
1298
- $src_version_premium = false;
1299
-
1300
- if ( ! WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] ) {
1301
-
1302
- /** @noinspection PhpInternalEntityUsedInspection */
1303
- $src_version = version_compare( WPSEO_VERSION, '4.0', '>=' ) ? '40' : $src_version;
1304
- /** @noinspection PhpInternalEntityUsedInspection */
1305
- $src_version = version_compare( WPSEO_VERSION, '4.1', '>=' ) ? '41' : $src_version;
1306
- /** @noinspection PhpInternalEntityUsedInspection */
1307
- $src_version = version_compare( WPSEO_VERSION, '4.4', '>=' ) ? '44' : $src_version;
1308
- if (
1309
- /** @noinspection PhpInternalEntityUsedInspection */
1310
- version_compare( WPSEO_VERSION, '4.8', '>=' )
1311
- ) {
1312
- $src_version = self::$version;
1313
- }
1314
-
1315
- } else {
1316
- /**
1317
- * Start with Yoast SEO Premium.
1318
- */
1319
-
1320
- /**
1321
- * Version of file yoast seo must be latest.
1322
- */
1323
- /** @noinspection PhpInternalEntityUsedInspection */
1324
- $src_version = version_compare( WPSEO_VERSION, '3.9', '>=' ) ? self::$version : $src_version;
1325
- /** @noinspection PhpInternalEntityUsedInspection */
1326
- $src_version_premium = version_compare( WPSEO_VERSION, '3.9', '>=' ) ? '39' : $src_version_premium;
1327
- /**
1328
- * @since WPGlobus 2.2.17
1329
- */
1330
- $src_version_premium = version_compare( WPSEO_VERSION, '12.0', '>=' ) ? $src_version : $src_version_premium;
1331
-
1332
- }
1333
-
1334
- if ( $src_version ) :
1335
-
1336
- $handle = self::$handle_script;
1337
-
1338
- $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/' .
1339
- $handle . '-' . $src_version .
1340
- WPGlobus::SCRIPT_SUFFIX() . '.js';
1341
-
1342
- wp_register_script(
1343
- $handle,
1344
- $src,
1345
- array( 'jquery', 'underscore' ),
1346
- WPGLOBUS_VERSION,
1347
- true
1348
- );
1349
-
1350
- wp_enqueue_script($handle);
1351
-
1352
- wp_localize_script(
1353
- $handle,
1354
- 'WPGlobusYoastSeo',
1355
- array(
1356
- 'version' => WPGLOBUS_VERSION,
1357
- 'wpseo_version' => WPSEO_VERSION,
1358
- 'src_version' => $src_version,
1359
- 'builder_id' => WPGlobus::Config()->builder->get('id'),
1360
- 'builder_page' => WPGlobus::Config()->builder->is_builder_page() ? 'true' : 'false',
1361
- 'language' => WPGlobus::Config()->builder->get_language(),
1362
- 'is_default_language' => WPGlobus::Config()->builder->is_default_language() ? true : false,
1363
- 'src_version_premium' => $src_version_premium,
1364
- 'plus_module' => self::$plus_module,
1365
- 'access_extra' => ( defined( 'WPGLOBUS_YOAST_SEO_ACCESS_EXTRA' ) && WPGLOBUS_YOAST_SEO_ACCESS_EXTRA ) ? 'true' : 'false'
1366
- )
1367
- );
1368
-
1369
- wp_localize_script(
1370
- $handle,
1371
- 'WPGlobusVendor',
1372
- array(
1373
- 'version' => WPGLOBUS_VERSION,
1374
- 'vendor' => WPGlobus::O()->vendors_scripts,
1375
- 'pagenow' => $pagenow,
1376
- 'i18n' => $i18n
1377
- )
1378
- );
1379
-
1380
- endif;
1381
- }
1382
- }
1383
-
1384
- /**
1385
- * Check disabled entity.
1386
- *
1387
- * @since 1.7.3
1388
- * @return boolean
1389
- */
1390
- public static function disabled_entity() {
1391
-
1392
- if ( WPGlobus_WP::is_pagenow( array( 'edit-tags.php', 'term.php' ) ) ) :
1393
- /**
1394
- * Don't check page when editing taxonomy.
1395
- */
1396
- return false;
1397
- endif;
1398
-
1399
- /** @global WP_Post $post */
1400
- global $post;
1401
-
1402
- $result = false;
1403
- if ( WPGlobus_WP::is_pagenow( array( 'post.php', 'post-new.php' ) ) ) :
1404
- if ( empty( $post ) ) {
1405
- $result = true;
1406
- } elseif ( WPGlobus::O()->disabled_entity( $post->post_type ) ) {
1407
- $result = true;
1408
- }
1409
- endif;
1410
- return $result;
1411
- }
1412
-
1413
- /**
1414
- * Filter allows changing graph breadcrumb output.
1415
- *
1416
- * @see wordpress-seo\src\generators\schema-generator.php
1417
- * @see "application/ld+json" in html code on front.
1418
- *
1419
- * @since 2.4.7
1420
- *
1421
- * @scope front
1422
- * @param array $graph_piece Array of graph piece.
1423
- * @param Meta_Tags_Context $context A value object with context variables.
1424
- * @return array
1425
- */
1426
- public static function filter__wpseo_schema_breadcrumb( $graph_piece, $context ) {
1427
-
1428
- if ( empty( $graph_piece['itemListElement'] ) ) {
1429
- return $graph_piece;
1430
- }
1431
-
1432
- $itemListElement = $graph_piece['itemListElement'];
1433
-
1434
- foreach( $itemListElement as $_key=>$_item ) {
1435
- if ( ! empty( $_item['item']['name'] ) && WPGlobus_Core::has_translations( $_item['item']['name'] ) ) {
1436
- $graph_piece['itemListElement'][$_key]['item']['name'] = WPGlobus_Core::extract_text( $graph_piece['itemListElement'][$_key]['item']['name'], WPGlobus::Config()->language );
1437
- }
1438
- }
1439
-
1440
- return $graph_piece;
1441
- }
1442
-
1443
- /**
1444
- * Filter allows changing output of graph `webpage`.
1445
- *
1446
- * @see wordpress-seo\src\generators\schema-generator.php
1447
- * @see "application/ld+json" in html code on front.
1448
- *
1449
- * @since 2.4.14
1450
- * @since 2.4.15 Localize description.
1451
- * @since 2.5.1 Added support of taxonomies.
1452
- *
1453
- * @scope front
1454
- * @param array $graph_piece Array of graph piece.
1455
- * @param Meta_Tags_Context $context A value object with context variables.
1456
- * @return array
1457
- */
1458
- public static function filter__wpseo_schema_webpage( $graph_piece, $context ) {
1459
-
1460
- if ( 'post' == $context->indexable->object_type ) {
1461
-
1462
- if ( ! empty( $graph_piece['name'] ) && WPGlobus_Core::has_translations( $graph_piece['name'] ) ) {
1463
- $graph_piece['name'] = WPGlobus_Core::extract_text( $graph_piece['name'], WPGlobus::Config()->language );
1464
- }
1465
-
1466
- /**
1467
- * @since 2.4.15
1468
- */
1469
- if ( ! empty( $graph_piece['description'] ) && WPGlobus_Core::has_translations( $graph_piece['description'] ) ) {
1470
- $graph_piece['description'] = WPGlobus_Core::extract_text( $graph_piece['description'], WPGlobus::Config()->language );
1471
- }
1472
-
1473
- } elseif ( 'term' == $context->indexable->object_type ) {
1474
-
1475
- /**
1476
- * Taxonomy.
1477
- * @since 2.5.1
1478
- */
1479
- $graph_piece['description'] = self::get_taxonomy_meta( $context->indexable->object_sub_type, $context->indexable->object_id, 'wpseo_desc' );
1480
- $graph_piece['url'] = WPGlobus_Utils::localize_url( $graph_piece['url'], WPGlobus::Config()->language );
1481
- $graph_piece['@id'] = WPGlobus_Utils::localize_url( $graph_piece['@id'], WPGlobus::Config()->language );
1482
- $graph_piece['breadcrumb']['@id'] = WPGlobus_Utils::localize_url( $graph_piece['breadcrumb']['@id'], WPGlobus::Config()->language );
1483
- }
1484
-
1485
- return $graph_piece;
1486
- }
1487
-
1488
- /**
1489
- * Filter for changing the Yoast SEO generated title.
1490
- *
1491
- * @see wordpress-seo\src\presenters\title-presenter.php
1492
- *
1493
- * @since 2.5.22
1494
- *
1495
- * @scope front
1496
- *
1497
- * @param string $title The title.
1498
- * @param Indexable_Presentation $presentation The presentation of an indexable.
1499
- *
1500
- * @return string
1501
- */
1502
- public static function filter_front__title( $title, $presentation ) {
1503
-
1504
- if ( 'post' == $presentation->model->object_type ) {
1505
-
1506
- /**
1507
- * Post.
1508
- */
1509
- $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
1510
-
1511
- if ( ! empty( $meta_cache['_yoast_wpseo_title'][0] ) ) {
1512
-
1513
- $__title = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_title'][0], WPGlobus::Config()->language );
1514
-
1515
- if ( $presentation->source instanceof WP_Post ) {
1516
-
1517
- if ( WPGlobus_Core::has_translations( $presentation->source->post_title ) ) {
1518
- $presentation->source->post_title = WPGlobus_Core::text_filter( $presentation->source->post_title, WPGlobus::Config()->language );
1519
- }
1520
-
1521
- /**
1522
- * @see wordpress-seo\inc\wpseo-functions.php
1523
- */
1524
- $title = wpseo_replace_vars( $__title, $presentation->source );
1525
- }
1526
-
1527
- } else {
1528
-
1529
- /**
1530
- * @since 2.5.23
1531
- */
1532
- if ( WPGlobus_Core::has_translations( $title ) ) {
1533
- $title = WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
1534
- }
1535
-
1536
- }
1537
-
1538
- } elseif ( 'term' == $presentation->model->object_type ) {
1539
-
1540
- /**
1541
- * Taxonomy.
1542
- */
1543
- $__title = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_title' );
1544
-
1545
- if ( empty( $__title ) ) {
1546
- $__title = self::get_option( 'wpseo_titles', 'title-tax-' . $presentation->model->object_sub_type );
1547
- }
1548
-
1549
- $title = wpseo_replace_vars( $__title, $presentation->source );
1550
-
1551
- }
1552
-
1553
- return $title;
1554
- }
1555
-
1556
- /**
1557
- * Get wpseo options.
1558
- *
1559
- * @since 2.5.22
1560
- *
1561
- * @return array|string
1562
- */
1563
- public static function get_option( $option = 'wpseo_titles', $key = '' ) {
1564
-
1565
- /**
1566
- * @todo Maybe to use WPSEO_Options.
1567
- * @see wordpress-seo\inc\options\class-wpseo-options.php
1568
- * @since 2.5.22
1569
- */
1570
-
1571
- $options = get_option( $option );
1572
-
1573
- if ( empty( $key ) ) {
1574
- return $options;
1575
- }
1576
-
1577
- if ( ! isset( $options[$key] ) ) {
1578
- return null;
1579
- }
1580
-
1581
- return $options[$key];
1582
- }
1583
-
1584
- } // class WPGlobus_YoastSEO.
1585
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1586
  # --- EOF
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-yoastseo140.php
4
+ *
5
+ * Support of Yoast SEO 14.0
6
+ *
7
+ * @package WPGlobus\Vendor\YoastSEO
8
+ * @since 2.4
9
+ * @since 2.5.19 Added support multilingual fields for social tab.
10
+ */
11
+
12
+ /**
13
+ * Class WPGlobus_YoastSEO.
14
+ */
15
+ class WPGlobus_YoastSEO {
16
+
17
+ /**
18
+ * Yoast SEO separator.
19
+ *
20
+ * @var string
21
+ */
22
+ public static $yoastseo_separator = '';
23
+
24
+ /**
25
+ * Name of the script.
26
+ *
27
+ * @var string
28
+ */
29
+ public static $handle_script = 'wpglobus-yoastseo';
30
+
31
+ /**
32
+ * Name of the dashboard script.
33
+ *
34
+ * @since 2.4.5
35
+ * @var string
36
+ */
37
+ public static $handle_script_dashboard = 'wpglobus-yoastseo-dashboard';
38
+
39
+ /**
40
+ * Name of the premium script.
41
+ *
42
+ * @since 1.7.2
43
+ * @var string
44
+ */
45
+ public static $handle_script_premium = 'wpglobus-yoastseo-premium';
46
+
47
+ /**
48
+ * Current version yoast seo.
49
+ *
50
+ * @since 1.8
51
+ * @var string
52
+ */
53
+ protected static $version = '';
54
+
55
+ /**
56
+ * Contains wpseo post meta.
57
+ *
58
+ * @since 2.2.16
59
+ * @var null|array
60
+ */
61
+ protected static $wpseo_meta = null;
62
+
63
+ /**
64
+ * Contains wpseo taxonomy meta.
65
+ *
66
+ * @since 2.5.1
67
+ * @var null|array
68
+ */
69
+ protected static $wpseo_taxonomy_meta = null;
70
+
71
+ /**
72
+ * Contains document title.
73
+ *
74
+ * @since 2.4.7
75
+ * @var null|string
76
+ */
77
+ protected static $title = null;
78
+
79
+ /**
80
+ * Plus access.
81
+ *
82
+ * @since 2.2.20
83
+ * @var boolean|string
84
+ */
85
+ protected static $plus_module = false;
86
+
87
+ /**
88
+ * Canonical URLs.
89
+ *
90
+ * @since 2.5.11
91
+ * @var array
92
+ */
93
+ protected static $canonical_url = array();
94
+
95
+ /**
96
+ * Description meta value.
97
+ *
98
+ * @scope front
99
+ * @since 2.6.3
100
+ * @var string
101
+ */
102
+ protected static $description = '';
103
+
104
+ /**
105
+ * Static "controller"
106
+ */
107
+ public static function controller($version, $plus_module = false) {
108
+
109
+ self::$version = $version;
110
+ self::$plus_module = $plus_module;
111
+
112
+ if ( is_admin() ) {
113
+
114
+ /**
115
+ * @since 2.2.20
116
+ */
117
+ add_action( 'admin_print_scripts', array(
118
+ __CLASS__,
119
+ 'action__admin_print_scripts'
120
+ ) );
121
+
122
+ if ( WPGlobus_WP::is_pagenow( 'edit.php' ) ) {
123
+
124
+ /**
125
+ * To translate Yoast columns on `edit.php` page.
126
+ * @since 2.2.16
127
+ */
128
+ add_filter( 'wpseo_title', array(
129
+ __CLASS__,
130
+ 'filter__wpseo_title'
131
+ ), 5 );
132
+
133
+
134
+ add_filter( 'wpseo_metadesc', array(
135
+ __CLASS__,
136
+ 'filter__wpseo_metadesc'
137
+ ), 5 );
138
+ }
139
+
140
+ } else {
141
+
142
+ /**
143
+ * Frontend.
144
+ */
145
+
146
+ /**
147
+ * Filter SEO title and meta description on front only, when the page header HTML tags are generated.
148
+ * AJAX is probably not required (waiting for a case).
149
+ */
150
+ // add_filter( 'wpseo_title', array( __CLASS__, 'filter__title' ), PHP_INT_MAX );
151
+ /**
152
+ * Filter title description.
153
+ * @since 2.5.22
154
+ */
155
+ add_filter( 'wpseo_title', array( __CLASS__, 'filter_front__title' ), PHP_INT_MAX, 2 );
156
+
157
+ /**
158
+ * Filter meta description.
159
+ * @since 2.4
160
+ */
161
+ add_filter( 'wpseo_metadesc', array( __CLASS__, 'filter_front__description' ), 5, 2 );
162
+
163
+ /**
164
+ * Open Graph.
165
+ * @since 2.4 Open Graph title.
166
+ * @since 2.4 Open Graph description.
167
+ * @since 2.4 Open Graph URL.
168
+ * @since 2.5.19 Open Graph image.
169
+ */
170
+ add_filter( 'wpseo_opengraph_title', array( __CLASS__, 'filter_front__opengraph_title' ), 5, 2 );
171
+ add_filter( 'wpseo_opengraph_desc', array( __CLASS__, 'filter_front__opengraph_description' ), 5, 2 );
172
+ add_filter( 'wpseo_opengraph_image', array( __CLASS__, 'filter_front__opengraph_image' ), 5, 2 );
173
+ add_filter( 'wpseo_opengraph_url', array( __CLASS__, 'filter_front__localize_url' ), 5, 2 );
174
+
175
+ /**
176
+ * Twitter.
177
+ * @since 2.5.19
178
+ */
179
+ add_filter( 'wpseo_twitter_title', array( __CLASS__, 'filter_front__twitter_title' ), 5, 2 );
180
+ add_filter( 'wpseo_twitter_description', array( __CLASS__, 'filter_front__twitter_description' ), 5, 2 );
181
+ add_filter( 'wpseo_twitter_image', array( __CLASS__, 'filter_front__twitter_image' ), 5, 2 );
182
+
183
+ /**
184
+ * Filter canonical URL and open graph URL.
185
+ * @since 2.4
186
+ */
187
+ add_filter( 'wpseo_canonical', array( __CLASS__, 'filter_front__localize_url' ), 5, 2 );
188
+
189
+ /**
190
+ * Filter of the rel prev and next URL put out by Yoast SEO.
191
+ * @since 2.5.11
192
+ */
193
+ add_filter( 'wpseo_adjacent_rel_url', array( __CLASS__, 'filter_front__wpseo_adjacent_rel_url' ), 5, 3 );
194
+
195
+ /**
196
+ * Filter the HTML output of the Yoast SEO breadcrumbs class.
197
+ * @since 2.4.2
198
+ */
199
+ add_filter( 'wpseo_breadcrumb_output', array( __CLASS__, 'filter__breadcrumb_output' ), 5, 2 );
200
+
201
+ /**
202
+ * @todo check for '_yoast_wpseo_title' meta
203
+ * @see <title> view-source:http://test/test-post-seo/
204
+ * @see <title> view-source:http://test/ru/test-post-seo/
205
+ */
206
+ add_filter( 'get_post_metadata', array( __CLASS__, 'filter__get_post_metadata' ), 6, 4 );
207
+
208
+ /**
209
+ * Filter meta keywords.
210
+ * @since 1.8.8
211
+ */
212
+ add_filter( 'wpseo_metakeywords', array( __CLASS__, 'filter__metakeywords' ), 0 );
213
+
214
+ /**
215
+ * Filter `wpseo_schema_breadcrumb` generator.
216
+ * @since 2.4.7
217
+ */
218
+ add_filter( 'wpseo_schema_breadcrumb', array( __CLASS__, 'filter__wpseo_schema_breadcrumb' ), 5, 2 );
219
+
220
+ /**
221
+ * Filter `wpseo_schema_webpage` generator.
222
+ * @since 2.4.14
223
+ */
224
+ add_filter( 'wpseo_schema_webpage', array( __CLASS__, 'filter__wpseo_schema_webpage' ), 5, 2 );
225
+ }
226
+ }
227
+
228
+ /**
229
+ * obsolete @since 2.5.22
230
+ * Filter Yoast post meta title.
231
+ *
232
+ * @scope front
233
+ * @since 1.9.18
234
+ * @since 2.4.7 Handle multilingual title from `postmeta` table.
235
+ *
236
+ * @param string $title Post title.
237
+ *
238
+ * @return string.
239
+ */
240
+ public static function filter__title( $title ) {
241
+
242
+ /**
243
+ * In some cases we can get $title like {:en}En title{:}{:ru}Ru title{:}{:fr}Fr title{:} - SiteTitle
244
+ * so, let's filter.
245
+ */
246
+ if ( WPGlobus_Core::has_translations($title) ) {
247
+
248
+ if ( is_null( self::$title ) ) {
249
+ self::$title = $title;
250
+ }
251
+ return WPGlobus_Core::extract_text( self::$title, WPGlobus::Config()->language );
252
+ }
253
+
254
+ /**
255
+ * We can get title in last saved language (has no multilingual) from @see `wp_yoast_indexable` table.
256
+ * So, we need get multilingual title from `postmeta` table.
257
+ * @since 2.4.7
258
+ */
259
+ if ( ! is_null( self::$title ) ) {
260
+ return WPGlobus_Core::extract_text( self::$title, WPGlobus::Config()->language );
261
+ }
262
+
263
+ /** @global wpdb $wpdb */
264
+ global $wpdb;
265
+
266
+ /** @global WP_Post $post */
267
+ global $post;
268
+
269
+ /**
270
+ * @since 2.4.14 Fixed PHP Notice: Trying to get property 'ID' of non-object.
271
+ */
272
+ if ( $post instanceof WP_Post && (int) $post->ID > 0 ) {
273
+ $query = $wpdb->prepare(
274
+ "SELECT meta_value FROM {$wpdb->prefix}postmeta AS m WHERE m.post_id = %s AND m.meta_key = %s",
275
+ $post->ID,
276
+ '_yoast_wpseo_title'
277
+ );
278
+
279
+ $meta = $wpdb->get_var($query);
280
+ if ( ! empty($meta) && false != mb_strpos($meta, $title) && WPGlobus_Core::has_translations($meta) ) {
281
+ self::$title = $meta;
282
+ return WPGlobus_Core::extract_text( self::$title, WPGlobus::Config()->language );
283
+ }
284
+ }
285
+
286
+ return $title;
287
+ }
288
+
289
+ /**
290
+ * Filter for changing the Yoast SEO generated Open Graph description.
291
+ *
292
+ * @see wordpress-seo\src\presenters\open-graph\description-presenter.php
293
+ *
294
+ * @since 2.5.19
295
+ *
296
+ * @scope front
297
+ * @param string $description The description.
298
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
299
+ *
300
+ * @return string
301
+ */
302
+ public static function filter_front__opengraph_description( $description, $presentation ) {
303
+
304
+ if ( empty( $description ) ) {
305
+ return $description;
306
+ }
307
+
308
+ if ( 'post' == $presentation->model->object_type ) {
309
+
310
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
311
+
312
+ if ( ! empty( $meta_cache['_yoast_wpseo_opengraph-description'][0] ) ) {
313
+
314
+ $description = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_opengraph-description'][0], WPGlobus::Config()->language );
315
+
316
+ if ( $presentation->source instanceof WP_Post ) {
317
+ /**
318
+ * @see wordpress-seo\inc\wpseo-functions.php
319
+ */
320
+ $description = wpseo_replace_vars( $description, $presentation->source );
321
+ }
322
+ } else {
323
+ /**
324
+ * Opengraph description is empty. We get it from `description` meta.
325
+ * @since 2.6.3
326
+ */
327
+ $description = self::$description;
328
+ }
329
+
330
+ } elseif ( 'term' == $presentation->model->object_type ) {
331
+
332
+ /**
333
+ * Taxonomy.
334
+ */
335
+ $__desc = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_desc' );
336
+
337
+ if ( empty( $__desc ) ) {
338
+
339
+ $__template = self::get_option( 'wpseo_titles', 'metadesc-tax-' . $presentation->model->object_sub_type );
340
+
341
+ if ( ! empty( $__template ) ) {
342
+ $__desc = $__template;
343
+ } else {
344
+ // @W.I.P if empty `Meta description` from Yoast, then we need output `Description` from Edit taxonomy page.
345
+ $__desc = $presentation->source->description;
346
+ }
347
+
348
+ }
349
+
350
+ $description = wpseo_replace_vars( $__desc, $presentation->source );
351
+ }
352
+
353
+ return $description;
354
+ }
355
+
356
+ /**
357
+ * Filter for changing the Open Graph image.
358
+ *
359
+ * @see wordpress-seo\src\presenters\open-graph\image-presenter.php
360
+ *
361
+ * @since 2.5.19
362
+ *
363
+ * @scope front
364
+ * @param string $image_url The URL of the Open Graph image.
365
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
366
+ *
367
+ * @return string
368
+ */
369
+ public static function filter_front__opengraph_image( $image_url, $presentation ) {
370
+
371
+ if ( empty( $image_url) ) {
372
+ return $image_url;
373
+ }
374
+
375
+ if ( 'post' == $presentation->model->object_type ) {
376
+
377
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
378
+
379
+ if ( ! empty( $meta_cache['_yoast_wpseo_opengraph-image'][0] ) ) {
380
+
381
+ $image_url = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_opengraph-image'][0], WPGlobus::Config()->language );
382
+
383
+ if ( $presentation->source instanceof WP_Post ) {
384
+ /**
385
+ * @see wordpress-seo\inc\wpseo-functions.php
386
+ */
387
+ $image_url = wpseo_replace_vars( $image_url, $presentation->source );
388
+ }
389
+ }
390
+ }
391
+
392
+ return $image_url;
393
+ }
394
+
395
+ /**
396
+ * Filter for changing the Twitter title.
397
+ *
398
+ * @see wordpress-seo\src\presenters\twitter\title-presenter.php
399
+ *
400
+ * @since 2.5.19
401
+ *
402
+ * @scope front
403
+ * @param string $title The Twitter title.
404
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
405
+ *
406
+ * @return string
407
+ */
408
+ public static function filter_front__twitter_title( $title, $presentation ) {
409
+
410
+ if ( empty( $title ) ) {
411
+ return $title;
412
+ }
413
+
414
+ if ( 'post' == $presentation->model->object_type ) {
415
+
416
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
417
+
418
+ if ( ! empty( $meta_cache['_yoast_wpseo_twitter-title'][0] ) ) {
419
+
420
+ $title = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_twitter-title'][0], WPGlobus::Config()->language );
421
+
422
+ if ( $presentation->source instanceof WP_Post ) {
423
+ /**
424
+ * @see wordpress-seo\inc\wpseo-functions.php
425
+ */
426
+ $title = wpseo_replace_vars( $title, $presentation->source );
427
+ }
428
+ }
429
+ }
430
+
431
+ return $title;
432
+ }
433
+
434
+ /**
435
+ * Filter for changing the Twitter description as output in the Twitter card by Yoast SEO.
436
+ *
437
+ * @see wordpress-seo\src\presenters\twitter\description-presenter.php
438
+ *
439
+ * @since 2.5.19
440
+ *
441
+ * @scope front
442
+ * @param string $description The description string.
443
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
444
+ *
445
+ * @return string
446
+ */
447
+ public static function filter_front__twitter_description( $description, $presentation ) {
448
+
449
+ if ( empty( $description ) ) {
450
+ return $description;
451
+ }
452
+
453
+ if ( 'post' == $presentation->model->object_type ) {
454
+
455
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
456
+
457
+ if ( ! empty( $meta_cache['_yoast_wpseo_twitter-description'][0] ) ) {
458
+
459
+ $description = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_twitter-description'][0], WPGlobus::Config()->language );
460
+
461
+ if ( $presentation->source instanceof WP_Post ) {
462
+ /**
463
+ * @see wordpress-seo\inc\wpseo-functions.php
464
+ */
465
+ $description = wpseo_replace_vars( $description, $presentation->source );
466
+ }
467
+ }
468
+ }
469
+
470
+ return $description;
471
+ }
472
+
473
+ /**
474
+ * Filter for changing the Twitter Card image.
475
+ *
476
+ * @see wordpress-seo\src\presenters\twitter\image-presenter.php
477
+ *
478
+ * @since 2.5.19
479
+ *
480
+ * @scope front
481
+ * @param string $image Image URL string.
482
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
483
+ *
484
+ * @return string
485
+ */
486
+ public static function filter_front__twitter_image( $image, $presentation ) {
487
+
488
+ if ( empty( $image ) ) {
489
+ return $image;
490
+ }
491
+
492
+ if ( 'post' == $presentation->model->object_type ) {
493
+
494
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
495
+
496
+ if ( ! empty( $meta_cache['_yoast_wpseo_twitter-image'][0] ) ) {
497
+
498
+ $image = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_twitter-image'][0], WPGlobus::Config()->language );
499
+
500
+ if ( $presentation->source instanceof WP_Post ) {
501
+ /**
502
+ * @see wordpress-seo\inc\wpseo-functions.php
503
+ */
504
+ $image = wpseo_replace_vars( $image, $presentation->source );
505
+ }
506
+ }
507
+ }
508
+
509
+ return $image;
510
+ }
511
+
512
+ /**
513
+ * Filter for changing the Yoast SEO generated title.
514
+ *
515
+ * @see wordpress-seo\src\presenters\open-graph\title-presenter.php
516
+ *
517
+ * @since 2.5.19
518
+ *
519
+ * @scope front
520
+ * @param string $title The title.
521
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
522
+ *
523
+ * @return string
524
+ */
525
+ public static function filter_front__opengraph_title( $title, $presentation ) {
526
+
527
+ if ( empty( $title ) ) {
528
+ return $title;
529
+ }
530
+
531
+ if ( 'post' == $presentation->model->object_type ) {
532
+
533
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
534
+
535
+ if ( ! empty( $meta_cache['_yoast_wpseo_opengraph-title'][0] ) ) {
536
+
537
+ $title = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_opengraph-title'][0], WPGlobus::Config()->language );
538
+
539
+ if ( $presentation->source instanceof WP_Post ) {
540
+ /**
541
+ * @see wordpress-seo\inc\wpseo-functions.php
542
+ */
543
+ $title = wpseo_replace_vars( $title, $presentation->source );
544
+ }
545
+
546
+ } else {
547
+
548
+ /**
549
+ * @since 2.5.23
550
+ */
551
+ if ( WPGlobus_Core::has_translations( $title ) ) {
552
+ $title = WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
553
+ }
554
+
555
+ }
556
+
557
+ } elseif ( 'term' == $presentation->model->object_type ) {
558
+
559
+ /**
560
+ * Taxonomy.
561
+ */
562
+ $__title = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_title' );
563
+
564
+ if ( empty( $__title ) ) {
565
+ $__title = self::get_option( 'wpseo_titles', 'title-tax-' . $presentation->model->object_sub_type );
566
+ }
567
+
568
+ $title = wpseo_replace_vars( $__title, $presentation->source );
569
+ }
570
+
571
+ return $title;
572
+ }
573
+
574
+ /**
575
+ * Filter post meta.
576
+ *
577
+ * @since 1.9.21
578
+ * @since 2.1.3
579
+ * @see function function get_value() in wordpress-seo\inc\class-wpseo-meta.php
580
+ */
581
+ public static function filter__get_post_metadata( $check, $object_id, $meta_key, $single ) {
582
+
583
+ global $post;
584
+
585
+ if ( $single ) {
586
+ return $check;
587
+ }
588
+
589
+ if ( ! is_object($post) ) {
590
+ return $check;
591
+ }
592
+
593
+ if ( $object_id != $post->ID ) {
594
+ return $check;
595
+ }
596
+
597
+ /**
598
+ * May be called many times on one page. Let's cache.
599
+ */
600
+ static $_done = null;
601
+ if ( ! is_null($_done) ) {
602
+ return $check;
603
+ }
604
+
605
+ $meta_type = 'post';
606
+
607
+ $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
608
+
609
+ if ( ! empty($meta_cache['_yoast_wpseo_title'][0]) ) {
610
+ $meta_cache['_yoast_wpseo_title'][0] = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_title'][0], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
611
+ wp_cache_replace( $object_id, $meta_cache, $meta_type . '_meta' );
612
+ }
613
+
614
+ /**
615
+ * @since 2.2.33
616
+ */
617
+ if ( ! empty($meta_cache['_yoast_wpseo_focuskw'][0]) ) {
618
+ $meta_cache['_yoast_wpseo_focuskw'][0] = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_focuskw'][0], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
619
+ wp_cache_replace( $object_id, $meta_cache, $meta_type . '_meta' );
620
+ }
621
+
622
+ $_done = true;
623
+
624
+ return $check;
625
+ }
626
+
627
+ /**
628
+ * Filter Yoast post meta keywords.
629
+ *
630
+ * @scope front
631
+ * @since 1.8.8
632
+ *
633
+ * @param string $keywords Multilingual keywords.
634
+ *
635
+ * @return string.
636
+ */
637
+ public static function filter__metakeywords( $keywords ) {
638
+ if ( WPGlobus::Config()->language != WPGlobus::Config()->default_language ) {
639
+ return '';
640
+ }
641
+ return WPGlobus_Core::text_filter($keywords, WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY);
642
+ }
643
+
644
+ /**
645
+ * Filter wpseo meta description.
646
+ *
647
+ * @see wordpress-seo\src\presenters\meta-description-presenter.php
648
+ * @see wordpress-seo\src\presenters\open-graph\description-presenter.php
649
+ *
650
+ * @since 2.4
651
+ * @since 2.5.1 Added support of taxonomies.
652
+ *
653
+ * @scope front
654
+ *
655
+ * @param string $meta_description Value from @see `description` field in `wp_yoast_indexable` table.
656
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
657
+ *
658
+ * @return string
659
+ */
660
+ public static function filter_front__description( $meta_description, $presentation ) {
661
+
662
+ /**
663
+ * $meta_description is received from `description` field in `wp_yoast_indexable` table.
664
+ */
665
+
666
+ /**
667
+ * Init description.
668
+ */
669
+ $description = '';
670
+
671
+ /**
672
+ * Key to define that `wpseo_metadesc` filter was already fired earlier.
673
+ */
674
+ static $meta_description_presenter_was_fired = false;
675
+
676
+ if ( 'post' == $presentation->model->object_type ) {
677
+
678
+ /**
679
+ * Post.
680
+ */
681
+ if ( $meta_description_presenter_was_fired ) {
682
+ /**
683
+ * Set meta description to empty value for `wpseo_opengraph_desc` filter like for empty $meta_description in `wpseo_metadesc` filter.
684
+ */
685
+ $meta_description = '';
686
+ } else {
687
+ if ( empty($meta_description) ) {
688
+ $meta_description_presenter_was_fired = true;
689
+ }
690
+ }
691
+
692
+ $description = self::get_meta( '_yoast_wpseo_metadesc', $meta_description );
693
+
694
+ } elseif ( 'term' == $presentation->model->object_type ) {
695
+
696
+ /**
697
+ * Taxonomy.
698
+ * @since 2.5.1
699
+ */
700
+ if ( $meta_description_presenter_was_fired ) {
701
+
702
+ /**
703
+ * This is `wpseo_opengraph_desc` filter with empty yoast description.
704
+ * @todo maybe need to use cache for term object.
705
+ */
706
+ $term = get_term( $presentation->model->object_id );
707
+ if ( $term instanceof WP_Term ) {
708
+ $description = $term->description;
709
+ } else {
710
+ $description = '';
711
+ }
712
+
713
+ } else {
714
+
715
+ /**
716
+ * @since 2.5.22
717
+ */
718
+ $description = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_desc' );
719
+
720
+ if ( empty($description) ) {
721
+ $meta_description_presenter_was_fired = true;
722
+ } else {
723
+ $description = wpseo_replace_vars( $description, $presentation->source );
724
+ }
725
+ }
726
+ }
727
+
728
+ /**
729
+ * @since 2.6.3
730
+ */
731
+ self::$description = $description;
732
+
733
+ return $description;
734
+ }
735
+
736
+ /**
737
+ * Filter canonical URL and open graph URL put out by Yoast SEO.
738
+ *
739
+ * @see wordpress-seo\src\presenters\canonical-presenter.php
740
+ * @see wordpress-seo\src\presenters\open-graph\url-presenter.php
741
+ * @scope front
742
+ * @since 2.4
743
+ * @since 2.5.1 Added support of taxonomies.
744
+ * @since 2.5.10 Added `wpglobus_wpseo_localize_url` filter.
745
+ *
746
+ * @param string $url The canonical URL or open graph URL.
747
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
748
+ *
749
+ * @return string
750
+ */
751
+ public static function filter_front__localize_url( $url, $presentation ) {
752
+ /**
753
+ * URL is received from `permalink` field in `wp_yoast_indexable` table.
754
+ */
755
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
756
+ return $url;
757
+ }
758
+
759
+ $tag = false;
760
+ if ( is_singular() ) {
761
+ $tag = 'singular';
762
+ } elseif ( is_category() ) {
763
+ $tag = 'category';
764
+ } elseif ( is_tag() ) {
765
+ $tag = 'tag';
766
+ } elseif ( is_tax() ) {
767
+ $tag = 'tax';
768
+ }
769
+
770
+ if ( $tag ) {
771
+
772
+ $language =WPGlobus::Config()->language;
773
+
774
+ self::$canonical_url[ WPGlobus::Config()->default_language ] = $url;
775
+
776
+ /**
777
+ * Filters for a localized url.
778
+ *
779
+ * @since 2.5.10
780
+ *
781
+ * @param string $url Localized URL.
782
+ * @param string $language Current language.
783
+ * @param string $tag Conditional Tag.
784
+ */
785
+ self::$canonical_url[ $language ] = apply_filters( 'wpglobus_wpseo_localize_url', WPGlobus_Utils::localize_url( $url, $language ), $language, $tag );
786
+
787
+ self::$canonical_url[ $language ] = urldecode( self::$canonical_url[ $language ] );
788
+
789
+ return self::$canonical_url[ $language ];
790
+ }
791
+
792
+ return $url;
793
+ }
794
+
795
+ /**
796
+ * Filtering of the rel `prev` and `next` URL put out by Yoast SEO.
797
+ *
798
+ * @see wordpress-seo\src\presenters\rel-prev-presenter.php
799
+ * @see wordpress-seo\src\presenters\rel-next-presenter.php
800
+ * @scope front
801
+ *
802
+ * @since 2.5.11
803
+ *
804
+ * @param string $url Link relationship, prev or next.
805
+ * @param string $relationship `prev` or `next`.
806
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
807
+ *
808
+ * @return string
809
+ */
810
+ public static function filter_front__wpseo_adjacent_rel_url( $link, $relationship, $presentation ) {
811
+
812
+ if ( empty( $link ) || WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
813
+ return $link;
814
+ }
815
+
816
+ if ( empty( self::$canonical_url ) ) {
817
+ return $link;
818
+ }
819
+
820
+ return str_replace(
821
+ self::$canonical_url[ WPGlobus::Config()->default_language ],
822
+ self::$canonical_url[ WPGlobus::Config()->language ],
823
+ $link
824
+ );
825
+ }
826
+
827
+ /**
828
+ * Filter the HTML output of the Yoast SEO breadcrumbs class.
829
+ *
830
+ * @see wordpress-seo\src\presenters\breadcrumbs-presenter.php
831
+ * @scope front
832
+ * @since 2.4.2
833
+ *
834
+ * @param $output The HTML output
835
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
836
+ *
837
+ * @api string $output The HTML output.
838
+ *
839
+ * @return string
840
+ */
841
+ public static function filter__breadcrumb_output( $output, $presentation ) {
842
+
843
+ /** @global wpdb $wpdb */
844
+ global $wpdb;
845
+
846
+ $object_type = null;
847
+ $object_sub_type = null;
848
+ $object_order = null;
849
+
850
+ if ( $presentation->source instanceof WP_Post ) {
851
+
852
+ $object_type = 'post';
853
+ $object_sub_type = $presentation->source->post_type;
854
+
855
+ } elseif ( $presentation->source instanceof WP_Term ) {
856
+
857
+ $object_type = 'taxonomy';
858
+ $object_sub_type = $presentation->source->taxonomy;
859
+
860
+ if ( $presentation->source->parent == 0 ) {
861
+ $object_order = array($presentation->source->term_id);
862
+ } else {
863
+ $object_order = get_ancestors($presentation->source->term_id, $object_sub_type);
864
+ if ( count($object_order) > 1 ) {
865
+ $object_order = array_reverse( $object_order );
866
+ }
867
+ $object_order[] = $presentation->source->term_id;
868
+ }
869
+
870
+ }
871
+
872
+ $ids = array();
873
+ $breadcrumbs = array();
874
+ $i = 0;
875
+
876
+ foreach( $presentation->breadcrumbs as $order=>$piece ) {
877
+
878
+ if ( $order == 0 ) {
879
+
880
+ $_piece = '/' . preg_quote($piece['url'], '/') . '/';
881
+
882
+ if ( empty( $piece['id'] ) ) {
883
+ /**
884
+ * If homepage displays as latest posts, then we should force the setting of `Home` for all languages.
885
+ */
886
+ $output = preg_replace( $_piece, home_url('/'), $output, 1 );
887
+ } else {
888
+ $output = preg_replace( $_piece, home_url('/'), $output, 1 );
889
+ }
890
+
891
+ if ( WPGlobus_Core::has_translations($piece['text']) ) {
892
+ $_home_text = WPGlobus_Core::text_filter( $piece['text'], WPGlobus::Config()->language, WPGlobus::RETURN_IN_DEFAULT_LANGUAGE );
893
+ $output = str_replace( $piece['text'], $_home_text, $output );
894
+ }
895
+
896
+ } else {
897
+
898
+ switch ($object_type) :
899
+ case 'post' :
900
+ if ( ! empty($piece['id']) ) {
901
+ $ids[] = $piece['id'];
902
+ $breadcrumbs[ $piece['id'] ] = $piece;
903
+ $breadcrumbs[ $piece['id'] ]['object_type'] = $object_type;
904
+ $breadcrumbs[ $piece['id'] ]['object_sub_type'] = $object_sub_type;
905
+ }
906
+ break;
907
+ case 'taxonomy' :
908
+ $_id = $order;
909
+ if ( ! is_null( $object_order ) ) {
910
+ $_id = $object_order[$i];
911
+ $ids[] = $_id;
912
+ }
913
+ $breadcrumbs[ $_id ] = $piece;
914
+ $breadcrumbs[ $_id ]['object_type'] = $object_type;
915
+ $breadcrumbs[ $_id ]['object_sub_type'] = $object_sub_type;
916
+ $i++;
917
+ break;
918
+ endswitch;
919
+ }
920
+ }
921
+
922
+ $query = null;
923
+
924
+ if ( ! empty($ids) ) {
925
+
926
+ $_ids = implode( ',', $ids );
927
+ switch ($object_type) :
928
+ case 'post' :
929
+ $select = $wpdb->prepare( "SELECT ID, post_title AS ml_title, post_name, post_type FROM $wpdb->posts WHERE ID IN ( %s )", $_ids );
930
+ $select = str_replace( "'", '', $select );
931
+ break;
932
+ case 'taxonomy' :
933
+ $select = $wpdb->prepare( "SELECT term_id, name AS ml_title, slug FROM $wpdb->terms WHERE term_id IN ( %s )", $_ids );
934
+ $select = str_replace( "'", '', $select );
935
+ break;
936
+ endswitch;
937
+
938
+ $query = $wpdb->get_results( $select, OBJECT_K );
939
+
940
+ foreach( $breadcrumbs as $id=>$piece ) {
941
+
942
+ $output = str_replace(
943
+ array(
944
+ $piece['url'],
945
+ $piece['text']
946
+ ),
947
+ array(
948
+ WPGlobus_Utils::localize_url( $piece['url'], WPGlobus::Config()->language ),
949
+ WPGlobus_Core::text_filter( $query[$id]->ml_title, WPGlobus::Config()->language )
950
+ ),
951
+ $output
952
+ );
953
+ }
954
+ }
955
+
956
+ /**
957
+ * @since 2.4.2 @W.I.P
958
+ */
959
+ //$output = apply_filters( 'wpglobus_wpseo_breadcrumb_output', $output, $breadcrumbs, $query );
960
+
961
+ return $output;
962
+ }
963
+
964
+ /**
965
+ * Filter wpseo meta description.
966
+ *
967
+ * @see wordpress-seo\admin\class-meta-columns.php
968
+ * @scope admin
969
+ * @since 2.2.16
970
+ *
971
+ * @param string $metadesc_val Value in default language.
972
+ *
973
+ * @return string
974
+ */
975
+ public static function filter__wpseo_metadesc( $metadesc_val ) {
976
+
977
+ if ( empty($metadesc_val) ) {
978
+ return $metadesc_val;
979
+ }
980
+
981
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
982
+ return $metadesc_val;
983
+ }
984
+
985
+ return self::get_meta( '_yoast_wpseo_metadesc', $metadesc_val );
986
+ }
987
+
988
+ /**
989
+ * To translate Yoast `column-wpseo-title`.
990
+ *
991
+ * @see wordpress-seo\admin\class-meta-columns.php
992
+ * @scope admin
993
+ * @since 2.2.16
994
+ *
995
+ * @param string $title
996
+ *
997
+ * @return string
998
+ */
999
+ public static function filter__wpseo_title( $title ) {
1000
+ return WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
1001
+ }
1002
+
1003
+ /**
1004
+ * Get meta for extra language.
1005
+ *
1006
+ * @scope admin
1007
+ * @since 2.2.16
1008
+ */
1009
+ protected static function get_meta( $meta_key, $meta_value = '' ) {
1010
+
1011
+ if ( is_null(self::$wpseo_meta) ) {
1012
+ self::get_wpseo_meta();
1013
+ }
1014
+
1015
+ if ( empty( self::$wpseo_meta[ $meta_key ] ) ) {
1016
+ return '';
1017
+ }
1018
+
1019
+ /** @global WP_Post $post */
1020
+ global $post;
1021
+
1022
+ if ( empty( $meta_value ) ) {
1023
+
1024
+ /**
1025
+ * Try get meta by post ID.
1026
+ */
1027
+ if ( ! $post instanceof WP_Post ) {
1028
+ return '';
1029
+ }
1030
+ if ( empty( self::$wpseo_meta[$meta_key][$post->ID] ) ) {
1031
+ return '';
1032
+ }
1033
+
1034
+ return WPGlobus_Core::text_filter( self::$wpseo_meta[$meta_key][$post->ID], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
1035
+ }
1036
+
1037
+ $_return_value = '';
1038
+ foreach( self::$wpseo_meta[ $meta_key ] as $_meta_value ) {
1039
+ if ( false !== strpos( $_meta_value, $meta_value ) ) {
1040
+ $_return_value = WPGlobus_Core::text_filter( $_meta_value, WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
1041
+ break;
1042
+ }
1043
+ }
1044
+
1045
+ return $_return_value;
1046
+ }
1047
+
1048
+ /**
1049
+ * Get `_yoast_wpseo_metadesc`, `_yoast_wpseo_focuskw` meta.
1050
+ *
1051
+ * @scope both
1052
+ * @since 2.4
1053
+ * @since 2.4.6 Separate the defining of post type for frontend and admin.
1054
+ * @since 2.4.14 Revised code.
1055
+ */
1056
+ protected static function get_wpseo_meta() {
1057
+
1058
+ /** @global wpdb $wpdb */
1059
+ global $wpdb;
1060
+
1061
+ /** @global WP_Post $post */
1062
+ global $post;
1063
+
1064
+ $post_id = false;
1065
+
1066
+ if ( is_admin() ) {
1067
+
1068
+ /**
1069
+ * Admin.
1070
+ */
1071
+ if ( ! empty( $_GET['post'] ) ) {
1072
+ $post_id = sanitize_text_field( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
1073
+ }
1074
+
1075
+ } else {
1076
+
1077
+ if ( $post instanceof WP_Post ) {
1078
+
1079
+ /**
1080
+ * Front-end.
1081
+ */
1082
+ $post_id = $post->ID;
1083
+
1084
+ }
1085
+ }
1086
+
1087
+ if ( $post_id ) {
1088
+
1089
+ $query = $wpdb->prepare(
1090
+ "SELECT p.ID, p.post_type, pm.meta_key, pm.meta_value FROM {$wpdb->prefix}posts AS p JOIN {$wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id WHERE p.ID = %s AND (pm.meta_key = %s OR pm.meta_key = %s)",
1091
+ $post_id,
1092
+ '_yoast_wpseo_metadesc',
1093
+ '_yoast_wpseo_focuskw'
1094
+ );
1095
+
1096
+ $metas = $wpdb->get_results( $query, ARRAY_A );
1097
+
1098
+ if ( ! empty( $metas ) ) {
1099
+ foreach( $metas as $_meta ) {
1100
+ if ( ! isset( self::$wpseo_meta[ $_meta['meta_key'] ] ) ) {
1101
+ self::$wpseo_meta[ $_meta['meta_key'] ] = array();
1102
+ }
1103
+ self::$wpseo_meta[ $_meta['meta_key'] ][ $_meta['ID'] ] = $_meta['meta_value'];
1104
+ }
1105
+ }
1106
+ } else {
1107
+ // Here we can add code to get meta for multiple posts.
1108
+ }
1109
+ }
1110
+
1111
+ /**
1112
+ * Get taxonomy meta from `wpseo_taxonomy_meta` option.
1113
+ *
1114
+ * @since 2.5.1
1115
+ * @since 2.5.22 Added $meta_key parameter to the `get_taxonomy_meta` function.
1116
+ * @scope front
1117
+ *
1118
+ * @param string $object_sub_type The Indexable Object sub type.
1119
+ * @param string $object_id The object ID.
1120
+ * @param Indexable_Presentation $meta_key The WPSEO meta key.
1121
+ *
1122
+ * return string | array
1123
+ */
1124
+ protected static function get_taxonomy_meta( $object_sub_type, $object_id, $meta_key = '' ) {
1125
+
1126
+ if ( is_null( self::$wpseo_taxonomy_meta ) ) {
1127
+ self::$wpseo_taxonomy_meta = get_option( 'wpseo_taxonomy_meta' );
1128
+ }
1129
+
1130
+ if ( empty( self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ] ) ) {
1131
+ return '';
1132
+ }
1133
+
1134
+ if ( empty( $meta_key ) ) {
1135
+ return self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ];
1136
+ }
1137
+
1138
+ if ( empty( self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ][ $meta_key ] ) ) {
1139
+ return '';
1140
+ }
1141
+
1142
+ $meta_value = WPGlobus_Core::text_filter(
1143
+ self::$wpseo_taxonomy_meta[ $object_sub_type ][ $object_id ][ $meta_key ],
1144
+ WPGlobus::Config()->language,
1145
+ WPGlobus::RETURN_EMPTY
1146
+ );
1147
+
1148
+ return $meta_value;
1149
+ }
1150
+
1151
+ /**
1152
+ * Enqueue JS for YoastSEO support.
1153
+ *
1154
+ * @since 1.4.0
1155
+ * @since 2.2.20
1156
+ * @since 2.4.5 Add JS script on dashboard.
1157
+ */
1158
+ public static function action__admin_print_scripts() {
1159
+
1160
+ if ( WPGlobus_WP::is_pagenow( 'admin.php' ) ) {
1161
+
1162
+ if ( 'wpseo_tools' == WPGlobus_Utils::safe_get('page') && 'bulk-editor' == WPGlobus_Utils::safe_get('tool') ) {
1163
+
1164
+ $wrng1 = '<div>' . esc_html__( 'Bulk editing of the multilingual titles and descriptions is not supported by the current version.', 'wpglobus' ) . '</div>';
1165
+ $wrng2 = '<div>' . esc_html__( 'Therefore, to avoid any data loss, we do not recommend using this.', 'wpglobus' ) . '</div>';
1166
+
1167
+ $i18n = array(
1168
+ 'preWarning' => esc_html__( 'WPGlobus warning: ', 'wpglobus' ),
1169
+ 'bulkEditorWarning' => $wrng1 . $wrng2,
1170
+ );
1171
+
1172
+ $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-yoastseo-dashboard' . WPGlobus::SCRIPT_SUFFIX() . '.js';
1173
+
1174
+ wp_register_script(
1175
+ self::$handle_script_dashboard,
1176
+ $src,
1177
+ array( 'jquery' ),
1178
+ WPGLOBUS_VERSION,
1179
+ true
1180
+ );
1181
+
1182
+ wp_enqueue_script(self::$handle_script_dashboard);
1183
+
1184
+ wp_localize_script(
1185
+ self::$handle_script_dashboard,
1186
+ 'WPGlobusYoastSeoDashboard',
1187
+ array(
1188
+ 'version' => WPGLOBUS_VERSION,
1189
+ 'wpseo_version' => WPSEO_VERSION,
1190
+ 'pagenow' => 'admin.php',
1191
+ 'page' => WPGlobus_Utils::safe_get('page'),
1192
+ 'tool' => WPGlobus_Utils::safe_get('tool'),
1193
+ 'i18n' => $i18n
1194
+ )
1195
+ );
1196
+
1197
+ return;
1198
+ }
1199
+ }
1200
+
1201
+ if ( 'off' === WPGlobus::Config()->toggle ) {
1202
+ return;
1203
+ }
1204
+
1205
+ if ( self::disabled_entity() ) {
1206
+ return;
1207
+ }
1208
+
1209
+ /** @global string $pagenow */
1210
+ global $pagenow;
1211
+
1212
+ $enabled_pages = array(
1213
+ 'post.php',
1214
+ 'post-new.php',
1215
+ 'edit-tags.php',
1216
+ 'term.php'
1217
+ );
1218
+
1219
+ if ( WPGlobus_WP::is_pagenow( $enabled_pages ) ) {
1220
+
1221
+ WPGlobus::O()->vendors_scripts['WPSEO'] = true;
1222
+
1223
+ if ( defined( 'WPSEO_PREMIUM_PLUGIN_FILE' ) ) {
1224
+ /**
1225
+ * @see wordpress-seo-premium\wp-seo-premium.php
1226
+ */
1227
+ WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] = true;
1228
+ }
1229
+
1230
+ $yoastseo_plus_readability_access = '';
1231
+ $yoastseo_plus_readability_inactive = '';
1232
+
1233
+ $yoastseo_plus_page_analysis_access = '';
1234
+ $yoastseo_plus_page_analysis_inactive = '';
1235
+
1236
+ $yoastseo_plus_meta_keywords_access = '';
1237
+ $yoastseo_plus_meta_keywords_inactive = '';
1238
+
1239
+ $yoastseo_plus_social_access = '';
1240
+ $yoastseo_plus_social_inactive = '';
1241
+
1242
+ if ( WPGlobus::Config()->builder->is_builder_page() ) {
1243
+
1244
+ $_url = '#';
1245
+ if ( class_exists('WPGlobusPlus') ) {
1246
+ /**
1247
+ * @see wpglobus-plus\includes\wpglobus-plus-main.php
1248
+ */
1249
+ $_url = add_query_arg(
1250
+ array(
1251
+ 'page' => 'wpglobus-plus-options'
1252
+ ),
1253
+ admin_url('admin.php')
1254
+ );
1255
+ }
1256
+
1257
+ $yoastseo_plus_readability_access = sprintf(
1258
+ esc_html__( 'Please see %1s to get access to Analysis results in %2s with YoastSEO.', '' ),
1259
+ '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1260
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1261
+ );
1262
+ $yoastseo_plus_readability_inactive = sprintf(
1263
+ esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Analysis results in %3s with YoastSEO.', '' ),
1264
+ '<a href="'.$_url.'">',
1265
+ '</a>',
1266
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1267
+ );
1268
+
1269
+ $yoastseo_plus_page_analysis_access = sprintf(
1270
+ esc_html__( 'Please see %1s to get access to Analysis results in %2s with YoastSEO.', '' ),
1271
+ '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1272
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1273
+ );
1274
+ $yoastseo_plus_page_analysis_inactive = sprintf(
1275
+ esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Analysis results in %3s with YoastSEO.', '' ),
1276
+ '<a href="'.$_url.'">',
1277
+ '</a>',
1278
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1279
+ );
1280
+
1281
+ $yoastseo_plus_meta_keywords_access = sprintf(
1282
+ esc_html__( 'Please see %1s to get access to Focus keyphrase in %2s with YoastSEO.', '' ),
1283
+ '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1284
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1285
+ );
1286
+ $yoastseo_plus_meta_keywords_inactive = sprintf(
1287
+ esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Focus keyphrase in %1s with YoastSEO.', '' ),
1288
+ '<a href="'.$_url.'">',
1289
+ '</a>',
1290
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1291
+ );
1292
+
1293
+ $yoastseo_plus_social_access = sprintf(
1294
+ esc_html__( 'Please see %1s to get access to Social Tab content in %2s with YoastSEO.', '' ),
1295
+ '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>',
1296
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1297
+ );
1298
+ $yoastseo_plus_social_inactive = sprintf(
1299
+ esc_html__( 'Please activate %1sYoast SEO Plus%2s module to get access to Social Tab content in %1s with YoastSEO.', '' ),
1300
+ '<a href="'.$_url.'">',
1301
+ '</a>',
1302
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->builder->get_language() ]
1303
+ );
1304
+ }
1305
+
1306
+ $i18n = array(
1307
+ 'yoastseo_plus_readability_access' => $yoastseo_plus_readability_access,
1308
+ 'yoastseo_plus_readability_inactive' => $yoastseo_plus_readability_inactive,
1309
+ 'yoastseo_plus_page_analysis_access' => $yoastseo_plus_page_analysis_access,
1310
+ 'yoastseo_plus_page_analysis_inactive' => $yoastseo_plus_page_analysis_inactive,
1311
+ 'yoastseo_plus_meta_keywords_access' => $yoastseo_plus_meta_keywords_access,
1312
+ 'yoastseo_plus_meta_keywords_inactive' => $yoastseo_plus_meta_keywords_inactive,
1313
+ 'yoastseo_plus_social_access' => $yoastseo_plus_social_access,
1314
+ 'yoastseo_plus_social_inactive' => $yoastseo_plus_social_inactive
1315
+ );
1316
+
1317
+ $src_version = false;
1318
+ $src_version_premium = false;
1319
+
1320
+ if ( ! WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] ) {
1321
+
1322
+ /** @noinspection PhpInternalEntityUsedInspection */
1323
+ $src_version = version_compare( WPSEO_VERSION, '4.0', '>=' ) ? '40' : $src_version;
1324
+ /** @noinspection PhpInternalEntityUsedInspection */
1325
+ $src_version = version_compare( WPSEO_VERSION, '4.1', '>=' ) ? '41' : $src_version;
1326
+ /** @noinspection PhpInternalEntityUsedInspection */
1327
+ $src_version = version_compare( WPSEO_VERSION, '4.4', '>=' ) ? '44' : $src_version;
1328
+ if (
1329
+ /** @noinspection PhpInternalEntityUsedInspection */
1330
+ version_compare( WPSEO_VERSION, '4.8', '>=' )
1331
+ ) {
1332
+ $src_version = self::$version;
1333
+ }
1334
+
1335
+ } else {
1336
+ /**
1337
+ * Start with Yoast SEO Premium.
1338
+ */
1339
+
1340
+ /**
1341
+ * Version of file yoast seo must be latest.
1342
+ */
1343
+ /** @noinspection PhpInternalEntityUsedInspection */
1344
+ $src_version = version_compare( WPSEO_VERSION, '3.9', '>=' ) ? self::$version : $src_version;
1345
+ /** @noinspection PhpInternalEntityUsedInspection */
1346
+ $src_version_premium = version_compare( WPSEO_VERSION, '3.9', '>=' ) ? '39' : $src_version_premium;
1347
+ /**
1348
+ * @since WPGlobus 2.2.17
1349
+ */
1350
+ $src_version_premium = version_compare( WPSEO_VERSION, '12.0', '>=' ) ? $src_version : $src_version_premium;
1351
+
1352
+ }
1353
+
1354
+ if ( $src_version ) :
1355
+
1356
+ $handle = self::$handle_script;
1357
+
1358
+ $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/' .
1359
+ $handle . '-' . $src_version .
1360
+ WPGlobus::SCRIPT_SUFFIX() . '.js';
1361
+
1362
+ wp_register_script(
1363
+ $handle,
1364
+ $src,
1365
+ array( 'jquery', 'underscore' ),
1366
+ WPGLOBUS_VERSION,
1367
+ true
1368
+ );
1369
+
1370
+ wp_enqueue_script($handle);
1371
+
1372
+ wp_localize_script(
1373
+ $handle,
1374
+ 'WPGlobusYoastSeo',
1375
+ array(
1376
+ 'version' => WPGLOBUS_VERSION,
1377
+ 'wpseo_version' => WPSEO_VERSION,
1378
+ 'src_version' => $src_version,
1379
+ 'builder_id' => WPGlobus::Config()->builder->get('id'),
1380
+ 'builder_page' => WPGlobus::Config()->builder->is_builder_page() ? 'true' : 'false',
1381
+ 'language' => WPGlobus::Config()->builder->get_language(),
1382
+ 'is_default_language' => WPGlobus::Config()->builder->is_default_language() ? true : false,
1383
+ 'src_version_premium' => $src_version_premium,
1384
+ 'plus_module' => self::$plus_module,
1385
+ 'access_extra' => ( defined( 'WPGLOBUS_YOAST_SEO_ACCESS_EXTRA' ) && WPGLOBUS_YOAST_SEO_ACCESS_EXTRA ) ? 'true' : 'false'
1386
+ )
1387
+ );
1388
+
1389
+ wp_localize_script(
1390
+ $handle,
1391
+ 'WPGlobusVendor',
1392
+ array(
1393
+ 'version' => WPGLOBUS_VERSION,
1394
+ 'vendor' => WPGlobus::O()->vendors_scripts,
1395
+ 'pagenow' => $pagenow,
1396
+ 'i18n' => $i18n
1397
+ )
1398
+ );
1399
+
1400
+ endif;
1401
+ }
1402
+ }
1403
+
1404
+ /**
1405
+ * Check disabled entity.
1406
+ *
1407
+ * @since 1.7.3
1408
+ * @return boolean
1409
+ */
1410
+ public static function disabled_entity() {
1411
+
1412
+ if ( WPGlobus_WP::is_pagenow( array( 'edit-tags.php', 'term.php' ) ) ) :
1413
+ /**
1414
+ * Don't check page when editing taxonomy.
1415
+ */
1416
+ return false;
1417
+ endif;
1418
+
1419
+ /** @global WP_Post $post */
1420
+ global $post;
1421
+
1422
+ $result = false;
1423
+ if ( WPGlobus_WP::is_pagenow( array( 'post.php', 'post-new.php' ) ) ) :
1424
+ if ( empty( $post ) ) {
1425
+ $result = true;
1426
+ } elseif ( WPGlobus::O()->disabled_entity( $post->post_type ) ) {
1427
+ $result = true;
1428
+ }
1429
+ endif;
1430
+ return $result;
1431
+ }
1432
+
1433
+ /**
1434
+ * Filter allows changing graph breadcrumb output.
1435
+ *
1436
+ * @see wordpress-seo\src\generators\schema-generator.php
1437
+ * @see "application/ld+json" in html code on front.
1438
+ *
1439
+ * @since 2.4.7
1440
+ *
1441
+ * @scope front
1442
+ * @param array $graph_piece Array of graph piece.
1443
+ * @param Meta_Tags_Context $context A value object with context variables.
1444
+ * @return array
1445
+ */
1446
+ public static function filter__wpseo_schema_breadcrumb( $graph_piece, $context ) {
1447
+
1448
+ if ( empty( $graph_piece['itemListElement'] ) ) {
1449
+ return $graph_piece;
1450
+ }
1451
+
1452
+ $itemListElement = $graph_piece['itemListElement'];
1453
+
1454
+ foreach( $itemListElement as $_key=>$_item ) {
1455
+ if ( ! empty( $_item['item']['name'] ) && WPGlobus_Core::has_translations( $_item['item']['name'] ) ) {
1456
+ $graph_piece['itemListElement'][$_key]['item']['name'] = WPGlobus_Core::extract_text( $graph_piece['itemListElement'][$_key]['item']['name'], WPGlobus::Config()->language );
1457
+ }
1458
+ }
1459
+
1460
+ return $graph_piece;
1461
+ }
1462
+
1463
+ /**
1464
+ * Filter allows changing output of graph `webpage`.
1465
+ *
1466
+ * @see wordpress-seo\src\generators\schema-generator.php
1467
+ * @see "application/ld+json" in html code on front.
1468
+ *
1469
+ * @since 2.4.14
1470
+ * @since 2.4.15 Localize description.
1471
+ * @since 2.5.1 Added support of taxonomies.
1472
+ *
1473
+ * @scope front
1474
+ * @param array $graph_piece Array of graph piece.
1475
+ * @param Meta_Tags_Context $context A value object with context variables.
1476
+ * @return array
1477
+ */
1478
+ public static function filter__wpseo_schema_webpage( $graph_piece, $context ) {
1479
+
1480
+ if ( 'post' == $context->indexable->object_type ) {
1481
+
1482
+ if ( ! empty( $graph_piece['name'] ) && WPGlobus_Core::has_translations( $graph_piece['name'] ) ) {
1483
+ $graph_piece['name'] = WPGlobus_Core::extract_text( $graph_piece['name'], WPGlobus::Config()->language );
1484
+ }
1485
+
1486
+ /**
1487
+ * @since 2.4.15
1488
+ */
1489
+ if ( ! empty( $graph_piece['description'] ) && WPGlobus_Core::has_translations( $graph_piece['description'] ) ) {
1490
+ $graph_piece['description'] = WPGlobus_Core::extract_text( $graph_piece['description'], WPGlobus::Config()->language );
1491
+ }
1492
+
1493
+ } elseif ( 'term' == $context->indexable->object_type ) {
1494
+
1495
+ /**
1496
+ * Taxonomy.
1497
+ * @since 2.5.1
1498
+ */
1499
+ $graph_piece['description'] = self::get_taxonomy_meta( $context->indexable->object_sub_type, $context->indexable->object_id, 'wpseo_desc' );
1500
+ $graph_piece['url'] = WPGlobus_Utils::localize_url( $graph_piece['url'], WPGlobus::Config()->language );
1501
+ $graph_piece['@id'] = WPGlobus_Utils::localize_url( $graph_piece['@id'], WPGlobus::Config()->language );
1502
+ $graph_piece['breadcrumb']['@id'] = WPGlobus_Utils::localize_url( $graph_piece['breadcrumb']['@id'], WPGlobus::Config()->language );
1503
+ }
1504
+
1505
+ return $graph_piece;
1506
+ }
1507
+
1508
+ /**
1509
+ * Filter for changing the Yoast SEO generated title.
1510
+ *
1511
+ * @see wordpress-seo\src\presenters\title-presenter.php
1512
+ *
1513
+ * @since 2.5.22
1514
+ *
1515
+ * @scope front
1516
+ *
1517
+ * @param string $title The title.
1518
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
1519
+ *
1520
+ * @return string
1521
+ */
1522
+ public static function filter_front__title( $title, $presentation ) {
1523
+
1524
+ if ( 'post' == $presentation->model->object_type ) {
1525
+
1526
+ /**
1527
+ * Post.
1528
+ */
1529
+ $meta_cache = wp_cache_get( $presentation->model->object_id, 'post_meta' );
1530
+
1531
+ if ( ! empty( $meta_cache['_yoast_wpseo_title'][0] ) ) {
1532
+
1533
+ $__title = WPGlobus_Core::text_filter( $meta_cache['_yoast_wpseo_title'][0], WPGlobus::Config()->language );
1534
+
1535
+ if ( $presentation->source instanceof WP_Post ) {
1536
+
1537
+ if ( WPGlobus_Core::has_translations( $presentation->source->post_title ) ) {
1538
+ $presentation->source->post_title = WPGlobus_Core::text_filter( $presentation->source->post_title, WPGlobus::Config()->language );
1539
+ }
1540
+
1541
+ /**
1542
+ * @see wordpress-seo\inc\wpseo-functions.php
1543
+ */
1544
+ $title = wpseo_replace_vars( $__title, $presentation->source );
1545
+ }
1546
+
1547
+ } else {
1548
+
1549
+ /**
1550
+ * @since 2.5.23
1551
+ */
1552
+ if ( WPGlobus_Core::has_translations( $title ) ) {
1553
+ $title = WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
1554
+ }
1555
+
1556
+ }
1557
+
1558
+ } elseif ( 'term' == $presentation->model->object_type ) {
1559
+
1560
+ /**
1561
+ * Taxonomy.
1562
+ */
1563
+ $__title = self::get_taxonomy_meta( $presentation->model->object_sub_type, $presentation->model->object_id, 'wpseo_title' );
1564
+
1565
+ if ( empty( $__title ) ) {
1566
+ $__title = self::get_option( 'wpseo_titles', 'title-tax-' . $presentation->model->object_sub_type );
1567
+ }
1568
+
1569
+ $title = wpseo_replace_vars( $__title, $presentation->source );
1570
+
1571
+ }
1572
+
1573
+ return $title;
1574
+ }
1575
+
1576
+ /**
1577
+ * Get wpseo options.
1578
+ *
1579
+ * @since 2.5.22
1580
+ *
1581
+ * @return array|string
1582
+ */
1583
+ public static function get_option( $option = 'wpseo_titles', $key = '' ) {
1584
+
1585
+ /**
1586
+ * @todo Maybe to use WPSEO_Options.
1587
+ * @see wordpress-seo\inc\options\class-wpseo-options.php
1588
+ * @since 2.5.22
1589
+ */
1590
+
1591
+ $options = get_option( $option );
1592
+
1593
+ if ( empty( $key ) ) {
1594
+ return $options;
1595
+ }
1596
+
1597
+ if ( ! isset( $options[$key] ) ) {
1598
+ return null;
1599
+ }
1600
+
1601
+ return $options[$key];
1602
+ }
1603
+
1604
+ } // class WPGlobus_YoastSEO.
1605
+
1606
  # --- EOF
languages/wpglobus.pot CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (C) 2021 WPGlobus 2.6.2
2
- # This file is distributed under the same license as the WPGlobus 2.6.2 package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPGlobus 2.6.2\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
1
+ # Copyright (C) 2021 WPGlobus 2.6.3
2
+ # This file is distributed under the same license as the WPGlobus 2.6.3 package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPGlobus 2.6.3\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
readme.txt CHANGED
@@ -217,6 +217,10 @@ WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.
217
 
218
  == Changelog ==
219
 
 
 
 
 
220
  = 2.6.2 =
221
  * (Core) Added `wpglobus_show_title_fields` filter.
222
  * (Core/Post Types) Added the `Ultimate Member` plugin post types to the `"hidden types"` list.
217
 
218
  == Changelog ==
219
 
220
+ = 2.6.3 =
221
+ * (Vendor/Yoast) Fixed issue with empty Open Graph description.
222
+ * (Updater) Missing assets in the ZIP file.
223
+
224
  = 2.6.2 =
225
  * (Core) Added `wpglobus_show_title_fields` filter.
226
  * (Core/Post Types) Added the `Ultimate Member` plugin post types to the `"hidden types"` list.
vendor/tivwp/updater/assets/css/fix-info-sections.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ #section-holder .section h2 {
2
+ clear: none;
3
+ }
4
+
5
+ #section-holder .section img {
6
+ max-width: 100%
7
+ }
vendor/tivwp/updater/assets/css/tivwp-updater.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tivwp-updater-status-value {
2
+ font-weight: 700;
3
+ }
4
+
5
+ .tivwp-updater-status-inactive .tivwp-updater-status-value {
6
+ color: #cc0000;
7
+ background-color: #ffffff;
8
+ }
9
+
10
+ .tivwp-updater-instance,
11
+ .tivwp-updater-notifications {
12
+ opacity: .6;
13
+ }
14
+
15
+ input[id$='_licence_key'] {
16
+ min-width: 23em;
17
+ font-family: monospace;
18
+ }
vendor/tivwp/updater/assets/js/tivwp-updater.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ jQuery(function ($) {
2
+ $('.tivwp-updater-action-button').on("click", function () {
3
+ // noinspection ES6ConvertVarToLetConst
4
+ var dataPlugin = $(this).data('tivwp-updater-plugin');
5
+ $(this).css({cursor: "wait", opacity: ".3"});
6
+ $('input[type="checkbox"]').prop("checked", false);
7
+ $('tr[data-plugin="' + dataPlugin + '"]').find('input[type="checkbox"]').prop("checked", true);
8
+ })
9
+ });
wpglobus.php CHANGED
@@ -15,7 +15,7 @@
15
  * Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
16
  * Text Domain: wpglobus
17
  * Domain Path: /languages/
18
- * Version: 2.6.2
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
@@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
44
  exit;
45
  }
46
 
47
- define( 'WPGLOBUS_VERSION', '2.6.2' );
48
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
49
  define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
50
 
15
  * Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
16
  * Text Domain: wpglobus
17
  * Domain Path: /languages/
18
+ * Version: 2.6.3
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
44
  exit;
45
  }
46
 
47
+ define( 'WPGLOBUS_VERSION', '2.6.3' );
48
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
49
  define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
50