text is also available * @param object The article params * @param int The 'page' number */ function onPrepareContent( &$article, &$params, $limitstart ) { global $mainframe; $tagName = 'VoxelLauncher'; $posStart = 0; while($posStart!==FALSE) { $posStart = strpos($article->text ,'{'.$tagName,$posStart); if ($posStart!==FALSE) { $posEnd = strpos($article->text,'}',$posStart); $contentStart = $posStart+strlen($tagName)+2; $content = substr($article->text,$contentStart,$posEnd-$contentStart); $content = trim($content); $repHtml = "{modal url=/components/com_comtest/views/comtest/tmpl/voxellauncherview.php?plugin=".$content."|type=shadowbox|width=800|height=800|overlay_close=0}View plugin{/modal}"; $article->text = substr_replace($article->text,$repHtml,$posStart,$posEnd-$posStart+1); } $posStart++; } /* $regex = '/{'.$tagName.'\s*.*?}/i'; $count = preg_match ($regex ,$article->text,$coincidencias); for ($i = 0;$i<$count;$i++) { int strpos ( string $haystack , mixed $needle } $regex = '/{VoxelLauncher\s/i'; $article->text .=print_r($coincidencias,true)." " . print_r(preg_split($regex,$coincidencias[0]),true); */ // $article->text = preg_replace($regex,'hola',$article->text); // $article->text .="asdf"; // $article->text ="{modal url=/components/com_comtest/views/comtest/tmpl/voxellauncherview.php?plugin=DataUploaderPlugin|type=shadowbox|width=800|height=800|overlay_close=0|animate=false|onclose=alert('hola')}View plugin{/modal}"; //$article->text ="Click"; } /** * Example after display title method * * Method is called by the view and the results are imploded and displayed in a placeholder * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number * @return string */ function onAfterDisplayTitle( &$article, &$params, $limitstart ) { global $mainframe; return ''; } /** * Example before display content method * * Method is called by the view and the results are imploded and displayed in a placeholder * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number * @return string */ function onBeforeDisplayContent( &$article, &$params, $limitstart ) { global $mainframe; return ''; } /** * Example after display content method * * Method is called by the view and the results are imploded and displayed in a placeholder * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number * @return string */ function onAfterDisplayContent( &$article, &$params, $limitstart ) { global $mainframe; return ''; } /** * Example before save content method * * Method is called right before content is saved into the database. * Article object is passed by reference, so any changes will be saved! * NOTE: Returning false will abort the save with an error. * You can set the error by calling $article->setError($message) * * @param object A JTableContent object * @param bool If the content is just about to be created * @return bool If false, abort the save */ function onBeforeContentSave( &$article, $isNew ) { global $mainframe; return true; } /** * Example after save content method * Article is passed by reference, but after the save, so no changes will be saved. * Method is called right after the content is saved * * * @param object A JTableContent object * @param bool If the content is just about to be created * @return void */ function onAfterContentSave( &$article, $isNew ) { global $mainframe; return true; } }