public function convertPostContent($post) {
		$content = $post->Content;
		
		$lines = explode("\n", $content);
		
		$newContent = array();
		$title = '';
		$converted = false;
		
		// store the converted items
		$convertedLinks = array();
		
		foreach ($lines as $line) {
			$url = trim($line);
			if (strlen($url) && $this->isWebpage($url)) {
				$convertedContent = $this->convertUrl($url);
				if ($convertedContent) {
					$converted = true;
					$line = 'CONVERTEDCONTENT:' . count($convertedLinks);
					$convertedLinks[] = $convertedContent;
					$title = strlen($convertedContent['Title']) ? $convertedContent['Title'] : '';
				}
			} 
			$newContent[] = $line;
		}

		$newContent = implode("\n", $newContent);
		$newContent = RestrictedMarkdown::create($newContent)->parse();
		
		// replace the converted bits
		$newContent = preg_replace_callback('/CONVERTEDCONTENT:(\d+)/is', function ($bit) use ($convertedLinks) {
			return isset($convertedLinks[$bit[1]]) ? $convertedLinks[$bit[1]]['Content'] : '';
		}, $newContent);
		
		if ($converted) {
			$post->IsOembed = true;
			$post->OriginalContent = $post->Content;
			$post->Content = $newContent;
			$post->Title = $title;
		}

		return $post;
	}
public function convertPostContent($post) {
		$content = $post->Content;
		
		$lines = explode("\n", $content);
		
		$newContent = array();
		$title = '';
		$converted = false;
		
		// store the converted items
		$convertedLinks = array();
		
		foreach ($lines as $line) {
			$url = trim($line);
			if (strlen($url) && $this->isWebpage($url)) {
				$convertedContent = $this->convertUrl($url);
				if ($convertedContent) {
					$converted = true;
					$line = 'CONVERTEDCONTENT:' . count($convertedLinks);
					$convertedLinks[] = $convertedContent;
					$title = strlen($convertedContent['Title']) ? $convertedContent['Title'] : '';
				}
			} 
			$newContent[] = $line;
		}

		$newContent = implode("\n", $newContent);
		$newContent = RestrictedMarkdown::create($newContent)->parse();
		
		// replace the converted bits
		$newContent = preg_replace_callback('/CONVERTEDCONTENT:(\d+)/is', function ($bit) use ($convertedLinks) {
			return isset($convertedLinks[$bit[1]]) ? $convertedLinks[$bit[1]]['Content'] : '';
		}, $newContent);
		
		if ($converted) {
			$post->IsOembed = true;
			$post->OriginalContent = $post->Content;
			$post->Content = $newContent;
			$post->Title = $title;
		}

		return $post;
	}
public function convertPostContent ( $ post ) { $ content = $ post -> Content ; $ lines = explode ( "\n" , $ content ) ; $ newContent = array ( ) ; $ title = '' ; $ converted = false ; // store the converted items $ convertedLinks = array ( ) ; foreach ( $ lines as $ line ) { $ url = trim ( $ line ) ; if ( strlen ( $ url ) && $ this -> isWebpage ( $ url ) ) { $ convertedContent = $ this -> convertUrl ( $ url ) ; if ( $ convertedContent ) { $ converted = true ; $ line = 'CONVERTEDCONTENT:' . count ( $ convertedLinks ) ; $ convertedLinks [ ] = $ convertedContent ; $ title = strlen ( $ convertedContent [ 'Title' ] ) ? $ convertedContent [ 'Title' ] : '' ; } } $ newContent [ ] = $ line ; } $ newContent = implode ( "\n" , $ newContent ) ; $ newContent = RestrictedMarkdown :: create ( $ newContent ) -> parse ( ) ; // replace the converted bits $ newContent = preg_replace_callback ( '/CONVERTEDCONTENT:(\d+)/is' , function ( $ bit ) use ( $ convertedLinks ) { return isset ( $ convertedLinks [ $ bit [ 1 ] ] ) ? $ convertedLinks [ $ bit [ 1 ] ] [ 'Content' ] : '' ; } , $ newContent ) ; if ( $ converted ) { $ post -> IsOembed = true ; $ post -> OriginalContent = $ post -> Content ; $ post -> Content = $ newContent ; $ post -> Title = $ title ; } return $ post ; }
Analyse a post and see if there's particular content that should be extracted

@param string $post
@param string $url
@return type
Analyse a post and see if there s particular content that should be extracted