WPSEO_Import_AIOSEO

Class WPSEO_Import_WooThemes_SEO.

Defined (1)

The class is defined in the following location(s).

/admin/class-import-aioseo.php  
  1. class WPSEO_Import_AIOSEO extends WPSEO_Import_External { 
  2.  
  3. /** 
  4. * Holds the AOIOSEO options 
  5. * @var array 
  6. */ 
  7. private $aioseo_options; 
  8.  
  9. /** 
  10. * Import All In One SEO settings 
  11. */ 
  12. public function __construct() { 
  13. parent::__construct(); 
  14.  
  15. $this->aioseo_options = get_option( 'aioseop_options' ); 
  16.  
  17. $this->import_metas(); 
  18. $this->import_ga(); 
  19.  
  20. /** 
  21. * Import All In One SEO meta values 
  22. */ 
  23. private function import_metas() { 
  24. WPSEO_Meta::replace_meta( '_aioseop_description', WPSEO_Meta::$meta_prefix . 'metadesc', $this->replace ); 
  25. WPSEO_Meta::replace_meta( '_aioseop_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $this->replace ); 
  26. WPSEO_Meta::replace_meta( '_aioseop_title', WPSEO_Meta::$meta_prefix . 'title', $this->replace ); 
  27.  
  28. /** 
  29. * Import the Google Analytics settings 
  30. */ 
  31. private function import_ga() { 
  32. if ( isset( $this->aioseo_options['aiosp_google_analytics_id'] ) ) { 
  33.  
  34. if ( get_option( 'yst_ga' ) === false ) { 
  35. update_option( 'yst_ga', $this->determine_ga_settings() ); 
  36.  
  37. $plugin_install_nonce = wp_create_nonce( 'install-plugin_google-analytics-for-wordpress' ); // Use the old name because that's the WordPress.org repo. 
  38.  
  39. $this->set_msg( sprintf( 
  40. /** translators: 1, 2: link open tag; 3: link close tag. */ 
  41. __( 'All in One SEO data successfully imported. Would you like to %1$sdisable the All in One SEO plugin%3$s? You\'ve had Google Analytics enabled in All in One SEO, would you like to install our %2$sGoogle Analytics plugin%3$s?', 'wordpress-seo' ),  
  42. '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export&deactivate_aioseo=1#top#import-seo' ) ) . '">',  
  43. '<a href="' . esc_url( admin_url( 'update.php?action=install-plugin&plugin=google-analytics-for-wordpress&_wpnonce=' . $plugin_install_nonce ) ) . '">',  
  44. '</a>' 
  45. ) ); 
  46. else { 
  47. $this->set_msg( sprintf( 
  48. /** translators: 1: link open tag; 2: link close tag. */ 
  49. __( 'All in One SEO data successfully imported. Would you like to %1$sdisable the All in One SEO plugin%2$s?', 'wordpress-seo' ),  
  50. '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export&deactivate_aioseo=1#top#import-seo' ) ) . '">',  
  51. '</a>' 
  52. ) ); 
  53.  
  54. /** 
  55. * Determine the appropriate GA settings for this site 
  56. * @return array $ga_settings 
  57. */ 
  58. private function determine_ga_settings() { 
  59. $ga_universal = 0; 
  60. if ( $this->aioseo_options['aiosp_ga_use_universal_analytics'] == 'on' ) { 
  61. $ga_universal = 1; 
  62.  
  63. $ga_track_outbound = 0; 
  64. if ( $this->aioseo_options['aiosp_ga_track_outbound_links'] == 'on' ) { 
  65. $ga_track_outbound = 1; 
  66.  
  67. $ga_anonymize_ip = 0; 
  68. if ( $this->aioseo_options['aiosp_ga_anonymize_ip'] == 'on' ) { 
  69. $ga_anonymize_ip = 1; 
  70.  
  71. return array( 
  72. 'ga_general' => array( 
  73. 'manual_ua_code' => (int) 1,  
  74. 'manual_ua_code_field' => $this->aioseo_options['aiosp_google_analytics_id'],  
  75. 'enable_universal' => $ga_universal,  
  76. 'track_outbound' => $ga_track_outbound,  
  77. 'ignore_users' => (array) $this->aioseo_options['aiosp_ga_exclude_users'],  
  78. 'anonymize_ips' => (int) $ga_anonymize_ip,  
  79. ),  
  80. );