// Cesta k Texy! a FSHL $texyPath = dirname(__FILE__).'/snippets/texy/'; $fshlPath = dirname(__FILE__).'/snippets/fshl/'; // Vlozenie suborov require_once($texyPath.'texy.php'); include_once($fshlPath.'fshl.php'); /******************************************************************************* * Flash Handler ******************************************************************************/ /** * User handler for images * * @param TexyHandlerInvocation handler invocation * @param TexyImage * @param TexyLink * @return TexyHtml|string|FALSE */ function imageHandlerFlash($invocation, $image, $link) { $texy = $invocation->getTexy(); if (substr($image->URL, -4) === '.swf') // accepts only *.swf { $movie = Texy::prependRoot($image->URL, $texy->imageModule->root); $dimensions = ($image->width ? 'width="'.$image->width.'" ' : '') . ($image->height ? 'width="'.$image->height.'" ' : ''); $movie = htmlSpecialChars($movie); $altContent = htmlSpecialChars($image->modifier->title); // @see http://latrine.dgx.cz/how-to-correctly-insert-a-flash-into-xhtml $code = '

'.$altContent.'

'; return $texy->protect($code, TEXY_CONTENT_BLOCK); // or Texy::CONTENT_BLOCK in PHP 5 } return $invocation->proceed(); } /******************************************************************************* * YouTube Handler ******************************************************************************/ /** * User handler for images * * @param TexyHandlerInvocation handler invocation * @param TexyImage * @param TexyLink * @return TexyHtml|string|FALSE */ function full_url() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")) . $s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; } function imageHandlerYouTube($invocation, $image, $link) { $parts = explode(':', $image->URL); if (count($parts) !== 2) return $invocation->proceed(); switch ($parts[0]) { case 'youtube': $video = htmlSpecialChars($parts[1]); $dimensions = 'width="'.($image->width ? $image->width : 480).'" height="'.($image->height ? $image->height : 395).'"'; $code = '
' . '' . '

Zdroj YouTube › '.$video.'

'; $texy = $invocation->getTexy(); return $texy->protect($code, TEXY_CONTENT_BLOCK); // or Texy::CONTENT_BLOCK in PHP 5 } return $invocation->proceed(); } /******************************************************************************* * FSHL Handler ******************************************************************************/ /** * User handler for code block * * @param TexyHandlerInvocation handler invocation * @param string block type * @param string text to highlight * @param string language * @param TexyModifier modifier * @return TexyHtml */ function blockHandlerFSHL($invocation, $blocktype, $content, $lang, $modifier) { if ($blocktype !== 'block/code') { return $invocation->proceed(); } $lang = strtoupper($lang); if ($lang == 'JAVASCRIPT') $lang = 'JS'; $parser = new fshlParser('HTML_UTF8', P_TAB_INDENT); if (!$parser->isLanguage($lang)) { return $invocation->proceed(); } $texy = $invocation->getTexy(); $content = $texy->blockModule->outdent($content); $content = $parser->highlightString($lang, $content); $content = $texy->protect($content, TEXY_CONTENT_BLOCK); // or Texy::CONTENT_BLOCK in PHP 5 $elPre = TexyHtml::el('pre'); if ($modifier) $modifier->decorate($texy, $elPre); $elPre->attrs['class'] = strtolower($lang); $elCode = $elPre->create('code', $content); return $elPre; } /******************************************************************************* * Texy! body ******************************************************************************/ // Inicializacia Texy! $texy = new Texy(); // Handlers $texy->addHandler('image', 'imageHandlerFlash'); $texy->addHandler('image', 'imageHandlerYouTube'); $texy->addHandler('block', 'blockHandlerFSHL'); $texy->headingModule->top= 2; // set headings top limit // other OPTIONAL configuration //$texy->encoding = 'windows-1250'; // disable UTF-8 $texy->imageModule->root = 'images/'; // specify image folder $texy->allowed['phrase/ins'] = TRUE; $texy->allowed['phrase/del'] = TRUE; $texy->allowed['phrase/sup'] = TRUE; $texy->allowed['phrase/sub'] = TRUE; $texy->allowed['phrase/cite'] = TRUE; /******************************************************************************* * emoticonModule ******************************************************************************/ // EMOTICONS ARE DISABLED BY DEFAULT! $texy->allowed['emoticon'] = TRUE; // Cesta k smajlikom $texy->emoticonModule->root = 'images/smiles/'; // CSS trieda pre smajliky $texy->emoticonModule->class = 'smilie'; // Konfiguracia smajlikov priradenie znak -> obrazok $texy->emoticonModule->icons[':D'] = 'icon_biggrin.gif'; $texy->emoticonModule->icons[':-D'] = 'icon_biggrin.gif'; $texy->emoticonModule->icons[':)'] = 'icon_smile.gif'; $texy->emoticonModule->icons[':-)'] = 'icon_smile.gif'; $texy->emoticonModule->icons[':('] = 'icon_sad.gif'; $texy->emoticonModule->icons[':o'] = 'icon_surprised.gif'; $texy->emoticonModule->icons[':shock:'] = 'icon_eek.gif'; $texy->emoticonModule->icons[':?'] = 'icon_confused.gif'; $texy->emoticonModule->icons['8)'] = 'icon_cool.gif'; $texy->emoticonModule->icons[':lol:'] = 'icon_lol.gif'; $texy->emoticonModule->icons[':X'] = 'icon_mad.gif'; $texy->emoticonModule->icons[':-X'] = 'icon_mad.gif'; $texy->emoticonModule->icons[':P'] = 'icon_razz.gif'; $texy->emoticonModule->icons[':oops:'] = 'icon_redface.gif'; $texy->emoticonModule->icons[':cry:'] = 'icon_cry.gif'; $texy->emoticonModule->icons[':evil:'] = 'icon_evil.gif'; $texy->emoticonModule->icons[':twisted:'] = 'icon_twisted.gif'; $texy->emoticonModule->icons[':roll:'] = 'icon_rolleyes.gif'; $texy->emoticonModule->icons[';)'] = 'icon_wink.gif'; $texy->emoticonModule->icons[':!:'] = 'icon_exclaim.gif'; $texy->emoticonModule->icons[':?:'] = 'icon_question.gif'; $texy->emoticonModule->icons[':idea:'] = 'icon_idea.gif'; $texy->emoticonModule->icons[':arrow:'] = 'icon_arrow.gif'; $texy->emoticonModule->icons[':|'] = 'icon_neutral.gif'; $texy->emoticonModule->icons[':mrgreen:'] = 'icon_mrgreen.gif'; $texy->emoticonModule->icons[':swoon:'] = 'swoon.gif'; $texy->emoticonModule->icons[':suicide:'] = 'suicide.gif'; $texy->emoticonModule->icons[':rofl:'] = 'rofl.gif'; $texy->emoticonModule->icons[':punish:'] = 'punish.gif'; $texy->emoticonModule->icons[':nhl-checking:'] = 'nhl_checking.gif'; $texy->emoticonModule->icons[':omg:'] = 'Just_Cuz_23.gif'; $texy->emoticonModule->icons[':ass:'] = 'Just_Cuz_17.gif'; $texy->emoticonModule->icons[':fuk:'] = 'fuk.gif'; $texy->emoticonModule->icons[':drinks:'] = 'drinks.gif'; $texy->emoticonModule->icons[':dancer:'] = 'hip23951fc5js.gif'; $texy->emoticonModule->icons[':beersss:'] = 'Just_Cuz_08.gif'; $texy->emoticonModule->icons[':caf:'] = 'Just_Cuz_19.gif'; $texy->emoticonModule->icons[':PP'] = 'Just_Cuz_34.gif'; $texy->emoticonModule->icons[':jupiii:'] = 'tatice_04.gif'; $texy->emoticonModule->icons[':B)'] = 'tatice_06.gif'; $texy->emoticonModule->icons[':**'] = 'fisch.gif'; $texy->emoticonModule->icons[':psp:'] = 'gathering.gif'; $texy->emoticonModule->icons[':*)'] = 'mwah1.gif'; $texy->emoticonModule->icons['<*><-'] = 'smileysex.gif'; /******************************************************************************* * GetAuthorData ($autorData) ******************************************************************************/ // Snippet name: GetAuthorData // Snippet description: Returns author information based on sent parameters // Revision: 1.1 ships with Etomite 0.6.1-Final // Created By: Ralph A. Dahlgren - rad14701@yahoo.com - Modified 2005-04-17 // Usage: [[GetAuthorData?internalKey=[*createdby*]&field=fullname]] // internalKey=[*editedby*] will return data about the user who last edited a document // field can be any column in the user_attributes database table // field subset: (fullname,email,phone,mobilephone) if(($internalKey == "") || ($field == "")){ $autorData = ""; } else { $sql = "SELECT * FROM ".$etomite->db."user_attributes WHERE internalKey=".$internalKey.";"; $rs = $etomite->dbQuery($sql); $limit = $etomite->recordCount($rs); if($limit > 0){ $author = $etomite->fetchRow($rs); $autorData = $author[$field]; } else { $autorData = ""; } } /******************************************************************************* * PageTrial ($pageTrial) ******************************************************************************/ // Snippet name: PageTrail // Snippet description: Outputs the page trail, based on Bill Wilson's script // Revision: 1.00 ships with Etomite 0.6.1-Final $sep = " ‹ "; // end config $ptarr = array(); $pid = $etomite->documentObject['parent']; $ptarr[] = "".$etomite->documentObject['pagetitle'].""; while ($parent=$etomite->getParent($pid)) { $ptarr[] = "".$parent['pagetitle'].""; $pid = $parent['parent']; } $ptarr = array_reverse($ptarr); $pageTrial = "R00t".$sep.join($ptarr, $sep); /******************************************************************************* * docInfo ($pagetitle, $longtitle, $editedon) ******************************************************************************/ $docInfo = $etomite->getDocument($etomite->documentIdentifier); // Titulok stranky - dokumentu $pagetitle = $docInfo['pagetitle']; // Dlhy nazov dokumentu $longtitle = $docInfo['longtitle']; // Popis dokumentu $description = $docInfo['description']; // Posledna uprava dokumentu $editedon = date("l, d. F Y \o H:m:s", $etomite->documentObject['editedon']); // Posledna uprava dokumentu $createdon = date("l, d. F Y \o H:m:s", $etomite->documentObject['createdon']); /******************************************************************************* * Texy! Content ******************************************************************************/ $header = "

".$longtitle."

\n"; //$header .= "
$pageTrial
\n"; $header .= "
» ".$description."

\n"; $doc = $etomite->getDocument($etomite->documentObject['id'], "content"); if($doc) { $output = $doc['content']; } else { $output = ""; } $footer = "- **článok publikovaný**: ".$createdon." - **patrí do kategórie**: ".$pageTrial; $html = $header; $html .= $texy->process($output); $html .= $texy->process($footer); return $html;