SEOPress - Version 3.9.2

Version Description

  • FIX Elementor synchronization
Download this release

Release Info

Developer rainbowgeek
Plugin Icon 128x128 SEOPress
Version 3.9.2
Comparing to
See all releases

Code changes from version 3.9.1 to 3.9.2

Files changed (3) hide show
  1. inc/admin/admin-metaboxes.php +500 -494
  2. readme.txt +5 -3
  3. seopress.php +2 -2
inc/admin/admin-metaboxes.php CHANGED
@@ -6,540 +6,546 @@ defined( 'ABSPATH' ) or die( 'Please don’t call the plugin directly. Thank
6
  //Restrict SEO metaboxes to user roles
7
  ///////////////////////////////////////////////////////////////////////////////////////////////////
8
  function seopress_advanced_security_metaboxe_role_hook_option() {
9
- $seopress_advanced_security_metaboxe_role_hook_option = get_option("seopress_advanced_option_name");
10
- if ( ! empty ( $seopress_advanced_security_metaboxe_role_hook_option ) ) {
11
- foreach ($seopress_advanced_security_metaboxe_role_hook_option as $key => $seopress_advanced_security_metaboxe_role_hook_value)
12
- $options[$key] = $seopress_advanced_security_metaboxe_role_hook_value;
13
- if (isset($seopress_advanced_security_metaboxe_role_hook_option['seopress_advanced_security_metaboxe_role'])) {
14
- return $seopress_advanced_security_metaboxe_role_hook_option['seopress_advanced_security_metaboxe_role'];
15
- }
16
- }
17
  }
18
 
19
  function seopress_advanced_security_metaboxe_ca_role_hook_option() {
20
- $seopress_advanced_security_metaboxe_ca_role_hook_option = get_option("seopress_advanced_option_name");
21
- if ( ! empty ( $seopress_advanced_security_metaboxe_ca_role_hook_option ) ) {
22
- foreach ($seopress_advanced_security_metaboxe_ca_role_hook_option as $key => $seopress_advanced_security_metaboxe_ca_role_hook_value)
23
- $options[$key] = $seopress_advanced_security_metaboxe_ca_role_hook_value;
24
- if (isset($seopress_advanced_security_metaboxe_ca_role_hook_option['seopress_advanced_security_metaboxe_ca_role'])) {
25
- return $seopress_advanced_security_metaboxe_ca_role_hook_option['seopress_advanced_security_metaboxe_ca_role'];
26
- }
27
- }
28
  }
29
 
30
  ///////////////////////////////////////////////////////////////////////////////////////////////////
31
  //Check global settings
32
  ///////////////////////////////////////////////////////////////////////////////////////////////////
33
  if (!function_exists('seopress_titles_single_cpt_noindex_option')) {
34
- function seopress_titles_single_cpt_noindex_option() {
35
- global $post;
36
- $seopress_get_current_cpt = get_post_type($post);
37
-
38
- $seopress_titles_single_cpt_noindex_option = get_option("seopress_titles_option_name");
39
- if ( ! empty ( $seopress_titles_single_cpt_noindex_option ) ) {
40
- foreach ($seopress_titles_single_cpt_noindex_option as $key => $seopress_titles_single_cpt_noindex_value)
41
- $options[$key] = $seopress_titles_single_cpt_noindex_value;
42
- if (isset($seopress_titles_single_cpt_noindex_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['noindex'])) {
43
- return $seopress_titles_single_cpt_noindex_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['noindex'];
44
- }
45
- }
46
- }
47
  }
48
 
49
  if (!function_exists('seopress_titles_noindex_option')) {
50
- function seopress_titles_noindex_option() {
51
- $seopress_titles_noindex_option = get_option("seopress_titles_option_name");
52
- if ( ! empty ( $seopress_titles_noindex_option ) ) {
53
- foreach ($seopress_titles_noindex_option as $key => $seopress_titles_noindex_value)
54
- $options[$key] = $seopress_titles_noindex_value;
55
- if (isset($seopress_titles_noindex_option['seopress_titles_noindex'])) {
56
- return $seopress_titles_noindex_option['seopress_titles_noindex'];
57
- }
58
- }
59
- }
60
  }
61
 
62
  if (!function_exists('seopress_titles_single_cpt_nofollow_option')) {
63
- function seopress_titles_single_cpt_nofollow_option() {
64
- global $post;
65
- $seopress_get_current_cpt = get_post_type($post);
66
-
67
- $seopress_titles_single_cpt_nofollow_option = get_option("seopress_titles_option_name");
68
- if ( ! empty ( $seopress_titles_single_cpt_nofollow_option ) ) {
69
- foreach ($seopress_titles_single_cpt_nofollow_option as $key => $seopress_titles_single_cpt_nofollow_value)
70
- $options[$key] = $seopress_titles_single_cpt_nofollow_value;
71
- if (isset($seopress_titles_single_cpt_nofollow_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['nofollow'])) {
72
- return $seopress_titles_single_cpt_nofollow_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['nofollow'];
73
- }
74
- }
75
- }
76
  }
77
 
78
  if (!function_exists('seopress_titles_nofollow_option')) {
79
- function seopress_titles_nofollow_option() {
80
- $seopress_titles_nofollow_option = get_option("seopress_titles_option_name");
81
- if ( ! empty ( $seopress_titles_nofollow_option ) ) {
82
- foreach ($seopress_titles_nofollow_option as $key => $seopress_titles_nofollow_value)
83
- $options[$key] = $seopress_titles_nofollow_value;
84
- if (isset($seopress_titles_nofollow_option['seopress_titles_nofollow'])) {
85
- return $seopress_titles_nofollow_option['seopress_titles_nofollow'];
86
- }
87
- }
88
- }
89
  }
90
 
91
  if (!function_exists('seopress_titles_noodp_option')) {
92
- function seopress_titles_noodp_option() {
93
- $seopress_titles_noodp_option = get_option("seopress_titles_option_name");
94
- if ( ! empty ( $seopress_titles_noodp_option ) ) {
95
- foreach ($seopress_titles_noodp_option as $key => $seopress_titles_noodp_value)
96
- $options[$key] = $seopress_titles_noodp_value;
97
- if (isset($seopress_titles_noodp_option['seopress_titles_noodp'])) {
98
- return $seopress_titles_noodp_option['seopress_titles_noodp'];
99
- }
100
- }
101
- }
102
  }
103
 
104
  if (!function_exists('seopress_titles_noarchive_option')) {
105
- function seopress_titles_noarchive_option() {
106
- $seopress_titles_noarchive_option = get_option("seopress_titles_option_name");
107
- if ( ! empty ( $seopress_titles_noarchive_option ) ) {
108
- foreach ($seopress_titles_noarchive_option as $key => $seopress_titles_noarchive_value)
109
- $options[$key] = $seopress_titles_noarchive_value;
110
- if (isset($seopress_titles_noarchive_option['seopress_titles_noarchive'])) {
111
- return $seopress_titles_noarchive_option['seopress_titles_noarchive'];
112
- }
113
- }
114
- }
115
  }
116
 
117
  if (!function_exists('seopress_titles_nosnippet_option')) {
118
- function seopress_titles_nosnippet_option() {
119
- $seopress_titles_nosnippet_option = get_option("seopress_titles_option_name");
120
- if ( ! empty ( $seopress_titles_nosnippet_option ) ) {
121
- foreach ($seopress_titles_nosnippet_option as $key => $seopress_titles_nosnippet_value)
122
- $options[$key] = $seopress_titles_nosnippet_value;
123
- if (isset($seopress_titles_nosnippet_option['seopress_titles_nosnippet'])) {
124
- return $seopress_titles_nosnippet_option['seopress_titles_nosnippet'];
125
- }
126
- }
127
- }
128
  }
129
 
130
  if (!function_exists('seopress_titles_noimageindex_option')) {
131
- function seopress_titles_noimageindex_option() {
132
- $seopress_titles_noimageindex_option = get_option("seopress_titles_option_name");
133
- if ( ! empty ( $seopress_titles_noimageindex_option ) ) {
134
- foreach ($seopress_titles_noimageindex_option as $key => $seopress_titles_noimageindex_value)
135
- $options[$key] = $seopress_titles_noimageindex_value;
136
- if (isset($seopress_titles_noimageindex_option['seopress_titles_noimageindex'])) {
137
- return $seopress_titles_noimageindex_option['seopress_titles_noimageindex'];
138
- }
139
- }
140
- }
141
  }
142
 
143
  ///////////////////////////////////////////////////////////////////////////////////////////////////
144
  //Display metabox in Custom Post Type
145
  ///////////////////////////////////////////////////////////////////////////////////////////////////
146
  function seopress_display_seo_metaboxe() {
147
- add_action('add_meta_boxes','seopress_init_metabox');
148
- function seopress_init_metabox(){
149
- if (function_exists('seopress_advanced_appearance_metaboxe_position_option')) {
150
- $seopress_advanced_appearance_metaboxe_position_option = seopress_advanced_appearance_metaboxe_position_option();
151
- } else {
152
- $seopress_advanced_appearance_metaboxe_position_option = 'default';
153
- }
154
-
155
- if (function_exists('seopress_get_post_types')) {
156
-
157
- $seopress_get_post_types = seopress_get_post_types();
158
-
159
- $seopress_get_post_types = apply_filters('seopress_metaboxe_seo', $seopress_get_post_types);
160
-
161
- if (!empty($seopress_get_post_types)) {
162
- foreach ($seopress_get_post_types as $key => $value) {
163
- add_meta_box('seopress_cpt', __('SEO','wp-seopress'), 'seopress_cpt', $key, 'normal', $seopress_advanced_appearance_metaboxe_position_option);
164
- }
165
- }
166
- add_meta_box('seopress_cpt', __('SEO','wp-seopress'), 'seopress_cpt', 'seopress_404', 'normal', $seopress_advanced_appearance_metaboxe_position_option);
167
- }
168
- }
169
-
170
- function seopress_cpt( $post ){
171
- global $typenow;
172
- $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
173
- wp_nonce_field( plugin_basename( __FILE__ ), 'seopress_cpt_nonce' );
174
-
175
- //init
176
- $disabled = array();
177
-
178
- wp_enqueue_script( 'seopress-cpt-tabs-js', plugins_url( 'assets/js/seopress-tabs2' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery-ui-tabs' ], SEOPRESS_VERSION );
179
-
180
- if ("seopress_404" != $typenow) {
181
- wp_enqueue_script('jquery-ui-accordion');
182
-
183
- //Register Google Snippet Preview / Content Analysis JS
184
- wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion' ], SEOPRESS_VERSION, true );
185
-
186
- //If Gutenberg ON
187
- if ( function_exists( 'get_current_screen' ) ) {
188
- $get_current_screen = get_current_screen();
189
- if ( isset( $get_current_screen->is_block_editor ) ) {
190
- if ( $get_current_screen->is_block_editor ) {
191
- wp_enqueue_script( 'seopress-block-editor-js', plugins_url( 'assets/js/seopress-block-editor' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery' ], SEOPRESS_VERSION, true );
192
- }
193
- }
194
- }
195
-
196
- wp_enqueue_script( 'seopress-cpt-video-sitemap-js', plugins_url( 'assets/js/seopress-sitemap-video' . $prefix . '.js', dirname(dirname( __FILE__ ))), [ 'jquery', 'jquery-ui-accordion' ], SEOPRESS_VERSION );
197
-
198
- $seopress_real_preview = array(
199
- 'seopress_nonce' => wp_create_nonce('seopress_real_preview_nonce'),
200
- 'seopress_real_preview' => admin_url('admin-ajax.php'),
201
- 'i18n' => [ 'progress' => __( 'Analysis in progress...', 'wp-seopress' ) ]
202
- );
203
- wp_localize_script( 'seopress-cpt-counters-js', 'seopressAjaxRealPreview', $seopress_real_preview );
204
-
205
- wp_enqueue_script( 'seopress-media-uploader-js', plugins_url('assets/js/seopress-media-uploader' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery' ], SEOPRESS_VERSION, false );
206
- wp_enqueue_media();
207
- }
208
-
209
- $seopress_titles_title = get_post_meta($post->ID,'_seopress_titles_title',true);
210
- $seopress_titles_desc = get_post_meta($post->ID,'_seopress_titles_desc',true);
211
-
212
- $disabled['robots_index'] ='';
213
- if (seopress_titles_single_cpt_noindex_option() || seopress_titles_noindex_option() || post_password_required($post->ID) ===true) {
214
- $seopress_robots_index = 'yes';
215
- $disabled['robots_index'] = 'disabled';
216
- } else {
217
- $seopress_robots_index = get_post_meta($post->ID,'_seopress_robots_index',true);
218
-
219
- }
220
-
221
- $disabled['robots_follow'] ='';
222
- if (seopress_titles_single_cpt_nofollow_option() || seopress_titles_nofollow_option()) {
223
- $seopress_robots_follow = 'yes';
224
- $disabled['robots_follow'] = 'disabled';
225
- } else {
226
- $seopress_robots_follow = get_post_meta($post->ID,'_seopress_robots_follow',true);
227
- }
228
-
229
- $disabled['robots_odp'] ='';
230
- if (seopress_titles_noodp_option()) {
231
- $seopress_robots_odp = 'yes';
232
- $disabled['robots_odp'] = 'disabled';
233
- } else {
234
- $seopress_robots_odp = get_post_meta($post->ID,'_seopress_robots_odp',true);
235
- }
236
-
237
- $disabled['archive'] ='';
238
- if (seopress_titles_noarchive_option()) {
239
- $seopress_robots_archive = 'yes';
240
- $disabled['archive'] = 'disabled';
241
- } else {
242
- $seopress_robots_archive = get_post_meta($post->ID,'_seopress_robots_archive',true);
243
- }
244
-
245
- $disabled['snippet'] ='';
246
- if (seopress_titles_nosnippet_option()) {
247
- $seopress_robots_snippet = 'yes';
248
- $disabled['snippet'] = 'disabled';
249
- } else {
250
- $seopress_robots_snippet = get_post_meta($post->ID,'_seopress_robots_snippet',true);
251
- }
252
-
253
- $disabled['imageindex'] ='';
254
- if (seopress_titles_noimageindex_option()) {
255
- $seopress_robots_imageindex = 'yes';
256
- $disabled['imageindex'] = 'disabled';
257
- } else {
258
- $seopress_robots_imageindex = get_post_meta($post->ID,'_seopress_robots_imageindex',true);
259
- }
260
-
261
- $seopress_robots_canonical = get_post_meta($post->ID,'_seopress_robots_canonical',true);
262
- $seopress_robots_primary_cat = get_post_meta($post->ID,'_seopress_robots_primary_cat',true);
263
- if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
264
- $seopress_robots_breadcrumbs = get_post_meta($post->ID,'_seopress_robots_breadcrumbs',true);
265
- }
266
- $seopress_social_fb_title = get_post_meta($post->ID,'_seopress_social_fb_title',true);
267
- $seopress_social_fb_desc = get_post_meta($post->ID,'_seopress_social_fb_desc',true);
268
- $seopress_social_fb_img = get_post_meta($post->ID,'_seopress_social_fb_img',true);
269
- $seopress_social_twitter_title = get_post_meta($post->ID,'_seopress_social_twitter_title',true);
270
- $seopress_social_twitter_desc = get_post_meta($post->ID,'_seopress_social_twitter_desc',true);
271
- $seopress_social_twitter_img = get_post_meta($post->ID,'_seopress_social_twitter_img',true);
272
- $seopress_redirections_enabled = get_post_meta($post->ID,'_seopress_redirections_enabled',true);
273
- $seopress_redirections_type = get_post_meta($post->ID,'_seopress_redirections_type',true);
274
- $seopress_redirections_value = get_post_meta($post->ID,'_seopress_redirections_value',true);
275
- $seopress_redirections_param = get_post_meta($post->ID,'_seopress_redirections_param',true);
276
- if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
277
- $seopress_news_disabled = get_post_meta($post->ID,'_seopress_news_disabled',true);
278
- $seopress_video_disabled = get_post_meta($post->ID,'_seopress_video_disabled',true);
279
- $seopress_video = get_post_meta($post->ID,'_seopress_video');
280
- }
281
-
282
- require_once ( dirname( __FILE__ ) . '/admin-metaboxes-form.php'); //Metaboxe HTML
283
- }
284
-
285
- add_action('save_post','seopress_save_metabox', 10, 2);
286
- function seopress_save_metabox($post_id, $post){
287
- //Nonce
288
- if ( !isset( $_POST['seopress_cpt_nonce'] ) || !wp_verify_nonce( $_POST['seopress_cpt_nonce'], plugin_basename( __FILE__ ) ) )
289
- return $post_id;
290
-
291
- //Post type object
292
- $post_type = get_post_type_object( $post->post_type );
293
-
294
- //Check permission
295
- if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
296
- return $post_id;
297
-
298
- if ( 'attachment' !== get_post_type($post_id)) {
299
- $seo_tabs = array();
300
- $seo_tabs = json_decode(stripslashes(htmlspecialchars_decode($_POST['seo_tabs'])));
301
-
302
- if (in_array('title-tab', $seo_tabs)) {
303
- if(isset($_POST['seopress_titles_title'])){
304
- update_post_meta($post_id, '_seopress_titles_title', esc_html($_POST['seopress_titles_title']));
305
- }
306
- if(isset($_POST['seopress_titles_desc'])){
307
- update_post_meta($post_id, '_seopress_titles_desc', esc_html($_POST['seopress_titles_desc']));
308
- }
309
- }
310
- if (in_array('advanced-tab', $seo_tabs)) {
311
- if( isset( $_POST[ 'seopress_robots_index' ] ) ) {
312
- update_post_meta( $post_id, '_seopress_robots_index', 'yes' );
313
- } else {
314
- delete_post_meta( $post_id, '_seopress_robots_index', '' );
315
- }
316
- if( isset( $_POST[ 'seopress_robots_follow' ] ) ) {
317
- update_post_meta( $post_id, '_seopress_robots_follow', 'yes' );
318
- } else {
319
- delete_post_meta( $post_id, '_seopress_robots_follow', '' );
320
- }
321
- if( isset( $_POST[ 'seopress_robots_odp' ] ) ) {
322
- update_post_meta( $post_id, '_seopress_robots_odp', 'yes' );
323
- } else {
324
- delete_post_meta( $post_id, '_seopress_robots_odp', '' );
325
- }
326
- if( isset( $_POST[ 'seopress_robots_imageindex' ] ) ) {
327
- update_post_meta( $post_id, '_seopress_robots_imageindex', 'yes' );
328
- } else {
329
- delete_post_meta( $post_id, '_seopress_robots_imageindex', '' );
330
- }
331
- if( isset( $_POST[ 'seopress_robots_archive' ] ) ) {
332
- update_post_meta( $post_id, '_seopress_robots_archive', 'yes' );
333
- } else {
334
- delete_post_meta( $post_id, '_seopress_robots_archive', '' );
335
- }
336
- if( isset( $_POST[ 'seopress_robots_snippet' ] ) ) {
337
- update_post_meta( $post_id, '_seopress_robots_snippet', 'yes' );
338
- } else {
339
- delete_post_meta( $post_id, '_seopress_robots_snippet', '' );
340
- }
341
- if(isset($_POST['seopress_robots_canonical'])){
342
- update_post_meta($post_id, '_seopress_robots_canonical', esc_html($_POST['seopress_robots_canonical']));
343
- }
344
- if(isset($_POST['seopress_robots_primary_cat'])){
345
- update_post_meta($post_id, '_seopress_robots_primary_cat', esc_html($_POST['seopress_robots_primary_cat']));
346
- }
347
- if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
348
- if(isset($_POST['seopress_robots_breadcrumbs'])){
349
- update_post_meta($post_id, '_seopress_robots_breadcrumbs', esc_html($_POST['seopress_robots_breadcrumbs']));
350
- }
351
- }
352
- }
353
- if (in_array('social-tab', $seo_tabs)) {
354
- if(isset($_POST['seopress_social_fb_title'])){
355
- update_post_meta($post_id, '_seopress_social_fb_title', esc_html($_POST['seopress_social_fb_title']));
356
- }
357
- if(isset($_POST['seopress_social_fb_desc'])){
358
- update_post_meta($post_id, '_seopress_social_fb_desc', esc_html($_POST['seopress_social_fb_desc']));
359
- }
360
- if(isset($_POST['seopress_social_fb_img'])){
361
- update_post_meta($post_id, '_seopress_social_fb_img', esc_html($_POST['seopress_social_fb_img']));
362
- }
363
- if(isset($_POST['seopress_social_twitter_title'])){
364
- update_post_meta($post_id, '_seopress_social_twitter_title', esc_html($_POST['seopress_social_twitter_title']));
365
- }
366
- if(isset($_POST['seopress_social_twitter_desc'])){
367
- update_post_meta($post_id, '_seopress_social_twitter_desc', esc_html($_POST['seopress_social_twitter_desc']));
368
- }
369
- if(isset($_POST['seopress_social_twitter_img'])){
370
- update_post_meta($post_id, '_seopress_social_twitter_img', esc_html($_POST['seopress_social_twitter_img']));
371
- }
372
- }
373
- if (in_array('redirect-tab', $seo_tabs)) {
374
- if(isset($_POST['seopress_redirections_type'])){
375
- update_post_meta($post_id, '_seopress_redirections_type', $_POST['seopress_redirections_type']);
376
- }
377
- if(isset($_POST['seopress_redirections_value'])){
378
- update_post_meta($post_id, '_seopress_redirections_value', esc_html($_POST['seopress_redirections_value']));
379
- }
380
- if(isset($_POST['seopress_redirections_param'])){
381
- update_post_meta($post_id, '_seopress_redirections_param', esc_html($_POST['seopress_redirections_param']));
382
- }
383
- if( isset( $_POST[ 'seopress_redirections_enabled' ] ) ) {
384
- update_post_meta( $post_id, '_seopress_redirections_enabled', 'yes' );
385
- } else {
386
- delete_post_meta( $post_id, '_seopress_redirections_enabled', '' );
387
- }
388
- }
389
- if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
390
- if (in_array('news-tab', $seo_tabs)) {
391
- if( isset( $_POST[ 'seopress_news_disabled' ] ) ) {
392
- update_post_meta( $post_id, '_seopress_news_disabled', 'yes' );
393
- } else {
394
- delete_post_meta( $post_id, '_seopress_news_disabled', '' );
395
- }
396
- }
397
- if (in_array('video-tab', $seo_tabs)) {
398
- if( isset( $_POST[ 'seopress_video_disabled' ] ) ) {
399
- update_post_meta( $post_id, '_seopress_video_disabled', 'yes' );
400
- } else {
401
- delete_post_meta( $post_id, '_seopress_video_disabled', '' );
402
- }
403
- if(isset($_POST['seopress_video'])){
404
- update_post_meta($post_id, '_seopress_video', $_POST['seopress_video']);
405
- }
406
- }
407
- }
408
- }
409
- }
410
  }
411
 
412
  function seopress_display_ca_metaboxe() {
413
- add_action('add_meta_boxes','seopress_init_ca_metabox');
414
- function seopress_init_ca_metabox(){
415
- if (function_exists('seopress_advanced_appearance_metaboxe_position_option')) {
416
- $seopress_advanced_appearance_metaboxe_position_option = seopress_advanced_appearance_metaboxe_position_option();
417
- } else {
418
- $seopress_advanced_appearance_metaboxe_position_option = 'default';
419
- }
420
- if (function_exists('seopress_get_post_types')) {
421
-
422
- $seopress_get_post_types = seopress_get_post_types();
423
-
424
- $seopress_get_post_types = apply_filters('seopress_metaboxe_content_analysis', $seopress_get_post_types);
425
-
426
- if (!empty($seopress_get_post_types)) {
427
- foreach ($seopress_get_post_types as $key => $value) {
428
- add_meta_box('seopress_content_analysis', __('Content analysis','wp-seopress'), 'seopress_content_analysis', $key, 'normal', $seopress_advanced_appearance_metaboxe_position_option);
429
- }
430
- }
431
- }
432
- }
433
-
434
- function seopress_content_analysis($post) {
435
- $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
436
- wp_nonce_field( plugin_basename( __FILE__ ), 'seopress_content_analysis_nonce' );
437
-
438
- wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters' . $prefix . '.js', dirname(dirname( __FILE__ ))), array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion' ), SEOPRESS_VERSION );
439
- $seopress_real_preview = array(
440
- 'seopress_nonce' => wp_create_nonce('seopress_real_preview_nonce'),
441
- 'seopress_real_preview' => admin_url('admin-ajax.php'),
442
- 'i18n' => array('progress' => __('Analysis in progress...','wp-seopress'))
443
- );
444
- wp_localize_script( 'seopress-cpt-counters-js', 'seopressAjaxRealPreview', $seopress_real_preview );
445
-
446
- $seopress_analysis_target_kw = get_post_meta($post->ID,'_seopress_analysis_target_kw',true);
447
- $seopress_analysis_data = get_post_meta($post->ID,'_seopress_analysis_data', true);
448
- $seopress_titles_title = get_post_meta($post->ID,'_seopress_titles_title',true);
449
- $seopress_titles_desc = get_post_meta($post->ID,'_seopress_titles_desc',true);
450
-
451
- if (seopress_titles_single_cpt_noindex_option() || seopress_titles_noindex_option() || post_password_required($post->ID) ===true) {
452
- $seopress_robots_index = 'yes';
453
- } else {
454
- $seopress_robots_index = get_post_meta($post->ID,'_seopress_robots_index',true);
455
- }
456
-
457
- if (seopress_titles_single_cpt_nofollow_option() || seopress_titles_nofollow_option()) {
458
- $seopress_robots_follow = 'yes';
459
- } else {
460
- $seopress_robots_follow = get_post_meta($post->ID,'_seopress_robots_follow',true);
461
- }
462
-
463
- if (seopress_titles_noodp_option()) {
464
- $seopress_robots_odp = 'yes';
465
- } else {
466
- $seopress_robots_odp = get_post_meta($post->ID,'_seopress_robots_odp',true);
467
- }
468
-
469
- if (seopress_titles_noarchive_option()) {
470
- $seopress_robots_archive = 'yes';
471
- } else {
472
- $seopress_robots_archive = get_post_meta($post->ID,'_seopress_robots_archive',true);
473
- }
474
-
475
- if (seopress_titles_nosnippet_option()) {
476
- $seopress_robots_snippet = 'yes';
477
- } else {
478
- $seopress_robots_snippet = get_post_meta($post->ID,'_seopress_robots_snippet',true);
479
- }
480
-
481
- if (seopress_titles_noimageindex_option()) {
482
- $seopress_robots_imageindex = 'yes';
483
- } else {
484
- $seopress_robots_imageindex = get_post_meta($post->ID,'_seopress_robots_imageindex',true);
485
- }
486
-
487
- require_once ( dirname( __FILE__ ) . '/admin-metaboxes-content-analysis-form.php'); //Metaboxe HTML
488
- }
489
-
490
- add_action('save_post','seopress_save_ca_metabox', 10, 2);
491
- function seopress_save_ca_metabox($post_id, $post){
492
- //Nonce
493
- if ( !isset( $_POST['seopress_content_analysis_nonce'] ) || !wp_verify_nonce( $_POST['seopress_content_analysis_nonce'], plugin_basename( __FILE__ ) ) )
494
- return $post_id;
495
-
496
- //Post type object
497
- $post_type = get_post_type_object( $post->post_type );
498
-
499
- //Check permission
500
- if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
501
- return $post_id;
502
-
503
- if ( 'attachment' !== get_post_type($post_id)) {
504
- if(isset($_POST['seopress_analysis_target_kw'])){
505
- update_post_meta($post_id, '_seopress_analysis_target_kw', esc_html($_POST['seopress_analysis_target_kw']));
506
- }
507
- }
508
- }
 
 
 
 
 
 
509
  }
510
 
511
  if (is_user_logged_in()) {
512
- if(is_super_admin()) {
513
- echo seopress_display_seo_metaboxe();
514
- echo seopress_display_ca_metaboxe();
515
- } else {
516
- global $wp_roles;
517
-
518
- //Get current user role
519
- if(isset(wp_get_current_user()->roles[0])) {
520
- $seopress_user_role = wp_get_current_user()->roles[0];
521
-
522
- //If current user role matchs values from Security settings then apply -- SEO Metaboxe
523
- if (function_exists('seopress_advanced_security_metaboxe_role_hook_option') && seopress_advanced_security_metaboxe_role_hook_option() !='') {
524
- if( array_key_exists( $seopress_user_role, seopress_advanced_security_metaboxe_role_hook_option())) {
525
- //do nothing
526
- } else {
527
- echo seopress_display_seo_metaboxe();
528
- }
529
- } else {
530
- echo seopress_display_seo_metaboxe();
531
- }
532
-
533
- //If current user role matchs values from Security settings then apply -- SEO Content Analysis
534
- if (function_exists('seopress_advanced_security_metaboxe_ca_role_hook_option') && seopress_advanced_security_metaboxe_ca_role_hook_option() !='') {
535
- if( array_key_exists( $seopress_user_role, seopress_advanced_security_metaboxe_ca_role_hook_option())) {
536
- //do nothing
537
- } else {
538
- echo seopress_display_ca_metaboxe();
539
- }
540
- } else {
541
- echo seopress_display_ca_metaboxe();
542
- }
543
- }
544
- }
545
  }
6
  //Restrict SEO metaboxes to user roles
7
  ///////////////////////////////////////////////////////////////////////////////////////////////////
8
  function seopress_advanced_security_metaboxe_role_hook_option() {
9
+ $seopress_advanced_security_metaboxe_role_hook_option = get_option("seopress_advanced_option_name");
10
+ if ( ! empty ( $seopress_advanced_security_metaboxe_role_hook_option ) ) {
11
+ foreach ($seopress_advanced_security_metaboxe_role_hook_option as $key => $seopress_advanced_security_metaboxe_role_hook_value)
12
+ $options[$key] = $seopress_advanced_security_metaboxe_role_hook_value;
13
+ if (isset($seopress_advanced_security_metaboxe_role_hook_option['seopress_advanced_security_metaboxe_role'])) {
14
+ return $seopress_advanced_security_metaboxe_role_hook_option['seopress_advanced_security_metaboxe_role'];
15
+ }
16
+ }
17
  }
18
 
19
  function seopress_advanced_security_metaboxe_ca_role_hook_option() {
20
+ $seopress_advanced_security_metaboxe_ca_role_hook_option = get_option("seopress_advanced_option_name");
21
+ if ( ! empty ( $seopress_advanced_security_metaboxe_ca_role_hook_option ) ) {
22
+ foreach ($seopress_advanced_security_metaboxe_ca_role_hook_option as $key => $seopress_advanced_security_metaboxe_ca_role_hook_value)
23
+ $options[$key] = $seopress_advanced_security_metaboxe_ca_role_hook_value;
24
+ if (isset($seopress_advanced_security_metaboxe_ca_role_hook_option['seopress_advanced_security_metaboxe_ca_role'])) {
25
+ return $seopress_advanced_security_metaboxe_ca_role_hook_option['seopress_advanced_security_metaboxe_ca_role'];
26
+ }
27
+ }
28
  }
29
 
30
  ///////////////////////////////////////////////////////////////////////////////////////////////////
31
  //Check global settings
32
  ///////////////////////////////////////////////////////////////////////////////////////////////////
33
  if (!function_exists('seopress_titles_single_cpt_noindex_option')) {
34
+ function seopress_titles_single_cpt_noindex_option() {
35
+ global $post;
36
+ $seopress_get_current_cpt = get_post_type($post);
37
+
38
+ $seopress_titles_single_cpt_noindex_option = get_option("seopress_titles_option_name");
39
+ if ( ! empty ( $seopress_titles_single_cpt_noindex_option ) ) {
40
+ foreach ($seopress_titles_single_cpt_noindex_option as $key => $seopress_titles_single_cpt_noindex_value)
41
+ $options[$key] = $seopress_titles_single_cpt_noindex_value;
42
+ if (isset($seopress_titles_single_cpt_noindex_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['noindex'])) {
43
+ return $seopress_titles_single_cpt_noindex_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['noindex'];
44
+ }
45
+ }
46
+ }
47
  }
48
 
49
  if (!function_exists('seopress_titles_noindex_option')) {
50
+ function seopress_titles_noindex_option() {
51
+ $seopress_titles_noindex_option = get_option("seopress_titles_option_name");
52
+ if ( ! empty ( $seopress_titles_noindex_option ) ) {
53
+ foreach ($seopress_titles_noindex_option as $key => $seopress_titles_noindex_value)
54
+ $options[$key] = $seopress_titles_noindex_value;
55
+ if (isset($seopress_titles_noindex_option['seopress_titles_noindex'])) {
56
+ return $seopress_titles_noindex_option['seopress_titles_noindex'];
57
+ }
58
+ }
59
+ }
60
  }
61
 
62
  if (!function_exists('seopress_titles_single_cpt_nofollow_option')) {
63
+ function seopress_titles_single_cpt_nofollow_option() {
64
+ global $post;
65
+ $seopress_get_current_cpt = get_post_type($post);
66
+
67
+ $seopress_titles_single_cpt_nofollow_option = get_option("seopress_titles_option_name");
68
+ if ( ! empty ( $seopress_titles_single_cpt_nofollow_option ) ) {
69
+ foreach ($seopress_titles_single_cpt_nofollow_option as $key => $seopress_titles_single_cpt_nofollow_value)
70
+ $options[$key] = $seopress_titles_single_cpt_nofollow_value;
71
+ if (isset($seopress_titles_single_cpt_nofollow_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['nofollow'])) {
72
+ return $seopress_titles_single_cpt_nofollow_option['seopress_titles_single_titles'][$seopress_get_current_cpt]['nofollow'];
73
+ }
74
+ }
75
+ }
76
  }
77
 
78
  if (!function_exists('seopress_titles_nofollow_option')) {
79
+ function seopress_titles_nofollow_option() {
80
+ $seopress_titles_nofollow_option = get_option("seopress_titles_option_name");
81
+ if ( ! empty ( $seopress_titles_nofollow_option ) ) {
82
+ foreach ($seopress_titles_nofollow_option as $key => $seopress_titles_nofollow_value)
83
+ $options[$key] = $seopress_titles_nofollow_value;
84
+ if (isset($seopress_titles_nofollow_option['seopress_titles_nofollow'])) {
85
+ return $seopress_titles_nofollow_option['seopress_titles_nofollow'];
86
+ }
87
+ }
88
+ }
89
  }
90
 
91
  if (!function_exists('seopress_titles_noodp_option')) {
92
+ function seopress_titles_noodp_option() {
93
+ $seopress_titles_noodp_option = get_option("seopress_titles_option_name");
94
+ if ( ! empty ( $seopress_titles_noodp_option ) ) {
95
+ foreach ($seopress_titles_noodp_option as $key => $seopress_titles_noodp_value)
96
+ $options[$key] = $seopress_titles_noodp_value;
97
+ if (isset($seopress_titles_noodp_option['seopress_titles_noodp'])) {
98
+ return $seopress_titles_noodp_option['seopress_titles_noodp'];
99
+ }
100
+ }
101
+ }
102
  }
103
 
104
  if (!function_exists('seopress_titles_noarchive_option')) {
105
+ function seopress_titles_noarchive_option() {
106
+ $seopress_titles_noarchive_option = get_option("seopress_titles_option_name");
107
+ if ( ! empty ( $seopress_titles_noarchive_option ) ) {
108
+ foreach ($seopress_titles_noarchive_option as $key => $seopress_titles_noarchive_value)
109
+ $options[$key] = $seopress_titles_noarchive_value;
110
+ if (isset($seopress_titles_noarchive_option['seopress_titles_noarchive'])) {
111
+ return $seopress_titles_noarchive_option['seopress_titles_noarchive'];
112
+ }
113
+ }
114
+ }
115
  }
116
 
117
  if (!function_exists('seopress_titles_nosnippet_option')) {
118
+ function seopress_titles_nosnippet_option() {
119
+ $seopress_titles_nosnippet_option = get_option("seopress_titles_option_name");
120
+ if ( ! empty ( $seopress_titles_nosnippet_option ) ) {
121
+ foreach ($seopress_titles_nosnippet_option as $key => $seopress_titles_nosnippet_value)
122
+ $options[$key] = $seopress_titles_nosnippet_value;
123
+ if (isset($seopress_titles_nosnippet_option['seopress_titles_nosnippet'])) {
124
+ return $seopress_titles_nosnippet_option['seopress_titles_nosnippet'];
125
+ }
126
+ }
127
+ }
128
  }
129
 
130
  if (!function_exists('seopress_titles_noimageindex_option')) {
131
+ function seopress_titles_noimageindex_option() {
132
+ $seopress_titles_noimageindex_option = get_option("seopress_titles_option_name");
133
+ if ( ! empty ( $seopress_titles_noimageindex_option ) ) {
134
+ foreach ($seopress_titles_noimageindex_option as $key => $seopress_titles_noimageindex_value)
135
+ $options[$key] = $seopress_titles_noimageindex_value;
136
+ if (isset($seopress_titles_noimageindex_option['seopress_titles_noimageindex'])) {
137
+ return $seopress_titles_noimageindex_option['seopress_titles_noimageindex'];
138
+ }
139
+ }
140
+ }
141
  }
142
 
143
  ///////////////////////////////////////////////////////////////////////////////////////////////////
144
  //Display metabox in Custom Post Type
145
  ///////////////////////////////////////////////////////////////////////////////////////////////////
146
  function seopress_display_seo_metaboxe() {
147
+ add_action('add_meta_boxes','seopress_init_metabox');
148
+ function seopress_init_metabox(){
149
+ if (function_exists('seopress_advanced_appearance_metaboxe_position_option')) {
150
+ $seopress_advanced_appearance_metaboxe_position_option = seopress_advanced_appearance_metaboxe_position_option();
151
+ } else {
152
+ $seopress_advanced_appearance_metaboxe_position_option = 'default';
153
+ }
154
+
155
+ if (function_exists('seopress_get_post_types')) {
156
+
157
+ $seopress_get_post_types = seopress_get_post_types();
158
+
159
+ $seopress_get_post_types = apply_filters('seopress_metaboxe_seo', $seopress_get_post_types);
160
+
161
+ if (!empty($seopress_get_post_types)) {
162
+ foreach ($seopress_get_post_types as $key => $value) {
163
+ add_meta_box('seopress_cpt', __('SEO','wp-seopress'), 'seopress_cpt', $key, 'normal', $seopress_advanced_appearance_metaboxe_position_option);
164
+ }
165
+ }
166
+ add_meta_box('seopress_cpt', __('SEO','wp-seopress'), 'seopress_cpt', 'seopress_404', 'normal', $seopress_advanced_appearance_metaboxe_position_option);
167
+ }
168
+ }
169
+
170
+ function seopress_cpt( $post ){
171
+ global $typenow;
172
+ $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
173
+ wp_nonce_field( plugin_basename( __FILE__ ), 'seopress_cpt_nonce' );
174
+
175
+ //init
176
+ $disabled = array();
177
+
178
+ wp_enqueue_script( 'seopress-cpt-tabs-js', plugins_url( 'assets/js/seopress-tabs2' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery-ui-tabs' ], SEOPRESS_VERSION );
179
+
180
+ if ("seopress_404" != $typenow) {
181
+ wp_enqueue_script('jquery-ui-accordion');
182
+
183
+ //Register Google Snippet Preview / Content Analysis JS
184
+ wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion' ], SEOPRESS_VERSION, true );
185
+
186
+ //If Gutenberg ON
187
+ if ( function_exists( 'get_current_screen' ) ) {
188
+ $get_current_screen = get_current_screen();
189
+ if ( isset( $get_current_screen->is_block_editor ) ) {
190
+ if ( $get_current_screen->is_block_editor ) {
191
+ wp_enqueue_script( 'seopress-block-editor-js', plugins_url( 'assets/js/seopress-block-editor' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery' ], SEOPRESS_VERSION, true );
192
+ }
193
+ }
194
+ }
195
+
196
+ wp_enqueue_script( 'seopress-cpt-video-sitemap-js', plugins_url( 'assets/js/seopress-sitemap-video' . $prefix . '.js', dirname(dirname( __FILE__ ))), [ 'jquery', 'jquery-ui-accordion' ], SEOPRESS_VERSION );
197
+
198
+ $seopress_real_preview = array(
199
+ 'seopress_nonce' => wp_create_nonce('seopress_real_preview_nonce'),
200
+ 'seopress_real_preview' => admin_url('admin-ajax.php'),
201
+ 'i18n' => [ 'progress' => __( 'Analysis in progress...', 'wp-seopress' ) ]
202
+ );
203
+ wp_localize_script( 'seopress-cpt-counters-js', 'seopressAjaxRealPreview', $seopress_real_preview );
204
+
205
+ wp_enqueue_script( 'seopress-media-uploader-js', plugins_url('assets/js/seopress-media-uploader' . $prefix . '.js', dirname( dirname( __FILE__ ) ) ), [ 'jquery' ], SEOPRESS_VERSION, false );
206
+ wp_enqueue_media();
207
+ }
208
+
209
+ $seopress_titles_title = get_post_meta($post->ID,'_seopress_titles_title',true);
210
+ $seopress_titles_desc = get_post_meta($post->ID,'_seopress_titles_desc',true);
211
+
212
+ $disabled['robots_index'] ='';
213
+ if (seopress_titles_single_cpt_noindex_option() || seopress_titles_noindex_option() || post_password_required($post->ID) ===true) {
214
+ $seopress_robots_index = 'yes';
215
+ $disabled['robots_index'] = 'disabled';
216
+ } else {
217
+ $seopress_robots_index = get_post_meta($post->ID,'_seopress_robots_index',true);
218
+
219
+ }
220
+
221
+ $disabled['robots_follow'] ='';
222
+ if (seopress_titles_single_cpt_nofollow_option() || seopress_titles_nofollow_option()) {
223
+ $seopress_robots_follow = 'yes';
224
+ $disabled['robots_follow'] = 'disabled';
225
+ } else {
226
+ $seopress_robots_follow = get_post_meta($post->ID,'_seopress_robots_follow',true);
227
+ }
228
+
229
+ $disabled['robots_odp'] ='';
230
+ if (seopress_titles_noodp_option()) {
231
+ $seopress_robots_odp = 'yes';
232
+ $disabled['robots_odp'] = 'disabled';
233
+ } else {
234
+ $seopress_robots_odp = get_post_meta($post->ID,'_seopress_robots_odp',true);
235
+ }
236
+
237
+ $disabled['archive'] ='';
238
+ if (seopress_titles_noarchive_option()) {
239
+ $seopress_robots_archive = 'yes';
240
+ $disabled['archive'] = 'disabled';
241
+ } else {
242
+ $seopress_robots_archive = get_post_meta($post->ID,'_seopress_robots_archive',true);
243
+ }
244
+
245
+ $disabled['snippet'] ='';
246
+ if (seopress_titles_nosnippet_option()) {
247
+ $seopress_robots_snippet = 'yes';
248
+ $disabled['snippet'] = 'disabled';
249
+ } else {
250
+ $seopress_robots_snippet = get_post_meta($post->ID,'_seopress_robots_snippet',true);
251
+ }
252
+
253
+ $disabled['imageindex'] ='';
254
+ if (seopress_titles_noimageindex_option()) {
255
+ $seopress_robots_imageindex = 'yes';
256
+ $disabled['imageindex'] = 'disabled';
257
+ } else {
258
+ $seopress_robots_imageindex = get_post_meta($post->ID,'_seopress_robots_imageindex',true);
259
+ }
260
+
261
+ $seopress_robots_canonical = get_post_meta($post->ID,'_seopress_robots_canonical',true);
262
+ $seopress_robots_primary_cat = get_post_meta($post->ID,'_seopress_robots_primary_cat',true);
263
+ if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
264
+ $seopress_robots_breadcrumbs = get_post_meta($post->ID,'_seopress_robots_breadcrumbs',true);
265
+ }
266
+ $seopress_social_fb_title = get_post_meta($post->ID,'_seopress_social_fb_title',true);
267
+ $seopress_social_fb_desc = get_post_meta($post->ID,'_seopress_social_fb_desc',true);
268
+ $seopress_social_fb_img = get_post_meta($post->ID,'_seopress_social_fb_img',true);
269
+ $seopress_social_twitter_title = get_post_meta($post->ID,'_seopress_social_twitter_title',true);
270
+ $seopress_social_twitter_desc = get_post_meta($post->ID,'_seopress_social_twitter_desc',true);
271
+ $seopress_social_twitter_img = get_post_meta($post->ID,'_seopress_social_twitter_img',true);
272
+ $seopress_redirections_enabled = get_post_meta($post->ID,'_seopress_redirections_enabled',true);
273
+ $seopress_redirections_type = get_post_meta($post->ID,'_seopress_redirections_type',true);
274
+ $seopress_redirections_value = get_post_meta($post->ID,'_seopress_redirections_value',true);
275
+ $seopress_redirections_param = get_post_meta($post->ID,'_seopress_redirections_param',true);
276
+ if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
277
+ $seopress_news_disabled = get_post_meta($post->ID,'_seopress_news_disabled',true);
278
+ $seopress_video_disabled = get_post_meta($post->ID,'_seopress_video_disabled',true);
279
+ $seopress_video = get_post_meta($post->ID,'_seopress_video');
280
+ }
281
+
282
+ require_once ( dirname( __FILE__ ) . '/admin-metaboxes-form.php'); //Metaboxe HTML
283
+ }
284
+
285
+ add_action('save_post','seopress_save_metabox', 10, 2);
286
+ function seopress_save_metabox($post_id, $post){
287
+ //Nonce
288
+ if ( !isset( $_POST['seopress_cpt_nonce'] ) || !wp_verify_nonce( $_POST['seopress_cpt_nonce'], plugin_basename( __FILE__ ) ) )
289
+ return $post_id;
290
+
291
+ //Post type object
292
+ $post_type = get_post_type_object( $post->post_type );
293
+
294
+ //Check permission
295
+ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
296
+ return $post_id;
297
+
298
+ if ( 'attachment' !== get_post_type($post_id)) {
299
+ $seo_tabs = array();
300
+ $seo_tabs = json_decode(stripslashes(htmlspecialchars_decode($_POST['seo_tabs'])));
301
+
302
+ if (in_array('title-tab', $seo_tabs)) {
303
+ if(isset($_POST['seopress_titles_title'])){
304
+ update_post_meta($post_id, '_seopress_titles_title', esc_html($_POST['seopress_titles_title']));
305
+ }
306
+ if(isset($_POST['seopress_titles_desc'])){
307
+ update_post_meta($post_id, '_seopress_titles_desc', esc_html($_POST['seopress_titles_desc']));
308
+ }
309
+ }
310
+ if (in_array('advanced-tab', $seo_tabs)) {
311
+ if( isset( $_POST[ 'seopress_robots_index' ] ) ) {
312
+ update_post_meta( $post_id, '_seopress_robots_index', 'yes' );
313
+ } else {
314
+ delete_post_meta( $post_id, '_seopress_robots_index', '' );
315
+ }
316
+ if( isset( $_POST[ 'seopress_robots_follow' ] ) ) {
317
+ update_post_meta( $post_id, '_seopress_robots_follow', 'yes' );
318
+ } else {
319
+ delete_post_meta( $post_id, '_seopress_robots_follow', '' );
320
+ }
321
+ if( isset( $_POST[ 'seopress_robots_odp' ] ) ) {
322
+ update_post_meta( $post_id, '_seopress_robots_odp', 'yes' );
323
+ } else {
324
+ delete_post_meta( $post_id, '_seopress_robots_odp', '' );
325
+ }
326
+ if( isset( $_POST[ 'seopress_robots_imageindex' ] ) ) {
327
+ update_post_meta( $post_id, '_seopress_robots_imageindex', 'yes' );
328
+ } else {
329
+ delete_post_meta( $post_id, '_seopress_robots_imageindex', '' );
330
+ }
331
+ if( isset( $_POST[ 'seopress_robots_archive' ] ) ) {
332
+ update_post_meta( $post_id, '_seopress_robots_archive', 'yes' );
333
+ } else {
334
+ delete_post_meta( $post_id, '_seopress_robots_archive', '' );
335
+ }
336
+ if( isset( $_POST[ 'seopress_robots_snippet' ] ) ) {
337
+ update_post_meta( $post_id, '_seopress_robots_snippet', 'yes' );
338
+ } else {
339
+ delete_post_meta( $post_id, '_seopress_robots_snippet', '' );
340
+ }
341
+ if(isset($_POST['seopress_robots_canonical'])){
342
+ update_post_meta($post_id, '_seopress_robots_canonical', esc_html($_POST['seopress_robots_canonical']));
343
+ }
344
+ if(isset($_POST['seopress_robots_primary_cat'])){
345
+ update_post_meta($post_id, '_seopress_robots_primary_cat', esc_html($_POST['seopress_robots_primary_cat']));
346
+ }
347
+ if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
348
+ if(isset($_POST['seopress_robots_breadcrumbs'])){
349
+ update_post_meta($post_id, '_seopress_robots_breadcrumbs', esc_html($_POST['seopress_robots_breadcrumbs']));
350
+ }
351
+ }
352
+ }
353
+ if (in_array('social-tab', $seo_tabs)) {
354
+ if(isset($_POST['seopress_social_fb_title'])){
355
+ update_post_meta($post_id, '_seopress_social_fb_title', esc_html($_POST['seopress_social_fb_title']));
356
+ }
357
+ if(isset($_POST['seopress_social_fb_desc'])){
358
+ update_post_meta($post_id, '_seopress_social_fb_desc', esc_html($_POST['seopress_social_fb_desc']));
359
+ }
360
+ if(isset($_POST['seopress_social_fb_img'])){
361
+ update_post_meta($post_id, '_seopress_social_fb_img', esc_html($_POST['seopress_social_fb_img']));
362
+ }
363
+ if(isset($_POST['seopress_social_twitter_title'])){
364
+ update_post_meta($post_id, '_seopress_social_twitter_title', esc_html($_POST['seopress_social_twitter_title']));
365
+ }
366
+ if(isset($_POST['seopress_social_twitter_desc'])){
367
+ update_post_meta($post_id, '_seopress_social_twitter_desc', esc_html($_POST['seopress_social_twitter_desc']));
368
+ }
369
+ if(isset($_POST['seopress_social_twitter_img'])){
370
+ update_post_meta($post_id, '_seopress_social_twitter_img', esc_html($_POST['seopress_social_twitter_img']));
371
+ }
372
+ }
373
+ if (in_array('redirect-tab', $seo_tabs)) {
374
+ if(isset($_POST['seopress_redirections_type'])){
375
+ update_post_meta($post_id, '_seopress_redirections_type', $_POST['seopress_redirections_type']);
376
+ }
377
+ if(isset($_POST['seopress_redirections_value'])){
378
+ update_post_meta($post_id, '_seopress_redirections_value', esc_html($_POST['seopress_redirections_value']));
379
+ }
380
+ if(isset($_POST['seopress_redirections_param'])){
381
+ update_post_meta($post_id, '_seopress_redirections_param', esc_html($_POST['seopress_redirections_param']));
382
+ }
383
+ if( isset( $_POST[ 'seopress_redirections_enabled' ] ) ) {
384
+ update_post_meta( $post_id, '_seopress_redirections_enabled', 'yes' );
385
+ } else {
386
+ delete_post_meta( $post_id, '_seopress_redirections_enabled', '' );
387
+ }
388
+ }
389
+ if (is_plugin_active('wp-seopress-pro/seopress-pro.php')) {
390
+ if (in_array('news-tab', $seo_tabs)) {
391
+ if( isset( $_POST[ 'seopress_news_disabled' ] ) ) {
392
+ update_post_meta( $post_id, '_seopress_news_disabled', 'yes' );
393
+ } else {
394
+ delete_post_meta( $post_id, '_seopress_news_disabled', '' );
395
+ }
396
+ }
397
+ if (in_array('video-tab', $seo_tabs)) {
398
+ if( isset( $_POST[ 'seopress_video_disabled' ] ) ) {
399
+ update_post_meta( $post_id, '_seopress_video_disabled', 'yes' );
400
+ } else {
401
+ delete_post_meta( $post_id, '_seopress_video_disabled', '' );
402
+ }
403
+ if(isset($_POST['seopress_video'])){
404
+ update_post_meta($post_id, '_seopress_video', $_POST['seopress_video']);
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }
410
  }
411
 
412
  function seopress_display_ca_metaboxe() {
413
+ add_action('add_meta_boxes','seopress_init_ca_metabox');
414
+ function seopress_init_ca_metabox(){
415
+ if (function_exists('seopress_advanced_appearance_metaboxe_position_option')) {
416
+ $seopress_advanced_appearance_metaboxe_position_option = seopress_advanced_appearance_metaboxe_position_option();
417
+ } else {
418
+ $seopress_advanced_appearance_metaboxe_position_option = 'default';
419
+ }
420
+ if (function_exists('seopress_get_post_types')) {
421
+
422
+ $seopress_get_post_types = seopress_get_post_types();
423
+
424
+ $seopress_get_post_types = apply_filters('seopress_metaboxe_content_analysis', $seopress_get_post_types);
425
+
426
+ if (!empty($seopress_get_post_types)) {
427
+ foreach ($seopress_get_post_types as $key => $value) {
428
+ add_meta_box('seopress_content_analysis', __('Content analysis','wp-seopress'), 'seopress_content_analysis', $key, 'normal', $seopress_advanced_appearance_metaboxe_position_option);
429
+ }
430
+ }
431
+ }
432
+ }
433
+
434
+ function seopress_content_analysis($post) {
435
+ $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
436
+ wp_nonce_field( plugin_basename( __FILE__ ), 'seopress_content_analysis_nonce' );
437
+
438
+ wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters' . $prefix . '.js', dirname(dirname( __FILE__ ))), array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion' ), SEOPRESS_VERSION );
439
+ $seopress_real_preview = array(
440
+ 'seopress_nonce' => wp_create_nonce('seopress_real_preview_nonce'),
441
+ 'seopress_real_preview' => admin_url('admin-ajax.php'),
442
+ 'i18n' => array('progress' => __('Analysis in progress...','wp-seopress'))
443
+ );
444
+ wp_localize_script( 'seopress-cpt-counters-js', 'seopressAjaxRealPreview', $seopress_real_preview );
445
+
446
+ $seopress_analysis_target_kw = get_post_meta($post->ID,'_seopress_analysis_target_kw',true);
447
+ $seopress_analysis_data = get_post_meta($post->ID,'_seopress_analysis_data', true);
448
+ $seopress_titles_title = get_post_meta($post->ID,'_seopress_titles_title',true);
449
+ $seopress_titles_desc = get_post_meta($post->ID,'_seopress_titles_desc',true);
450
+
451
+ if (seopress_titles_single_cpt_noindex_option() || seopress_titles_noindex_option() || post_password_required($post->ID) ===true) {
452
+ $seopress_robots_index = 'yes';
453
+ } else {
454
+ $seopress_robots_index = get_post_meta($post->ID,'_seopress_robots_index',true);
455
+ }
456
+
457
+ if (seopress_titles_single_cpt_nofollow_option() || seopress_titles_nofollow_option()) {
458
+ $seopress_robots_follow = 'yes';
459
+ } else {
460
+ $seopress_robots_follow = get_post_meta($post->ID,'_seopress_robots_follow',true);
461
+ }
462
+
463
+ if (seopress_titles_noodp_option()) {
464
+ $seopress_robots_odp = 'yes';
465
+ } else {
466
+ $seopress_robots_odp = get_post_meta($post->ID,'_seopress_robots_odp',true);
467
+ }
468
+
469
+ if (seopress_titles_noarchive_option()) {
470
+ $seopress_robots_archive = 'yes';
471
+ } else {
472
+ $seopress_robots_archive = get_post_meta($post->ID,'_seopress_robots_archive',true);
473
+ }
474
+
475
+ if (seopress_titles_nosnippet_option()) {
476
+ $seopress_robots_snippet = 'yes';
477
+ } else {
478
+ $seopress_robots_snippet = get_post_meta($post->ID,'_seopress_robots_snippet',true);
479
+ }
480
+
481
+ if (seopress_titles_noimageindex_option()) {
482
+ $seopress_robots_imageindex = 'yes';
483
+ } else {
484
+ $seopress_robots_imageindex = get_post_meta($post->ID,'_seopress_robots_imageindex',true);
485
+ }
486
+
487
+ require_once ( dirname( __FILE__ ) . '/admin-metaboxes-content-analysis-form.php'); //Metaboxe HTML
488
+ }
489
+
490
+ add_action('save_post','seopress_save_ca_metabox', 10, 2);
491
+ function seopress_save_ca_metabox($post_id, $post){
492
+ //Nonce
493
+ if ( !isset( $_POST['seopress_content_analysis_nonce'] ) || !wp_verify_nonce( $_POST['seopress_content_analysis_nonce'], plugin_basename( __FILE__ ) ) )
494
+ return $post_id;
495
+
496
+ //Post type object
497
+ $post_type = get_post_type_object( $post->post_type );
498
+
499
+ //Check permission
500
+ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
501
+ return $post_id;
502
+
503
+ if ( 'attachment' !== get_post_type($post_id)) {
504
+ if(isset($_POST['seopress_analysis_target_kw'])){
505
+ update_post_meta($post_id, '_seopress_analysis_target_kw', esc_html($_POST['seopress_analysis_target_kw']));
506
+ }
507
+ }
508
+ }
509
+
510
+ //Save metabox values in elementor
511
+ add_action('save_post', 'seopress_update_elementor_fields', 999, 2);
512
+ function seopress_update_elementor_fields( $post_id, $post ) {
513
+ do_action( 'seopress/page-builders/elementor/save_meta', $post_id );
514
+ }
515
  }
516
 
517
  if (is_user_logged_in()) {
518
+ if(is_super_admin()) {
519
+ echo seopress_display_seo_metaboxe();
520
+ echo seopress_display_ca_metaboxe();
521
+ } else {
522
+ global $wp_roles;
523
+
524
+ //Get current user role
525
+ if(isset(wp_get_current_user()->roles[0])) {
526
+ $seopress_user_role = wp_get_current_user()->roles[0];
527
+
528
+ //If current user role matchs values from Security settings then apply -- SEO Metaboxe
529
+ if (function_exists('seopress_advanced_security_metaboxe_role_hook_option') && seopress_advanced_security_metaboxe_role_hook_option() !='') {
530
+ if( array_key_exists( $seopress_user_role, seopress_advanced_security_metaboxe_role_hook_option())) {
531
+ //do nothing
532
+ } else {
533
+ echo seopress_display_seo_metaboxe();
534
+ }
535
+ } else {
536
+ echo seopress_display_seo_metaboxe();
537
+ }
538
+
539
+ //If current user role matchs values from Security settings then apply -- SEO Content Analysis
540
+ if (function_exists('seopress_advanced_security_metaboxe_ca_role_hook_option') && seopress_advanced_security_metaboxe_ca_role_hook_option() !='') {
541
+ if( array_key_exists( $seopress_user_role, seopress_advanced_security_metaboxe_ca_role_hook_option())) {
542
+ //do nothing
543
+ } else {
544
+ echo seopress_display_ca_metaboxe();
545
+ }
546
+ } else {
547
+ echo seopress_display_ca_metaboxe();
548
+ }
549
+ }
550
+ }
551
  }
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: SEO, sitemap, schema, content analysis, redirection
6
  Requires at least: 4.7+
7
  Tested up to: 5.5
8
  Requires PHP: 5.6
9
- Stable tag: 3.9.1
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -107,7 +107,7 @@ SEOPress is a powerful WordPress SEO plugin to optimize your SEO, boost your tra
107
  <li><strong>404 Monitoring</strong> to improve user experience, performances and increase the crawl budget allocated by Google</li>
108
  <li><strong>Redirect 404 to homepage/custom url automatically</strong> with custom status code (301, 302, 307, 410 or 451)</li>
109
  <li>Email notifications on 404</li>
110
- <li><strong>Redirect manager</strong>: create unlmited 301, 302, 307, 410 and 451 redirections. Import / export redirections to CSV or htaccess file.</li>
111
  <li>Import redirections using CSV</li>
112
  <li>Import redirections from Redirections plugin (via a JSON file)</li>
113
  <li>Edit your <strong>htaccess file</strong> from the admin</li>
@@ -291,7 +291,9 @@ You're theme is probably using a deprecated function to handle the title. <a hre
291
  6. SEOPress PRO
292
  7. Installation Wizard
293
 
294
- == Changelog ==
 
 
295
  = 3.9.1 =
296
  * FIX Fatal error: Cannot redeclare seopress_title_columns()
297
  = 3.9 <a href="https://www.seopress.org/blog/elementor-integration-seopress-3-9/">Read our Blog post update</a> =
6
  Requires at least: 4.7+
7
  Tested up to: 5.5
8
  Requires PHP: 5.6
9
+ Stable tag: 3.9.2
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
107
  <li><strong>404 Monitoring</strong> to improve user experience, performances and increase the crawl budget allocated by Google</li>
108
  <li><strong>Redirect 404 to homepage/custom url automatically</strong> with custom status code (301, 302, 307, 410 or 451)</li>
109
  <li>Email notifications on 404</li>
110
+ <li><strong>Redirect manager</strong>: create unlimited 301, 302, 307, 410 and 451 redirections. Import / export redirections to CSV or htaccess file.</li>
111
  <li>Import redirections using CSV</li>
112
  <li>Import redirections from Redirections plugin (via a JSON file)</li>
113
  <li>Edit your <strong>htaccess file</strong> from the admin</li>
291
  6. SEOPress PRO
292
  7. Installation Wizard
293
 
294
+ == Changelog ==
295
+ = 3.9.2 =
296
+ * FIX Elementor synchronization
297
  = 3.9.1 =
298
  * FIX Fatal error: Cannot redeclare seopress_title_columns()
299
  = 3.9 <a href="https://www.seopress.org/blog/elementor-integration-seopress-3-9/">Read our Blog post update</a> =
seopress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SEOPress
4
  Plugin URI: https://www.seopress.org/
5
  Description: One of the best SEO plugins for WordPress.
6
- Version: 3.9.1
7
  Author: SEOPress
8
  Author URI: https://www.seopress.org/
9
  License: GPLv2
@@ -55,7 +55,7 @@ register_deactivation_hook(__FILE__, 'seopress_deactivation');
55
  ///////////////////////////////////////////////////////////////////////////////////////////////////
56
  //Define
57
  ///////////////////////////////////////////////////////////////////////////////////////////////////
58
- define( 'SEOPRESS_VERSION', '3.9.1' );
59
  define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
60
 
61
  ///////////////////////////////////////////////////////////////////////////////////////////////////
3
  Plugin Name: SEOPress
4
  Plugin URI: https://www.seopress.org/
5
  Description: One of the best SEO plugins for WordPress.
6
+ Version: 3.9.2
7
  Author: SEOPress
8
  Author URI: https://www.seopress.org/
9
  License: GPLv2
55
  ///////////////////////////////////////////////////////////////////////////////////////////////////
56
  //Define
57
  ///////////////////////////////////////////////////////////////////////////////////////////////////
58
+ define( 'SEOPRESS_VERSION', '3.9.2' );
59
  define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
60
 
61
  ///////////////////////////////////////////////////////////////////////////////////////////////////