SEOPress - Version 4.6

Version Description

(29/04/2021) - https://www.seopress.org/blog/seopress-4-6/ = * NEW Custom capabilities (SEO, Advanced, Security) * NEW Bricks compatibility with our content analysis feature * NEW %%author_first_name%% dynamic variable to request user first name * NEW %%author_last_name%% dynamic variable to request user last name * NEW %%author_website%% dynamic variable to request user website * NEW %%author_nickname%% dynamic variable to request user nickname * NEW %%ucf_your_user_meta%% dynamic variable to request user meta * NEW Complete refactoring of the manual schema module * NEW "Display a text before the Breadcrumbs" option * NEW Add og:locale and og:locale:alternate support for WPML * NEW Option to disable content analysis metabox (SEO, Advanced, Advanced tab) * NEW "seopress_remove_category_base" hook to filter /category/ slug * NEW Hooks to filter manual schemas: * seopress_get_json_data_organization * seopress_get_json_data_image * seopress_get_json_data_contact_point * seopress_pro_get_json_data_author * seopress_pro_get_json_data_article * seopress_pro_get_json_data_aggreagate_rating * seopress_pro_get_json_data_brand * seopress_pro_get_json_data_course * seopress_pro_get_json_data_event * seopress_pro_get_json_data_faq * seopress_pro_get_json_data_geo * seopress_pro_get_json_data_how_to_step * seopress_pro_get_json_data_job * seopress_pro_get_json_data_local_business * seopress_pro_get_json_data_main_entity * seopress_pro_get_json_data_main_entity_of_page * seopress_pro_get_json_data_monetary_amount * seopress_pro_get_json_data_nutrition_information * seopress_pro_get_json_data_offer * seopress_pro_get_json_data_opening_hours * seopress_pro_get_json_data_person * seopress_pro_get_json_data_place * seopress_pro_get_jsondata_postal_address * seopress_pro_get_json_data_product * seopress_pro_get_json_data_rating * seopress_pro_get_json_data_recipe * seopress_pro_get_json_data_review * seopress_pro_get_json_data_service * seopress_pro_get_json_data_site_navigation_element * seopress_pro_get_json_data_software_app * seopress_pro_get_json_data_thing * seopress_pro_get_json_data_video * seopress_pro_get_json_data_virtual_location * INFO Improve Themify Builer compatibility with Content Analysis * INFO Improve Oxygen compatibility in specific cases * INFO Allow to show taxonomies in Breadcrumbs for Page post type * INFO Elementor Dark mode compatibility * FIX Duplicated meta robots on WC pages (checkout, cart, account) * FIX Remove /category/ slug with WPML if the slug is translated * FIX Fatal error when connecting Google Analytics / Google Console if no permission * FIX Google Analytics widget logout after view lock * FIX Google Analytics listing properties error handling * FIX Canonical URL on paginated pages (is_singular && is_paged) * FIX PHP notice queried object * FIX JS Encoding for Google Preview * FIX Missing compatibility center options in export file * FIX Undefined index: image with FAQ Block (props to @audrasjb) * FIX LocalBusiness widget in specific cases * FIX SEOPress metaboxes not loaded in specific cases (props to @J-Brk)

View our complete changelog

Download this release

Release Info

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

Code changes from version 4.5.1 to 4.6

Files changed (69) hide show
  1. inc/admin/admin-dyn-variables-helper.php +5 -0
  2. inc/admin/admin-metaboxes.php +3 -3
  3. inc/admin/admin.php +41 -10
  4. inc/admin/ajax-migrate/aio.php +137 -0
  5. inc/admin/ajax-migrate/platinum.php +181 -0
  6. inc/admin/ajax-migrate/premium-seo-pack.php +118 -0
  7. inc/admin/ajax-migrate/seo-framework.php +121 -0
  8. inc/admin/ajax-migrate/seo-ultimate.php +72 -0
  9. inc/admin/ajax-migrate/seopressor.php +488 -0
  10. inc/admin/ajax-migrate/smart-crawl.php +174 -0
  11. inc/admin/ajax-migrate/squirrly.php +72 -0
  12. inc/admin/ajax-migrate/wp-meta-seo.php +92 -0
  13. inc/admin/ajax-migrate/wpseo.php +128 -0
  14. inc/admin/ajax-migrate/yoast.php +169 -0
  15. inc/admin/ajax.php +41 -1798
  16. inc/admin/page-builders/elementor/assets/css/dark-mode.css +48 -0
  17. inc/admin/page-builders/elementor/assets/css/social-preview.css +105 -44
  18. inc/admin/page-builders/elementor/inc/admin/class-document-settings-section.php +30 -16
  19. inc/admin/page-builders/elementor/inc/class-register-controls.php +1 -1
  20. inc/admin/page-builders/gutenberg/inc/blocks/faq-block/src/register-block.php +7 -5
  21. inc/functions/options-advanced-admin.php +20 -0
  22. inc/functions/options-import-export.php +4 -0
  23. inc/functions/options-social.php +29 -2
  24. inc/functions/options-titles-metas.php +147 -12
  25. inc/functions/options.php +13 -0
  26. inc/functions/variables/dynamic-variables.php +30 -6
  27. languages/wp-seopress.pot +1746 -1639
  28. readme.txt +66 -66
  29. seopress.php +792 -765
  30. src/Actions/Admin/ContentAnalysis.php +35 -0
  31. src/Actions/Admin/CustomCapabilities.php +165 -0
  32. src/Actions/Admin/ManageColumn.php +1 -2
  33. src/Actions/Ajax/PreviewMetaTitle.php +1 -1
  34. src/Actions/Front/Metas/DescriptionMeta.php +64 -1
  35. src/Actions/Front/Metas/TitleMeta.php +64 -1
  36. src/Actions/Options/Init.php +3 -1
  37. src/Compose/UseTags.php +6 -7
  38. src/Constants/Options.php +7 -0
  39. src/Helpers/PagesAdmin.php +124 -0
  40. src/Helpers/RichSnippetType.php +17 -0
  41. src/JsonSchemas/Image.php +31 -0
  42. src/JsonSchemas/Organization.php +27 -2
  43. src/Services/ContentAnalysis/GetContent.php +3 -3
  44. src/Services/Context/CheckContextPage.php +28 -0
  45. src/Services/{ContextPage.php → Context/ContextPage.php} +30 -22
  46. src/Services/JsonSchemaGenerator.php +12 -3
  47. src/Services/Options/AdvancedOption.php +39 -0
  48. src/Services/Options/TitleOption.php +8 -2
  49. src/Services/Settings/Roles/SectionPagesSEOPress.php +102 -0
  50. src/Tags/AuthorFirstName.php +38 -0
  51. src/Tags/AuthorLastName.php +38 -0
  52. src/Tags/AuthorNickname.php +38 -0
  53. src/Tags/AuthorWebsite.php +38 -0
  54. src/Tags/Custom/CustomUserMeta.php +40 -0
  55. src/Tags/PostAuthor.php +4 -3
  56. src/Tags/PostExcerpt.php +4 -3
  57. src/Tags/PostThumbnailUrlHeight.php +31 -0
  58. src/Tags/PostThumbnailUrlWidth.php +31 -0
  59. src/Tags/PostTitle.php +2 -0
  60. src/Tags/Schema/Date/PostDate.php +24 -0
  61. src/Tags/Schema/Date/PostModifiedDate.php +24 -0
  62. src/Tags/WooCommerce/GetPrice.php +33 -0
  63. src/Tags/WooCommerce/PriceValidDate.php +36 -0
  64. src/Tags/WooCommerce/Sku.php +1 -1
  65. src/Thirds/ACF/ContentAnalysisAcfFields.php +91 -0
  66. templates/json-schemas/image.json +6 -0
  67. templates/json-schemas/organization.json +10 -10
  68. vendor/composer/InstalledVersions.php +6 -6
  69. vendor/composer/installed.php +6 -6
inc/admin/admin-dyn-variables-helper.php CHANGED
@@ -44,7 +44,12 @@ function seopress_get_dyn_variables() {
44
  '%%currentyear%%' => __('Current year', 'wp-seopress'),
45
  '%%currentdate%%' => __('Current date', 'wp-seopress'),
46
  '%%currenttime%%' => __('Current time', 'wp-seopress'),
 
 
 
 
47
  '%%author_bio%%' => __('Author biography', 'wp-seopress'),
 
48
  '%%currentmonth_num%%' => __('Current month in digital format', 'wp-seopress'),
49
  '%%target_keyword%%' => __('Target keyword', 'wp-seopress'),
50
  ];
44
  '%%currentyear%%' => __('Current year', 'wp-seopress'),
45
  '%%currentdate%%' => __('Current date', 'wp-seopress'),
46
  '%%currenttime%%' => __('Current time', 'wp-seopress'),
47
+ '%%author_first_name%%' => __('Author first name', 'wp-seopress'),
48
+ '%%author_last_name%%' => __('Author last name', 'wp-seopress'),
49
+ '%%author_website%%' => __('Author website', 'wp-seopress'),
50
+ '%%author_nickname%%' => __('Author nickname', 'wp-seopress'),
51
  '%%author_bio%%' => __('Author biography', 'wp-seopress'),
52
+ '%%_ucf_your_user_meta%%' => __('Author user meta', 'wp-seopress'),
53
  '%%currentmonth_num%%' => __('Current month in digital format', 'wp-seopress'),
54
  '%%target_keyword%%' => __('Target keyword', 'wp-seopress'),
55
  ];
inc/admin/admin-metaboxes.php CHANGED
@@ -694,10 +694,10 @@ if (is_user_logged_in()) {
694
  echo seopress_display_ca_metaboxe();
695
  } else {
696
  global $wp_roles;
697
-
698
  //Get current user role
699
- if (isset(wp_get_current_user()->roles[0])) {
700
- $seopress_user_role = wp_get_current_user()->roles[0];
701
 
702
  //If current user role matchs values from Security settings then apply -- SEO Metaboxe
703
  if (function_exists('seopress_advanced_security_metaboxe_role_hook_option') && '' != seopress_advanced_security_metaboxe_role_hook_option()) {
694
  echo seopress_display_ca_metaboxe();
695
  } else {
696
  global $wp_roles;
697
+ $user = wp_get_current_user();
698
  //Get current user role
699
+ if (isset($user->roles) && is_array($user->roles) && ! empty($user->roles)) {
700
+ $seopress_user_role = current($user->roles);
701
 
702
  //If current user role matchs values from Security settings then apply -- SEO Metaboxe
703
  if (function_exists('seopress_advanced_security_metaboxe_role_hook_option') && '' != seopress_advanced_security_metaboxe_role_hook_option()) {
inc/admin/admin.php CHANGED
@@ -2,8 +2,9 @@
2
 
3
  defined('ABSPATH') or exit('Please don’t call the plugin directly. Thanks :)');
4
 
5
- class seopress_options
6
- {
 
7
  /**
8
  * Holds the values to be used in the fields callbacks.
9
  */
@@ -37,12 +38,12 @@ class seopress_options
37
 
38
  add_menu_page(__('SEOPress Option Page', 'wp-seopress-pro'), $sp_seo_admin_menu['title'], seopress_capability('manage_options', 'menu'), 'seopress-option', [$this, 'create_admin_page'], $sp_seo_admin_menu['icon'], 90);
39
  add_submenu_page('seopress-option', __('Dashboard', 'wp-seopress'), __('Dashboard', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-option', [$this, 'create_admin_page']);
40
- $seopress_titles_help_tab = add_submenu_page('seopress-option', __('Titles & Metas', 'wp-seopress'), __('Titles & Metas', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-titles', [$this, 'seopress_titles_page']);
41
- $seopress_xml_sitemaps_help_tab = add_submenu_page('seopress-option', __('XML / Image / Video / HTML Sitemap', 'wp-seopress'), __('XML / HTML Sitemap', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-xml-sitemap', [$this, 'seopress_xml_sitemap_page']);
42
- $seopress_social_networks_help_tab = add_submenu_page('seopress-option', __('Social Networks', 'wp-seopress'), __('Social Networks', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-social', [$this, 'seopress_social_page']);
43
- $seopress_google_analytics_help_tab = add_submenu_page('seopress-option', __('Analytics', 'wp-seopress'), __('Analytics', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-google-analytics', [$this, 'seopress_google_analytics_page']);
44
- add_submenu_page('seopress-option', __('Advanced', 'wp-seopress'), __('Advanced', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-advanced', [$this, 'seopress_advanced_page']);
45
- add_submenu_page('seopress-option', __('Tools', 'wp-seopress'), __('Tools', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-import-export', [$this, 'seopress_import_export_page']);
46
 
47
  if (function_exists('seopress_get_toggle_white_label_option')) {
48
  $white_label_toggle = seopress_get_toggle_white_label_option();
@@ -2754,6 +2755,14 @@ class seopress_options
2754
  'seopress_setting_section_advanced_appearance' // Section
2755
  );
2756
 
 
 
 
 
 
 
 
 
2757
  add_settings_field(
2758
  'seopress_advanced_appearance_genesis_seo_metaboxe', // ID
2759
  __('Hide Genesis SEO Metabox', 'wp-seopress'), // Title
@@ -2803,6 +2812,8 @@ class seopress_options
2803
  'seopress_setting_section_advanced_security' // Section
2804
  );
2805
 
 
 
2806
  //Tools SECTION=======================================================================
2807
  add_settings_section(
2808
  'seopress_setting_section_tools_compatibility', // ID
@@ -3157,7 +3168,7 @@ class seopress_options
3157
  }
3158
 
3159
  public function print_section_info_advanced_security() {
3160
- echo '<p>' . __('Manage security.', 'wp-seopress') . '</p>';
3161
  }
3162
 
3163
  public function print_section_info_tools_compatibility() {
@@ -4975,7 +4986,7 @@ class seopress_options
4975
  echo ' value="wp_head">' . __('Head (not recommended)', 'wp-seopress') . '</option>';
4976
  echo '</select>';
4977
 
4978
- echo '<p class="description">'.__('Your theme must be compatible with wp_body_open hook introduced in WordPress 5.2 if "opening body tag" option selected.').'</p>';
4979
 
4980
  if (isset($this->options['seopress_google_analytics_hook'])) {
4981
  esc_attr($this->options['seopress_google_analytics_hook']);
@@ -6290,6 +6301,8 @@ class seopress_options
6290
 
6291
  echo '<label for="seopress_advanced_advanced_wp_rsd">' . __('Remove Really Simple Discovery meta tag in source code (eg:', 'wp-seopress') . '<em>' . esc_attr('<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://www.seopress.dev/xmlrpc.php?rsd" />') . '</em>)</label>';
6292
 
 
 
6293
  if (isset($this->options['seopress_advanced_advanced_wp_rsd'])) {
6294
  esc_attr($this->options['seopress_advanced_advanced_wp_rsd']);
6295
  }
@@ -6715,6 +6728,24 @@ class seopress_options
6715
  }
6716
  }
6717
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6718
  public function seopress_advanced_appearance_genesis_seo_metaboxe_callback() {
6719
  $options = get_option('seopress_advanced_option_name');
6720
 
2
 
3
  defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
 
5
+ use SEOPress\Helpers\PagesAdmin;
6
+
7
+ class seopress_options {
8
  /**
9
  * Holds the values to be used in the fields callbacks.
10
  */
38
 
39
  add_menu_page(__('SEOPress Option Page', 'wp-seopress-pro'), $sp_seo_admin_menu['title'], seopress_capability('manage_options', 'menu'), 'seopress-option', [$this, 'create_admin_page'], $sp_seo_admin_menu['icon'], 90);
40
  add_submenu_page('seopress-option', __('Dashboard', 'wp-seopress'), __('Dashboard', 'wp-seopress'), seopress_capability('manage_options', 'menu'), 'seopress-option', [$this, 'create_admin_page']);
41
+ $seopress_titles_help_tab = add_submenu_page('seopress-option', __('Titles & Metas', 'wp-seopress'), __('Titles & Metas', 'wp-seopress'), seopress_capability('manage_options', PagesAdmin::TITLE_METAS), 'seopress-titles', [$this, 'seopress_titles_page']);
42
+ $seopress_xml_sitemaps_help_tab = add_submenu_page('seopress-option', __('XML / Image / Video / HTML Sitemap', 'wp-seopress'), __('XML / HTML Sitemap', 'wp-seopress'), seopress_capability('manage_options', PagesAdmin::XML_HTML_SITEMAP), 'seopress-xml-sitemap', [$this, 'seopress_xml_sitemap_page']);
43
+ $seopress_social_networks_help_tab = add_submenu_page('seopress-option', __('Social Networks', 'wp-seopress'), __('Social Networks', 'wp-seopress'), seopress_capability('manage_options', PagesAdmin::SOCIAL_NETWORKS), 'seopress-social', [$this, 'seopress_social_page']);
44
+ $seopress_google_analytics_help_tab = add_submenu_page('seopress-option', __('Analytics', 'wp-seopress'), __('Analytics', 'wp-seopress'), seopress_capability('manage_options', PagesAdmin::ANALYTICS), 'seopress-google-analytics', [$this, 'seopress_google_analytics_page']);
45
+ add_submenu_page('seopress-option', __('Advanced', 'wp-seopress'), __('Advanced', 'wp-seopress'), seopress_capability('manage_options', PagesAdmin::ADVANCED), 'seopress-advanced', [$this, 'seopress_advanced_page']);
46
+ add_submenu_page('seopress-option', __('Tools', 'wp-seopress'), __('Tools', 'wp-seopress'), seopress_capability('manage_options', PagesAdmin::TOOLS), 'seopress-import-export', [$this, 'seopress_import_export_page']);
47
 
48
  if (function_exists('seopress_get_toggle_white_label_option')) {
49
  $white_label_toggle = seopress_get_toggle_white_label_option();
2755
  'seopress_setting_section_advanced_appearance' // Section
2756
  );
2757
 
2758
+ add_settings_field(
2759
+ 'seopress_advanced_appearance_ca_metaboxe', // ID
2760
+ __('Remove Content Analysis Metabox', 'wp-seopress'), // Title
2761
+ [$this, 'seopress_advanced_appearance_ca_metaboxe_callback'], // Callback
2762
+ 'seopress-settings-admin-advanced-appearance', // Page
2763
+ 'seopress_setting_section_advanced_appearance' // Section
2764
+ );
2765
+
2766
  add_settings_field(
2767
  'seopress_advanced_appearance_genesis_seo_metaboxe', // ID
2768
  __('Hide Genesis SEO Metabox', 'wp-seopress'), // Title
2812
  'seopress_setting_section_advanced_security' // Section
2813
  );
2814
 
2815
+ seopress_get_service('SectionPagesSEOPress')->printSectionPages();
2816
+
2817
  //Tools SECTION=======================================================================
2818
  add_settings_section(
2819
  'seopress_setting_section_tools_compatibility', // ID
3168
  }
3169
 
3170
  public function print_section_info_advanced_security() {
3171
+ echo '<p>' . __('Manage security for user roles.', 'wp-seopress') . '</p>';
3172
  }
3173
 
3174
  public function print_section_info_tools_compatibility() {
4986
  echo ' value="wp_head">' . __('Head (not recommended)', 'wp-seopress') . '</option>';
4987
  echo '</select>';
4988
 
4989
+ echo '<p class="description">' . __('Your theme must be compatible with wp_body_open hook introduced in WordPress 5.2 if "opening body tag" option selected.') . '</p>';
4990
 
4991
  if (isset($this->options['seopress_google_analytics_hook'])) {
4992
  esc_attr($this->options['seopress_google_analytics_hook']);
6301
 
6302
  echo '<label for="seopress_advanced_advanced_wp_rsd">' . __('Remove Really Simple Discovery meta tag in source code (eg:', 'wp-seopress') . '<em>' . esc_attr('<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://www.seopress.dev/xmlrpc.php?rsd" />') . '</em>)</label>';
6303
 
6304
+ echo '<p class="description">' . __('WordPress Site Health feature will return a HTTPS warning if you enable this option. This is a false positive of course.', 'wp-seopress') . '</p>';
6305
+
6306
  if (isset($this->options['seopress_advanced_advanced_wp_rsd'])) {
6307
  esc_attr($this->options['seopress_advanced_advanced_wp_rsd']);
6308
  }
6728
  }
6729
  }
6730
 
6731
+ public function seopress_advanced_appearance_ca_metaboxe_callback() {
6732
+ $options = get_option('seopress_advanced_option_name');
6733
+
6734
+ $check = isset($options['seopress_advanced_appearance_ca_metaboxe']);
6735
+
6736
+ echo '<input id="seopress_advanced_appearance_ca_metaboxe" name="seopress_advanced_option_name[seopress_advanced_appearance_ca_metaboxe]" type="checkbox"';
6737
+ if ('1' == $check) {
6738
+ echo 'checked="yes"';
6739
+ }
6740
+ echo ' value="1"/>';
6741
+
6742
+ echo '<label for="seopress_advanced_appearance_ca_metaboxe">' . __('Remove Content Analysis Metabox', 'wp-seopress') . '</label>';
6743
+
6744
+ if (isset($this->options['seopress_advanced_appearance_ca_metaboxe'])) {
6745
+ esc_attr($this->options['seopress_advanced_appearance_ca_metaboxe']);
6746
+ }
6747
+ }
6748
+
6749
  public function seopress_advanced_appearance_genesis_seo_metaboxe_callback() {
6750
  $options = get_option('seopress_advanced_option_name');
6751
 
inc/admin/ajax-migrate/aio.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
+
5
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
6
+ //AIO migration
7
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
8
+ function seopress_aio_migration() {
9
+ check_ajax_referer('seopress_aio_migrate_nonce', $_POST['_ajax_nonce'], true);
10
+
11
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
12
+ if (isset($_POST['offset']) && isset($_POST['offset'])) {
13
+ $offset = absint($_POST['offset']);
14
+ }
15
+
16
+ global $wpdb;
17
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts}");
18
+
19
+ $increment = 200;
20
+ global $post;
21
+
22
+ if ($offset > $total_count_posts) {
23
+ wp_reset_query();
24
+
25
+ $args = [
26
+ //'number' => $increment,
27
+ 'hide_empty' => false,
28
+ //'offset' => $offset,
29
+ 'fields' => 'ids',
30
+ ];
31
+ $aio_query_terms = get_terms($args);
32
+
33
+ if ($aio_query_terms) {
34
+ foreach ($aio_query_terms as $term_id) {
35
+ if ('' != get_term_meta($term_id, '_aioseop_title', true)) { //Import title tag
36
+ update_term_meta($term_id, '_seopress_titles_title', get_term_meta($term_id, '_aioseop_title', true));
37
+ }
38
+ if ('' != get_term_meta($term_id, '_aioseop_description', true)) { //Import meta desc
39
+ update_term_meta($term_id, '_seopress_titles_desc', get_term_meta($term_id, '_aioseop_description', true));
40
+ }
41
+ if ('' != get_term_meta($term_id, '_aioseop_opengraph_settings', true)) { //Import Facebook / Twitter Title
42
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
43
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_title'])) {
44
+ update_term_meta($term_id, '_seopress_social_fb_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
45
+ update_term_meta($term_id, '_seopress_social_twitter_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
46
+ }
47
+ }
48
+ if ('' != get_term_meta($term_id, '_aioseop_opengraph_settings', true)) { //Import Facebook / Twitter Title
49
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
50
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_desc'])) {
51
+ update_term_meta($term_id, '_seopress_social_fb_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
52
+ update_term_meta($term_id, '_seopress_social_twitter_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
53
+ }
54
+ }
55
+ if ('' != get_term_meta($term_id, '_aioseop_opengraph_settings', true)) { //Import Facebook Image
56
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
57
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
58
+ update_term_meta($term_id, '_seopress_social_fb_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg']);
59
+ }
60
+ }
61
+ if ('' != get_term_meta($term_id, '_aioseop_opengraph_settings', true)) { //Import Twitter Image
62
+ $_aioseop_opengraph_settings = get_term_meta($term_id, '_aioseop_opengraph_settings', true);
63
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
64
+ update_term_meta($term_id, '_seopress_social_twitter_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter']);
65
+ }
66
+ }
67
+ if ('on' == get_term_meta($term_id, '_aioseop_noindex', true)) { //Import Robots NoIndex
68
+ update_term_meta($term_id, '_seopress_robots_index', 'yes');
69
+ }
70
+ if ('on' == get_term_meta($term_id, '_aioseop_nofollow', true)) { //Import Robots NoIndex
71
+ update_term_meta($term_id, '_seopress_robots_follow', 'yes');
72
+ }
73
+ }
74
+ }
75
+ $offset = 'done';
76
+ wp_reset_query();
77
+ } else {
78
+ $args = [
79
+ 'posts_per_page' => $increment,
80
+ 'post_type' => 'any',
81
+ 'post_status' => 'any',
82
+ 'offset' => $offset,
83
+ ];
84
+
85
+ $aio_query = get_posts($args);
86
+
87
+ if ($aio_query) {
88
+ foreach ($aio_query as $post) {
89
+ if ('' != get_post_meta($post->ID, '_aioseop_title', true)) { //Import title tag
90
+ update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_aioseop_title', true));
91
+ }
92
+ if ('' != get_post_meta($post->ID, '_aioseop_description', true)) { //Import meta desc
93
+ update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_aioseop_description', true));
94
+ }
95
+ if ('' != get_post_meta($post->ID, '_aioseop_opengraph_settings', true)) { //Import Facebook / Twitter Title
96
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
97
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_title'])) {
98
+ update_post_meta($post->ID, '_seopress_social_fb_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
99
+ update_post_meta($post->ID, '_seopress_social_twitter_title', $_aioseop_opengraph_settings['aioseop_opengraph_settings_title']);
100
+ }
101
+ }
102
+ if ('' != get_post_meta($post->ID, '_aioseop_opengraph_settings', true)) { //Import Facebook / Twitter Desc
103
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
104
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_desc'])) {
105
+ update_post_meta($post->ID, '_seopress_social_fb_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
106
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', $_aioseop_opengraph_settings['aioseop_opengraph_settings_desc']);
107
+ }
108
+ }
109
+ if ('' != get_post_meta($post->ID, '_aioseop_opengraph_settings', true)) { //Import Facebook Image
110
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
111
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_image'])) {
112
+ update_post_meta($post->ID, '_seopress_social_fb_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg']);
113
+ }
114
+ }
115
+ if ('' != get_post_meta($post->ID, '_aioseop_opengraph_settings', true)) { //Import Twitter Image
116
+ $_aioseop_opengraph_settings = get_post_meta($post->ID, '_aioseop_opengraph_settings', true);
117
+ if (isset($_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter'])) {
118
+ update_post_meta($post->ID, '_seopress_social_twitter_img', $_aioseop_opengraph_settings['aioseop_opengraph_settings_customimg_twitter']);
119
+ }
120
+ }
121
+ if ('on' == get_post_meta($post->ID, '_aioseop_noindex', true)) { //Import Robots NoIndex
122
+ update_post_meta($post->ID, '_seopress_robots_index', 'yes');
123
+ }
124
+ if ('on' == get_post_meta($post->ID, '_aioseop_nofollow', true)) { //Import Robots NoFollow
125
+ update_post_meta($post->ID, '_seopress_robots_follow', 'yes');
126
+ }
127
+ }
128
+ }
129
+ $offset += $increment;
130
+ }
131
+ $data = [];
132
+ $data['offset'] = $offset;
133
+ wp_send_json_success($data);
134
+ exit();
135
+ }
136
+ }
137
+ add_action('wp_ajax_seopress_aio_migration', 'seopress_aio_migration');
inc/admin/ajax-migrate/platinum.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
+
5
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
6
+ /* Platinum SEO migration
7
+ * @since 4.5
8
+ * @author Benjamin Denis
9
+ */
10
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
11
+ function seopress_platinum_seo_migration() {
12
+ check_ajax_referer('seopress_platinum_seo_migrate_nonce', $_POST['_ajax_nonce'], true);
13
+
14
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
15
+ if (isset($_POST['offset']) && isset($_POST['offset'])) {
16
+ $offset = absint($_POST['offset']);
17
+ }
18
+
19
+ global $wpdb;
20
+
21
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts}");
22
+
23
+ $increment = 200;
24
+ global $post;
25
+
26
+ if ($offset > $total_count_posts) {
27
+ wp_reset_query();
28
+
29
+ $args = [
30
+ 'hide_empty' => false,
31
+ ];
32
+ $platinum_seo_query_terms = get_terms($args);
33
+
34
+ if ($platinum_seo_query_terms) {
35
+ foreach ($platinum_seo_query_terms as $term) {
36
+ if ( ! is_wp_error($term)) {
37
+ $tax = 'taxonomy';
38
+ if ('category' === $term->taxonomy) {
39
+ $tax = 'category';
40
+ }
41
+ if ('' != get_term_meta($term->term_id, 'psp_' . $tax . '_seo_metas_' . $term->term_id, true) || '' != get_term_meta($term->$term_id, 'psp_' . $tax . '_social_metas_' . $term->term_id, true)) {
42
+ $term_settings = get_term_meta($term->term_id, 'psp_' . $tax . '_seo_metas_' . $term->term_id, true);
43
+ $term_social_settings = get_term_meta($term->term_id, 'psp_' . $tax . '_social_metas_' . $term->term_id, true);
44
+
45
+ if ( ! empty($term_settings['title'])) { //Import title tag
46
+ update_term_meta($term->term_id, '_seopress_titles_title', $term_settings['title']);
47
+ }
48
+ if ( ! empty($term_settings['description'])) { //Import meta desc
49
+ update_term_meta($term->term_id, '_seopress_titles_desc', $term_settings['description']);
50
+ }
51
+ if ( ! empty($term_social_settings['fb_title'])) { //Import Facebook Title
52
+ update_term_meta($term->term_id, '_seopress_social_fb_title', $term_social_settings['fb_title']);
53
+ update_term_meta($term->term_id, '_seopress_social_twitter_title', $term_social_settings['fb_title']);
54
+ }
55
+ if ( ! empty($term_social_settings['fb_description'])) { //Import Facebook Desc
56
+ update_term_meta($term->term_id, '_seopress_social_fb_desc', $term_social_settings['fb_description']);
57
+ update_term_meta($term->term_id, '_seopress_social_twitter_desc', $term_social_settings['fb_description']);
58
+ }
59
+ if ( ! empty($term_social_settings['fb_image'])) { //Import Facebook Image
60
+ update_term_meta($term->term_id, '_seopress_social_fb_img', $term_social_settings['fb_image']);
61
+ update_term_meta($term->term_id, '_seopress_social_twitter_img', $term_social_settings['fb_image']);
62
+ }
63
+ if ( ! empty($term_settings['canonical_url'])) { //Import Canonical URL
64
+ update_term_meta($term->term_id, '_seopress_robots_canonical', $term_settings['canonical_url']);
65
+ }
66
+ if ( ! empty($term_settings['redirect_to_url'])) { //Import Redirect URL
67
+ update_term_meta($term->term_id, '_seopress_redirections_value', $term_settings['redirect_to_url']);
68
+ update_term_meta($term->term_id, '_seopress_redirections_enabled', 'yes');
69
+ if ( ! empty($term_settings['redirect_status_code'])) {
70
+ $status = $term_settings['redirect_status_code'];
71
+ if ('303' === $term_settings['redirect_status_code']) {
72
+ $status = '301';
73
+ }
74
+
75
+ update_term_meta($term->term_id, '_seopress_redirections_type', $status);
76
+ }
77
+ }
78
+ if ( ! empty($term_settings['noindex'])) { //Import Robots NoIndex
79
+ update_term_meta($term->term_id, '_seopress_robots_index', 'yes');
80
+ }
81
+ if ( ! empty($term_settings['nofollow'])) { //Import Robots NoFollow
82
+ update_term_meta($term->term_id, '_seopress_robots_follow', 'yes');
83
+ }
84
+ if ( ! empty($term_settings['noarchive'])) { //Import Robots NoArchive
85
+ update_term_meta($term->term_id, '_seopress_robots_archive', 'yes');
86
+ }
87
+ if ( ! empty($term_settings['nosnippet'])) { //Import Robots NoSnippet
88
+ update_term_meta($term->term_id, '_seopress_robots_snippet', 'yes');
89
+ }
90
+ if ( ! empty($term_settings['noimageindex'])) { //Import Robots NoImageIndex
91
+ update_term_meta($term->term_id, '_seopress_robots_imageindex', 'yes');
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ $offset = 'done';
98
+ wp_reset_query();
99
+ } else {
100
+ $args = [
101
+ 'posts_per_page' => $increment,
102
+ 'post_type' => 'any',
103
+ 'post_status' => 'any',
104
+ 'offset' => $offset,
105
+ ];
106
+
107
+ $platinum_seo_query = get_posts($args);
108
+
109
+ if ($platinum_seo_query) {
110
+ foreach ($platinum_seo_query as $post) {
111
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_title', true)) { //Import title tag
112
+ update_post_meta($post->ID, '_seopress_titles_title', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_title', true));
113
+ }
114
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_description', true)) { //Import meta desc
115
+ update_post_meta($post->ID, '_seopress_titles_desc', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_description', true));
116
+ }
117
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_title', true)) { //Import Facebook Title
118
+ update_post_meta($post->ID, '_seopress_social_fb_title', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_title', true));
119
+ update_post_meta($post->ID, '_seopress_social_twitter_title', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_title', true));
120
+ }
121
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_description', true)) { //Import Facebook Desc
122
+ update_post_meta($post->ID, '_seopress_social_fb_desc', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_description', true));
123
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_description', true));
124
+ }
125
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_image', true)) { //Import Facebook Image
126
+ update_post_meta($post->ID, '_seopress_social_fb_img', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_image', true));
127
+ update_post_meta($post->ID, '_seopress_social_twitter_img', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_fb_image', true));
128
+ }
129
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_keywords', true)) { //Import Target Keyword
130
+ update_post_meta($post->ID, '_seopress_analysis_target_kw', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_keywords', true));
131
+ }
132
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_canonical_url', true)) { //Import Canonical URL
133
+ update_post_meta($post->ID, '_seopress_robots_canonical', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_canonical_url', true));
134
+ }
135
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_redirect_to_url', true)) { //Import Redirect URL
136
+ update_post_meta($post->ID, '_seopress_redirections_value', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_redirect_to_url', true));
137
+ update_post_meta($post->ID, '_seopress_redirections_enabled', 'yes'); //Enable the redirect
138
+
139
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_redirect_status_code', true)) {
140
+ $status = get_metadata('platinumseo', $post->ID, '_techblissonline_psp_redirect_status_code', true);
141
+ if ('303' === get_metadata('platinumseo', $post->ID, '_techblissonline_psp_redirect_status_code', true)) {
142
+ $status = '301';
143
+ }
144
+
145
+ update_term_meta($post->ID, '_seopress_redirections_type', $status);
146
+ }
147
+ }
148
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_noindex', true)) { //Import Robots NoIndex
149
+ update_post_meta($post->ID, '_seopress_robots_index', 'yes');
150
+ }
151
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_nofollow', true)) { //Import Robots NoFollow
152
+ update_post_meta($post->ID, '_seopress_robots_follow', 'yes');
153
+ }
154
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_noarchive', true)) { //Import Robots NoArchive
155
+ update_post_meta($post->ID, '_seopress_robots_archive', 'yes');
156
+ }
157
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_nosnippet', true)) { //Import Robots NoSnippet
158
+ update_post_meta($post->ID, '_seopress_robots_snippet', 'yes');
159
+ }
160
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_noimageidx', true)) { //Import Robots NoImageIndex
161
+ update_post_meta($post->ID, '_seopress_robots_imageindex', 'yes');
162
+ }
163
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_keywords', true)) { //Import Target Keywords
164
+ update_post_meta($post->ID, '_seopress_analysis_target_kw', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_keywords', true));
165
+ }
166
+ if ('' != get_metadata('platinumseo', $post->ID, '_techblissonline_psp_preferred_term', true)) { //Import Primary category
167
+ if ('category' == get_metadata('platinumseo', $post->ID, '_techblissonline_psp_preferred_taxonomy', true) || 'product_cat' == get_metadata('platinumseo', $post->ID, '_techblissonline_psp_preferred_taxonomy', true)) {
168
+ update_post_meta($post->ID, '_seopress_robots_primary_cat', get_metadata('platinumseo', $post->ID, '_techblissonline_psp_preferred_term', true));
169
+ }
170
+ }
171
+ }
172
+ }
173
+ $offset += $increment;
174
+ }
175
+ $data = [];
176
+ $data['offset'] = $offset;
177
+ wp_send_json_success($data);
178
+ exit();
179
+ }
180
+ }
181
+ add_action('wp_ajax_seopress_platinum_seo_migration', 'seopress_platinum_seo_migration');
inc/admin/ajax-migrate/premium-seo-pack.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
+
5
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
6
+ /* Premium SEO Pack migration
7
+ * @since 3.8.7
8
+ * @author Benjamin Denis
9
+ */
10
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
11
+ function seopress_premium_seo_pack_migration() {
12
+ check_ajax_referer('seopress_premium_seo_pack_migrate_nonce', $_POST['_ajax_nonce'], true);
13
+
14
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
15
+ if (isset($_POST['offset']) && isset($_POST['offset'])) {
16
+ $offset = absint($_POST['offset']);
17
+ }
18
+
19
+ global $wpdb;
20
+
21
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts}");
22
+
23
+ $increment = 200;
24
+ global $post;
25
+
26
+ if ($offset > $total_count_posts) {
27
+ wp_reset_query();
28
+
29
+ $premium_query_terms = get_option('psp_taxonomy_seo');
30
+
31
+ if ($premium_query_terms) {
32
+ foreach ($premium_query_terms as $taxonomies => $taxonomie) {
33
+ foreach ($taxonomie as $term_id => $term_value) {
34
+ if ('' != $term_value['psp_meta']['title']) { //Import title tag
35
+ update_term_meta($term_id, '_seopress_titles_title', $term_value['psp_meta']['title']);
36
+ }
37
+ if ('' != $term_value['psp_meta']['description']) { //Import meta desc
38
+ update_term_meta($term_id, '_seopress_titles_desc', $term_value['psp_meta']['description']);
39
+ }
40
+ if ('' != $term_value['psp_meta']['facebook_titlu']) { //Import Facebook Title
41
+ update_term_meta($term_id, '_seopress_social_fb_title', $term_value['psp_meta']['facebook_titlu']);
42
+ }
43
+ if ('' != $term_value['psp_meta']['facebook_desc']) { //Import Facebook Desc
44
+ update_term_meta($term_id, '_seopress_social_fb_desc', $term_value['psp_meta']['facebook_desc']);
45
+ }
46
+ if ('' != $term_value['psp_meta']['facebook_image']) { //Import Facebook Image
47
+ update_term_meta($term_id, '_seopress_social_fb_img', $term_value['psp_meta']['facebook_image']);
48
+ }
49
+ if ('noindex' == $term_value['psp_meta']['robots_index']) { //Import Robots NoIndex
50
+ update_term_meta($term_id, '_seopress_robots_index', 'yes');
51
+ }
52
+ if ('nofollow' == $term_value['psp_meta']['robots_follow']) { //Import Robots NoFollow
53
+ update_term_meta($term_id, '_seopress_robots_follow', 'yes');
54
+ }
55
+ if ('' != $term_value['psp_meta']['canonical']) { //Import Canonical URL
56
+ update_term_meta($term_id, '_seopress_robots_canonical', $term_value['psp_meta']['canonical']);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ $offset = 'done';
62
+ wp_reset_query();
63
+ } else {
64
+ $args = [
65
+ 'posts_per_page' => $increment,
66
+ 'post_type' => 'any',
67
+ 'post_status' => 'any',
68
+ 'offset' => $offset,
69
+ ];
70
+
71
+ $premium_query = get_posts($args);
72
+
73
+ if ($premium_query) {
74
+ foreach ($premium_query as $post) {
75
+ $psp_meta = get_post_meta($post->ID, 'psp_meta', true);
76
+
77
+ if ( ! empty($psp_meta)) {
78
+ if ( ! empty($psp_meta['title'])) { //Import title tag
79
+ update_post_meta($post->ID, '_seopress_titles_title', $psp_meta['title']);
80
+ }
81
+ if ( ! empty($psp_meta['description'])) { //Import meta desc
82
+ update_post_meta($post->ID, '_seopress_titles_desc', $psp_meta['description']);
83
+ }
84
+ if ( ! empty($psp_meta['facebook_titlu'])) { //Import Facebook Title
85
+ update_post_meta($post->ID, '_seopress_social_fb_title', $psp_meta['facebook_titlu']);
86
+ }
87
+ if ( ! empty($psp_meta['facebook_desc'])) { //Import Facebook Desc
88
+ update_post_meta($post->ID, '_seopress_social_fb_desc', $psp_meta['facebook_desc']);
89
+ }
90
+ if ( ! empty($psp_meta['facebook_image'])) { //Import Facebook Image
91
+ update_post_meta($post->ID, '_seopress_social_fb_img', $psp_meta['facebook_image']);
92
+ }
93
+ if ('noindex' == $psp_meta['robots_index']) { //Import Robots NoIndex
94
+ update_post_meta($post->ID, '_seopress_robots_index', 'yes');
95
+ }
96
+ if ('nofollow' == $psp_meta['robots_follow']) { //Import Robots NoIndex
97
+ update_post_meta($post->ID, '_seopress_robots_follow', 'yes');
98
+ }
99
+ if ( ! empty($psp_meta['canonical'])) { //Import Canonical URL
100
+ update_post_meta($post->ID, '_seopress_robots_canonical', $psp_meta['canonical']);
101
+ }
102
+ if ( ! empty($psp_meta['mfocus_keyword'])) { //Import Focus Keywords
103
+ $target_kw = preg_split('/\r\n|\r|\n/', $psp_meta['mfocus_keyword']);
104
+
105
+ update_post_meta($post->ID, '_seopress_analysis_target_kw', implode(',', $target_kw));
106
+ }
107
+ }
108
+ }
109
+ }
110
+ $offset += $increment;
111
+ }
112
+ $data = [];
113
+ $data['offset'] = $offset;
114
+ wp_send_json_success($data);
115
+ exit();
116
+ }
117
+ }
118
+ add_action('wp_ajax_seopress_premium_seo_pack_migration', 'seopress_premium_seo_pack_migration');
inc/admin/ajax-migrate/seo-framework.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
+
5
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
6
+ //SEO Framework migration
7
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
8
+ function seopress_seo_framework_migration() {
9
+ check_ajax_referer('seopress_seo_framework_migrate_nonce', $_POST['_ajax_nonce'], true);
10
+
11
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
12
+ if (isset($_POST['offset']) && isset($_POST['offset'])) {
13
+ $offset = absint($_POST['offset']);
14
+ }
15
+
16
+ global $wpdb;
17
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts}");
18
+
19
+ $increment = 200;
20
+ global $post;
21
+
22
+ if ($offset > $total_count_posts) {
23
+ wp_reset_query();
24
+
25
+ $args = [
26
+ //'number' => $increment,
27
+ 'hide_empty' => false,
28
+ //'offset' => $offset,
29
+ 'fields' => 'ids',
30
+ ];
31
+ $seo_framework_query_terms = get_terms($args);
32
+
33
+ if ($seo_framework_query_terms) {
34
+ foreach ($seo_framework_query_terms as $term_id) {
35
+ if ('' != get_term_meta($term_id, 'autodescription-term-settings', true)) {
36
+ $term_settings = get_term_meta($term_id, 'autodescription-term-settings', true);
37
+
38
+ if ( ! empty($term_settings['doctitle'])) { //Import title tag
39
+ update_term_meta($term_id, '_seopress_titles_title', $term_settings['doctitle']);
40
+ }
41
+ if ( ! empty($term_settings['description'])) { //Import meta desc
42
+ update_term_meta($term_id, '_seopress_titles_desc', $term_settings['description']);
43
+ }
44
+ if ( ! empty($term_settings['noindex'])) { //Import Robots NoIndex
45
+ update_term_meta($term_id, '_seopress_robots_index', 'yes');
46
+ }
47
+ if ( ! empty($term_settings['nofollow'])) { //Import Robots NoFollow
48
+ update_term_meta($term_id, '_seopress_robots_follow', 'yes');
49
+ }
50
+ if ( ! empty($term_settings['noarchive'])) { //Import Robots NoArchive
51
+ update_term_meta($term_id, '_seopress_robots_archive', 'yes');
52
+ }
53
+ }
54
+ }
55
+ }
56
+ $offset = 'done';
57
+ wp_reset_query();
58
+ } else {
59
+ $args = [
60
+ 'posts_per_page' => $increment,
61
+ 'post_type' => 'any',
62
+ 'post_status' => 'any',
63
+ 'offset' => $offset,
64
+ ];
65
+
66
+ $seo_framework_query = get_posts($args);
67
+
68
+ if ($seo_framework_query) {
69
+ foreach ($seo_framework_query as $post) {
70
+ if ('' != get_post_meta($post->ID, '_genesis_title', true)) { //Import title tag
71
+ update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_genesis_title', true));
72
+ }
73
+ if ('' != get_post_meta($post->ID, '_genesis_description', true)) { //Import meta desc
74
+ update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_genesis_description', true));
75
+ }
76
+ if ('' != get_post_meta($post->ID, '_open_graph_title', true)) { //Import Facebook Title
77
+ update_post_meta($post->ID, '_seopress_social_fb_title', get_post_meta($post->ID, '_open_graph_title', true));
78
+ }
79
+ if ('' != get_post_meta($post->ID, '_open_graph_description', true)) { //Import Facebook Desc
80
+ update_post_meta($post->ID, '_seopress_social_fb_desc', get_post_meta($post->ID, '_open_graph_description', true));
81
+ }
82
+ if ('' != get_post_meta($post->ID, '_social_image_url', true)) { //Import Facebook Image
83
+ update_post_meta($post->ID, '_seopress_social_fb_img', get_post_meta($post->ID, '_social_image_url', true));
84
+ }
85
+ if ('' != get_post_meta($post->ID, '_twitter_title', true)) { //Import Twitter Title
86
+ update_post_meta($post->ID, '_seopress_social_twitter_title', get_post_meta($post->ID, '_twitter_title', true));
87
+ }
88
+ if ('' != get_post_meta($post->ID, '_twitter_description', true)) { //Import Twitter Desc
89
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', get_post_meta($post->ID, '_twitter_description', true));
90
+ }
91
+ if ('' != get_post_meta($post->ID, '_social_image_url', true)) { //Import Twitter Image
92
+ update_post_meta($post->ID, '_seopress_social_twitter_img', get_post_meta($post->ID, '_social_image_url', true));
93
+ }
94
+ if ('1' == get_post_meta($post->ID, '_genesis_noindex', true)) { //Import Robots NoIndex
95
+ update_post_meta($post->ID, '_seopress_robots_index', 'yes');
96
+ }
97
+ if ('1' == get_post_meta($post->ID, '_genesis_nofollow', true)) { //Import Robots NoFollow
98
+ update_post_meta($post->ID, '_seopress_robots_follow', 'yes');
99
+ }
100
+ if ('1' == get_post_meta($post->ID, '_genesis_noarchive', true)) { //Import Robots NoArchive
101
+ update_post_meta($post->ID, '_seopress_robots_archive', 'yes');
102
+ }
103
+ if ('' != get_post_meta($post->ID, '_genesis_canonical_uri', true)) { //Import Canonical URL
104
+ update_post_meta($post->ID, '_seopress_robots_canonical', get_post_meta($post->ID, '_genesis_canonical_uri', true));
105
+ }
106
+ if ('' != get_post_meta($post->ID, 'redirect', true)) { //Import Redirect URL
107
+ update_post_meta($post->ID, '_seopress_redirections_enabled', 'yes');
108
+ update_post_meta($post->ID, '_seopress_redirections_type', '301');
109
+ update_post_meta($post->ID, '_seopress_redirections_value', get_post_meta($post->ID, 'redirect', true));
110
+ }
111
+ }
112
+ }
113
+ $offset += $increment;
114
+ }
115
+ $data = [];
116
+ $data['offset'] = $offset;
117
+ wp_send_json_success($data);
118
+ exit();
119
+ }
120
+ }
121
+ add_action('wp_ajax_seopress_seo_framework_migration', 'seopress_seo_framework_migration');
inc/admin/ajax-migrate/seo-ultimate.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
+
5
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
6
+ /* SEO Ultimate migration
7
+ * @since 3.8.2
8
+ * @author Benjamin Denis
9
+ */
10
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
11
+ function seopress_seo_ultimate_migration() {
12
+ check_ajax_referer('seopress_seo_ultimate_migrate_nonce', $_POST['_ajax_nonce'], true);
13
+
14
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
15
+ if (isset($_POST['offset']) && isset($_POST['offset'])) {
16
+ $offset = absint($_POST['offset']);
17
+ }
18
+
19
+ global $wpdb;
20
+
21
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts}");
22
+
23
+ $increment = 200;
24
+ global $post;
25
+
26
+ if ($offset > $total_count_posts) {
27
+ $offset = 'done';
28
+ wp_reset_query();
29
+ } else {
30
+ $args = [
31
+ 'posts_per_page' => $increment,
32
+ 'post_type' => 'any',
33
+ 'post_status' => 'any',
34
+ 'offset' => $offset,
35
+ ];
36
+
37
+ $su_query = get_posts($args);
38
+
39
+ if ($su_query) {
40
+ foreach ($su_query as $post) {
41
+ if ('' != get_post_meta($post->ID, '_su_title', true)) { //Import title tag
42
+ update_post_meta($post->ID, '_seopress_titles_title', get_post_meta($post->ID, '_su_title', true));
43
+ }
44
+ if ('' != get_post_meta($post->ID, '_su_description', true)) { //Import meta desc
45
+ update_post_meta($post->ID, '_seopress_titles_desc', get_post_meta($post->ID, '_su_description', true));
46
+ }
47
+ if ('' != get_post_meta($post->ID, '_su_og_title', true)) { //Import Facebook Title
48
+ update_post_meta($post->ID, '_seopress_social_fb_title', get_post_meta($post->ID, '_su_og_title', true));
49
+ }
50
+ if ('' != get_post_meta($post->ID, '_su_og_description', true)) { //Import Facebook Desc
51
+ update_post_meta($post->ID, '_seopress_social_fb_desc', get_post_meta($post->ID, '_su_og_description', true));
52
+ }
53
+ if ('' != get_post_meta($post->ID, '_su_og_image', true)) { //Import Facebook Image
54
+ update_post_meta($post->ID, '_seopress_social_fb_img', get_post_meta($post->ID, '_su_og_image', true));
55
+ }
56
+ if ('1' == get_post_meta($post->ID, '_su_meta_robots_noindex', true)) { //Import Robots NoIndex
57
+ update_post_meta($post->ID, '_seopress_robots_index', 'yes');
58
+ }
59
+ if ('1' == get_post_meta($post->ID, '_su_meta_robots_nofollow', true)) { //Import Robots NoFollow
60
+ update_post_meta($post->ID, '_seopress_robots_follow', 'yes');
61
+ }
62
+ }
63
+ }
64
+ $offset += $increment;
65
+ }
66
+ $data = [];
67
+ $data['offset'] = $offset;
68
+ wp_send_json_success($data);
69
+ exit();
70
+ }
71
+ }
72
+ add_action('wp_ajax_seopress_seo_ultimate_migration', 'seopress_seo_ultimate_migration');
inc/admin/ajax-migrate/seopressor.php ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');
4
+
5
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
6
+ /* SEOPressor migration
7
+ * @since 4.5
8
+ * @author Benjamin Denis
9
+ */
10
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
11
+ function seopress_seopressor_migration() {
12
+ check_ajax_referer('seopress_seopressor_migrate_nonce', $_POST['_ajax_nonce'], true);
13
+
14
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
15
+ if (isset($_POST['offset']) && isset($_POST['offset'])) {
16
+ $offset = absint($_POST['offset']);
17
+ }
18
+
19
+ global $wpdb;
20
+
21
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts}");
22
+
23
+ $increment = 200;
24
+ global $post;
25
+
26
+ if ($offset > $total_count_posts) {
27
+ $offset = 'done';
28
+ wp_reset_query();
29
+ } else {
30
+ $args = [
31
+ 'posts_per_page' => $increment,
32
+ 'post_type' => 'any',
33
+ 'post_status' => 'any',
34
+ 'offset' => $offset,
35
+ ];
36
+
37
+ $su_query = get_posts($args);
38
+
39
+ if ($su_query) {
40
+ foreach ($su_query as $post) {
41
+ if ( ! empty(get_post_meta($post->ID, '_seop_settings', true))) {
42
+ $_seop_settings = get_post_meta($post->ID, '_seop_settings', true);
43
+
44
+ if ( ! empty($_seop_settings['meta_title'])) { //Import title tag
45
+ update_post_meta($post->ID, '_seopress_titles_title', $_seop_settings['meta_title']);
46
+ }
47
+ if ( ! empty($_seop_settings['meta_description'])) { //Import meta desc
48
+ update_post_meta($post->ID, '_seopress_titles_desc', $_seop_settings['meta_description']);
49
+ }
50
+ if ( ! empty($_seop_settings['fb_title'])) { //Import Facebook Title
51
+ update_post_meta($post->ID, '_seopress_social_fb_title', $_seop_settings['fb_title']);
52
+ }
53
+ if ( ! empty($_seop_settings['fb_description'])) { //Import Facebook Desc
54
+ update_post_meta($post->ID, '_seopress_social_fb_desc', $_seop_settings['fb_description']);
55
+ }
56
+ if ( ! empty($_seop_settings['fb_img'])) { //Import Facebook Image
57
+ update_post_meta($post->ID, '_seopress_social_fb_img', $_seop_settings['fb_img']);
58
+ }
59
+ if ( ! empty($_seop_settings['tw_title'])) { //Import Twitter Title
60
+ update_post_meta($post->ID, '_seopress_social_twitter_title', $_seop_settings['tw_title']);
61
+ }
62
+ if ( ! empty($_seop_settings['tw_description'])) { //Import Twitter Desc
63
+ update_post_meta($post->ID, '_seopress_social_twitter_desc', $_seop_settings['tw_description']);
64
+ }
65
+ if ( ! empty($_seop_settings['tw_image'])) { //Import Twitter Image
66
+ update_post_meta($post->ID, '_seopress_social_twitter_img', $_seop_settings['tw_image']);
67
+ }
68
+ if ( ! empty($_seop_settings['meta_rules'])) {
69
+ $robots = explode('#|#|#', $_seop_settings['meta_rules']);
70
+
71
+ if ( ! empty($robots)) {
72
+ if (in_array('noindex', $robots)) { //Import Robots NoIndex
73
+ update_post_meta($post->ID, '_seopress_robots_index', 'yes');
74
+ }
75
+ if (in_array('nofollow', $robots)) { //Import Robots NoFollow
76
+ update_post_meta($post->ID, '_seopress_robots_follow', 'yes');
77
+ }
78
+ if (in_array('noarchive', $robots)) { //Import Robots NoArchive
79
+ update_post_meta($post->ID, '_seopress_robots_archive', 'yes');
80
+ }
81
+ if (in_array('nosnippet', $robots)) { //Import Robots NoSnippet
82
+ update_post_meta($post->ID, '_seopress_robots_snippet', 'yes');
83
+ }
84
+ if (in_array('noodp', $robots)) { //Import Robots NoOdp
85
+ update_post_meta($post->ID, '_seopress_robots_odp', 'yes');
86
+ }
87
+ if (in_array('noimageindex', $robots)) { //Import Robots NoImageIndex
88
+ update_post_meta($post->ID, '_seopress_robots_imageindex', 'yes');
89
+ }
90
+ }
91
+ }
92
+ if ('' != get_post_meta($post->ID, '_seop_kw_1', true) || '' != get_post_meta($post->ID, '_seop_kw_2', true) || '' != get_post_meta($post->ID, '_seop_kw_3', true)) { //Import Target Keyword
93
+ $kw = [];
94
+ $kw[] = get_post_meta($post->ID, '_seop_kw_1', true);
95
+ $kw[] = get_post_meta($post->ID, '_seop_kw_2', true);
96
+ $kw[] = get_post_meta($post->ID, '_seop_kw_3', true);
97
+
98
+ $kw = implode(',', $kw);
99
+
100
+ if ( ! empty($kw)) {
101
+ update_post_meta($post->ID, '_seopress_analysis_target_kw', $kw);
102
+ }
103
+ }
104
+ if ( ! empty($_seop_settings['meta_canonical'])) { //Import Canonical URL
105
+ update_post_meta($post->ID, '_seopress_robots_canonical', $_seop_settings['meta_canonical']);
106
+ }
107
+ if ( ! empty($_seop_settings['meta_redirect'])) { //Import Redirect URL
108
+ update_post_meta($post->ID, '_seopress_redirections_value', $_seop_settings['meta_redirect']);
109
+ update_post_meta($post->ID, '_seopress_redirections_enabled', 'yes'); //Enable the redirect
110
+ }
111
+ }
112
+ }
113
+ }
114
+ $offset += $increment;
115
+ }
116
+ $data = [];
117
+ $data['offset'] = $offset;
118
+ wp_send_json_success($data);
119
+ exit();
120
+ }
121
+ }
122
+ add_action('wp_ajax_seopress_seopressor_migration', 'seopress_seopressor_migration');
123
+
124
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
125
+ //Export SEOPress metadata to CSV
126
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
127
+ function seopress_metadata_export() {
128
+ check_ajax_referer('seopress_export_csv_metadata_nonce', $_POST['_ajax_nonce'], true);
129
+
130
+ if (current_user_can(seopress_capability('manage_options', 'migration')) && is_admin()) {
131
+ if (isset($_POST['offset'])) {
132
+ $offset = absint($_POST['offset']);
133
+ }
134
+
135
+ $post_export = '';
136
+ if (isset($_POST['post_export'])) {
137
+ $post_export = esc_attr($_POST['post_export']);
138
+ }
139
+
140
+ $term_export = '';
141
+ if (isset($_POST['term_export'])) {
142
+ $term_export = esc_attr($_POST['term_export']);
143
+ }
144
+
145
+ //Get post types
146
+ $seopress_get_post_types = [];
147
+ foreach (seopress_get_post_types() as $seopress_cpt_key => $seopress_cpt_value) {
148
+ $seopress_get_post_types[] = $seopress_cpt_key;
149
+ }
150
+
151
+ //Get taxonomies
152
+ $seopress_get_taxonomies = [];
153
+ foreach (seopress_get_taxonomies() as $seopress_tax_key => $seopress_tax_value) {
154
+ $seopress_get_taxonomies[] = $seopress_tax_key;
155
+ }
156
+
157
+ global $wpdb;
158
+ global $post;
159
+
160
+ //Count posts
161
+ $i = 1;
162
+ $sql = '(';
163
+ $count = count($seopress_get_post_types);
164
+ foreach ($seopress_get_post_types as $cpt) {
165
+ $sql .= '(post_type = "' . $cpt . '")';
166
+
167
+ if ($i < $count) {
168
+ $sql .= ' OR ';
169
+ }
170
+
171
+ ++$i;
172
+ }
173
+ $sql .= ')';
174
+
175
+ $total_count_posts = (int) $wpdb->get_var("SELECT count(*)
176
+ FROM {$wpdb->posts}
177
+ WHERE $sql
178
+ AND (post_status = 'publish' OR post_status = 'pending' OR post_status = 'draft' OR post_status = 'auto-draft' OR post_status = 'future' OR post_status = 'private' OR post_status = 'inherit' OR post_status = 'trash') ");
179
+
180
+ //Count terms
181
+ $total_count_terms = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->terms}");
182
+
183
+ $increment = 200;
184
+
185
+ $csv = '';
186
+ $csv = get_option('seopress_metadata_csv');
187
+ $download_url = '';
188
+
189
+ $settings['id'] = [];
190
+ $settings['post_title'] = [];
191
+ $settings['url'] = [];
192
+ $settings['meta_title'] = [];
193
+ $settings['meta_desc'] = [];
194
+ $settings['fb_title'] = [];
195
+ $settings['fb_desc'] = [];
196
+ $settings['fb_img'] = [];
197
+ $settings['tw_title'] = [];
198
+ $settings['tw_desc'] = [];
199
+ $settings['tw_img'] = [];
200
+ $settings['noindex'] = [];
201
+ $settings['nofollow'] = [];
202
+ $settings['noodp'] = [];
203
+ $settings['noimageindex'] = [];
204
+ $settings['noarchive'] = [];
205
+ $settings['nosnippet'] = [];
206
+ $settings['canonical_url'] = [];
207
+ $settings['primary_cat'] = [];
208
+ $settings['redirect_active'] = [];
209
+ $settings['redirect_type'] = [];
210
+ $settings['redirect_url'] = [];
211
+ $settings['target_kw'] = [];
212
+
213
+ //Posts
214
+ if ('done' != $post_export) {
215
+ if ($offset > $total_count_posts) {
216
+ wp_reset_query();
217
+ //Reset offset once Posts export is done
218
+ $offset = 0;
219
+ update_option('seopress_metadata_csv', $csv);
220
+ $post_export = 'done';
221
+ } else {
222
+ $args = [
223
+ 'post_type' => $seopress_get_post_types,
224
+ 'posts_per_page' => $increment,
225
+ 'offset' => $offset,
226
+ 'post_status' => 'any',
227
+ 'order' => 'DESC',
228
+ 'orderby' => 'date',
229
+ ];
230
+ $args = apply_filters('seopress_metadata_query_args', $args, $seopress_get_post_types, $increment, $offset);
231
+ $meta_query = get_posts($args);
232
+
233
+ if ($meta_query) {
234
+ // The Loop
235
+ foreach ($meta_query as $post) {
236
+ array_push($settings['id'], $post->ID);
237
+
238
+ array_push($settings['post_title'], $post->post_title);
239
+
240
+ array_push($settings['url'], get_permalink($post));
241
+
242
+ array_push($settings['meta_title'], get_post_meta($post->ID, '_seopress_titles_title', true));
243
+
244
+ array_push($settings['meta_desc'], get_post_meta($post->ID, '_seopress_titles_desc', true));
245
+
246
+ array_push($settings['fb_title'], get_post_meta($post->ID, '_seopress_social_fb_title', true));
247
+
248
+ array_push($settings['fb_desc'], get_post_meta($post->ID, '_seopress_social_fb_desc', true));
249
+
250
+ array_push($settings['fb_img'], get_post_meta($post->ID, '_seopress_social_fb_img', true));
251
+
252
+ array_push($settings['tw_title'], get_post_meta($post->ID, '_seopress_social_twitter_title', true));
253
+
254
+ array_push($settings['tw_desc'], get_post_meta($post->ID, '_seopress_social_twitter_desc', true));
255
+
256
+ array_push($settings['tw_img'], get_post_meta($post->ID, '_seopress_social_twitter_img', true));
257
+
258
+ array_push($settings['noindex'], get_post_meta($post->ID, '_seopress_robots_index', true));
259
+
260
+ array_push($settings['nofollow'], get_post_meta($post->ID, '_seopress_robots_follow', true));
261
+
262
+ array_push($settings['noodp'], get_post_meta($post->ID, '_seopress_robots_odp', true));
263
+
264
+ array_push($settings['noimageindex'], get_post_meta($post->ID, '_seopress_robots_imageindex', true));
265
+
266
+ array_push($settings['noarchive'], get_post_meta($post->ID, '_seopress_robots_archive', true));
267
+
268
+ array_push($settings['nosnippet'], get_post_meta($post->ID, '_seopress_robots_snippet', true));
269
+
270
+ array_push($settings['canonical_url'], get_post_meta($post->ID, '_seopress_robots_canonical', true));
271
+
272
+ array_push($settings['primary_cat'], get_post_meta($post->ID, 'seopress_robots_primary_cat', true));
273
+
274
+ array_push($settings['redirect_active'], get_post_meta($post->ID, '_seopress_redirections_enabled', true));
275
+
276
+ array_push($settings['redirect_type'], get_post_meta($post->ID, '_seopress_redirections_type', true));
277
+
278
+ array_push($settings['redirect_url'], get_post_meta($post->ID, '_seopress_redirections_value', true));
279
+
280
+ array_push($settings['target_kw'], get_post_meta($post->ID, '_seopress_analysis_target_kw', true));
281
+
282
+ $csv[] = array_merge(
283
+ $settings['id'],
284
+ $settings['post_title'],
285
+ $settings['url'],
286
+ $settings['meta_title'],
287
+ $settings['meta_desc'],
288
+ $settings['fb_title'],
289
+ $settings['fb_desc'],
290
+ $settings['fb_img'],
291
+ $settings['tw_title'],
292
+ $settings['tw_desc'],
293
+ $settings['tw_img'],
294
+ $settings['noindex'],
295
+ $settings['nofollow'],
296
+ $settings['noodp'],
297
+ $settings['noimageindex'],
298
+ $settings['noarchive'],
299
+ $settings['nosnippet'],
300
+ $settings['canonical_url'],
301
+ $settings['primary_cat'],
302
+ $settings['redirect_active'],
303
+ $settings['redirect_type'],
304
+ $settings['redirect_url'],
305
+ $settings['target_kw']
306
+ );
307
+
308
+ //Clean arrays
309
+ $settings['id'] = [];
310
+ $settings['post_title'] = [];
311
+ $settings['url'] = [];
312
+ $settings['meta_title'] = [];
313
+ $settings['meta_desc'] = [];
314
+ $settings['fb_title'] = [];
315
+ $settings['fb_desc'] = [];
316
+ $settings['fb_img'] = [];
317
+ $settings['tw_title'] = [];
318
+ $settings['tw_desc'] = [];
319
+ $settings['tw_img'] = [];
320
+ $settings['noindex'] = [];
321
+ $settings['nofollow'] = [];
322
+ $settings['noodp'] = [];
323
+ $settings['noimageindex'] = [];
324
+ $settings['noarchive'] = [];
325
+ $settings['nosnippet'] = [];
326
+ $settings['canonical_url'] = [];
327
+ $settings['primary_cat'] = [];
328
+ $settings['redirect_active'] = [];
329
+ $settings['redirect_type'] = [];
330
+ $settings['redirect_url'] = [];
331
+ $settings['target_kw'] = [];
332
+ }
333
+ }
334
+ $offset += $increment;
335
+ update_option('seopress_metadata_csv', $csv);
336
+ }
337
+ } elseif ('done' != $term_export) {
338
+ //Terms
339
+ if ($offset > $total_count_terms) {
340
+ update_option('seopress_metadata_csv', $csv);
341
+ $post_export = 'done';
342
+ $term_export = 'done';
343
+ } else {
344
+ $args = [
345
+ 'taxonomy' => $seopress_get_taxonomies,
346
+ 'number' => $increment,
347
+ 'offset' => $offset,
348
+ 'order' => 'DESC',
349
+ 'orderby' => 'date',
350
+ 'hide_empty' => false,
351
+ ];
352
+
353
+ $args = apply_filters('seopress_metadata_query_terms_args', $args, $seopress_get_taxonomies, $increment, $offset);
354
+
355
+ $meta_query = get_terms($args);
356
+
357
+ if ($meta_query) {
358
+ // The Loop
359
+ foreach ($meta_query as $term) {
360
+ array_push($settings['id'], $term->term_id);
361
+
362
+ array_push($settings['post_title'], $term->name);
363
+
364
+ array_push($settings['url'], get_term_link($term));
365
+
366
+ array_push($settings['meta_title'], get_term_meta($term->term_id, '_seopress_titles_title', true));
367
+
368
+ array_push($settings['meta_desc'], get_term_meta($term->term_id, '_seopress_titles_desc', true));
369
+
370
+ array_push($settings['fb_title'], get_term_meta($term->term_id, '_seopress_social_fb_title', true));
371
+
372
+ array_push($settings['fb_desc'], get_term_meta($term->term_id, '_seopress_social_fb_desc', true));
373
+
374
+ array_push($settings['fb_img'], get_term_meta($term->term_id, '_seopress_social_fb_img', true));
375
+
376
+ array_push($settings['tw_title'], get_term_meta($term->term_id, '_seopress_social_twitter_title', true));
377
+
378
+ array_push($settings['tw_desc'], get_term_meta($term->term_id, '_seopress_social_twitter_desc', true));
379
+
380
+ array_push($settings['tw_img'], get_term_meta($term->term_id, '_seopress_social_twitter_img', true));
381
+
382
+ array_push($settings['noindex'], get_term_meta($term->term_id, '_seopress_robots_index', true));
383
+
384
+ array_push($settings['nofollow'], get_term_meta($term->term_id, '_seopress_robots_follow', true));
385
+
386
+ array_push($settings['noodp'], get_term_meta($term->term_id, '_seopress_robots_odp', true));
387
+
388
+ array_push($settings['noimageindex'], get_term_meta($term->term_id, '_seopress_robots_imageindex', true));
389
+
390
+ array_push($settings['noarchive'], get_term_meta($term->term_id, '_seopress_robots_archive', true));
391
+
392
+ array_push($settings['nosnippet'], get_term_meta($term->term_id, '_seopress_robots_snippet', true));
393
+
394
+ array_push($settings['canonical_url'], get_term_meta($term->term_id, '_seopress_robots_canonical', true));
395
+
396
+ array_push($settings['redirect_active'], get_term_meta($term->term_id, '_seopress_redirections_enabled', true));
397
+
398
+ array_push($settings['redirect_type'], get_term_meta($term->term_id, '_seopress_redirections_type', true));
399
+
400
+ array_push($settings['redirect_url'], get_term_meta($term->term_id, '_seopress_redirections_value', true));
401
+
402
+ array_push($settings['target_kw'], get_term_meta($term->term_id, '_seopress_analysis_target_kw', true));
403
+
404
+ $csv[] = array_merge(
405
+ $settings['id'],
406
+ $settings['post_title'],
407
+ $settings['url'],
408
+ $settings['meta_title'],
409
+ $settings['meta_desc'],
410
+ $settings['fb_title'],
411
+ $settings['fb_desc'],
412
+ $settings['fb_img'],
413
+ $settings['tw_title'],
414
+ $settings['tw_desc'],
415
+ $settings['tw_img'],
416
+ $settings['noindex'],
417
+ $settings['nofollow'],
418
+ $settings['noodp'],
419
+ $settings['noimageindex'],
420
+ $settings['noarchive'],
421
+ $settings['nosnippet'],
422
+ $settings['canonical_url'],
423
+ $settings['redirect_active'],
424
+ $settings['redirect_type'],
425
+ $settings['redirect_url'],
426
+ $settings['target_kw']
427
+ );
428
+
429
+ //Clean arrays
430
+ $settings['id'] = [];
431
+ $settings['post_title'] = [];
432
+ $settings['url'] = [];
433
+ $settings['meta_title'] = [];
434
+ $settings['meta_desc'] = [];
435
+ $settings['fb_title'] = [];
436
+ $settings['fb_desc'] = [];
437
+ $settings['fb_img'] = [];
438
+ $settings['tw_title'] = [];
439
+ $settings['tw_desc'] = [];
440
+ $settings['tw_img'] = [];
441
+ $settings['noindex'] = [];
442
+ $settings['nofollow'] = [];
443
+ $settings['noodp'] = [];
444
+ $settings['noimageindex'] = [];
445
+ $settings['noarchive'] = [];
446
+ $settings['nosnippet'] = [];
447
+ $settings['canonical_url'] = [];
448
+ $settings['redirect_active'] = [];
449
+ $settings['redirect_type'] = [];
450
+ $settings['redirect_url'] = [];
451
+ $settings['target_kw'] = [];
452
+ }
453
+ }
454
+ $offset += $increment;
455
+ $post_export = 'done';
456
+ update_option('seopress_metadata_csv', $csv);
457
+ }
458
+ } else {
459
+ $post_export = 'done';
460
+ $term_export = 'done';
461
+ }
462
+
463
+ //Create download URL
464
+ if ('done' == $post_export && 'done' == $term_export) {
465
+ $args = array_merge($_POST, [
466
+ 'nonce' => wp_create_nonce('seopress_csv_batch_export_nonce'),
467
+ 'page' => 'seopress-import-export',
468
+ 'seopress_action' => 'seopress_download_batch_export',
469
+ ]);
470
+
471
+ $download_url = add_query_arg($args, admin_url('admin.php'));
472
+
473
+ $offset = 'done';
474
+ }
475
+
476
+ //Return data to JSON
477
+ $data = [];
478
+ $data['offset'] = $offset;
479
+ $data['url'] = $download_url;
480
+ $data['post_export'] = $post_export;
481
+ $data['term_export'] = $term_export;
482
+ wp_send_json_success($data);
483
+
484
+ exit();
485
+ }
486
+ }
487
+
488
+ add_action('wp_ajax_seopress_metadata_export', 'seopress_metadata_export');
inc/admin/ajax-migrate/smart-crawl.php ADDED
@@ -0,0 +1,174 @@