WPGlobus – Multilingual Everything! - Version 2.7.14

Version Description

  • (Vendor/Yoast) Fixed incorrect meta description output in some situations.
  • (Vendor/Yoast) Additional multilingual filters.
Download this release

Release Info

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

Code changes from version 2.7.13 to 2.7.14

includes/vendor/yoast-seo/class-wpglobus-yoastseo140.php CHANGED
@@ -234,10 +234,104 @@ class WPGlobus_YoastSEO {
234
  /**
235
  * @since 2.7.7
236
  */
237
- add_filter( 'option_wpseo_titles', array( __CLASS__, 'filter__wpseo_titles' ), 5, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
 
239
  }
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  /**
242
  * Filter "application/ld+json".
243
  * @since 2.7.4
@@ -753,6 +847,13 @@ class WPGlobus_YoastSEO {
753
  */
754
  $description = self::get_meta( '_yoast_wpseo_metadesc', $meta_description, $presentation->source );
755
 
 
 
 
 
 
 
 
756
  } else if ( 'term' == $presentation->model->object_type ) {
757
 
758
  /**
@@ -1097,12 +1198,22 @@ class WPGlobus_YoastSEO {
1097
  */
1098
  protected static function get_meta( $meta_key, $meta_value = '', $presentation_source = null ) {
1099
 
 
 
 
 
 
1100
  if ( is_null(self::$wpseo_meta) ) {
1101
  self::get_wpseo_meta();
1102
  }
1103
 
1104
  if ( empty( self::$wpseo_meta[ $meta_key ] ) ) {
1105
- return '';
 
 
 
 
 
1106
  }
1107
 
1108
  /** @global WP_Post $post */
@@ -1114,7 +1225,8 @@ class WPGlobus_YoastSEO {
1114
  if ( empty( self::$wpseo_meta[$meta_key][$presentation_source->ID] ) ) {
1115
  return '';
1116
  }
1117
- return WPGlobus_Core::text_filter( self::$wpseo_meta[$meta_key][$presentation_source->ID], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
 
1118
  }
1119
 
1120
  /**
@@ -1126,8 +1238,9 @@ class WPGlobus_YoastSEO {
1126
  if ( empty( self::$wpseo_meta[$meta_key][$post->ID] ) ) {
1127
  return '';
1128
  }
1129
-
1130
- return WPGlobus_Core::text_filter( self::$wpseo_meta[$meta_key][$post->ID], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
 
1131
  }
1132
 
1133
  $_return_value = '';
@@ -1140,7 +1253,8 @@ class WPGlobus_YoastSEO {
1140
  }
1141
 
1142
  if ( false !== strpos( $_meta_value, $meta_value ) ) {
1143
- $_return_value = WPGlobus_Core::text_filter( $_meta_value, WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
 
1144
  break;
1145
  }
1146
  }
@@ -1726,4 +1840,4 @@ class WPGlobus_YoastSEO {
1726
 
1727
  } // class WPGlobus_YoastSEO.
1728
 
1729
- # --- EOF
234
  /**
235
  * @since 2.7.7
236
  */
237
+ add_filter( 'option_wpseo_titles', array( __CLASS__, 'filter__wpseo_titles' ), 5, 2 );
238
+
239
+ /**
240
+ * @since 2.7.14
241
+ */
242
+ add_filter( 'wpseo_replacements', array( __CLASS__, 'filter__wpseo_replacements' ), 0, 2 );
243
+
244
+ /**
245
+ * @since 2.7.14
246
+ */
247
+ add_filter( 'wpseo_enhanced_slack_data', array( __CLASS__, 'filter__wpseo_enhanced_slack_data' ), 5, 2 );
248
+
249
+ /**
250
+ * @since 2.7.14
251
+ */
252
+ add_filter( 'wpseo_schema_person', array( __CLASS__, 'filter__wpseo_schema_person' ), 5, 4 );
253
+
254
+ /**
255
+ * @since 2.7.14
256
+ * @todo Add filters like "get_the_author_{$field}" to controller, @see wp-includes\author-template.php
257
+ */
258
+ add_filter( 'get_the_author_display_name', array( 'WPGlobus_Filters', 'filter__text' ), 5 );
259
+ add_filter( 'get_the_author_description', array( 'WPGlobus_Filters', 'filter__text' ), 5 );
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Filter: 'wpseo_schema_<type>' - Allows changing graph piece output by @type.
265
+ * @see wordpress-seo\src\generators\schema-generator.php
266
+ *
267
+ * @since 2.7.14
268
+ *
269
+ * @param array $graph_piece The graph piece to filter.
270
+ * @param Meta_Tags_Context $context A value object with context variables.
271
+ * @param Abstract_Schema_Piece $graph_piece_generator A value object with context variables.
272
+ * @param Abstract_Schema_Piece[] $graph_piece_generators A value object with context variables.
273
+ */
274
+ public static function filter__wpseo_schema_person( $graph_piece, $context, $graph_piece_generator, $graph_piece_generators ) {
275
+
276
+ $keys = array( 'name', 'description' );
277
+ foreach( $keys as $_key ) {
278
+ if ( WPGlobus_Core::has_translations( $graph_piece[$_key] ) ) {
279
+ $graph_piece[$_key] = WPGlobus_Core::extract_text( $graph_piece[$_key], WPGlobus::Config()->language );
280
+ }
281
+ }
282
+
283
+ $image_keys = array( 'caption' );
284
+ foreach( $image_keys as $_key ) {
285
+ if ( WPGlobus_Core::has_translations( $graph_piece['image'][$_key] ) ) {
286
+ $graph_piece['image'][$_key] = WPGlobus_Core::extract_text( $graph_piece['image'][$_key], WPGlobus::Config()->language );
287
+ }
288
+ }
289
+ return $graph_piece;
290
+ }
291
+
292
+ /**
293
+ * Filter: 'wpseo_enhanced_slack_data' - Allows filtering of the enhanced data for sharing on Slack.
294
+ * @see wordpress-seo\src\presenters\slack\enhanced-data-presenter.php
295
+ *
296
+ * @since 2.7.14
297
+ *
298
+ * @param array $data The enhanced Slack sharing data.
299
+ * @param Indexable_Presentation $presentation The presentation of an indexable.
300
+ */
301
+ public static function filter__wpseo_enhanced_slack_data( $data, $presentation ) {
302
+ foreach( $data as $_key=>$_value ) {
303
+ if ( WPGlobus_Core::has_translations($_value) ) {
304
+ $data[$_key] = WPGlobus_Core::extract_text( $_value, WPGlobus::Config()->language );
305
+ }
306
  }
307
+ return $data;
308
  }
309
 
310
+ /**
311
+ * Customization of the replacements before they are applied.
312
+ *
313
+ * @since 2.7.14
314
+ *
315
+ * @param array $replacements The replacements.
316
+ * @param array $args The object some of the replacement values might come from,
317
+ * could be a post, taxonomy or term.
318
+ */
319
+ public static function filter__wpseo_replacements( $replacements, $args ) {
320
+
321
+ if ( empty( $replacements ) ) {
322
+ return $replacements;
323
+ }
324
+
325
+ $replacements = (array) $replacements;
326
+
327
+ foreach ( $replacements as &$replacement ) {
328
+ $replacement = WPGlobus_Core::extract_text( $replacement );
329
+ }
330
+
331
+ return $replacements;
332
+ }
333
+
334
+
335
  /**
336
  * Filter "application/ld+json".
337
  * @since 2.7.4
847
  */
848
  $description = self::get_meta( '_yoast_wpseo_metadesc', $meta_description, $presentation->source );
849
 
850
+ /**
851
+ * @since 2.7.14
852
+ */
853
+ if ( ! empty($description) ) {
854
+ $description = wpseo_replace_vars( $description, $presentation->source );
855
+ }
856
+
857
  } else if ( 'term' == $presentation->model->object_type ) {
858
 
859
  /**
1198
  */
1199
  protected static function get_meta( $meta_key, $meta_value = '', $presentation_source = null ) {
1200
 
1201
+ // TODO: Test it!
1202
+ if ( ! empty( $meta_value ) ) {
1203
+ return WPGlobus_Core::extract_text( $meta_value );
1204
+ }
1205
+
1206
  if ( is_null(self::$wpseo_meta) ) {
1207
  self::get_wpseo_meta();
1208
  }
1209
 
1210
  if ( empty( self::$wpseo_meta[ $meta_key ] ) ) {
1211
+ // TODO: Test it!
1212
+ if ( ! empty( $presentation_source->ID ) ) {
1213
+ self::$wpseo_meta[ $meta_key ][ $presentation_source->ID ] = $meta_value;
1214
+ } else {
1215
+ return '';
1216
+ }
1217
  }
1218
 
1219
  /** @global WP_Post $post */
1225
  if ( empty( self::$wpseo_meta[$meta_key][$presentation_source->ID] ) ) {
1226
  return '';
1227
  }
1228
+ // TODO: Test it!
1229
+ return WPGlobus_Core::extract_text( self::$wpseo_meta[$meta_key][$presentation_source->ID] );
1230
  }
1231
 
1232
  /**
1238
  if ( empty( self::$wpseo_meta[$meta_key][$post->ID] ) ) {
1239
  return '';
1240
  }
1241
+
1242
+ // TODO: Test it!
1243
+ return WPGlobus_Core::extract_text( self::$wpseo_meta[$meta_key][$post->ID] );
1244
  }
1245
 
1246
  $_return_value = '';
1253
  }
1254
 
1255
  if ( false !== strpos( $_meta_value, $meta_value ) ) {
1256
+ // TODO: Test it!
1257
+ $_return_value = WPGlobus_Core::extract_text( $_meta_value );
1258
  break;
1259
  }
1260
  }
1840
 
1841
  } // class WPGlobus_YoastSEO.
1842
 
1843
+ # --- EOF
readme.txt CHANGED
@@ -220,6 +220,10 @@ WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.
220
 
221
  == Changelog ==
222
 
 
 
 
 
223
  = 2.7.13 =
224
  * (Vendor/Yoast) Init `TinyMCE` description editor on the `term.php` page.
225
  * (Vendor/Yoast) Fixed incorrect rewriting taxonomy metas during the update process.
@@ -234,12 +238,6 @@ WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.
234
  = 2.7.10 =
235
  * (Vendor/Yoast) Fixed an issue with using variables in post descriptions.
236
 
237
- = 2.7.9 =
238
- * (Vendor/ACF) Added the current language name for the ACF fields metabox in the Builder mode.
239
- * (Vendor/ACF) Added filtering of the field array before it is updated.
240
- * (Core) Added language switcher to the admin bar for the posts in the Builder mode.
241
- * (POMO) Ukrainian translations completed (thanks go to Jack Willson)
242
-
243
  == Demo Sites ==
244
 
245
  * [WPGlobus.com](https://wpglobus.com/):
220
 
221
  == Changelog ==
222
 
223
+ = 2.7.14 =
224
+ * (Vendor/Yoast) Fixed incorrect meta description output in some situations.
225
+ * (Vendor/Yoast) Additional multilingual filters.
226
+
227
  = 2.7.13 =
228
  * (Vendor/Yoast) Init `TinyMCE` description editor on the `term.php` page.
229
  * (Vendor/Yoast) Fixed incorrect rewriting taxonomy metas during the update process.
238
  = 2.7.10 =
239
  * (Vendor/Yoast) Fixed an issue with using variables in post descriptions.
240
 
 
 
 
 
 
 
241
  == Demo Sites ==
242
 
243
  * [WPGlobus.com](https://wpglobus.com/):
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.7.13
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.7.13' );
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.7.14
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
44
  exit;
45
  }
46
 
47
+ define( 'WPGLOBUS_VERSION', '2.7.14' );
48
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
49
  define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
50