Keyword

Is it possible to add caption to videos via mambot syntax

  • savatage
  • savatage's Avatar Topic Author
  • Offline
  • New Member
More
16 years 5 months ago #8992 by savatage
Hi;
Is it possible to add caption to videos via mambot syntax to show the caption bottom/top of the video.

Example:
{youtube}xxxxx|Caption{/youtube}

I am not sure on this but is that possible?

Or do I need to hack the mambot?

Please Log in or Create an account to join the conversation.

  • savatage
  • savatage's Avatar Topic Author
  • Offline
  • New Member
More
16 years 5 months ago - 16 years 5 months ago #8993 by savatage
I recode the some parts of mambot to define captions to videos

Basic Usage
{youtube}JUOgNdqEA-k|Murat Net{/youtube} //Caption located at the top of video by default

{youtube}JUOgNdqEA-k|Murat Net|bottom{/youtube} //Caption located at the bottom of video

Recoded part:
foreach ($regex as $key => $value) {  // searching for marks  
	    	if (preg_match_all($regex[$key][1], $row->text, $matches, PREG_PATTERN_ORDER) > 0) {      			 
	    		foreach ($matches[0] as $match) {
					
				$match = preg_replace("/{.+?}/", "", $match); 

				//Hacked By SaVaTaGe
				if (strpos($match,'|'))
				{
					$parts = explode('|',$match);					
					$match2 = $parts[0];
					$caption = $parts[1];
					$caption_text = '<div style="text-align: center; font-weight: bold; font-size: 14px;">'.$caption.'</div>';
					if ($parts[2] && $parts[2] = 'bottom')
					{
						$endcode2 = $caption_text.$endcode;
					}
					else
					{
						$startcode2  = $startcode.$caption_text;
					}					
				}
				else
				{
					$match2 = $match;
					$startcode2  = $startcode;
					$endcode2  = $endcode;
				}	
				//End of Hack
				
				
				
				$code = str_replace("***code***", $match2, $regex[$key][0] );				

				//$row->text = preg_replace( "#{".$key."}".$match."{/".$key."}#s", $startcode.$code.$endcode , $row->text );
				//$row->text = preg_replace("#{".preg_quote($key)."}".preg_quote($match)."{/".preg_quote($key)."}#s", $startcode.$code.$endcode , $row->text );
				//Hacked By SaVaTaGe
				$row->text = preg_replace("#{".preg_quote($key)."}".preg_quote($match,'|')."{/".preg_quote($key)."}#s", $startcode2.$code.$endcode2, $row->text );		
				
				
	    		}
	    	}			
	    } 

There is a small bug in this code, which causes nested DIVs, I try to find it but not found yet, anyone noticed what causes it, please inform me...

Bug explanation:
<div class="allvideos" .............>
video 1 code
<div class="allvideos" .............>
video 2 code
</div>
</div

Must be right below:
<div class="allvideos" .............>
video 1 code
</div>

<div class="allvideos" .............>
video 2 code
</div

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum