WPGlobus – Multilingual Everything! - Version 1.9.18

Version Description

  • COMPATIBILITY:
    • Elementor 2.2.6
  • FIXED:
    • Incorrect handling of the _yoast_wpseo_title field for Yoast SEO.
Download this release

Release Info

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

Code changes from version 1.9.17 to 1.9.18

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-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.8"},"wpglobus-for-slider-revolution":{"title":"{:en}WPGlobus for Slider Revolution{:}{:ru}WPGlobus \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Slider Revolution{:}","_api_new_version":"1.5.0","_api_tested_up_to":"4.9.8"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"1.1.0","_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.8"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"1.2.2","_api_tested_up_to":"4.9.8"},"wpglobus-multi-currency":{"title":"{:en}WPGlobus 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.8"},"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":"1.1.0","_api_tested_up_to":"4.9.8"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.1.41","_api_tested_up_to":"4.9.8"},"woocommerce-wpglobus":{"title":"{:en}WPGlobus for WooCommerce{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"3.4.1","_api_tested_up_to":"4.9.8"}}
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-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.8"},"wpglobus-for-slider-revolution":{"title":"{:en}WPGlobus for Slider Revolution{:}{:ru}WPGlobus \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Slider Revolution{:}","_api_new_version":"1.5.0","_api_tested_up_to":"4.9.8"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"1.1.0","_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.8"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"1.2.2","_api_tested_up_to":"4.9.8"},"wpglobus-multi-currency":{"title":"{:en}WPGlobus 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-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":"1.1.0","_api_tested_up_to":"4.9.8"},"woocommerce-wpglobus":{"title":"{:en}WPGlobus for WooCommerce{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"3.4.1","_api_tested_up_to":"4.9.8"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.1.43","_api_tested_up_to":"4.9.8"}}
includes/builders/class-wpglobus-builders.php CHANGED
@@ -53,7 +53,7 @@ if ( ! class_exists( 'WPGlobus_Builders' ) ) :
53
 
54
  self::$add_on['elementor'] = array(
55
  'id' => 'elementor',
56
- 'supported_min_version' => '2.2.4',
57
  'const' => 'ELEMENTOR_VERSION',
58
  'plugin_name' => 'Elementor',
59
  'plugin_uri' => 'https://wordpress.org/plugins/elementor/',
@@ -162,8 +162,15 @@ if ( ! class_exists( 'WPGlobus_Builders' ) ) :
162
  */
163
  if ( ! $builder ) {
164
  $builder = self::is_elementor();
165
- if ( $builder && $builder['builder_page'] ) {
166
- return $builder;
 
 
 
 
 
 
 
167
  }
168
  }
169
 
53
 
54
  self::$add_on['elementor'] = array(
55
  'id' => 'elementor',
56
+ 'supported_min_version' => '2.2.6',
57
  'const' => 'ELEMENTOR_VERSION',
58
  'plugin_name' => 'Elementor',
59
  'plugin_uri' => 'https://wordpress.org/plugins/elementor/',
162
  */
163
  if ( ! $builder ) {
164
  $builder = self::is_elementor();
165
+ if ( $builder ) {
166
+ if ( $builder['is_admin'] ) {
167
+ if ( $builder['builder_page'] ) {
168
+ return $builder;
169
+ }
170
+ } else {
171
+ include_once( WPGlobus::$PLUGIN_DIR_PATH.'\includes\builders\elementor\class-wpglobus-elementor-front.php' );
172
+ WPGlobus_Elementor_Front::init();
173
+ }
174
  }
175
  }
176
 
includes/builders/elementor/class-wpglobus-elementor-front.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-elementor-front.php
4
+ *
5
+ * @package WPGlobus\Builders\Elementor
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Elementor_Front' ) ) :
10
+
11
+ /**
12
+ * Class WPGlobus_Elementor_Front.
13
+ */
14
+ class WPGlobus_Elementor_Front{
15
+
16
+ const ELEMENTOR_DATA_META_KEY = '_elementor_data';
17
+
18
+ /**
19
+ * Init.
20
+ */
21
+ public static function init() {
22
+ add_filter( 'get_post_metadata', array( __CLASS__, 'filter__post_metadata' ), 5, 4 );
23
+ }
24
+
25
+ /**
26
+ * Get meta callback.
27
+ *
28
+ * @scope front.
29
+ * @param $check
30
+ * @param $object_id
31
+ * @param $meta_key
32
+ * @param $single
33
+ *
34
+ * @return string
35
+ */
36
+ public static function filter__post_metadata(
37
+ $check, $object_id, $meta_key, /** @noinspection PhpUnusedParameterInspection */
38
+ $single
39
+ ) {
40
+
41
+ if ( self::ELEMENTOR_DATA_META_KEY === $meta_key ) {
42
+
43
+ $meta_cache = wp_cache_get( $object_id, 'post_meta' );
44
+
45
+ if ( isset( $meta_cache[ $meta_key ] ) && isset( $meta_cache[ $meta_key ][0] ) ) {
46
+
47
+ /** @noinspection PhpUnusedLocalVariableInspection */
48
+ $_value = '';
49
+
50
+ if ( WPGlobus_Core::has_translations( $meta_cache[ $meta_key ][0] ) ) {
51
+ $_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], WPGlobus::Config()->language );
52
+ } else {
53
+ $_value = $meta_cache[ $meta_key ][0];
54
+ }
55
+
56
+ return $_value;
57
+
58
+ }
59
+
60
+ }
61
+
62
+ return $check;
63
+
64
+ }
65
+
66
+ }
67
+
68
+ endif;
includes/vendor/yoast-seo/class-wpglobus-yoastseo80.php ADDED
@@ -0,0 +1,719 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Front-end support of Yoast SEO 8.0
4
+ * @package WPGlobus\Vendor\YoastSEO
5
+ * @since 1.9.18
6
+ */
7
+
8
+ /**
9
+ * Class WPGlobus_YoastSEO
10
+ */
11
+ class WPGlobus_YoastSEO {
12
+
13
+ /**
14
+ * Yoast SEO separator.
15
+ *
16
+ * @var string
17
+ */
18
+ public static $yoastseo_separator = '';
19
+
20
+ /**
21
+ * Name of the script.
22
+ *
23
+ * @var string
24
+ */
25
+ public static $handle_script = 'wpglobus-yoastseo';
26
+
27
+ /**
28
+ * Name of the premium script.
29
+ *
30
+ * @since 1.7.2
31
+ * @var string
32
+ */
33
+ public static $handle_script_premium = 'wpglobus-yoastseo-premium';
34
+
35
+ /**
36
+ * Current version yoast seo.
37
+ *
38
+ * @since 1.8
39
+ * @var string
40
+ */
41
+ protected static $version = '';
42
+
43
+ /**
44
+ * Static "controller"
45
+ */
46
+ public static function controller($version) {
47
+
48
+ self::$version = $version;
49
+
50
+ if ( is_admin() ) {
51
+
52
+ /**
53
+ * Don't start in admin @since 1.9.17
54
+ */
55
+ return;
56
+
57
+ if ( ! WPGlobus_WP::is_doing_ajax() ) {
58
+
59
+ /** @see WPGlobus::__construct */
60
+ WPGlobus::O()->vendors_scripts['WPSEO'] = true;
61
+
62
+ if ( defined( 'WPSEO_PREMIUM_PLUGIN_FILE' ) ) {
63
+ /**
64
+ * @see wordpress-seo-premium\wp-seo-premium.php
65
+ */
66
+ WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] = true;
67
+ }
68
+
69
+ if ( WPGlobus_WP::is_pagenow( 'edit.php' ) ) {
70
+
71
+ /**
72
+ * @since 1.5.3
73
+ */
74
+ add_filter( 'wpseo_replacements_filter_sep', array( __CLASS__, 'filter__get_separator' ), 999 );
75
+
76
+ /**
77
+ * To translate Yoast columns on edit.php page
78
+ */
79
+ add_filter( 'esc_html', array(
80
+ __CLASS__,
81
+ 'filter__wpseo_columns'
82
+ ), 0 );
83
+
84
+ }
85
+
86
+ /**
87
+ * @since 1.6.3
88
+ */
89
+ add_action( 'wpseo_save_compare_data', array(
90
+ __CLASS__,
91
+ 'action__save_compare_data'
92
+ ) );
93
+
94
+ add_action( 'admin_print_scripts', array(
95
+ __CLASS__,
96
+ 'action__admin_print_scripts'
97
+ ) );
98
+
99
+ add_action( 'wpseo_tab_content', array(
100
+ __CLASS__,
101
+ 'action__wpseo_tab_content'
102
+ ), 11 );
103
+
104
+ if ( WPGlobus_WP::is_pagenow( array( 'edit-tags.php', 'term.php' ) ) ) {
105
+ add_filter( 'wp_default_editor', array(
106
+ __CLASS__,
107
+ 'set_default_editor'
108
+ ) );
109
+ }
110
+
111
+ }
112
+
113
+ } else {
114
+ /**
115
+ * Filter SEO title and meta description on front only, when the page header HTML tags are generated.
116
+ * AJAX is probably not required (waiting for a case).
117
+ */
118
+ //add_filter( 'wpseo_title', array( 'WPGlobus_Filters', 'filter__text' ), PHP_INT_MAX );
119
+ /**
120
+ * '_yoast_wpseo_title' field is not multilingual @see yoast-seo.json because it is a mask only.
121
+ * @since 1.9.18
122
+ */
123
+ add_filter( 'wpseo_title', array( __CLASS__, 'filter__title' ), PHP_INT_MAX );
124
+
125
+ add_filter( 'wpseo_metadesc', array( 'WPGlobus_Filters', 'filter__text' ), PHP_INT_MAX );
126
+
127
+ /**
128
+ * @todo check for '_yoast_wpseo_title' meta
129
+ * @see <title> view-source:http://www.dev-wpg.com/test-post-seo/
130
+ * @see <title> view-source:http://www.dev-wpg.com/ru/test-post-seo/
131
+ */
132
+ //add_filter( 'get_post_metadata', array( __CLASS__, 'filter__get_post_metadata' ), 0, 4 );
133
+
134
+ /**
135
+ * Filter meta keywords.
136
+ * @from 1.8.8
137
+ */
138
+ add_filter( 'wpseo_metakeywords', array( __CLASS__, 'filter__metakeywords' ), 0 );
139
+
140
+ }
141
+
142
+ }
143
+ /**
144
+ * Filter Yoast post meta title.
145
+ *
146
+ * @scope front
147
+ * @since 1.9.18
148
+ *
149
+ * @param string $title Post title.
150
+ *
151
+ * @return string.
152
+ */
153
+ public static function filter__title( $title ) {
154
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
155
+ return $title;
156
+ }
157
+ return WPGlobus_Core::extract_text( $title, WPGlobus::Config()->language );
158
+ }
159
+
160
+ /**
161
+ * Filter Yoast post meta keywords.
162
+ *
163
+ * @scope front
164
+ * @since 1.8.8
165
+ *
166
+ * @param string $keywords Multilingual keywords.
167
+ *
168
+ * @return string.
169
+ */
170
+ public static function filter__metakeywords( $keywords ) {
171
+ if ( WPGlobus::Config()->language != WPGlobus::Config()->default_language ) {
172
+ return '';
173
+ }
174
+ return WPGlobus_Core::text_filter($keywords, WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY);
175
+ }
176
+
177
+ /**
178
+ * Fix empty yoast_wpseo_focuskw while saving/updating post with active extra language.
179
+ *
180
+ * @since 1.6.3
181
+ * @since 1.7.7
182
+ * @see filter 'wpseo_save_compare_data' wordpress-seo\admin\metabox\class-metabox.php
183
+ *
184
+ * @param WP_Post Object $post Current post.
185
+ */
186
+ public static function action__save_compare_data( $post ) {
187
+ /**
188
+ * Don't need @since 1.7.7
189
+ * It is helpful for testing purposes, use: error_log( print_r( $_POST, true ) );
190
+ */
191
+ return;
192
+ /*
193
+ if ( empty( $_POST[ 'yoast_wpseo_focuskw' ] ) ) {
194
+ if ( ! empty( $_POST[ 'yoast_wpseo_focuskw_text_input' ] ) ) {
195
+ $_POST[ 'yoast_wpseo_focuskw' ] = $_POST[ 'yoast_wpseo_focuskw_text_input' ];
196
+ }
197
+ } */
198
+ }
199
+
200
+ /**
201
+ * Filter Yoast post metadata.
202
+ *
203
+ * When Yoast builds HTML title and meta description, it looks in tree places:
204
+ * - Actual post_title,
205
+ * - Title and Description from Yoast Snippet (fancy metabox for each post),
206
+ * - Rules (%%title%% %%sep%% %%page%%) in the SEO Settings.
207
+ * Yoast gets confused when not all languages are filled in consistently
208
+ * (one language has post_title, another one - only Snippet, others - should work
209
+ * from the Rules).
210
+ * We are trying to hook into the `get_post_metadata` and return filtered values
211
+ * to Yoast, so when it should be empty - it's empty and not
212
+ * {:xx}Something from another language{:}
213
+ *
214
+ * @scope front
215
+ * @since 1.4.0 (original)
216
+ * 1.5.5 (restored and rewritten)
217
+ *
218
+ * @param null|array $metadata Comes as NULL. Return something to short-circuit.
219
+ * @param int $post_id Post ID.
220
+ * @param string $meta_key Empty because the array of all metas is returned.
221
+ * @param bool $single False in this case.
222
+ *
223
+ * @return null|array Return metadata array if we are "in business".
224
+ */
225
+ public static function filter__get_post_metadata(
226
+ $metadata, $post_id, $meta_key, $single
227
+ ) {
228
+ // Yoast does not pass any `meta_key`, and does not ask for `single`.
229
+ // Checking it here is faster than going to backtrace directly.
230
+ if ( $meta_key || $single ) {
231
+ return $metadata;
232
+ }
233
+
234
+ // We only need to deal with these two callers:
235
+ if ( WPGlobus_WP::is_functions_in_backtrace( array(
236
+ array( 'WPSEO_Frontend', 'get_content_title' ),
237
+ array( 'WPSEO_Frontend', 'generate_metadesc' ),
238
+ ) )
239
+ ) {
240
+ /**
241
+ * The part of getting meta / updating cache is copied from
242
+ * @see get_metadata
243
+ * (except for doing serialize - we believe it's not necessary for Yoast).
244
+ */
245
+
246
+ /** @var array $post_meta */
247
+ $post_meta = wp_cache_get( $post_id, 'post_meta' );
248
+
249
+ if ( ! $post_meta ) {
250
+ $meta_cache = update_meta_cache( 'post', array( $post_id ) );
251
+ $post_meta = $meta_cache[ $post_id ];
252
+ }
253
+
254
+ /**
255
+ * Filter both title and meta description to the current language.
256
+ *
257
+ * @important Return empty if no current language text exists,
258
+ * do not use the default. Yoast must receive empty string to realize
259
+ * that meta is not set for that language.
260
+ */
261
+ foreach ( array( '_yoast_wpseo_title', '_yoast_wpseo_metadesc' ) as $_ ) {
262
+ if ( ! empty( $post_meta[ $_ ][0] ) ) {
263
+ $post_meta[ $_ ][0] = WPGlobus_Core::text_filter(
264
+ $post_meta[ $_ ][0],
265
+ WPGlobus::Config()->language,
266
+ WPGlobus::RETURN_EMPTY
267
+ );
268
+ }
269
+ }
270
+ // ... and return it.
271
+ $metadata = $post_meta;
272
+ }
273
+
274
+ return $metadata;
275
+ }
276
+
277
+ /**
278
+ * Filter to get yoast seo separator.
279
+ *
280
+ * @since 1.5.3
281
+ *
282
+ * @param array $sep Contains separator.
283
+ *
284
+ * @return string
285
+ */
286
+ public static function filter__get_separator( $sep ) {
287
+ self::$yoastseo_separator = $sep;
288
+
289
+ return $sep;
290
+ }
291
+
292
+ /**
293
+ * Filter which editor should be displayed by default.
294
+ *
295
+ * @since 1.4.8
296
+ *
297
+ * @param array $editors An array of editors. Accepts 'tinymce', 'html', 'test'.
298
+ *
299
+ * @return string
300
+ */
301
+ public static function set_default_editor(
302
+ /** @noinspection PhpUnusedParameterInspection */
303
+ $editors
304
+ ) {
305
+ return 'tinymce';
306
+ }
307
+
308
+ /**
309
+ * To translate Yoast columns
310
+ * @see WPSEO_Meta_Columns::column_content
311
+ * @scope admin
312
+ *
313
+ * @param string $text
314
+ *
315
+ * @return string
316
+ * @todo Yoast said things might change in the next version. See the pull request
317
+ * @link https://github.com/Yoast/wordpress-seo/pull/1946
318
+ */
319
+ public static function filter__wpseo_columns( $text ) {
320
+
321
+ if ( WPGlobus_WP::is_filter_called_by( 'column_content', 'WPSEO_Meta_Columns' ) ) {
322
+
323
+ if ( self::$yoastseo_separator && false !== strpos( $text, self::$yoastseo_separator ) ) {
324
+
325
+ $title_arr = explode( self::$yoastseo_separator, $text );
326
+
327
+ foreach ( $title_arr as $key => $piece ) {
328
+ if ( (int) $key === 0 ) {
329
+ $title_arr[ $key ] = WPGlobus_Core::text_filter( $piece, WPGlobus::Config()->language ) . ' ';
330
+ } else {
331
+ $title_arr[ $key ] = ' ' . WPGlobus_Core::text_filter( $piece, WPGlobus::Config()->language );
332
+ }
333
+ }
334
+
335
+ $text = implode( self::$yoastseo_separator, $title_arr );
336
+
337
+ } else {
338
+
339
+ $text = WPGlobus_Core::text_filter(
340
+ $text,
341
+ WPGlobus::Config()->language,
342
+ null,
343
+ WPGlobus::Config()->default_language
344
+ );
345
+
346
+ }
347
+ }
348
+
349
+ return $text;
350
+ }
351
+
352
+ /**
353
+ * Enqueue js for YoastSEO support
354
+ * @since 1.4.0
355
+ */
356
+ public static function action__admin_print_scripts() {
357
+
358
+ if ( 'off' === WPGlobus::Config()->toggle ) {
359
+ return;
360
+ }
361
+
362
+ if ( self::disabled_entity() ) {
363
+ return;
364
+ }
365
+
366
+ /** @global string $pagenow */
367
+ global $pagenow;
368
+
369
+ $enabled_pages = array(
370
+ 'post.php',
371
+ 'post-new.php',
372
+ 'edit-tags.php',
373
+ 'term.php'
374
+ );
375
+
376
+ if ( WPGlobus_WP::is_pagenow( $enabled_pages ) ) {
377
+
378
+ WPGlobus::O()->vendors_scripts['WPSEO'] = true;
379
+
380
+ if ( defined( 'WPSEO_PREMIUM_PLUGIN_FILE' ) ) {
381
+ /**
382
+ * @see wordpress-seo-premium\wp-seo-premium.php
383
+ */
384
+ WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] = true;
385
+ }
386
+
387
+ $yoastseo_plus_page_analysis_access = sprintf(
388
+ __( 'Please see %s to get access to page analysis with YoastSEO.', '' ),
389
+ '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>'
390
+ );
391
+
392
+ $yoastseo_plus_meta_keywords_access = sprintf(
393
+ __( 'Please see %s to get access to meta keywords with YoastSEO.', '' ),
394
+ '<a href="https://wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>'
395
+ );
396
+
397
+ $i18n = array(
398
+ 'yoastseo_plus_page_analysis_access' => $yoastseo_plus_page_analysis_access,
399
+ 'yoastseo_plus_meta_keywords_access' => $yoastseo_plus_meta_keywords_access
400
+ );
401
+
402
+ $src_version = false;
403
+ $src_version_premium = false;
404
+
405
+ if ( ! WPGlobus::O()->vendors_scripts['WPSEO_PREMIUM'] ) {
406
+
407
+ /** @noinspection PhpInternalEntityUsedInspection */
408
+ $src_version = version_compare( WPSEO_VERSION, '4.0', '>=' ) ? '40' : $src_version;
409
+ /** @noinspection PhpInternalEntityUsedInspection */
410
+ $src_version = version_compare( WPSEO_VERSION, '4.1', '>=' ) ? '41' : $src_version;
411
+ /** @noinspection PhpInternalEntityUsedInspection */
412
+ $src_version = version_compare( WPSEO_VERSION, '4.4', '>=' ) ? '44' : $src_version;
413
+ if (
414
+ /** @noinspection PhpInternalEntityUsedInspection */
415
+ version_compare( WPSEO_VERSION, '4.8', '>=' )
416
+ ) {
417
+ $src_version = self::$version;
418
+ }
419
+
420
+ } else {
421
+ /**
422
+ * Start with Yoast SEO Premium.
423
+ */
424
+
425
+ /**
426
+ * Version of file yoast seo must be latest.
427
+ */
428
+ /** @noinspection PhpInternalEntityUsedInspection */
429
+ $src_version = version_compare( WPSEO_VERSION, '3.9', '>=' ) ? self::$version : $src_version;
430
+ /** @noinspection PhpInternalEntityUsedInspection */
431
+ $src_version_premium = version_compare( WPSEO_VERSION, '3.9', '>=' ) ? '39' : $src_version_premium;
432
+
433
+ }
434
+
435
+ if ( $src_version_premium ) :
436
+
437
+ $handle = self::$handle_script_premium;
438
+
439
+ $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/' .
440
+ $handle . '-' . $src_version_premium .
441
+ WPGlobus::SCRIPT_SUFFIX() . '.js';
442
+
443
+ wp_enqueue_script(
444
+ $handle,
445
+ $src,
446
+ array( 'jquery', 'underscore' ),
447
+ WPGLOBUS_VERSION,
448
+ true
449
+ );
450
+
451
+ endif;
452
+
453
+ if ( $src_version ) :
454
+
455
+ $handle = self::$handle_script;
456
+
457
+ $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/' .
458
+ $handle . '-' . $src_version .
459
+ WPGlobus::SCRIPT_SUFFIX() . '.js';
460
+
461
+ wp_enqueue_script(
462
+ $handle,
463
+ $src,
464
+ array( 'jquery', 'underscore' ),
465
+ WPGLOBUS_VERSION,
466
+ true
467
+ );
468
+
469
+ wp_localize_script(
470
+ $handle,
471
+ 'WPGlobusVendor',
472
+ array(
473
+ 'version' => WPGLOBUS_VERSION,
474
+ 'vendor' => WPGlobus::O()->vendors_scripts,
475
+ 'pagenow' => $pagenow,
476
+ 'i18n' => $i18n
477
+ )
478
+ );
479
+
480
+ endif;
481
+
482
+ }
483
+
484
+ }
485
+
486
+ /**
487
+ * Add language tabs to wpseo metabox ( .wpseo-metabox-tabs-div )
488
+ */
489
+ public static function action__wpseo_tab_content() {
490
+
491
+ /** @global WP_Post $post */
492
+ global $post;
493
+
494
+ if ( self::disabled_entity() ) {
495
+ return;
496
+ }
497
+
498
+ $permalink = array();
499
+ if ( 'publish' === $post->post_status ) {
500
+ $permalink['url'] = get_permalink( $post->ID );
501
+ $permalink['action'] = 'complete';
502
+ } else {
503
+ $permalink['url'] = trailingslashit( home_url() );
504
+ $permalink['action'] = '';
505
+ }
506
+
507
+ /**
508
+ * #wpseo-metabox-tabs
509
+ */
510
+ /**
511
+ * Array of IDs to make multilingual.
512
+ */
513
+ $ids = array(
514
+ 'wpseo-add-keyword-popup',
515
+ 'wpseosnippet',
516
+ #'wpseosnippet_title',
517
+ 'snippet_preview',
518
+ 'title_container',
519
+ 'snippet_title',
520
+ 'snippet_sitename',
521
+ 'url_container',
522
+ 'snippet_citeBase',
523
+ 'snippet_cite',
524
+ 'meta_container',
525
+ 'snippet_meta',
526
+ 'yoast_wpseo_focuskw_text_input',
527
+ 'yoast_wpseo_focuskw',
528
+ 'yoast_wpseo_focuskeywords',
529
+ 'focuskwresults',
530
+ 'yoast_wpseo_title',
531
+ #'yoast_wpseo_title-length-warning',
532
+ 'yoast_wpseo_metadesc',
533
+ #'yoast_wpseo_metadesc-length',
534
+ #'yoast_wpseo_metadesc_notice',
535
+ 'yoast_wpseo_linkdex',
536
+ 'wpseo-pageanalysis',
537
+ 'yoast-seo-content-analysis',
538
+ 'YoastSEO-plugin-loading',
539
+ #from Yoast 3.1
540
+ 'snippet-editor-title',
541
+ 'snippet-editor-slug',
542
+ 'snippet-editor-meta-description',
543
+ #from Yoast 4.4
544
+ 'wpseo-focuskeyword-section',
545
+ 'wpseo-pageanalysis-section',
546
+ 'pageanalysis',
547
+ #'_yst_is_cornerstone',
548
+ /* @since 1.8.8 */
549
+ 'wpseometakeywords',
550
+ 'yoast_wpseo_metakeywords'
551
+ );
552
+
553
+ /**
554
+ * Array of special IDs for yoast premium.
555
+ * @since 1.7.12
556
+ */
557
+ $ids_premium_special = array(
558
+ '_yst_is_cornerstone',
559
+ /* @since 1.8.8 */
560
+ 'wpseometakeywords'
561
+ );
562
+
563
+ $names = array(
564
+ 'yoast_wpseo_focuskw_text_input',
565
+ 'yoast_wpseo_focuskw',
566
+ 'yoast_wpseo_focuskeywords',
567
+ 'yoast_wpseo_title',
568
+ 'yoast_wpseo_metadesc',
569
+ 'yoast_wpseo_linkdex',
570
+ /* @since 1.8.8 */
571
+ 'yoast_wpseo_metakeywords'
572
+ );
573
+
574
+ $qtip = array(
575
+ 'snippetpreviewhelp',
576
+ 'focuskw_text_inputhelp',
577
+ 'pageanalysishelp',
578
+ #'focuskwhelp',
579
+ #'titlehelp',
580
+ #'metadeschelp',
581
+ #since yoast seo 3.2
582
+ 'snippetpreview-help',
583
+ 'focuskw_text_input-help',
584
+ 'pageanalysis-help',
585
+ 'snippetpreview-help-toggle',
586
+ 'focuskw_text_input-help-toggle',
587
+ 'pageanalysis-help-toggle'
588
+ );
589
+
590
+ ?>
591
+
592
+ <div id="wpglobus-wpseo-tabs" style="width:90%;float:right;"> <?php
593
+ /**
594
+ * Use span with attributes 'data' for send to js script ids, names elements for which needs to be set new ids, names with language code.
595
+ */ ?>
596
+ <span id="wpglobus-wpseo-attr"
597
+ data-ids="<?php echo esc_attr( implode( ',', $ids ) ); ?>"
598
+ data-names="<?php echo esc_attr( implode( ',', $names ) ); ?>"
599
+ data-qtip="<?php echo esc_attr( implode( ',', $qtip ) ); ?>"
600
+ data-ids-premium-special="<?php echo esc_attr( implode( ',', $ids_premium_special ) ); ?>">
601
+ </span>
602
+ <ul class="wpglobus-wpseo-tabs-list"> <?php
603
+ $order = 0;
604
+ foreach ( WPGlobus::Config()->open_languages as $language ) { ?>
605
+ <li id="wpseo-link-tab-<?php echo esc_attr( $language ); ?>"
606
+ data-language="<?php echo esc_attr( $language ); ?>"
607
+ data-order="<?php echo esc_attr( $order ); ?>"
608
+ class="wpglobus-wpseo-tab"><a
609
+ href="#wpseo-tab-<?php echo esc_attr($language); ?>"><?php echo esc_attr( WPGlobus::Config()->en_language_name[ $language ] ); ?></a>
610
+ </li> <?php
611
+ $order ++;
612
+ } ?>
613
+ </ul> <?php
614
+
615
+ /**
616
+ * Get meta description
617
+ */
618
+ $metadesc = get_post_meta( $post->ID, '_yoast_wpseo_metadesc', true );
619
+
620
+ /**
621
+ * Get title
622
+ */
623
+ $wpseotitle = get_post_meta( $post->ID, '_yoast_wpseo_title', true );
624
+
625
+ /**
626
+ * From Yoast3 focus keyword key is '_yoast_wpseo_focuskw_text_input'.
627
+ */
628
+ $focuskw = get_post_meta( $post->ID, '_yoast_wpseo_focuskw_text_input', true );
629
+
630
+ /**
631
+ * Make yoast cite base.
632
+ */
633
+ list( $yoast_permalink ) = get_sample_permalink( $post->ID );
634
+ $yoast_permalink = str_replace( array( '%pagename%', '%postname%' ), '', urldecode( $yoast_permalink ) );
635
+
636
+ /**
637
+ * Set cite does not editable by default.
638
+ */
639
+ $cite_contenteditable = 'false';
640
+
641
+ foreach ( WPGlobus::Config()->open_languages as $language ) {
642
+
643
+ $focuskeywords = '';
644
+ if ( $language == WPGlobus::Config()->default_language ) {
645
+ /**
646
+ * Get meta _yoast_wpseo_focuskeywords from yoast premium.
647
+ * @since 1.7.2 are processing default language only.
648
+ */
649
+ $focuskeywords = get_post_meta( $post->ID, '_yoast_wpseo_focuskeywords', true );
650
+ }
651
+
652
+ $yoast_cite_base = WPGlobus_Utils::localize_url( $yoast_permalink, $language );
653
+ $yoast_cite_base = str_replace( array( 'http://', 'https://' ), '', $yoast_cite_base );
654
+ $yoast_cite_base = str_replace( '//', '/', $yoast_cite_base );
655
+
656
+ $permalink['url'] = WPGlobus_Utils::localize_url( $permalink['url'], $language );
657
+ $url = apply_filters( 'wpglobus_wpseo_permalink', $permalink['url'], $language );
658
+
659
+ if ( $url !== $permalink['url'] ) {
660
+ /* We accept that user's filter make complete permalink for draft */
661
+ /* @todo maybe need more investigation */
662
+ $permalink['action'] = 'complete';
663
+ } else {
664
+ if ( 'publish' !== $post->post_status ) {
665
+ /**
666
+ * We cannot get post-name-full to make correct url here ( for draft & auto-draft ). We do it in JS
667
+ * @see var wpseosnippet_url in wpglobus-wpseo-**.js
668
+ */
669
+ $permalink['action'] = '';
670
+ }
671
+ } ?>
672
+ <div id="wpseo-tab-<?php echo esc_attr( $language ); ?>" class="wpglobus-wpseo-general"
673
+ data-language="<?php echo esc_attr( $language ); ?>"
674
+ data-url-<?php echo esc_attr( $language ); ?>="<?php echo esc_attr( $url ); ?>"
675
+ data-yoast-cite-base="<?php echo esc_attr( $yoast_cite_base ); ?>"
676
+ data-cite-contenteditable="<?php echo esc_attr( $cite_contenteditable ); ?>"
677
+ data-permalink="<?php echo esc_attr( $permalink['action'] ); ?>"
678
+ data-metadesc="<?php echo esc_attr( WPGlobus_Core::text_filter( $metadesc, $language, WPGlobus::RETURN_EMPTY ) ); ?>"
679
+ data-wpseotitle="<?php echo esc_attr( WPGlobus_Core::text_filter( $wpseotitle, $language, WPGlobus::RETURN_EMPTY ) ); ?>"
680
+ data-focuskw="<?php echo esc_attr( WPGlobus_Core::text_filter( $focuskw, $language, WPGlobus::RETURN_EMPTY ) ); ?>"
681
+ data-focuskeywords='<?php echo esc_attr( $focuskeywords ); ?>'>
682
+ </div> <?php
683
+ } ?>
684
+ </div>
685
+ <?php
686
+ }
687
+
688
+ /**
689
+ * Check disabled entity.
690
+ *
691
+ * @since 1.7.3
692
+ * @return boolean
693
+ */
694
+ public static function disabled_entity() {
695
+
696
+ if ( WPGlobus_WP::is_pagenow( array( 'edit-tags.php', 'term.php' ) ) ) :
697
+ /**
698
+ * Don't check page when editing taxonomy.
699
+ */
700
+ return false;
701
+ endif;
702
+
703
+ /** @global WP_Post $post */
704
+ global $post;
705
+
706
+ $result = false;
707
+ if ( WPGlobus_WP::is_pagenow( array( 'post.php', 'post-new.php' ) ) ) :
708
+ if ( empty( $post ) ) {
709
+ $result = true;
710
+ } else if ( WPGlobus::O()->disabled_entity( $post->post_type ) ) {
711
+ $result = true;
712
+ }
713
+ endif;
714
+ return $result;
715
+ }
716
+
717
+ } // class
718
+
719
+ # --- EOF
includes/wpglobus-yoastseo.php CHANGED
@@ -13,7 +13,11 @@
13
  * @since 1.9.17
14
  * 05.07.2018 - 77
15
  */
16
- $wpglobus_yoastseo_latest_version = '77';
 
 
 
 
17
 
18
  if ( defined('WPSEO_VERSION') && defined('WPSEO_PREMIUM_PLUGIN_FILE') ) {
19
  /**
@@ -23,7 +27,15 @@ if ( defined('WPSEO_VERSION') && defined('WPSEO_PREMIUM_PLUGIN_FILE') ) {
23
  /**
24
  * Support Yoast SEO Premium version 3.9 or later.
25
  */
26
- if ( version_compare( WPGLOBUS_VERSION, '1.8', '>=' ) ) {
 
 
 
 
 
 
 
 
27
  /**
28
  * Version of file must be latest.
29
  */
@@ -53,12 +65,18 @@ if ( defined('WPSEO_VERSION') && defined('WPSEO_PREMIUM_PLUGIN_FILE') ) {
53
  $version = version_compare( WPSEO_VERSION, '4.8', '>=' ) ? '48' : $version;
54
  $version = version_compare( WPSEO_VERSION, '5.9', '>=' ) ? '59' : $version;
55
  $version = version_compare( WPSEO_VERSION, '7.3', '>=' ) ? '73' : $version;
56
- $version = version_compare( WPSEO_VERSION, '7.7', '>=' ) ? $wpglobus_yoastseo_latest_version : $version;
 
57
 
58
  if ( $version == '77' && is_admin() ) {
59
 
60
  // Don't start support here.
61
 
 
 
 
 
 
62
  } else {
63
 
64
  require_once "vendor/class-wpglobus-yoastseo$version.php";
13
  * @since 1.9.17
14
  * 05.07.2018 - 77
15
  */
16
+ /**
17
+ * @since 1.9.18
18
+ * 23.10.2018 - 80
19
+ */
20
+ $wpglobus_yoastseo_latest_version = '80';
21
 
22
  if ( defined('WPSEO_VERSION') && defined('WPSEO_PREMIUM_PLUGIN_FILE') ) {
23
  /**
27
  /**
28
  * Support Yoast SEO Premium version 3.9 or later.
29
  */
30
+ if ( version_compare( WPGLOBUS_VERSION, '1.9.17', '>=' ) ) {
31
+ /**
32
+ * Version of file must be latest.
33
+ * @todo W.I.P.
34
+ */
35
+ $ver = $wpglobus_yoastseo_latest_version;
36
+ require_once "vendor/yoast-seo/class-wpglobus-yoastseo$ver.php";
37
+ WPGlobus_YoastSEO::controller($ver);
38
+ } elseif ( version_compare( WPGLOBUS_VERSION, '1.8', '>=' ) ) {
39
  /**
40
  * Version of file must be latest.
41
  */
65
  $version = version_compare( WPSEO_VERSION, '4.8', '>=' ) ? '48' : $version;
66
  $version = version_compare( WPSEO_VERSION, '5.9', '>=' ) ? '59' : $version;
67
  $version = version_compare( WPSEO_VERSION, '7.3', '>=' ) ? '73' : $version;
68
+ $version = version_compare( WPSEO_VERSION, '7.7', '>=' ) ? '77' : $version;
69
+ $version = version_compare( WPSEO_VERSION, '8.0', '>=' ) ? $wpglobus_yoastseo_latest_version : $version;
70
 
71
  if ( $version == '77' && is_admin() ) {
72
 
73
  // Don't start support here.
74
 
75
+ } elseif ( version_compare( WPSEO_VERSION, '8.0', '>=' ) ) {
76
+
77
+ require_once "vendor/yoast-seo/class-wpglobus-yoastseo$version.php";
78
+ WPGlobus_YoastSEO::controller($version);
79
+
80
  } else {
81
 
82
  require_once "vendor/class-wpglobus-yoastseo$version.php";
languages/wpglobus.pot CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (C) 2018 WPGlobus 1.9.17
2
- # This file is distributed under the same license as the WPGlobus 1.9.17 package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPGlobus 1.9.17\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.18
2
+ # This file is distributed under the same license as the WPGlobus 1.9.18 package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPGlobus 1.9.18\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,13 @@ This maintenance release introduces Gutenberg support in beta-stage.
218
 
219
  == Changelog ==
220
 
 
 
 
 
 
 
 
221
  = 1.9.17 =
222
 
223
  * COMPATIBILITY:
218
 
219
  == Changelog ==
220
 
221
+ = 1.9.18 =
222
+
223
+ * COMPATIBILITY:
224
+ * Elementor 2.2.6
225
+ * FIXED:
226
+ * Incorrect handling of the `_yoast_wpseo_title` field for Yoast SEO.
227
+
228
  = 1.9.17 =
229
 
230
  * COMPATIBILITY:
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.17
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.17' );
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.18
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
42
  exit;
43
  }
44
 
45
+ define( 'WPGLOBUS_VERSION', '1.9.18' );
46
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47
 
48
  /**