wpp_img_url

The WooCommerce PDF & Print wpp img url function.

Description

wpp_img_url( $content ); 

Parameters (1)

0. $content
The content.

Usage

  1. if ( !function_exists( 'wpp_img_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-pdf-print/functions.php'; 
  3.  
  4. // The content. 
  5. $content = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpp_img_url($content); 
  9.  

Defined (1)

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

/functions.php  
  1. function wpp_img_url($content) { 
  2.  
  3. preg_match_all('|<img\s+[^>]*src=[\"\']+([^>\"\']+)[\"\']+\s+[^>]*>|i', $content, $body_array, PREG_SET_ORDER); 
  4. preg_match('|^(.+)'.basename(WP_CONTENT_URL).'\/.+$|i', WPP_PATH, $img_url_array); 
  5. if( !empty($body_array) ) { 
  6.  
  7. for ($i=0; $i < count($body_array); $i++) { 
  8.  
  9. if( strpos($body_array [$i][1], 'http') === FALSE ) { 
  10. if( preg_match('|^(.*)'.basename(WP_CONTENT_URL).'\/(.+)$|i', $body_array[$i][1], $img_curr_url_array) ) { 
  11. $img[$body_array[$i][1]] = $img_url_array[1]. basename(WP_CONTENT_URL) . '/'.$img_curr_url_array[2]; 
  12. else{ 
  13. $img[$body_array[$i][1]] = $img_url_array[1].$body_array[$i][1]; 
  14. else{ 
  15. $img[$body_array[$i][1]] = $body_array [$i][1];  
  16. return $img;