aioseop_ajax_scan_header

The All In One SEO Pack aioseop ajax scan header function.

Description

aioseop_ajax_scan_header(); 

Usage

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

Defined (1)

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

/inc/aioseop_functions.php  
  1. function aioseop_ajax_scan_header() { 
  2. $_POST['options'] = 'foo'; 
  3. $options = Array(); 
  4. parse_str( $_POST['options'], $options ); 
  5. foreach ( $options as $k => $v ) { 
  6. $_POST[ $k ] = $v; 
  7. $_POST['action'] = 'aiosp_update_module'; 
  8. $_POST['location'] = null; 
  9. $_POST['Submit'] = 'ajax'; 
  10. ob_start(); 
  11. do_action( wp ); 
  12. global $aioseop_modules; 
  13. $module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' ); 
  14. wp_head(); 
  15. $output = ob_get_clean(); 
  16. global $aiosp; 
  17. $output = $aiosp->html_string_to_array( $output ); 
  18. $meta = ''; 
  19. $metatags = Array( 
  20. 'facebook' => Array( 'name' => 'property', 'value' => 'content' ),  
  21. 'twitter' => Array( 'name' => 'name', 'value' => 'value' ),  
  22. 'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ),  
  23. ); 
  24. $metadata = Array( 
  25. 'facebook' => Array( 
  26. 'title' => 'og:title',  
  27. 'type' => 'og:type',  
  28. 'url' => 'og:url',  
  29. 'thumbnail' => 'og:image',  
  30. 'sitename' => 'og:site_name',  
  31. 'key' => 'fb:admins',  
  32. 'description' => 'og:description',  
  33. ),  
  34. 'google+' => Array( 
  35. 'thumbnail' => 'image',  
  36. 'title' => 'name',  
  37. 'description' => 'description',  
  38. ),  
  39. 'twitter' => Array( 
  40. 'card' => 'twitter:card',  
  41. 'url' => 'twitter:url',  
  42. 'title' => 'twitter:title',  
  43. 'description' => 'twitter:description',  
  44. 'thumbnail' => 'twitter:image',  
  45. ),  
  46. ); 
  47. if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) { 
  48. foreach ( $output['head']['meta'] as $v ) { 
  49. if ( ! empty( $v['@attributes'] ) ) { 
  50. $m = $v['@attributes']; 
  51. foreach ( $metatags as $type => $tags ) { 
  52. if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) { 
  53. foreach ( $metadata[ $type ] as $tk => $tv ) { 
  54. if ( $m[ $tags['name'] ] == $tv ) { 
  55. $meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta' ), ucwords( $type ) ) . '</th><td>' . ucwords( $tk ) . "</td><td>{$m[$tags['name']]}</td><td>{$m[$tags['value']]}</td></tr>\n"; 
  56. if ( empty( $meta ) ) { 
  57. $meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>'; 
  58. } else { 
  59. $meta = "<table cellspacing=0 cellpadding=0 width=80% class='aioseop_table'><tr class='aioseop_table_header'><th>Meta For Site</th><th>Kind of Meta</th><th>Element Name</th><th>Element Value</th></tr>" . $meta . '</table>'; 
  60. $meta .= "<p><div class='aioseop_meta_info'><h3 style='padding:5px;margin-bottom:0px;'>" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "</h3><div style='padding:5px;padding-top:0px;'>" 
  61. . '<p>' . __( 'All in One SEO Pack has detected that a plugin(s) or theme is also outputting social meta tags on your site. You can view this social meta in the source code of your site (check your browser help for instructions on how to view source code).', 'all-in-one-seo-pack' ) 
  62. . '</p><p>' . __( 'You may prefer to use the social meta tags that are being output by the other plugin(s) or theme. If so, then you should deactivate this Social Meta feature in All in One SEO Pack Feature Manager.', 'all-in-one-seo-pack' ) 
  63. . '</p><p>' . __( 'You should avoid duplicate social meta tags. You can use these free tools from Facebook, Google and Twitter to validate your social meta and check for errors:', 'all-in-one-seo-pack' ) . '</p>'; 
  64.  
  65. foreach ( 
  66. Array( 
  67. 'https://developers.facebook.com/tools/debug',  
  68. 'http://www.google.com/webmasters/tools/richsnippets',  
  69. 'https://dev.twitter.com/docs/cards/validation/validator',  
  70. ) as $link 
  71. ) { 
  72. $meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />"; 
  73. $meta .= '<p>' . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . '</div></div>'; 
  74. $output = $meta; 
  75. $output = str_replace( "'", "\'", $output ); 
  76. $output = str_replace( "\n", '\n', $output ); 
  77. die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );