ngg_ajax_test_head_footer

Check for the header / footer, parts taken from Matt Martz (http://sivel.net/).

Description

ngg_ajax_test_head_footer(); 

Usage

  1. if ( !function_exists( 'ngg_ajax_test_head_footer' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextcellent-gallery/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ngg_ajax_test_head_footer(); 
  7.  

Defined (1)

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

/admin/ajax.php  
  1. function ngg_ajax_test_head_footer() { 
  2.  
  3. // Build the url to call, NOTE: uses home_url and thus requires WordPress 3.0 
  4. $url = add_query_arg( array( 'test-head' => '', 'test-footer' => '' ), home_url() ); 
  5. // Perform the HTTP GET ignoring SSL errors 
  6. $response = wp_remote_get( $url, array( 'sslverify' => false ) ); 
  7. // Grab the response code and make sure the request was sucessful 
  8. $code = (int) wp_remote_retrieve_response_code( $response ); 
  9. if ( $code == 200 ) { 
  10. global $head_footer_errors; 
  11. $head_footer_errors = array(); 
  12.  
  13. // Strip all tabs, line feeds, carriage returns and spaces 
  14. $html = preg_replace( '/[\t\r\n\s]/', '', wp_remote_retrieve_body( $response ) ); 
  15.  
  16. // Check to see if we found the existence of wp_head 
  17. if ( ! strstr( $html, '<!--wp_head-->' ) ) 
  18. die('Missing the call to wp_head() in your theme, contact the theme author'); 
  19. // Check to see if we found the existence of wp_footer 
  20. if ( ! strstr( $html, '<!--wp_footer-->' ) ) 
  21. die('Missing the call to wp_footer() in your theme, contact the theme author'); 
  22. die('success');