stats_convert_post_titles

Stats Convert Post Title HTML.

Description

stats_convert_post_titles( $html ); 

Parameters (1)

0. $html
The html.

Usage

  1. if ( !function_exists( 'stats_convert_post_titles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/stats.php'; 
  3.  
  4. // The html. 
  5. $html = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = stats_convert_post_titles($html); 
  9.  

Defined (1)

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

/modules/stats.php  
  1. function stats_convert_post_titles( $html ) { 
  2. global $wpdb, $stats_posts; 
  3. $pattern = "<span class='post-(\d+)-link'>.*?</span>"; 
  4. if ( !preg_match_all( "!$pattern!", $html, $matches ) ) 
  5. return $html; 
  6. $posts = get_posts( array( 
  7. 'include' => implode( ', ', $matches[1] ),  
  8. 'post_type' => 'any',  
  9. 'post_status' => 'any',  
  10. 'numberposts' => -1,  
  11. )); 
  12. foreach ( $posts as $post ) 
  13. $stats_posts[$post->ID] = $post; 
  14. $html = preg_replace_callback( "!$pattern!", 'stats_convert_post_title', $html ); 
  15. return $html;