WPGlobus – Multilingual Everything! - Version 1.9.23

Version Description

  • FIXED:
    • Gutenberg: saving languages correctly when editing pages.
    • ACF: Check the existence of the acf_maybe_get_field function to prevent fatal error in older versions.
Download this release

Release Info

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

Code changes from version 1.9.22 to 1.9.23

includes/admin/meta/class-wpglobus-meta.php CHANGED
@@ -69,7 +69,7 @@ if ( ! class_exists( 'WPGlobus_Meta' ) ) :
69
  * @return WPGlobus_Meta
70
  */
71
  public static function get_instance( $meta_fields, $builder ) {
72
- if ( ! ( self::$instance instanceof self ) ) {
73
  self::$instance = new self( $meta_fields, $builder );
74
  }
75
 
@@ -130,8 +130,9 @@ if ( ! class_exists( 'WPGlobus_Meta' ) ) :
130
  /**
131
  * Don't auto-modify this SQL query.
132
  */
 
133
  $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
134
-
135
  /*
136
  // Incorrect query.
137
  $meta_ids = $wpdb->get_col( $wpdb->prepare(
@@ -401,7 +402,7 @@ if ( ! class_exists( 'WPGlobus_Meta' ) ) :
401
 
402
  if ( WPGlobus_Core::has_translations( $_value ) ) {
403
  $_value = WPGlobus_Core::text_filter( $_value, self::$builder->get_language(), WPGlobus::RETURN_EMPTY );
404
- } elseif( self::$builder->get_language() != WPGlobus::Config()->default_language ) {
405
  $_value = '';
406
  }
407
 
69
  * @return WPGlobus_Meta
70
  */
71
  public static function get_instance( $meta_fields, $builder ) {
72
+ if ( ! ( self::$instance instanceof WPGlobus_Meta ) ) {
73
  self::$instance = new self( $meta_fields, $builder );
74
  }
75
 
130
  /**
131
  * Don't auto-modify this SQL query.
132
  */
133
+ // phpcs:ignore WordPress.WP.PreparedSQL
134
  $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
135
+
136
  /*
137
  // Incorrect query.
138
  $meta_ids = $wpdb->get_col( $wpdb->prepare(
402
 
403
  if ( WPGlobus_Core::has_translations( $_value ) ) {
404
  $_value = WPGlobus_Core::text_filter( $_value, self::$builder->get_language(), WPGlobus::RETURN_EMPTY );
405
+ } elseif ( self::$builder->get_language() !== WPGlobus::Config()->default_language ) {
406
  $_value = '';
407
  }
408
 
includes/builders/class-wpglobus-builders.php CHANGED
@@ -640,7 +640,12 @@ if ( ! class_exists( 'WPGlobus_Builders' ) ) :
640
  */
641
  //$actions = array( 'edit' );
642
  // @todo check 'wp/v2/' in wp.api.versionString (JS).
643
- if ( false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/posts' ) ) {
 
 
 
 
 
644
  $load_gutenberg = true;
645
  }
646
  }
640
  */
641
  //$actions = array( 'edit' );
642
  // @todo check 'wp/v2/' in wp.api.versionString (JS).
643
+
644
+ // /wp-json/wp/v2/posts/
645
+ // /wp-json/wp/v2/pages/
646
+ // @todo check /wp-json/wp/v2/taxonomies?context=edit
647
+ if ( false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/posts' )
648
+ || false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/pages' ) ) {
649
  $load_gutenberg = true;
650
  }
651
  }
includes/builders/class-wpglobus-config-builder.php CHANGED
@@ -262,16 +262,21 @@ if ( ! class_exists( 'WPGlobus_Config_Builder' ) ) :
262
  } elseif ( isset( $_REQUEST['id'] ) && 0 !== (int) $_REQUEST['id'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
263
 
264
  /**
265
- * Case when post in draft status are autosaved.
266
  */
267
  $language = get_post_meta( $_REQUEST['id'], $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
268
 
269
  } elseif ( isset( $_SERVER['REQUEST_URI'] ) ) {
270
-
271
- if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-json/wp/v2/posts/' ) ) {
 
 
 
 
272
  /**
273
  * Case when post status was changed ( draft->publish or publish->draft ) in Gutenberg.
274
- * @see also is_gutenberg() function in includes\builders\class-wpglobus-builders.php
 
275
  */
276
  $_request_uri = explode( '/', $_SERVER['REQUEST_URI'] );
277
 
@@ -280,7 +285,6 @@ if ( ! class_exists( 'WPGlobus_Config_Builder' ) ) :
280
  $language = get_post_meta( $post_id, $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
281
  }
282
  }
283
-
284
  }
285
  }
286
 
@@ -464,22 +468,21 @@ if ( ! class_exists( 'WPGlobus_Config_Builder' ) ) :
464
  return $data;
465
 
466
  }
467
-
468
  /**
469
  * Set multilingual fields.
 
 
470
  */
471
- public function set_multilingual_fields($multilingual_fields) {
472
-
473
  if ( ! isset( $this->attrs ) ) {
474
  return;
475
  }
476
 
477
- if ( is_array($multilingual_fields) && ! empty($multilingual_fields) ) {
478
- $this->attrs['multilingualFields'] = array_merge($this->attrs['multilingualFields'], $multilingual_fields);
479
  }
480
-
481
- return;
482
-
483
  }
484
 
485
  }
262
  } elseif ( isset( $_REQUEST['id'] ) && 0 !== (int) $_REQUEST['id'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
263
 
264
  /**
265
+ * Case when post in draft status is autosaved.
266
  */
267
  $language = get_post_meta( $_REQUEST['id'], $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
268
 
269
  } elseif ( isset( $_SERVER['REQUEST_URI'] ) ) {
270
+
271
+ /**
272
+ * See also the Update action in @see \WPGlobus_Builders
273
+ */
274
+ if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-json/wp/v2/posts/' )
275
+ || false !== strpos( $_SERVER['REQUEST_URI'], '/wp-json/wp/v2/pages/' ) ) {
276
  /**
277
  * Case when post status was changed ( draft->publish or publish->draft ) in Gutenberg.
278
+ *
279
+ * @see \WPGlobus_Builders::is_gutenberg()
280
  */
281
  $_request_uri = explode( '/', $_SERVER['REQUEST_URI'] );
282
 
285
  $language = get_post_meta( $post_id, $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
286
  }
287
  }
 
288
  }
289
  }
290
 
468
  return $data;
469
 
470
  }
471
+
472
  /**
473
  * Set multilingual fields.
474
+ *
475
+ * @param array $multilingual_fields
476
  */
477
+ public function set_multilingual_fields( $multilingual_fields ) {
478
+
479
  if ( ! isset( $this->attrs ) ) {
480
  return;
481
  }
482
 
483
+ if ( is_array( $multilingual_fields ) && ! empty( $multilingual_fields ) ) {
484
+ $this->attrs['multilingualFields'] = array_merge( $this->attrs['multilingualFields'], $multilingual_fields );
485
  }
 
 
 
486
  }
487
 
488
  }
includes/builders/gutenberg/class-wpglobus-gutenberg-update-post.php CHANGED
@@ -40,9 +40,10 @@ if ( ! class_exists( 'WPGlobus_Gutenberg_Update_Post' ) ) :
40
  */
41
 
42
  /**
43
- * @see wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php
44
  */
45
  add_filter( 'rest_pre_insert_post', array( $this, 'filter__pre_insert_post' ), 2, 2 );
 
46
 
47
  /**
48
  * @todo incorrect the saving post in extra languages with priority = 10
@@ -50,7 +51,7 @@ if ( ! class_exists( 'WPGlobus_Gutenberg_Update_Post' ) ) :
50
  add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
51
 
52
  /**
53
- * @see \wp-includes\rest-api\class-wp-rest-server.php
54
  */
55
  add_filter( 'rest_request_after_callbacks', array( $this, 'filter__rest_after_callbacks' ), 10, 3 );
56
 
40
  */
41
 
42
  /**
43
+ * @see \WP_REST_Posts_Controller::prepare_item_for_database
44
  */
45
  add_filter( 'rest_pre_insert_post', array( $this, 'filter__pre_insert_post' ), 2, 2 );
46
+ add_filter( 'rest_pre_insert_page', array( $this, 'filter__pre_insert_post' ), 2, 2 );
47
 
48
  /**
49
  * @todo incorrect the saving post in extra languages with priority = 10
51
  add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
52
 
53
  /**
54
+ * @see \WP_REST_Server::dispatch in \wp-includes\rest-api\class-wp-rest-server.php
55
  */
56
  add_filter( 'rest_request_after_callbacks', array( $this, 'filter__rest_after_callbacks' ), 10, 3 );
57
 
includes/class-wpglobus-config-vendor.php CHANGED
@@ -3,51 +3,53 @@
3
  * Class WPGlobus_Config_Vendor
4
  *
5
  * @package WPGlobus\Config
6
- * @author Alex Gor(alexgff)
7
  */
8
-
9
- if ( ! class_exists('WPGlobus_Config_Vendor') ) :
10
 
11
  class WPGlobus_Config_Vendor {
12
-
13
  const PLUGIN_CONFIG_FILES = 'configs/*.json';
14
-
15
  const PLUGIN_CONFIG_DIR = 'configs/';
16
-
17
  /**
18
  * @var object Instance of this class.
19
  */
20
  protected static $instance;
21
-
22
  protected static $config = array();
23
-
24
  protected static $post_meta_fields = null;
25
-
26
  protected static $post_ml_fields = null;
27
-
28
  protected static $wp_options = null;
29
-
30
  /**
31
  * Builder.
32
  *
33
  * @var WPGlobus_Config_Builder
34
  */
35
  protected static $builder = null;
36
-
37
  /**
38
  * Array of registered vendors.
39
  *
40
  * @var string[]
41
  */
42
  protected static $vendors = array();
43
-
44
  /**
45
  * Constructor.
46
- */
47
- protected function __construct($builder) {
48
-
 
 
49
  self::$builder = $builder;
50
-
51
  self::get_config_files();
52
  self::parse_config();
53
 
@@ -56,246 +58,261 @@ if ( ! class_exists('WPGlobus_Config_Vendor') ) :
56
  /**
57
  * Get instance of this class.
58
  *
59
- * @return object
 
 
60
  */
61
- public static function get_instance($builder) {
62
- if ( ! ( self::$instance instanceof self ) ) {
63
- self::$instance = new self($builder);
64
  }
 
65
  return self::$instance;
66
  }
67
 
68
  /**
69
  * Get meta fields.
70
- */
71
  public static function get_meta_fields() {
72
- if ( is_null(self::$post_meta_fields) ) {
73
  return false;
74
  }
75
- return self::$post_meta_fields;
 
76
  }
77
 
78
  /**
79
  * Get multilingual fields.
80
- */
81
  public static function get_ml_fields() {
82
- if ( is_null(self::$post_ml_fields) ) {
83
  return false;
84
  }
85
- return self::$post_ml_fields;
86
- }
87
-
 
88
  /**
89
  * Get wp_options.
90
- */
91
  public static function get_wp_options() {
92
- if ( is_null(self::$wp_options) ) {
93
  return false;
94
  }
 
95
  return self::$wp_options;
96
  }
97
-
98
  /**
99
  * Get config files.
100
  */
101
  public static function get_config_files() {
102
-
103
  $config_plugin_dir = WPGlobus::$PLUGIN_DIR_PATH . self::PLUGIN_CONFIG_DIR;
104
 
105
  /**
106
  * WPGlobus SEO.
107
  */
108
- if ( function_exists('wpglobus_seo__init') ) {
109
  self::$vendors[] = 'wpglobus-seo.json';
110
  }
111
-
112
  /**
113
  * Yoast SEO.
114
  * https://wordpress.org/plugins/wordpress-seo/
115
  */
116
- if ( defined('WPSEO_VERSION') ) {
117
  /**
118
  * check 'WPSEO_PREMIUM_PLUGIN_FILE' for premium add-on.
119
  */
120
  self::$vendors[] = 'yoast-seo.json';
121
  }
122
-
123
  /**
124
  * All in One SEO Pack.
125
  * https://wordpress.org/plugins/all-in-one-seo-pack/
126
  */
127
- if ( defined('AIOSEOP_VERSION') ) {
128
  self::$vendors[] = 'all-in-one-seo-pack.json';
129
  }
130
-
131
  /**
132
  * Elementor.
133
  * https://wordpress.org/plugins/elementor/
134
  */
135
- if ( defined('ELEMENTOR_VERSION') ) {
136
  self::$vendors[] = 'elementor.json';
137
  }
138
 
139
  /**
140
  * Advanced Custom Fields.
141
  * https://wordpress.org/plugins/advanced-custom-fields/
142
- */
143
  if ( function_exists( 'acf' ) ) {
144
- self::$vendors[] = 'acf.json';
 
 
 
 
 
145
  }
146
-
147
  /**
148
  * Page Builder by SiteOrigin.
149
  * https://wordpress.org/plugins/siteorigin-panels/
150
- */
151
- /*
152
- if ( defined('SITEORIGIN_PANELS_VERSION') ) {
153
- self::$vendors[] = 'siteorigin-panels.json';
154
- }
155
- // */
156
-
157
- foreach( self::$vendors as $file ) {
158
-
159
  if ( is_readable( $config_plugin_dir . $file ) ) {
160
- $file_name = pathinfo( $file, PATHINFO_FILENAME );
161
- self::$config[$file_name] = json_decode(file_get_contents($config_plugin_dir . $file), true);
162
  }
163
-
164
  }
165
-
166
  }
167
 
168
  /**
169
  * Get multilingual fields for post.
 
 
 
 
 
170
  */
171
  public static function get_post_ml_fields( $_meta, $_init ) {
172
-
173
  $_post_ml_fields = array();
174
-
175
- if ( empty($_init) ) {
176
  return $_post_ml_fields;
177
  }
178
-
179
- $file = empty($_init['file']) ? '' : WPGlobus::$PLUGIN_DIR_PATH . 'includes/' . $_init['file'];
180
- $class = empty($_init['class']) ? '' : $_init['class'];
181
-
182
- if ( ! empty($class) && class_exists($class) ) {
 
 
183
  $_post_ml_fields = $class::get_post_multilingual_fields();
184
- }
185
 
186
  return $_post_ml_fields;
187
  }
188
-
189
  /**
190
  * Get meta fields for post.
 
 
 
 
 
191
  */
192
- public static function get_post_meta_fields( $_meta, $_init ) {
193
-
194
  $_post_meta_fields = array();
195
-
196
- if ( empty($_init) ) {
197
  return $_post_meta_fields;
198
- }
199
-
200
- $file = empty($_init['file']) ? '' : WPGlobus::$PLUGIN_DIR_PATH . 'includes/' . $_init['file'];
201
- $class = empty($_init['class']) ? '' : $_init['class'];
202
-
203
- if ( ! empty($file) && file_exists($file) ) {
204
- include_once( $file );
205
- if ( ! empty($class) && class_exists($class) ) {
206
- $_post_meta_fields = $class::get_post_meta_fields( self::$builder->get('post_id') );
 
 
 
207
  }
208
  }
209
 
210
  return $_post_meta_fields;
211
-
212
  }
213
-
214
  /**
215
  * Parse config files.
216
  */
217
- public static function parse_config() {
218
 
219
  /**
220
  * Parse post meta fields.
221
  */
222
  if ( is_null( self::$post_meta_fields ) ) {
223
-
224
  self::$post_meta_fields = array();
225
- self::$post_ml_fields = array();
226
-
227
- foreach( self::$config as $vendor=>$data ) {
228
 
229
  if ( isset( $data['post_meta_fields'] ) && is_array( $data['post_meta_fields'] ) ) :
230
-
231
- foreach( $data['post_meta_fields'] as $_meta=>$_init ) {
232
 
233
- if ( isset( $data['post_meta_fields'][$_meta] ) ) {
 
 
234
 
235
  if ( '*' == $_meta ) {
236
- $_arr = self::get_post_meta_fields($_meta, $_init);
237
  if ( ! empty( $_arr ) ) {
238
  self::$post_meta_fields = array_merge( self::$post_meta_fields, $_arr );
239
  }
240
  } else {
241
  self::$post_meta_fields[] = $_meta;
242
  }
243
-
244
  }
245
-
246
  }
247
-
248
  endif;
249
-
250
  if ( isset( $data['post_ml_fields'] ) && is_array( $data['post_ml_fields'] ) ) :
251
- foreach( $data['post_ml_fields'] as $_meta=>$_init ) {
252
- if ( isset( $data['post_ml_fields'][$_meta] ) ) {
253
-
254
  if ( '*' == $_meta ) {
255
- $_arr = self::get_post_ml_fields($_meta, $_init);
256
  if ( ! empty( $_arr ) ) {
257
  self::$post_ml_fields = array_merge( self::$post_ml_fields, $_arr );
258
  }
259
  } else {
260
  self::$post_ml_fields[] = $_meta;
261
  }
262
-
263
  }
264
  }
265
- endif;
266
-
267
- }
268
 
 
269
  }
270
-
271
  /**
272
  * Parse WP options.
273
  */
274
  if ( is_null( self::$wp_options ) ) {
275
-
276
- foreach( self::$config as $vendor=>$data ) {
277
 
278
  if ( isset( $data['wp_options'] ) && is_array( $data['wp_options'] ) ) :
279
- foreach( $data['wp_options'] as $_option=>$_init ) {
280
- if ( isset( $data['wp_options'][$_option] ) ) {
281
  self::$wp_options[] = $_option;
282
  }
283
  }
284
  endif;
285
-
286
  }
287
-
288
  if ( ! is_null( self::$wp_options ) ) {
289
  self::$wp_options = array_unique( self::$wp_options );
290
  }
291
-
292
- }
293
-
294
- }
295
-
296
-
297
  }
298
-
299
- endif;
300
 
301
- # --- EOF
3
  * Class WPGlobus_Config_Vendor
4
  *
5
  * @package WPGlobus\Config
6
+ * @author Alex Gor(alexgff)
7
  */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Config_Vendor' ) ) :
10
 
11
  class WPGlobus_Config_Vendor {
12
+
13
  const PLUGIN_CONFIG_FILES = 'configs/*.json';
14
+
15
  const PLUGIN_CONFIG_DIR = 'configs/';
16
+
17
  /**
18
  * @var object Instance of this class.
19
  */
20
  protected static $instance;
21
+
22
  protected static $config = array();
23
+
24
  protected static $post_meta_fields = null;
25
+
26
  protected static $post_ml_fields = null;
27
+
28
  protected static $wp_options = null;
29
+
30
  /**
31
  * Builder.
32
  *
33
  * @var WPGlobus_Config_Builder
34
  */
35
  protected static $builder = null;
36
+
37
  /**
38
  * Array of registered vendors.
39
  *
40
  * @var string[]
41
  */
42
  protected static $vendors = array();
43
+
44
  /**
45
  * Constructor.
46
+ *
47
+ * @param $builder
48
+ */
49
+ protected function __construct( $builder ) {
50
+
51
  self::$builder = $builder;
52
+
53
  self::get_config_files();
54
  self::parse_config();
55
 
58
  /**
59
  * Get instance of this class.
60
  *
61
+ * @param $builder
62
+ *
63
+ * @return WPGlobus_Config_Vendor
64
  */
65
+ public static function get_instance( $builder ) {
66
+ if ( ! ( self::$instance instanceof WPGlobus_Config_Vendor ) ) {
67
+ self::$instance = new self( $builder );
68
  }
69
+
70
  return self::$instance;
71
  }
72
 
73
  /**
74
  * Get meta fields.
75
+ */
76
  public static function get_meta_fields() {
77
+ if ( is_null( self::$post_meta_fields ) ) {
78
  return false;
79
  }
80
+
81
+ return self::$post_meta_fields;
82
  }
83
 
84
  /**
85
  * Get multilingual fields.
86
+ */
87
  public static function get_ml_fields() {
88
+ if ( is_null( self::$post_ml_fields ) ) {
89
  return false;
90
  }
91
+
92
+ return self::$post_ml_fields;
93
+ }
94
+
95
  /**
96
  * Get wp_options.
97
+ */
98
  public static function get_wp_options() {
99
+ if ( is_null( self::$wp_options ) ) {
100
  return false;
101
  }
102
+
103
  return self::$wp_options;
104
  }
105
+
106
  /**
107
  * Get config files.
108
  */
109
  public static function get_config_files() {
110
+
111
  $config_plugin_dir = WPGlobus::$PLUGIN_DIR_PATH . self::PLUGIN_CONFIG_DIR;
112
 
113
  /**
114
  * WPGlobus SEO.
115
  */
116
+ if ( function_exists( 'wpglobus_seo__init' ) ) {
117
  self::$vendors[] = 'wpglobus-seo.json';
118
  }
119
+
120
  /**
121
  * Yoast SEO.
122
  * https://wordpress.org/plugins/wordpress-seo/
123
  */
124
+ if ( defined( 'WPSEO_VERSION' ) ) {
125
  /**
126
  * check 'WPSEO_PREMIUM_PLUGIN_FILE' for premium add-on.
127
  */
128
  self::$vendors[] = 'yoast-seo.json';
129
  }
130
+
131
  /**
132
  * All in One SEO Pack.
133
  * https://wordpress.org/plugins/all-in-one-seo-pack/
134
  */
135
+ if ( defined( 'AIOSEOP_VERSION' ) ) {
136
  self::$vendors[] = 'all-in-one-seo-pack.json';
137
  }
138
+
139
  /**
140
  * Elementor.
141
  * https://wordpress.org/plugins/elementor/
142
  */
143
+ if ( defined( 'ELEMENTOR_VERSION' ) ) {
144
  self::$vendors[] = 'elementor.json';
145
  }
146
 
147
  /**
148
  * Advanced Custom Fields.
149
  * https://wordpress.org/plugins/advanced-custom-fields/
150
+ */
151
  if ( function_exists( 'acf' ) ) {
152
+ /**
153
+ * Check the existence of function to prevent getting fatal error in older version (checked with 4.4.12).
154
+ */
155
+ if ( function_exists( 'acf_maybe_get_field' ) ) {
156
+ self::$vendors[] = 'acf.json';
157
+ }
158
  }
159
+
160
  /**
161
  * Page Builder by SiteOrigin.
162
  * https://wordpress.org/plugins/siteorigin-panels/
163
+ */
164
+ // if ( defined('SITEORIGIN_PANELS_VERSION') ) {
165
+ // self::$vendors[] = 'siteorigin-panels.json';
166
+ // }
167
+
168
+ foreach ( self::$vendors as $file ) {
169
+
 
 
170
  if ( is_readable( $config_plugin_dir . $file ) ) {
171
+ $file_name = pathinfo( $file, PATHINFO_FILENAME );
172
+ self::$config[ $file_name ] = json_decode( file_get_contents( $config_plugin_dir . $file ), true );
173
  }
 
174
  }
175
+
176
  }
177
 
178
  /**
179
  * Get multilingual fields for post.
180
+ *
181
+ * @param $_meta
182
+ * @param $_init
183
+ *
184
+ * @return array
185
  */
186
  public static function get_post_ml_fields( $_meta, $_init ) {
187
+
188
  $_post_ml_fields = array();
189
+
190
+ if ( empty( $_init ) ) {
191
  return $_post_ml_fields;
192
  }
193
+
194
+ $file = empty( $_init['file'] ) ? '' : WPGlobus::$PLUGIN_DIR_PATH . 'includes/' . $_init['file'];
195
+
196
+ /** @var WPGlobus_Acf_2 $class */
197
+ $class = empty( $_init['class'] ) ? '' : $_init['class'];
198
+
199
+ if ( ! empty( $class ) && class_exists( $class ) ) {
200
  $_post_ml_fields = $class::get_post_multilingual_fields();
201
+ }
202
 
203
  return $_post_ml_fields;
204
  }
205
+
206
  /**
207
  * Get meta fields for post.
208
+ *
209
+ * @param $_meta
210
+ * @param $_init
211
+ *
212
+ * @return array
213
  */
214
+ public static function get_post_meta_fields( $_meta, $_init ) {
215
+
216
  $_post_meta_fields = array();
217
+
218
+ if ( empty( $_init ) ) {
219
  return $_post_meta_fields;
220
+ }
221
+
222
+ $file = empty( $_init['file'] ) ? '' : WPGlobus::$PLUGIN_DIR_PATH . 'includes/' . $_init['file'];
223
+
224
+ /** @var WPGlobus_Acf_2 $class */
225
+ $class = empty( $_init['class'] ) ? '' : $_init['class'];
226
+
227
+ if ( ! empty( $file ) && file_exists( $file ) ) {
228
+ /** @noinspection PhpIncludeInspection */
229
+ include_once $file;
230
+ if ( ! empty( $class ) && class_exists( $class ) ) {
231
+ $_post_meta_fields = $class::get_post_meta_fields( self::$builder->get( 'post_id' ) );
232
  }
233
  }
234
 
235
  return $_post_meta_fields;
236
+
237
  }
238
+
239
  /**
240
  * Parse config files.
241
  */
242
+ public static function parse_config() {
243
 
244
  /**
245
  * Parse post meta fields.
246
  */
247
  if ( is_null( self::$post_meta_fields ) ) {
248
+
249
  self::$post_meta_fields = array();
250
+ self::$post_ml_fields = array();
251
+
252
+ foreach ( self::$config as $vendor => $data ) {
253
 
254
  if ( isset( $data['post_meta_fields'] ) && is_array( $data['post_meta_fields'] ) ) :
 
 
255
 
256
+ foreach ( $data['post_meta_fields'] as $_meta => $_init ) {
257
+
258
+ if ( isset( $data['post_meta_fields'][ $_meta ] ) ) {
259
 
260
  if ( '*' == $_meta ) {
261
+ $_arr = self::get_post_meta_fields( $_meta, $_init );
262
  if ( ! empty( $_arr ) ) {
263
  self::$post_meta_fields = array_merge( self::$post_meta_fields, $_arr );
264
  }
265
  } else {
266
  self::$post_meta_fields[] = $_meta;
267
  }
 
268
  }
 
269
  }
270
+
271
  endif;
272
+
273
  if ( isset( $data['post_ml_fields'] ) && is_array( $data['post_ml_fields'] ) ) :
274
+ foreach ( $data['post_ml_fields'] as $_meta => $_init ) {
275
+ if ( isset( $data['post_ml_fields'][ $_meta ] ) ) {
276
+
277
  if ( '*' == $_meta ) {
278
+ $_arr = self::get_post_ml_fields( $_meta, $_init );
279
  if ( ! empty( $_arr ) ) {
280
  self::$post_ml_fields = array_merge( self::$post_ml_fields, $_arr );
281
  }
282
  } else {
283
  self::$post_ml_fields[] = $_meta;
284
  }
 
285
  }
286
  }
287
+ endif;
 
 
288
 
289
+ }
290
  }
291
+
292
  /**
293
  * Parse WP options.
294
  */
295
  if ( is_null( self::$wp_options ) ) {
296
+
297
+ foreach ( self::$config as $vendor => $data ) {
298
 
299
  if ( isset( $data['wp_options'] ) && is_array( $data['wp_options'] ) ) :
300
+ foreach ( $data['wp_options'] as $_option => $_init ) {
301
+ if ( isset( $data['wp_options'][ $_option ] ) ) {
302
  self::$wp_options[] = $_option;
303
  }
304
  }
305
  endif;
306
+
307
  }
308
+
309
  if ( ! is_null( self::$wp_options ) ) {
310
  self::$wp_options = array_unique( self::$wp_options );
311
  }
312
+ }
313
+
314
+ }
315
+
 
 
316
  }
 
 
317
 
318
+ endif;
includes/vendor/acf/class-wpglobus-acf.php CHANGED
@@ -27,10 +27,10 @@ class WPGlobus_Acf_2 {
27
  /**
28
  * Get instance of this class.
29
  *
30
- * @return object
31
  */
32
  public static function get_instance() {
33
- if ( ! ( self::$instance instanceof self ) ) {
34
  self::$instance = new self();
35
  }
36
  return self::$instance;
@@ -101,4 +101,4 @@ class WPGlobus_Acf_2 {
101
  }
102
 
103
  }
104
- # --- EOF
27
  /**
28
  * Get instance of this class.
29
  *
30
+ * @return WPGlobus_Acf_2
31
  */
32
  public static function get_instance() {
33
+ if ( ! ( self::$instance instanceof WPGlobus_Acf_2 ) ) {
34
  self::$instance = new self();
35
  }
36
  return self::$instance;
101
  }
102
 
103
  }
104
+ # --- EOF
includes/vendor/aioseopack/class-wpglobus-aioseopack.php CHANGED
@@ -20,7 +20,7 @@ class WPGlobus_All_in_One_SEO_Pack {
20
  protected static $meta_fields_in_processing = array();
21
 
22
  /**
23
- * @var object Instance of this class.
24
  */
25
  protected static $instance;
26
 
@@ -50,10 +50,10 @@ class WPGlobus_All_in_One_SEO_Pack {
50
  /**
51
  * Get instance of this class.
52
  *
53
- * @return object
54
  */
55
  public static function get_instance() {
56
- if ( ! ( self::$instance instanceof self ) ) {
57
  self::$instance = new self();
58
  }
59
  return self::$instance;
@@ -249,4 +249,4 @@ class WPGlobus_All_in_One_SEO_Pack {
249
 
250
  }
251
 
252
- # --- EOF
20
  protected static $meta_fields_in_processing = array();
21
 
22
  /**
23
+ * @var WPGlobus_All_in_One_SEO_Pack Instance of this class.
24
  */
25
  protected static $instance;
26
 
50
  /**
51
  * Get instance of this class.
52
  *
53
+ * @return WPGlobus_All_in_One_SEO_Pack
54
  */
55
  public static function get_instance() {
56
+ if ( ! ( self::$instance instanceof WPGlobus_All_in_One_SEO_Pack ) ) {
57
  self::$instance = new self();
58
  }
59
  return self::$instance;
249
 
250
  }
251
 
252
+ # --- EOF
includes/wp_options/class-wpglobus-wp_options.php CHANGED
@@ -44,7 +44,7 @@ if ( ! class_exists( 'WPGlobus_WP_Options' ) ) :
44
  * @return WPGlobus_WP_Options
45
  */
46
  public static function get_instance( $wp_options ) {
47
- if ( ! ( self::$instance instanceof self ) ) {
48
  self::$instance = new self( $wp_options );
49
  }
50
 
44
  * @return WPGlobus_WP_Options
45
  */
46
  public static function get_instance( $wp_options ) {
47
+ if ( ! ( self::$instance instanceof WPGlobus_WP_Options ) ) {
48
  self::$instance = new self( $wp_options );
49
  }
50
 
languages/wpglobus.pot CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (C) 2018 WPGlobus 1.9.22
2
- # This file is distributed under the same license as the WPGlobus 1.9.22 package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPGlobus 1.9.22\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) 2018 WPGlobus 1.9.23
2
+ # This file is distributed under the same license as the WPGlobus 1.9.23 package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPGlobus 1.9.23\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
@@ -218,6 +218,12 @@ This maintenance release introduces Gutenberg support in beta-stage.
218
 
219
  == Changelog ==
220
 
 
 
 
 
 
 
221
  = 1.9.22 =
222
 
223
  * FIXED:
218
 
219
  == Changelog ==
220
 
221
+ = 1.9.23 =
222
+
223
+ * FIXED:
224
+ * Gutenberg: saving languages correctly when editing pages.
225
+ * ACF: Check the existence of the `acf_maybe_get_field` function to prevent fatal error in older versions.
226
+
227
  = 1.9.22 =
228
 
229
  * FIXED:
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: 1.9.22
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  exit;
43
  }
44
 
45
- define( 'WPGLOBUS_VERSION', '1.9.22' );
46
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47
 
48
  /**
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: 1.9.23
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
42
  exit;
43
  }
44
 
45
+ define( 'WPGLOBUS_VERSION', '1.9.23' );
46
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47
 
48
  /**