nsFindAudioInPost

The NextScripts: Social Networks Auto-Poster nsFindAudioInPost function.

Description

nsFindAudioInPost( $post, (constant) $raw = true ); 

Parameters (2)

0. $post
The post.
1. $raw — Optional. (constant) => true
The raw.

Usage

  1. if ( !function_exists( 'nsFindAudioInPost' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4. // The post. 
  5. $post = null; 
  6.  
  7. // The raw. 
  8. $raw = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = nsFindAudioInPost($post, $raw); 
  12.  

Defined (1)

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

/nxs_functions.php  
  1. if (!function_exists('nsFindAudioInPost')) {function nsFindAudioInPost($post, $raw=true) { //### !!! $raw=false Breaks ob_start() [ref.outcontrol]: Cannot use output buffering in output buffering display handlers - Investigate 
  2. global $ShownAds; if (isset($ShownAds)) $ShownAdsL = $ShownAds; $postVids = array(); 
  3. if (is_object($post)) { if ($raw) $postCnt = $post->post_content; else $postCnt = apply_filters('the_content', $post->post_content); } else $postCnt = $post; 
  4. $regex_pattern = "((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*\.(mp3|aac|m4a))"; 
  5. $output = preg_match_all( $regex_pattern, $postCnt, $matches ); if ($output === false) {return false;}  
  6. foreach ($matches[0] as $match) { $postAu[] = $match; } $postAu = array_unique($postAu); if (isset($ShownAds)) $ShownAds = $ShownAdsL; return $postAu; 
  7. }}