aiosp_seometa_action

Intercept POST data from the form submission.

Description

aiosp_seometa_action(); 

Use the intercepted data to convert values in the postmeta table from one platform to another.


Usage

  1. if ( !function_exists( 'aiosp_seometa_action' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'all-in-one-seo-pack/admin/meta_import.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = aiosp_seometa_action(); 
  7.  

Defined (1)

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

/admin/meta_import.php  
  1. function aiosp_seometa_action() { 
  2.  
  3. if ( empty( $_REQUEST['_wpnonce'] ) ) { 
  4. return; 
  5.  
  6. if ( empty( $_REQUEST['platform_old'] ) ) { 
  7. printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) ); 
  8.  
  9. return; 
  10.  
  11. if ( 'All in One SEO Pack' === $_REQUEST['platform_old'] ) { 
  12. printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) ); 
  13.  
  14. return; 
  15.  
  16. check_admin_referer( 'aiosp_nonce' ); // Verify nonce. TODO We should make this better. 
  17.  
  18. if ( ! empty( $_REQUEST['analyze'] ) ) { 
  19.  
  20. printf( '<h3>%s</h3>', __( 'Analysis Results', 'all-in-one-seo-pack' ) ); 
  21.  
  22. $response = aiosp_seometa_post_meta_analyze( $_REQUEST['platform_old'], 'All in One SEO Pack' ); 
  23. if ( is_wp_error( $response ) ) { 
  24. printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, something went wrong. Please try again' ) ); 
  25.  
  26. return; 
  27.  
  28. printf( __( '<p>Analyzing records in a %s to %s conversion…', 'all-in-one-seo-pack' ), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' ); 
  29. printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update ); 
  30. // printf( '<p>%d Compatible Records will be ignored</p>', $response->ignore ); 
  31.  
  32. printf( '<p><b>%s</b></p>', __( 'Compatible data:', 'all-in-one-seo-pack' ) ); 
  33. echo '<ol>'; 
  34. foreach ( (array) $response->elements as $element ) { 
  35. printf( '<li>%s</li>', $element ); 
  36. echo '</ol>'; 
  37.  
  38. return; 
  39.  
  40. printf( '<h3>%s</h3>', __( 'Conversion Results', 'all-in-one-seo-pack' ) ); 
  41.  
  42. $result = aiosp_seometa_post_meta_convert( stripslashes( $_REQUEST['platform_old'] ), 'All in One SEO Pack' ); 
  43. if ( is_wp_error( $result ) ) { 
  44. printf( '<p>%s</p>', __( 'Sorry, something went wrong. Please try again' ) ); 
  45.  
  46. return; 
  47.  
  48. printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 ); 
  49. printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 ); 
  50.