SEOPress - Version 3.2.5

Version Description

  • NEW Add hook 'seopress_real_preview_remote' to filter Google Snippet Preview remote request and allow htaccess/htpasswd
  • INFO Support maintenance plugin for Google Snippet Preview
  • FIX Gutenberg compatibility if Classic Editor activated
Download this release

Release Info

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

Code changes from version 3.2.4 to 3.2.5

assets/js/seopress-block-analysis.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+
3
+ const { subscribe, select } = wp.data;
4
+ let hasSaved = false;
5
+
6
+ subscribe( () => {
7
+
8
+ const editor = select( 'core/editor' );
9
+ const isSaved = editor && editor.didPostSaveRequestSucceed();
10
+
11
+ if ( ! hasSaved && isSaved ) {
12
+ jQuery.ajax({
13
+ method : 'POST',
14
+ url : seopressContentAnalysis.seopress_content_analysis,
15
+ data : {
16
+ action: 'seopress_do_content_analysis',
17
+ post_id: jQuery('#seopress_launch_analysis').attr('data_id'),
18
+ post_type: jQuery('#seopress_launch_analysis').attr('data_post_type'),
19
+ seopress_analysis_target_kw: jQuery('#seopress_analysis_target_kw_meta').val(),
20
+ _ajax_nonce: seopressContentAnalysis.seopress_nonce,
21
+ },
22
+ success : function( data ) {
23
+ jQuery( '#seopress_analysis_results_state' ).fadeIn().css('display', 'inline-block');
24
+ jQuery( '#seopress_analysis_results_state' ).delay(3500).fadeOut();
25
+ jQuery( '#seopress-analysis-tabs-1' ).load(' #seopress-analysis-tabs-1');
26
+ jQuery( '#seopress-analysis-tabs-2' ).load(' #seopress-analysis-tabs-2');
27
+ jQuery( '#seopress-analysis-tabs-3' ).load(' #seopress-analysis-tabs-3');
28
+ jQuery( '#seopress-analysis-tabs-4' ).load(' #seopress-analysis-tabs-4');
29
+ },
30
+ });
31
+ }
32
+
33
+ hasSaved = !! isSaved;
34
+
35
+ });
36
+ });
assets/js/seopress-block-editor.js CHANGED
@@ -1,6 +1,5 @@
1
  //Retrieve title / meta-desc from source code
2
  jQuery(document).ready(function(){
3
-
4
  const { subscribe, select } = wp.data;
5
  let hasSaved = false;
6
 
@@ -10,6 +9,7 @@ let hasSaved = false;
10
  const isSaved = editor && editor.didPostSaveRequestSucceed();
11
 
12
  if ( ! hasSaved && isSaved ) {
 
13
  jQuery.ajax({
14
  method : 'GET',
15
  url : seopressAjaxRealPreview.seopress_real_preview,
@@ -38,8 +38,6 @@ let hasSaved = false;
38
  },
39
  });
40
  }
41
-
42
  hasSaved = !! isSaved;
43
-
44
  });
45
  });
1
  //Retrieve title / meta-desc from source code
2
  jQuery(document).ready(function(){
 
3
  const { subscribe, select } = wp.data;
4
  let hasSaved = false;
5
 
9
  const isSaved = editor && editor.didPostSaveRequestSucceed();
10
 
11
  if ( ! hasSaved && isSaved ) {
12
+
13
  jQuery.ajax({
14
  method : 'GET',
15
  url : seopressAjaxRealPreview.seopress_real_preview,
38
  },
39
  });
40
  }
 
41
  hasSaved = !! isSaved;
 
42
  });
43
  });
assets/js/seopress-content-analysis.js CHANGED
@@ -1,41 +1,4 @@
1
  jQuery(document).ready(function(){
2
-
3
- const { subscribe, select } = wp.data;
4
- let hasSaved = false;
5
-
6
- subscribe( () => {
7
-
8
- const editor = select( 'core/editor' );
9
- const isSaved = editor && editor.didPostSaveRequestSucceed();
10
-
11
- if ( ! hasSaved && isSaved ) {
12
- jQuery.ajax({
13
- method : 'POST',
14
- url : seopressContentAnalysis.seopress_content_analysis,
15
- data : {
16
- action: 'seopress_do_content_analysis',
17
- post_id: jQuery('#seopress_launch_analysis').attr('data_id'),
18
- post_type: jQuery('#seopress_launch_analysis').attr('data_post_type'),
19
- seopress_analysis_target_kw: jQuery('#seopress_analysis_target_kw_meta').val(),
20
- _ajax_nonce: seopressContentAnalysis.seopress_nonce,
21
- },
22
- success : function( data ) {
23
- jQuery( '#seopress_analysis_results_state' ).fadeIn().css('display', 'inline-block');
24
- jQuery( '#seopress_analysis_results_state' ).delay(3500).fadeOut();
25
- jQuery( '#seopress-analysis-tabs-1' ).load(' #seopress-analysis-tabs-1');
26
- jQuery( '#seopress-analysis-tabs-2' ).load(' #seopress-analysis-tabs-2');
27
- jQuery( '#seopress-analysis-tabs-3' ).load(' #seopress-analysis-tabs-3');
28
- jQuery( '#seopress-analysis-tabs-4' ).load(' #seopress-analysis-tabs-4');
29
- },
30
- });
31
- }
32
-
33
- hasSaved = !! isSaved;
34
-
35
- });
36
-
37
-
38
-
39
  //Tabs
40
  jQuery("#seopress-analysis-tabs .hidden").removeClass('hidden');
41
  jQuery("#seopress-analysis-tabs").tabs();
1
  jQuery(document).ready(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  //Tabs
3
  jQuery("#seopress-analysis-tabs .hidden").removeClass('hidden');
4
  jQuery("#seopress-analysis-tabs").tabs();
inc/admin/admin-metaboxes.php CHANGED
@@ -178,9 +178,9 @@ function seopress_display_seo_metaboxe() {
178
 
179
  wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
180
 
181
- //If WordPress 5.0+
182
- global $wp_version;
183
- if ( version_compare( $wp_version, '5.0', '>=' ) ) {
184
  wp_enqueue_script( 'seopress-block-editor-js', plugins_url( 'assets/js/seopress-block-editor.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
185
  }
186
 
@@ -388,7 +388,14 @@ function seopress_display_ca_metaboxe() {
388
 
389
  function seopress_content_analysis($post) {
390
  //Loads JS/CSS
 
391
  wp_enqueue_script( 'seopress-content-analysis-ajax', plugins_url( 'assets/js/seopress-content-analysis.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery', 'jquery-ui-tabs' ), SEOPRESS_VERSION, true );
 
 
 
 
 
 
392
 
393
  $seopress_content_analysis = array(
394
  'seopress_nonce' => wp_create_nonce('seopress_content_analysis_nonce'),
178
 
179
  wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
180
 
181
+ //If Gutenberg ON
182
+ $get_current_screen = get_current_screen();
183
+ if ($get_current_screen->is_block_editor == 1) {
184
  wp_enqueue_script( 'seopress-block-editor-js', plugins_url( 'assets/js/seopress-block-editor.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
185
  }
186
 
388
 
389
  function seopress_content_analysis($post) {
390
  //Loads JS/CSS
391
+
392
  wp_enqueue_script( 'seopress-content-analysis-ajax', plugins_url( 'assets/js/seopress-content-analysis.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery', 'jquery-ui-tabs' ), SEOPRESS_VERSION, true );
393
+
394
+ //If Gutenberg ON
395
+ $get_current_screen = get_current_screen();
396
+ if ($get_current_screen->is_block_editor == 1) {
397
+ wp_enqueue_script( 'seopress-block-analysis-ajax', plugins_url( 'assets/js/seopress-block-analysis.js', dirname( dirname( __FILE__ ) ) ), array( 'jquery', 'jquery-ui-tabs' ), SEOPRESS_VERSION, true );
398
+ }
399
 
400
  $seopress_content_analysis = array(
401
  'seopress_nonce' => wp_create_nonce('seopress_content_analysis_nonce'),
inc/admin/ajax.php CHANGED
@@ -4,116 +4,128 @@ defined( 'ABSPATH' ) or die( 'Please don’t call the plugin directly. Thank
4
  ///////////////////////////////////////////////////////////////////////////////////////////////////
5
  //Get real preview
6
  ///////////////////////////////////////////////////////////////////////////////////////////////////
7
- function seopress_do_real_preview() {
8
-
9
  check_ajax_referer( 'seopress_real_preview_nonce', $_GET['_ajax_nonce'], true );
10
-
11
- //Get post id
12
- if ( isset( $_GET['post_id'] ) ) {
13
- $seopress_get_the_id = $_GET['post_id'];
14
- }
15
 
16
- //Origin
17
- if ( isset( $_GET['origin'] ) ) {
18
- $seopress_origin = $_GET['origin'];
19
- }
20
 
21
- //Tax name
22
- if ( isset( $_GET['tax_name'] ) ) {
23
- $seopress_tax_name = $_GET['tax_name'];
24
- }
25
 
26
- //Init
27
- $title = '';
28
- $meta_desc = '';
29
- $data = array();
 
 
 
 
30
 
31
- //DOM
32
- $dom = new DOMDocument();
33
- $internalErrors = libxml_use_internal_errors(true);
34
- $dom->preserveWhiteSpace = false;
35
-
36
- //Get source code
37
- $args = array(
38
- 'blocking' => true,
39
- 'timeout' => 5,
40
- );
41
-
42
- if ($seopress_origin =='post') { //Default: post type
43
- $response = wp_remote_get(get_permalink((int)$seopress_get_the_id), $args);
44
- } else { //Term taxonomy
45
- $response = wp_remote_get(get_term_link((int)$seopress_get_the_id, $seopress_tax_name), $args);
46
- }
47
 
48
- //Check for error
49
- if ( is_wp_error( $response ) || wp_remote_retrieve_response_code($response) =='404' ) {
50
- $data['title'] = __('To get your Google snippet preview, publish your post!', 'wp-seopress');
51
- } else {
52
- $response = wp_remote_retrieve_body($response);
53
- if($dom->loadHTML('<?xml encoding="utf-8" ?>' .$response)) {
54
- //Title
55
- $list = $dom->getElementsByTagName("title");
56
- if ($list->length > 0) {
57
- $title = $list->item(0)->textContent;
58
- $data['title'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($title)));
59
- }
60
 
61
- //Meta desc
62
- $xpath = new DOMXPath($dom);
63
- $meta_description = $xpath->query('//meta[@name="description"]/@content');
 
64
 
65
- foreach ($meta_description as $key=>$mdesc) {
66
- $data['meta_desc'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses(wp_strip_all_tags($mdesc->nodeValue))));
67
- }
 
 
 
 
 
 
 
 
68
 
69
- //OG:title
70
- $og_title = $xpath->query('//meta[@property="og:title"]/@content');
71
 
72
- foreach ($og_title as $key=>$mogtitle) {
73
- $data['og_title'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mogtitle->nodeValue)));
74
- }
 
 
75
 
76
- //OG:description
77
- $og_desc = $xpath->query('//meta[@property="og:description"]/@content');
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- foreach ($og_desc as $key=>$mogdesc) {
80
- $data['og_desc'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mogdesc->nodeValue)));
81
- }
82
 
83
- //OG:image
84
- $og_img = $xpath->query('//meta[@property="og:image"]/@content');
 
85
 
86
- foreach ($og_img as $key=>$mogimg) {
87
- $data['og_img'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mogimg->nodeValue)));
88
- }
89
 
90
- //Twitter:title
91
- $tw_title = $xpath->query('//meta[@name="twitter:title"]/@content');
 
92
 
93
- foreach ($tw_title as $key=>$mtwtitle) {
94
- $data['tw_title'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mtwtitle->nodeValue)));
95
- }
96
 
97
- //Twitter:description
98
- $tw_desc = $xpath->query('//meta[@name="twitter:description"]/@content');
 
99
 
100
- foreach ($tw_desc as $key=>$mtwdesc) {
101
- $data['tw_desc'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mtwdesc->nodeValue)));
102
- }
103
 
104
- //Twitter:image
105
- $tw_img = $xpath->query('//meta[@name="twitter:image"]/@content');
 
106
 
107
- foreach ($tw_img as $key=>$mtwimg) {
108
- $data['tw_img'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mtwimg->nodeValue)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  }
110
  }
111
- }
112
-
113
- libxml_use_internal_errors($internalErrors);
114
 
115
- //Return
116
- wp_send_json_success($data);
 
117
  }
118
  add_action('wp_ajax_seopress_do_real_preview', 'seopress_do_real_preview');
119
 
@@ -332,146 +344,149 @@ add_action('wp_ajax_seopress_hide_notices', 'seopress_hide_notices');
332
  function seopress_yoast_migration() {
333
  check_ajax_referer( 'seopress_yoast_migrate_nonce', $_POST['_ajax_nonce'], true );
334
 
335
- if ( isset( $_POST['offset']) && isset( $_POST['offset'] )) {
336
- $offset = absint($_POST['offset']);
337
- }
338
-
339
- global $wpdb;
340
- $table_name = $wpdb->prefix . 'posts';
341
- $count_query = $wpdb->get_results( "SELECT * FROM $table_name" );
342
- $total_count_posts = $wpdb->num_rows;
343
-
344
- $increment = 200;
345
- global $post;
346
-
347
- if ($offset > $total_count_posts) {
348
- wp_reset_query();
349
-
350
- $yoast_query_terms = get_option('wpseo_taxonomy_meta');
351
 
352
- if ($yoast_query_terms) {
 
 
353
 
354
- foreach ($yoast_query_terms as $taxonomies => $taxonomie) {
355
- foreach ($taxonomie as $term_id => $term_value) {
356
- if ($term_value['wpseo_title'] !='') { //Import title tag
357
- update_term_meta($term_id, '_seopress_titles_title', $term_value['wpseo_title']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  }
359
- if ($term_value['wpseo_desc'] !='') { //Import meta desc
360
- update_term_meta($term_id, '_seopress_titles_desc', $term_value['wpseo_desc']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  }
362
- if ($term_value['wpseo_opengraph-title'] !='') { //Import Facebook Title
363
- update_term_meta($term_id, '_seopress_social_fb_title', $term_value['wpseo_opengraph-title']);
 
 
 
364
  }
365
- if ($term_value['wpseo_opengraph-description'] !='') { //Import Facebook Desc
366
- update_term_meta($term_id, '_seopress_social_fb_desc', $term_value['wpseo_opengraph-description']);
367
  }
368
- if ($term_value['wpseo_opengraph-image'] !='') { //Import Facebook Image
369
- update_term_meta($term_id, '_seopress_social_fb_img', $term_value['wpseo_opengraph-image']);
370
  }
371
- if ($term_value['wpseo_twitter-title'] !='') { //Import Twitter Title
372
- update_term_meta($term_id, '_seopress_social_twitter_title', $term_value['wpseo_twitter-title']);
373
  }
374
- if ($term_value['wpseo_twitter-description'] !='') { //Import Twitter Desc
375
- update_term_meta($term_id, '_seopress_social_twitter_desc', $term_value['wpseo_twitter-description']);
376
  }
377
- if ($term_value['wpseo_twitter-image'] !='') { //Import Twitter Image
378
- update_term_meta($term_id, '_seopress_social_twitter_img', $term_value['wpseo_twitter-image']);
379
  }
380
- if ($term_value['wpseo_noindex'] =='noindex') { //Import Robots NoIndex
381
- update_term_meta($term_id, '_seopress_robots_index', "yes");
382
- }
383
- if ($term_value['wpseo_canonical'] !='') { //Import Canonical URL
384
- update_term_meta($term_id, '_seopress_robots_canonical', $term_value['wpseo_canonical']);
385
- }
386
- }
387
- }
388
- }
389
- $offset = 'done';
390
- wp_reset_query();
391
- } else {
392
- $args = array(
393
- 'posts_per_page' => $increment,
394
- 'post_type' => 'any',
395
- 'post_status' => 'any',
396
- 'offset' => $offset,
397
- );
398
-
399
- $yoast_query = get_posts( $args );
400
-
401
- if ($yoast_query) {
402
- foreach ($yoast_query as $post) {
403
- if (get_post_meta($post->ID, '_yoast_wpseo_title', true) !='') { //Import title tag
404
- update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_yoast_wpseo_title', true));
405
- }
406
- if (get_post_meta($post->ID, '_yoast_wpseo_metadesc', true) !='') { //Import meta desc
407
- update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_yoast_wpseo_metadesc', true));
408
- }
409
- if (get_post_meta($post->ID, '_yoast_wpseo_opengraph-title', true) !='') { //Import Facebook Title
410
- update_post_meta($post->ID, '_seopress_social_fb_title', get_post_meta($post->ID, '_yoast_wpseo_opengraph-title', true));
411
- }
412
- if (get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true) !='') { //Import Facebook Desc
413
- update_post_meta($post->ID, '_seopress_social_fb_desc', get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true));
414
- }
415
- if (get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true) !='') { //Import Facebook Image
416
- update_post_meta($post->ID, '_seopress_social_fb_img', get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true));
417
- }
418
- if (get_post_meta($post->ID, '_yoast_wpseo_twitter-title', true) !='') { //Import Twitter Title
419
- update_post_meta($post->ID, '_seopress_social_twitter_title', get_post_meta($post->ID, '_yoast_wpseo_twitter-title', true));
420
- }
421
- if (get_post_meta($post->ID, '_yoast_wpseo_twitter-description', true) !='') { //Import Twitter Desc
422
- update_post_meta($post->ID, '_seopress_social_twitter_desc', get_post_meta($post->ID, '_yoast_wpseo_twitter-description', true));
423
- }
424
- if (get_post_meta($post->ID, '_yoast_wpseo_twitter-image', true) !='') { //Import Twitter Image
425
- update_post_meta($post->ID, '_seopress_social_twitter_img', get_post_meta($post->ID, '_yoast_wpseo_twitter-image', true));
426
- }
427
- if (get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true) =='1') { //Import Robots NoIndex
428
- update_post_meta($post->ID, '_seopress_robots_index', "yes");
429
- }
430
- if (get_post_meta($post->ID, '_yoast_wpseo_meta-robots-nofollow', true) =='1') { //Import Robots NoFollow
431
- update_post_meta($post->ID, '_seopress_robots_follow', "yes");
432
- }
433
- if (get_post_meta($post->ID, '_yoast_wpseo_meta-robots-adv', true) !='') { //Import Robots NoOdp, NoImageIndex, NoArchive, NoSnippet
434
- $yoast_wpseo_meta_robots_adv = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-adv', true);
435
-
436
- if (strpos($yoast_wpseo_meta_robots_adv, 'noodp') !== false) {
437
- update_post_meta($post->ID, '_seopress_robots_odp', "yes");
438
- }
439
- if (strpos($yoast_wpseo_meta_robots_adv, 'noimageindex') !== false) {
440
- update_post_meta($post->ID, '_seopress_robots_imageindex', "yes");
441
- }
442
- if (strpos($yoast_wpseo_meta_robots_adv, 'noarchive') !== false) {
443
- update_post_meta($post->ID, '_seopress_robots_archive', "yes");
444
- }
445
- if (strpos($yoast_wpseo_meta_robots_adv, 'nosnippet') !== false) {
446
- update_post_meta($post->ID, '_seopress_robots_snippet', "yes");
447
- }
448
- }
449
- if (get_post_meta($post->ID, '_yoast_wpseo_canonical', true) !='') { //Import Canonical URL
450
- update_post_meta($post->ID, '_seopress_robots_canonical', get_post_meta($post->ID, '_yoast_wpseo_canonical', true));
451
- }
452
- if (get_post_meta($post->ID, '_yoast_wpseo_focuskw', true) !='' || get_post_meta($post->ID, '_yoast_wpseo_focuskeywords', true) !='') { //Import Focus Keywords
453
- $y_fkws_clean = array(); //reset array
454
-
455
- $y_fkws = get_post_meta($post->ID, '_yoast_wpseo_focuskeywords', false);
456
-
457
- foreach ($y_fkws as $value) {
458
- foreach (json_decode($value) as $key => $value) {
459
- $y_fkws_clean[] .= $value->keyword;
460
  }
 
 
 
 
 
 
 
 
 
461
  }
 
 
 
 
 
 
 
 
 
 
462
 
463
- $y_fkws_clean[] .= get_post_meta($post->ID, '_yoast_wpseo_focuskw', true);
464
 
465
- update_post_meta($post->ID, '_seopress_analysis_target_kw', implode(',',$y_fkws_clean));
 
466
  }
467
  }
 
468
  }
469
- $offset += $increment;
 
 
 
470
  }
471
- $data = array();
472
- $data['offset'] = $offset;
473
- wp_send_json_success($data);
474
- die();
475
  }
476
  add_action('wp_ajax_seopress_yoast_migration', 'seopress_yoast_migration');
477
 
@@ -481,131 +496,134 @@ add_action('wp_ajax_seopress_yoast_migration', 'seopress_yoast_migration');
481
  function seopress_aio_migration() {
482
  check_ajax_referer( 'seopress_aio_migrate_nonce', $_POST['_ajax_nonce'], true );
483
 
484
- if ( isset( $_POST['offset2']) && isset( $_POST['offset2'] )) {
485
- $offset2 = absint($_POST['offset2']);
486
- }
487
-
488
- global $wpdb;
489
- $table_name = $wpdb->prefix . 'posts';
490
- $count_query = $wpdb->get_results( "SELECT * FROM $table_name" );
491
- $total_count_posts = $wpdb->num_rows;
492
-
493
- $increment = 200;
494
- global $post;
495
-
496
- if ($offset2 > $total_count_posts) {
497
- wp_reset_query();
498
-
499
- $args = array(
500
- //'number' => $increment,
501
- 'hide_empty' => false,
502
- //'offset' => $offset2,
503
- 'fields' => 'ids',
504
- );
505
- $aio_query_terms = get_terms($args);
506
 
507
- if ($aio_query_terms) {
508
- foreach ($aio_query_terms as $term_id) {
509
- if (get_term_meta($term_id, '_aioseop_title', true) !='') { //Import title tag
510
- update_term_meta($term_id, '_seopress_titles_title', get_term_meta($term_id, '_aioseop_title', true));
511
- }
512
- if (get_term_meta($term_id, '_aioseop_description', true) !='') { //Import meta desc
513
- update_term_meta($term_id, '_seopress_titles_desc', get_term_meta($term_id, '_aioseop_description', true));
514
- }
515
- if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Title
516
- $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
517
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_title'])) {
518
- update_term_meta($term_id, '_seopress_social_fb_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
519
- update_term_meta($term_id, '_seopress_social_twitter_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  }
521
- }
522
- if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Title
523
- $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
524
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_desc'])) {
525
- update_term_meta($term_id, '_seopress_social_fb_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
526
- update_term_meta($term_id, '_seopress_social_twitter_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
527
  }
528
- }
529
- if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Facebook Image
530
- $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
531
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
532
- update_term_meta($term_id, '_seopress_social_fb_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg']);
 
533
  }
534
- }
535
- if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Twitter Image
536
- $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
537
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
538
- update_term_meta($term_id, '_seopress_social_twitter_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
  }
540
- }
541
- if (get_term_meta($term_id, '_aioseop_noindex', true) =='on') { //Import Robots NoIndex
542
- update_term_meta($term_id, '_seopress_robots_index', "yes");
543
- }
544
- if (get_term_meta($term_id, '_aioseop_nofollow', true) =='on') { //Import Robots NoIndex
545
- update_term_meta($term_id, '_seopress_robots_follow', "yes");
546
  }
547
  }
548
- }
549
- $offset2 = 'done';
550
- wp_reset_query();
551
- } else {
552
- $args = array(
553
- 'posts_per_page' => $increment,
554
- 'post_type' => 'any',
555
- 'post_status' => 'any',
556
- 'offset' => $offset2,
557
- );
558
-
559
- $aio_query = get_posts( $args );
560
-
561
- if ($aio_query) {
562
- foreach ($aio_query as $post) {
563
- if (get_post_meta($post->ID, '_aioseop_title', true) !='') { //Import title tag
564
- update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_aioseop_title', true));
565
- }
566
- if (get_post_meta($post->ID, '_aioseop_description', true) !='') { //Import meta desc
567
- update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_aioseop_description', true));
568
- }
569
- if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Title
570
- $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
571
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_title'])) {
572
- update_post_meta($post->ID, '_seopress_social_fb_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
573
- update_post_meta($post->ID, '_seopress_social_twitter_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
574
  }
575
- }
576
- if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Desc
577
- $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
578
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_desc'])) {
579
- update_post_meta($post->ID, '_seopress_social_fb_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
580
- update_post_meta($post->ID, '_seopress_social_twitter_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
581
  }
582
- }
583
- if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Facebook Image
584
- $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
585
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
586
- update_post_meta($post->ID, '_seopress_social_fb_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg']);
 
587
  }
588
- }
589
- if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Twitter Image
590
- $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
591
- if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter'])) {
592
- update_post_meta($post->ID, '_seopress_social_twitter_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  }
594
- }
595
- if (get_post_meta($post->ID, '_aioseop_noindex', true) =='on') { //Import Robots NoIndex
596
- update_post_meta($post->ID, '_seopress_robots_index', "yes");
597
- }
598
- if (get_post_meta($post->ID, '_aioseop_nofollow', true) =='on') { //Import Robots NoFollow
599
- update_post_meta($post->ID, '_seopress_robots_follow', "yes");
600
  }
601
  }
 
602
  }
603
- $offset2 += $increment;
 
 
 
604
  }
605
- $data = array();
606
- $data['offset2'] = $offset2;
607
- wp_send_json_success($data);
608
- die();
609
  }
610
  add_action('wp_ajax_seopress_aio_migration', 'seopress_aio_migration');
611
 
@@ -614,115 +632,118 @@ add_action('wp_ajax_seopress_aio_migration', 'seopress_aio_migration');
614
  ///////////////////////////////////////////////////////////////////////////////////////////////////
615
  function seopress_seo_framework_migration() {
616
  check_ajax_referer( 'seopress_seo_framework_migrate_nonce', $_POST['_ajax_nonce'], true );
617
-
618
- if ( isset( $_POST['offset3']) && isset( $_POST['offset3'] )) {
619
- $offset3 = absint($_POST['offset3']);
620
- }
621
-
622
- global $wpdb;
623
- $table_name = $wpdb->prefix . 'posts';
624
- $count_query = $wpdb->get_results( "SELECT * FROM $table_name" );
625
- $total_count_posts = $wpdb->num_rows;
626
-
627
- $increment = 200;
628
- global $post;
629
 
630
- if ($offset3 > $total_count_posts) {
631
- wp_reset_query();
632
 
633
- $args = array(
634
- //'number' => $increment,
635
- 'hide_empty' => false,
636
- //'offset' => $offset3,
637
- 'fields' => 'ids',
638
- );
639
- $seo_framework_query_terms = get_terms($args);
640
-
641
- if ($seo_framework_query_terms) {
642
- foreach ($seo_framework_query_terms as $term_id) {
643
- if (get_term_meta($term_id, 'autodescription-term-settings', true) !='') {
644
- $term_settings = get_term_meta($term_id, 'autodescription-term-settings', true);
645
-
646
- if (!empty($term_settings['doctitle'])) { //Import title tag
647
- update_term_meta($term_id, '_seopress_titles_title', $term_settings['doctitle']);
648
- }
649
- if (!empty($term_settings['description'])) { //Import meta desc
650
- update_term_meta($term_id, '_seopress_titles_desc', $term_settings['description']);
651
- }
652
- if (!empty($term_settings['noindex'])) { //Import Robots NoIndex
653
- update_term_meta($term_id, '_seopress_robots_index', "yes");
654
- }
655
- if (!empty($term_settings['nofollow'])) { //Import Robots NoFollow
656
- update_term_meta($term_id, '_seopress_robots_follow', "yes");
657
- }
658
- if (!empty($term_settings['noarchive'])) { //Import Robots NoArchive
659
- update_term_meta($term_id, '_seopress_robots_archive', "yes");
660
- }
661
- }
662
- }
663
  }
664
- $offset3 = 'done';
665
- wp_reset_query();
666
- } else {
667
- $args = array(
668
- 'posts_per_page' => $increment,
669
- 'post_type' => 'any',
670
- 'post_status' => 'any',
671
- 'offset' => $offset3,
672
- );
673
 
674
- $seo_framework_query = get_posts( $args );
 
 
 
675
 
676
- if ($seo_framework_query) {
677
- foreach ($seo_framework_query as $post) {
678
- if (get_post_meta($post->ID, '_genesis_title', true) !='') { //Import title tag
679
- update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_genesis_title', true));
680
- }
681
- if (get_post_meta($post->ID, '_genesis_description', true) !='') { //Import meta desc
682
- update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_genesis_description', true));
683
- }
684
- if (get_post_meta($post->ID, '_open_graph_title', true) !='') { //Import Facebook Title
685
- update_post_meta($post->ID, '_seopress_social_fb_title', get_post_meta($post->ID, '_open_graph_title', true));
686
- }
687
- if (get_post_meta($post->ID, '_open_graph_description', true) !='') { //Import Facebook Desc
688
- update_post_meta($post->ID, '_seopress_social_fb_desc', get_post_meta($post->ID, '_open_graph_description', true));
689
- }
690
- if (get_post_meta($post->ID, '_social_image_url', true) !='') { //Import Facebook Image
691
- update_post_meta($post->ID, '_seopress_social_fb_img', get_post_meta($post->ID, '_social_image_url', true));
692
- }
693
- if (get_post_meta($post->ID, '_twitter_title', true) !='') { //Import Twitter Title
694
- update_post_meta($post->ID, '_seopress_social_twitter_title', get_post_meta($post->ID, '_twitter_title', true));
695
- }
696
- if (get_post_meta($post->ID, '_twitter_description', true) !='') { //Import Twitter Desc
697
- update_post_meta($post->ID, '_seopress_social_twitter_desc', get_post_meta($post->ID, '_twitter_description', true));
698
- }
699
- if (get_post_meta($post->ID, '_social_image_url', true) !='') { //Import Twitter Image
700
- update_post_meta($post->ID, '_seopress_social_twitter_img', get_post_meta($post->ID, '_social_image_url', true));
701
- }
702
- if (get_post_meta($post->ID, '_genesis_noindex', true) =='1') { //Import Robots NoIndex
703
- update_post_meta($post->ID, '_seopress_robots_index', "yes");
704
- }
705
- if (get_post_meta($post->ID, '_genesis_nofollow', true) =='1') { //Import Robots NoFollow
706
- update_post_meta($post->ID, '_seopress_robots_follow', "yes");
707
- }
708
- if (get_post_meta($post->ID, '_genesis_noarchive', true) =='1') { //Import Robots NoArchive
709
- update_post_meta($post->ID, '_seopress_robots_archive', "yes");
710
- }
711
- if (get_post_meta($post->ID, '_genesis_canonical_uri', true) !='') { //Import Canonical URL
712
- update_post_meta($post->ID, '_seopress_robots_canonical', get_post_meta($post->ID, '_genesis_canonical_uri', true));
713
  }
714
- if (get_post_meta($post->ID, 'redirect', true) !='') { //Import Redirect URL
715
- update_post_meta($post->ID, '_seopress_redirections_enabled', 'yes');
716
- update_post_meta($post->ID, '_seopress_redirections_type', '301');
717
- update_post_meta($post->ID, '_seopress_redirections_value', get_post_meta($post->ID, 'redirect', true));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718
  }
719
  }
 
720
  }
721
- $offset3 += $increment;
 
 
 
722
  }
723
- $data = array();
724
- $data['offset3'] = $offset3;
725
- wp_send_json_success($data);
726
- die();
727
  }
728
  add_action('wp_ajax_seopress_seo_framework_migration', 'seopress_seo_framework_migration');
4
  ///////////////////////////////////////////////////////////////////////////////////////////////////
5
  //Get real preview
6
  ///////////////////////////////////////////////////////////////////////////////////////////////////
7
+ function seopress_do_real_preview() {
 
8
  check_ajax_referer( 'seopress_real_preview_nonce', $_GET['_ajax_nonce'], true );
 
 
 
 
 
9
 
10
+ if (current_user_can('edit_posts') && is_admin()) {
 
 
 
11
 
12
+ $cookies = array();
 
 
 
13
 
14
+ foreach ( $_COOKIE as $name => $value ) {
15
+ $cookies[] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value ) );
16
+ }
17
+
18
+ //Get post id
19
+ if ( isset( $_GET['post_id'] ) ) {
20
+ $seopress_get_the_id = $_GET['post_id'];
21
+ }
22
 
23
+ //Origin
24
+ if ( isset( $_GET['origin'] ) ) {
25
+ $seopress_origin = $_GET['origin'];
26
+ }
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ //Tax name
29
+ if ( isset( $_GET['tax_name'] ) ) {
30
+ $seopress_tax_name = $_GET['tax_name'];
31
+ }
 
 
 
 
 
 
 
 
32
 
33
+ //Init
34
+ $title = '';
35
+ $meta_desc = '';
36
+ $data = array();
37
 
38
+ //DOM
39
+ $dom = new DOMDocument();
40
+ $internalErrors = libxml_use_internal_errors(true);
41
+ $dom->preserveWhiteSpace = false;
42
+
43
+ //Get source code
44
+ $args = array(
45
+ 'blocking' => true,
46
+ 'timeout' => 5,
47
+ 'cookies' => $cookies,
48
+ );
49
 
50
+ $args = apply_filters('seopress_real_preview_remote', $args);
 
51
 
52
+ if ($seopress_origin =='post') { //Default: post type
53
+ $response = wp_remote_get(get_permalink((int)$seopress_get_the_id), $args);
54
+ } else { //Term taxonomy
55
+ $response = wp_remote_get(get_term_link((int)$seopress_get_the_id, $seopress_tax_name), $args);
56
+ }
57
 
58
+ //Check for error
59
+ if ( is_wp_error( $response ) || wp_remote_retrieve_response_code($response) =='404' ) {
60
+ $data['title'] = __('To get your Google snippet preview, publish your post!', 'wp-seopress');
61
+ } else {
62
+ $response = wp_remote_retrieve_body($response);
63
+
64
+ if($dom->loadHTML('<?xml encoding="utf-8" ?>' .$response)) {
65
+ //Title
66
+ $list = $dom->getElementsByTagName("title");
67
+ if ($list->length > 0) {
68
+ $title = $list->item(0)->textContent;
69
+ $data['title'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($title)));
70
+ }
71
 
72
+ //Meta desc
73
+ $xpath = new DOMXPath($dom);
74
+ $meta_description = $xpath->query('//meta[@name="description"]/@content');
75
 
76
+ foreach ($meta_description as $key=>$mdesc) {
77
+ $data['meta_desc'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses(wp_strip_all_tags($mdesc->nodeValue))));
78
+ }
79
 
80
+ //OG:title
81
+ $og_title = $xpath->query('//meta[@property="og:title"]/@content');
 
82
 
83
+ foreach ($og_title as $key=>$mogtitle) {
84
+ $data['og_title'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mogtitle->nodeValue)));
85
+ }
86
 
87
+ //OG:description
88
+ $og_desc = $xpath->query('//meta[@property="og:description"]/@content');
 
89
 
90
+ foreach ($og_desc as $key=>$mogdesc) {
91
+ $data['og_desc'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mogdesc->nodeValue)));
92
+ }
93
 
94
+ //OG:image
95
+ $og_img = $xpath->query('//meta[@property="og:image"]/@content');
 
96
 
97
+ foreach ($og_img as $key=>$mogimg) {
98
+ $data['og_img'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mogimg->nodeValue)));
99
+ }
100
 
101
+ //Twitter:title
102
+ $tw_title = $xpath->query('//meta[@name="twitter:title"]/@content');
103
+
104
+ foreach ($tw_title as $key=>$mtwtitle) {
105
+ $data['tw_title'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mtwtitle->nodeValue)));
106
+ }
107
+
108
+ //Twitter:description
109
+ $tw_desc = $xpath->query('//meta[@name="twitter:description"]/@content');
110
+
111
+ foreach ($tw_desc as $key=>$mtwdesc) {
112
+ $data['tw_desc'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mtwdesc->nodeValue)));
113
+ }
114
+
115
+ //Twitter:image
116
+ $tw_img = $xpath->query('//meta[@name="twitter:image"]/@content');
117
+
118
+ foreach ($tw_img as $key=>$mtwimg) {
119
+ $data['tw_img'] = esc_attr(stripslashes_deep(wp_filter_nohtml_kses($mtwimg->nodeValue)));
120
+ }
121
  }
122
  }
123
+
124
+ libxml_use_internal_errors($internalErrors);
 
125
 
126
+ //Return
127
+ wp_send_json_success($data);
128
+ }
129
  }
130
  add_action('wp_ajax_seopress_do_real_preview', 'seopress_do_real_preview');
131
 
344
  function seopress_yoast_migration() {
345
  check_ajax_referer( 'seopress_yoast_migrate_nonce', $_POST['_ajax_nonce'], true );
346
 
347
+ if (current_user_can('manage_options') && is_admin()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
 
349
+ if ( isset( $_POST['offset']) && isset( $_POST['offset'] )) {
350
+ $offset = absint($_POST['offset']);
351
+ }
352
 
353
+ global $wpdb;
354
+ $table_name = $wpdb->prefix . 'posts';
355
+ $count_query = $wpdb->get_results( "SELECT * FROM $table_name" );
356
+ $total_count_posts = $wpdb->num_rows;
357
+
358
+ $increment = 200;
359
+ global $post;
360
+
361
+ if ($offset > $total_count_posts) {
362
+ wp_reset_query();
363
+
364
+ $yoast_query_terms = get_option('wpseo_taxonomy_meta');
365
+
366
+ if ($yoast_query_terms) {
367
+
368
+ foreach ($yoast_query_terms as $taxonomies => $taxonomie) {
369
+ foreach ($taxonomie as $term_id => $term_value) {
370
+ if ($term_value['wpseo_title'] !='') { //Import title tag
371
+ update_term_meta($term_id, '_seopress_titles_title', $term_value['wpseo_title']);
372
+ }
373
+ if ($term_value['wpseo_desc'] !='') { //Import meta desc
374
+ update_term_meta($term_id, '_seopress_titles_desc', $term_value['wpseo_desc']);
375
+ }
376
+ if ($term_value['wpseo_opengraph-title'] !='') { //Import Facebook Title
377
+ update_term_meta($term_id, '_seopress_social_fb_title', $term_value['wpseo_opengraph-title']);
378
+ }
379
+ if ($term_value['wpseo_opengraph-description'] !='') { //Import Facebook Desc
380
+ update_term_meta($term_id, '_seopress_social_fb_desc', $term_value['wpseo_opengraph-description']);
381
+ }
382
+ if ($term_value['wpseo_opengraph-image'] !='') { //Import Facebook Image
383
+ update_term_meta($term_id, '_seopress_social_fb_img', $term_value['wpseo_opengraph-image']);
384
+ }
385
+ if ($term_value['wpseo_twitter-title'] !='') { //Import Twitter Title
386
+ update_term_meta($term_id, '_seopress_social_twitter_title', $term_value['wpseo_twitter-title']);
387
+ }
388
+ if ($term_value['wpseo_twitter-description'] !='') { //Import Twitter Desc
389
+ update_term_meta($term_id, '_seopress_social_twitter_desc', $term_value['wpseo_twitter-description']);
390
+ }
391
+ if ($term_value['wpseo_twitter-image'] !='') { //Import Twitter Image
392
+ update_term_meta($term_id, '_seopress_social_twitter_img', $term_value['wpseo_twitter-image']);
393
+ }
394
+ if ($term_value['wpseo_noindex'] =='noindex') { //Import Robots NoIndex
395
+ update_term_meta($term_id, '_seopress_robots_index', "yes");
396
+ }
397
+ if ($term_value['wpseo_canonical'] !='') { //Import Canonical URL
398
+ update_term_meta($term_id, '_seopress_robots_canonical', $term_value['wpseo_canonical']);
399
+ }
400
  }
401
+ }
402
+ }
403
+ $offset = 'done';
404
+ wp_reset_query();
405
+ } else {
406
+ $args = array(
407
+ 'posts_per_page' => $increment,
408
+ 'post_type' => 'any',
409
+ 'post_status' => 'any',
410
+ 'offset' => $offset,
411
+ );
412
+
413
+ $yoast_query = get_posts( $args );
414
+
415
+ if ($yoast_query) {
416
+ foreach ($yoast_query as $post) {
417
+ if (get_post_meta($post->ID, '_yoast_wpseo_title', true) !='') { //Import title tag
418
+ update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_yoast_wpseo_title', true));
419
  }
420
+ if (get_post_meta($post->ID, '_yoast_wpseo_metadesc', true) !='') { //Import meta desc
421
+ update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_yoast_wpseo_metadesc', true));
422
+ }
423
+ if (get_post_meta($post->ID, '_yoast_wpseo_opengraph-title', true) !='') { //Import Facebook Title
424
+ update_post_meta($post->ID, '_seopress_social_fb_title', get_post_meta($post->ID, '_yoast_wpseo_opengraph-title', true));
425
  }
426
+ if (get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true) !='') { //Import Facebook Desc
427
+ update_post_meta($post->ID, '_seopress_social_fb_desc', get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true));
428
  }
429
+ if (get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true) !='') { //Import Facebook Image
430
+ update_post_meta($post->ID, '_seopress_social_fb_img', get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true));
431
  }
432
+ if (get_post_meta($post->ID, '_yoast_wpseo_twitter-title', true) !='') { //Import Twitter Title
433
+ update_post_meta($post->ID, '_seopress_social_twitter_title', get_post_meta($post->ID, '_yoast_wpseo_twitter-title', true));
434
  }
435
+ if (get_post_meta($post->ID, '_yoast_wpseo_twitter-description', true) !='') { //Import Twitter Desc
436
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', get_post_meta($post->ID, '_yoast_wpseo_twitter-description', true));
437
  }
438
+ if (get_post_meta($post->ID, '_yoast_wpseo_twitter-image', true) !='') { //Import Twitter Image
439
+ update_post_meta($post->ID, '_seopress_social_twitter_img', get_post_meta($post->ID, '_yoast_wpseo_twitter-image', true));
440
  }
441
+ if (get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true) =='1') { //Import Robots NoIndex
442
+ update_post_meta($post->ID, '_seopress_robots_index', "yes");
443
+ }
444
+ if (get_post_meta($post->ID, '_yoast_wpseo_meta-robots-nofollow', true) =='1') { //Import Robots NoFollow
445
+ update_post_meta($post->ID, '_seopress_robots_follow', "yes");
446
+ }
447
+ if (get_post_meta($post->ID, '_yoast_wpseo_meta-robots-adv', true) !='') { //Import Robots NoOdp, NoImageIndex, NoArchive, NoSnippet
448
+ $yoast_wpseo_meta_robots_adv = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-adv', true);
449
+
450
+ if (strpos($yoast_wpseo_meta_robots_adv, 'noodp') !== false) {
451
+ update_post_meta($post->ID, '_seopress_robots_odp', "yes");
452
+ }
453
+ if (strpos($yoast_wpseo_meta_robots_adv, 'noimageindex') !== false) {
454
+ update_post_meta($post->ID, '_seopress_robots_imageindex', "yes");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  }
456
+ if (strpos($yoast_wpseo_meta_robots_adv, 'noarchive') !== false) {
457
+ update_post_meta($post->ID, '_seopress_robots_archive', "yes");
458
+ }
459
+ if (strpos($yoast_wpseo_meta_robots_adv, 'nosnippet') !== false) {
460
+ update_post_meta($post->ID, '_seopress_robots_snippet', "yes");
461
+ }
462
+ }
463
+ if (get_post_meta($post->ID, '_yoast_wpseo_canonical', true) !='') { //Import Canonical URL
464
+ update_post_meta($post->ID, '_seopress_robots_canonical', get_post_meta($post->ID, '_yoast_wpseo_canonical', true));
465
  }
466
+ if (get_post_meta($post->ID, '_yoast_wpseo_focuskw', true) !='' || get_post_meta($post->ID, '_yoast_wpseo_focuskeywords', true) !='') { //Import Focus Keywords
467
+ $y_fkws_clean = array(); //reset array
468
+
469
+ $y_fkws = get_post_meta($post->ID, '_yoast_wpseo_focuskeywords', false);
470
+
471
+ foreach ($y_fkws as $value) {
472
+ foreach (json_decode($value) as $key => $value) {
473
+ $y_fkws_clean[] .= $value->keyword;
474
+ }
475
+ }
476
 
477
+ $y_fkws_clean[] .= get_post_meta($post->ID, '_yoast_wpseo_focuskw', true);
478
 
479
+ update_post_meta($post->ID, '_seopress_analysis_target_kw', implode(',',$y_fkws_clean));
480
+ }
481
  }
482
  }
483
+ $offset += $increment;
484
  }
485
+ $data = array();
486
+ $data['offset'] = $offset;
487
+ wp_send_json_success($data);
488
+ die();
489
  }
 
 
 
 
490
  }
491
  add_action('wp_ajax_seopress_yoast_migration', 'seopress_yoast_migration');
492
 
496
  function seopress_aio_migration() {
497
  check_ajax_referer( 'seopress_aio_migrate_nonce', $_POST['_ajax_nonce'], true );
498
 
499
+ if (current_user_can('manage_options') && is_admin()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
+ if ( isset( $_POST['offset2']) && isset( $_POST['offset2'] )) {
502
+ $offset2 = absint($_POST['offset2']);
503
+ }
504
+
505
+ global $wpdb;
506
+ $table_name = $wpdb->prefix . 'posts';
507
+ $count_query = $wpdb->get_results( "SELECT * FROM $table_name" );
508
+ $total_count_posts = $wpdb->num_rows;
509
+
510
+ $increment = 200;
511
+ global $post;
512
+
513
+ if ($offset2 > $total_count_posts) {
514
+ wp_reset_query();
515
+
516
+ $args = array(
517
+ //'number' => $increment,
518
+ 'hide_empty' => false,
519
+ //'offset' => $offset2,
520
+ 'fields' => 'ids',
521
+ );
522
+ $aio_query_terms = get_terms($args);
523
+
524
+ if ($aio_query_terms) {
525
+ foreach ($aio_query_terms as $term_id) {
526
+ if (get_term_meta($term_id, '_aioseop_title', true) !='') { //Import title tag
527
+ update_term_meta($term_id, '_seopress_titles_title', get_term_meta($term_id, '_aioseop_title', true));
528
  }
529
+ if (get_term_meta($term_id, '_aioseop_description', true) !='') { //Import meta desc
530
+ update_term_meta($term_id, '_seopress_titles_desc', get_term_meta($term_id, '_aioseop_description', true));
 
 
 
 
531
  }
532
+ if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Title
533
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
534
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_title'])) {
535
+ update_term_meta($term_id, '_seopress_social_fb_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
536
+ update_term_meta($term_id, '_seopress_social_twitter_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
537
+ }
538
  }
539
+ if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Title
540
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
541
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_desc'])) {
542
+ update_term_meta($term_id, '_seopress_social_fb_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
543
+ update_term_meta($term_id, '_seopress_social_twitter_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
544
+ }
545
+ }
546
+ if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Facebook Image
547
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
548
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
549
+ update_term_meta($term_id, '_seopress_social_fb_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg']);
550
+ }
551
+ }
552
+ if (get_term_meta($term_id, '_aioseop_opengraph_settings', true) !='') { //Import Twitter Image
553
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
554
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
555
+ update_term_meta($term_id, '_seopress_social_twitter_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter']);
556
+ }
557
+ }
558
+ if (get_term_meta($term_id, '_aioseop_noindex', true) =='on') { //Import Robots NoIndex
559
+ update_term_meta($term_id, '_seopress_robots_index', "yes");
560
+ }
561
+ if (get_term_meta($term_id, '_aioseop_nofollow', true) =='on') { //Import Robots NoIndex
562
+ update_term_meta($term_id, '_seopress_robots_follow', "yes");
563
  }
 
 
 
 
 
 
564
  }
565
  }
566
+ $offset2 = 'done';
567
+ wp_reset_query();
568
+ } else {
569
+ $args = array(
570
+ 'posts_per_page' => $increment,
571
+ 'post_type' => 'any',
572
+ 'post_status' => 'any',
573
+ 'offset' => $offset2,
574
+ );
575
+
576
+ $aio_query = get_posts( $args );
577
+
578
+ if ($aio_query) {
579
+ foreach ($aio_query as $post) {
580
+ if (get_post_meta($post->ID, '_aioseop_title', true) !='') { //Import title tag
581
+ update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_aioseop_title', true));
 
 
 
 
 
 
 
 
 
 
582
  }
583
+ if (get_post_meta($post->ID, '_aioseop_description', true) !='') { //Import meta desc
584
+ update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_aioseop_description', true));
 
 
 
 
585
  }
586
+ if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Title
587
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
588
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_title'])) {
589
+ update_post_meta($post->ID, '_seopress_social_fb_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
590
+ update_post_meta($post->ID, '_seopress_social_twitter_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
591
+ }
592
  }
593
+ if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Facebook / Twitter Desc
594
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
595
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_desc'])) {
596
+ update_post_meta($post->ID, '_seopress_social_fb_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
597
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
598
+ }
599
+ }
600
+ if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Facebook Image
601
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
602
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
603
+ update_post_meta($post->ID, '_seopress_social_fb_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg']);
604
+ }
605
+ }
606
+ if (get_post_meta($post->ID, '_aioseop_opengraph_settings', true) !='') { //Import Twitter Image
607
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
608
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter'])) {
609
+ update_post_meta($post->ID, '_seopress_social_twitter_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter']);
610
+ }
611
+ }
612
+ if (get_post_meta($post->ID, '_aioseop_noindex', true) =='on') { //Import Robots NoIndex
613
+ update_post_meta($post->ID, '_seopress_robots_index', "yes");
614
+ }
615
+ if (get_post_meta($post->ID, '_aioseop_nofollow', true) =='on') { //Import Robots NoFollow
616
+ update_post_meta($post->ID, '_seopress_robots_follow', "yes");
617
  }
 
 
 
 
 
 
618
  }
619
  }
620
+ $offset2 += $increment;
621
  }
622
+ $data = array();
623
+ $data['offset2'] = $offset2;
624
+ wp_send_json_success($data);
625
+ die();
626
  }
 
 
 
 
627
  }
628
  add_action('wp_ajax_seopress_aio_migration', 'seopress_aio_migration');
629
 
632
  ///////////////////////////////////////////////////////////////////////////////////////////////////
633
  function seopress_seo_framework_migration() {
634
  check_ajax_referer( 'seopress_seo_framework_migrate_nonce', $_POST['_ajax_nonce'], true );
 
 
 
 
 
 
 
 
 
 
 
 
635
 
636
+ if (current_user_can('manage_options') && is_admin()) {
 
637
 
638
+ if ( isset( $_POST['offset3']) && isset( $_POST['offset3'] )) {
639
+ $offset3 = absint($_POST['offset3']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
640
  }
 
 
 
 
 
 
 
 
 
641
 
642
+ global $wpdb;
643
+ $table_name = $wpdb->prefix . 'posts';
644
+ $count_query = $wpdb->get_results( "SELECT * FROM $table_name" );
645
+ $total_count_posts = $wpdb->num_rows;
646
 
647
+ $increment = 200;
648
+ global $post;
649
+
650
+ if ($offset3 > $total_count_posts) {
651
+ wp_reset_query();
652
+
653
+ $args = array(
654
+ //'number' => $increment,
655
+ 'hide_empty' => false,
656
+ //'offset' => $offset3,
657
+ 'fields' => 'ids',
658
+ );
659
+ $seo_framework_query_terms = get_terms($args);
660
+
661
+ if ($seo_framework_query_terms) {
662
+ foreach ($seo_framework_query_terms as $term_id) {
663
+ if (get_term_meta($term_id, 'autodescription-term-settings', true) !='') {
664
+ $term_settings = get_term_meta($term_id, 'autodescription-term-settings', true);
665
+
666
+ if (!empty($term_settings['doctitle'])) { //Import title tag
667
+ update_term_meta($term_id, '_seopress_titles_title', $term_settings['doctitle']);
668
+ }
669
+ if (!empty($term_settings['description'])) { //Import meta desc
670
+ update_term_meta($term_id, '_seopress_titles_desc', $term_settings['description']);
671
+ }
672
+ if (!empty($term_settings['noindex'])) { //Import Robots NoIndex
673
+ update_term_meta($term_id, '_seopress_robots_index', "yes");
674
+ }
675
+ if (!empty($term_settings['nofollow'])) { //Import Robots NoFollow
676
+ update_term_meta($term_id, '_seopress_robots_follow', "yes");
677
+ }
678
+ if (!empty($term_settings['noarchive'])) { //Import Robots NoArchive
679
+ update_term_meta($term_id, '_seopress_robots_archive', "yes");
680
+ }
681
+ }
 
 
682
  }
683
+ }
684
+ $offset3 = 'done';
685
+ wp_reset_query();
686
+ } else {
687
+ $args = array(
688
+ 'posts_per_page' => $increment,
689
+ 'post_type' => 'any',
690
+ 'post_status' => 'any',
691
+ 'offset' => $offset3,
692
+ );
693
+
694
+ $seo_framework_query = get_posts( $args );
695
+
696
+ if ($seo_framework_query) {
697
+ foreach ($seo_framework_query as $post) {
698
+ if (get_post_meta($post->ID, '_genesis_title', true) !='') { //Import title tag
699
+ update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_genesis_title', true));
700
+ }
701
+ if (get_post_meta($post->ID, '_genesis_description', true) !='') { //Import meta desc
702
+ update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_genesis_description', true));
703
+ }
704
+ if (get_post_meta($post->ID, '_open_graph_title', true) !='') { //Import Facebook Title
705
+ update_post_meta($post->ID, '_seopress_social_fb_title', get_post_meta($post->ID, '_open_graph_title', true));
706
+ }
707
+ if (get_post_meta($post->ID, '_open_graph_description', true) !='') { //Import Facebook Desc
708
+ update_post_meta($post->ID, '_seopress_social_fb_desc', get_post_meta($post->ID, '_open_graph_description', true));
709
+ }
710
+ if (get_post_meta($post->ID, '_social_image_url', true) !='') { //Import Facebook Image
711
+ update_post_meta($post->ID, '_seopress_social_fb_img', get_post_meta($post->ID, '_social_image_url', true));
712
+ }
713
+ if (get_post_meta($post->ID, '_twitter_title', true) !='') { //Import Twitter Title
714
+ update_post_meta($post->ID, '_seopress_social_twitter_title', get_post_meta($post->ID, '_twitter_title', true));
715
+ }
716
+ if (get_post_meta($post->ID, '_twitter_description', true) !='') { //Import Twitter Desc
717
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', get_post_meta($post->ID, '_twitter_description', true));
718
+ }
719
+ if (get_post_meta($post->ID, '_social_image_url', true) !='') { //Import Twitter Image
720
+ update_post_meta($post->ID, '_seopress_social_twitter_img', get_post_meta($post->ID, '_social_image_url', true));
721
+ }
722
+ if (get_post_meta($post->ID, '_genesis_noindex', true) =='1') { //Import Robots NoIndex
723
+ update_post_meta($post->ID, '_seopress_robots_index', "yes");
724
+ }
725
+ if (get_post_meta($post->ID, '_genesis_nofollow', true) =='1') { //Import Robots NoFollow
726
+ update_post_meta($post->ID, '_seopress_robots_follow', "yes");
727
+ }
728
+ if (get_post_meta($post->ID, '_genesis_noarchive', true) =='1') { //Import Robots NoArchive
729
+ update_post_meta($post->ID, '_seopress_robots_archive', "yes");
730
+ }
731
+ if (get_post_meta($post->ID, '_genesis_canonical_uri', true) !='') { //Import Canonical URL
732
+ update_post_meta($post->ID, '_seopress_robots_canonical', get_post_meta($post->ID, '_genesis_canonical_uri', true));
733
+ }
734
+ if (get_post_meta($post->ID, 'redirect', true) !='') { //Import Redirect URL
735
+ update_post_meta($post->ID, '_seopress_redirections_enabled', 'yes');
736
+ update_post_meta($post->ID, '_seopress_redirections_type', '301');
737
+ update_post_meta($post->ID, '_seopress_redirections_value', get_post_meta($post->ID, 'redirect', true));
738
+ }
739
  }
740
  }
741
+ $offset3 += $increment;
742
  }
743
+ $data = array();
744
+ $data['offset3'] = $offset3;
745
+ wp_send_json_success($data);
746
+ die();
747
  }
 
 
 
 
748
  }
749
  add_action('wp_ajax_seopress_seo_framework_migration', 'seopress_seo_framework_migration');
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: seo, search engine optimization, meta title, open graph, content analysis,
6
  Requires at least: 4.4+
7
  Tested up to: 5.0
8
  Requires PHP: 5.4
9
- Stable tag: 3.2.4
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -161,6 +161,10 @@ Subscribe on <a href="https://www.seopress.org/" target="_blank">seopress.org</a
161
  44. Structured Data Types metaboxe in post, page, custom post type (PRO)
162
 
163
  == Changelog ==
 
 
 
 
164
  = 3.2.4 =
165
  * NEW Add Guternberg / WP 5.0 compatibility
166
  * INFO German translation updated (thanks to Nicola Stobbe)
6
  Requires at least: 4.4+
7
  Tested up to: 5.0
8
  Requires PHP: 5.4
9
+ Stable tag: 3.2.5
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
161
  44. Structured Data Types metaboxe in post, page, custom post type (PRO)
162
 
163
  == Changelog ==
164
+ = 3.2.5 =
165
+ * NEW Add hook 'seopress_real_preview_remote' to filter Google Snippet Preview remote request and allow htaccess/htpasswd
166
+ * INFO Support maintenance plugin for Google Snippet Preview
167
+ * FIX Gutenberg compatibility if Classic Editor activated
168
  = 3.2.4 =
169
  * NEW Add Guternberg / WP 5.0 compatibility
170
  * INFO German translation updated (thanks to Nicola Stobbe)
seopress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SEOPress
4
  Plugin URI: https://www.seopress.org/
5
  Description: The best plugin for SEO.
6
- Version: 3.2.4
7
  Author: Benjamin Denis
8
  Author URI: https://www.seopress.org/
9
  License: GPLv2
@@ -53,7 +53,7 @@ register_deactivation_hook(__FILE__, 'seopress_deactivation');
53
  ///////////////////////////////////////////////////////////////////////////////////////////////////
54
  //Define
55
  ///////////////////////////////////////////////////////////////////////////////////////////////////
56
- define( 'SEOPRESS_VERSION', '3.2.4' );
57
  define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
58
 
59
  ///////////////////////////////////////////////////////////////////////////////////////////////////
3
  Plugin Name: SEOPress
4
  Plugin URI: https://www.seopress.org/
5
  Description: The best plugin for SEO.
6
+ Version: 3.2.5
7
  Author: Benjamin Denis
8
  Author URI: https://www.seopress.org/
9
  License: GPLv2
53
  ///////////////////////////////////////////////////////////////////////////////////////////////////
54
  //Define
55
  ///////////////////////////////////////////////////////////////////////////////////////////////////
56
+ define( 'SEOPRESS_VERSION', '3.2.5' );
57
  define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
58
 
59
  ///////////////////////////////////////////////////////////////////////////////////////////////////