Example #1
0
 public function commentTexy($text)
 {
     if (!isset($this->commentTexy)) {
         $this->commentTexy = $this->texyFactory->createTexyForComment();
     }
     return $this->commentTexy->process($text);
 }
Example #2
0
 /**
  * @param array $values
  * @return Comment
  * @throws ActionFailedException
  */
 public function save(array $values)
 {
     $numberOfComments = $this->getNumberOfComments($values['page']);
     $repliesReferences = $this->findRepliesReferences($values['text']);
     try {
         $this->em->beginTransaction();
         // no replies references found
         if (empty($repliesReferences)) {
             $comment = new Comment($values['author'], $this->texy->process($values['text']), $values['page'], $numberOfComments + 1, $this->request->getRemoteAddress());
             $this->em->persist($comment)->flush();
             $this->em->commit();
             return $comment;
         }
         $commentsToReply = $this->findCommentsToReply($values['page'], $repliesReferences);
         $values['text'] = $this->replaceReplyReferencesByAuthors($values['text'], $commentsToReply);
         $comment = new Comment($values['author'], $this->texy->process($values['text']), $values['page'], $numberOfComments + 1);
         $this->em->persist($comment);
         /** @var Comment $comment */
         foreach ($commentsToReply as $commentToReply) {
             $commentToReply->addReaction($comment);
             $this->em->persist($commentToReply);
         }
         $this->em->flush();
         $this->em->commit();
     } catch (\Exception $e) {
         $this->em->rollback();
         $this->em->close();
         throw new ActionFailedException();
     }
     return $comment;
 }
 public function process($text, $singleLine = FALSE)
 {
     $key = $this->cacheKey($text);
     if (!($html = $this->cache->load($key))) {
         $html = parent::process($text, $singleLine);
         $this->cache->save($html);
     }
     return $html;
 }
Example #4
0
 /**
  * @param null $class
  * @return Nette\Templating\ITemplate
  */
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->registerHelper('texy', function ($input) {
         $texy = new \Texy();
         $html = new Nette\Utils\Html();
         return $html::el()->setHtml($texy->process($input));
     });
     $template->registerHelper('vlna', function ($string) {
         $string = preg_replace('<([^a-zA-Z0-9])([ksvzaiou])\\s([a-zA-Z0-9]{1,})>i', "\$1\$2 \$3", $string);
         //&nbsp; === \xc2\xa0
         return $string;
     });
     $template->registerHelper('dateInWords', function ($time) {
         $time = Nette\Utils\DateTime::from($time);
         $months = [1 => 'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'];
         return $time->format('j. ') . $months[$time->format('n')] . $time->format(' Y');
     });
     $template->registerHelper('timeAgoInWords', function ($time) {
         $time = Nette\Utils\DateTime::from($time);
         $delta = round((time() - $time->getTimestamp()) / 60);
         if ($delta == 0) {
             return 'před okamžikem';
         }
         if ($delta == 1) {
             return 'před minutou';
         }
         if ($delta < 45) {
             return "před {$delta} minutami";
         }
         if ($delta < 90) {
             return 'před hodinou';
         }
         if ($delta < 1440) {
             return 'před ' . round($delta / 60) . ' hodinami';
         }
         if ($delta < 2880) {
             return 'včera';
         }
         if ($delta < 43200) {
             return 'před ' . round($delta / 1440) . ' dny';
         }
         if ($delta < 86400) {
             return 'před měsícem';
         }
         if ($delta < 525960) {
             return 'před ' . round($delta / 43200) . ' měsíci';
         }
         if ($delta < 1051920) {
             return 'před rokem';
         }
         return 'před ' . round($delta / 525960) . ' lety';
     });
     return $template;
 }
Example #5
0
 public static function prepareTemplate(Template $template)
 {
     $texy = new \Texy();
     $latte = $template->getLatte();
     $latte->addFilter('texy', function ($text) use($texy) {
         return Html::el('')->setHtml($texy->process($text));
     });
     $latte->addFilter('time', function ($text) {
         return date('j.n.Y G:i:s', $text);
     });
 }
 protected function createTemplate()
 {
     $template = parent::createTemplate();
     $template->addFilter('texy', function ($text) {
         $texy = new \Texy();
         $texy->setOutputMode(\Texy::HTML4_TRANSITIONAL);
         $texy->encoding = 'utf-8';
         $texy->allowedTags = array('strong' => \Texy::NONE, 'b' => \Texy::NONE, 'a' => array('href'), 'em' => \Texy::NONE, 'p' => \Texy::NONE);
         //$texy->allowedTags = \Texy::NONE;
         return $texy->process($text);
     });
     return $template;
 }
Example #7
0
 /**
  * @param array $values
  * @param Page $page
  * @throws PagePublicationTimeException
  * @throws PageIntroHtmlLengthException
  */
 private function fillPageEntity(array $values, Page $page)
 {
     $page->setTitle($values['title']);
     $page->setMetaDescription($values['description']);
     $page->setMetaKeywords($values['keywords']);
     $page->setIntro($values['intro']);
     $page->setIntroHtml($this->texy->process($values['intro']));
     $page->setText($values['text']);
     if ($values['text'] === null) {
         $page->setTextHtml(null);
     } else {
         $page->setTextHtml($this->texy->process($values['text']));
     }
     $page->setPublishedAt($values['publishedAt']);
     $page->setAllowedComments($values['allowedComments']);
     if ($page->isDraft() and $values['saveAsDraft'] === false) {
         $page->setAsPublished($values['publishedAt']);
     }
 }
 /**
  * Callback for self::texyBlocks.
  * @ignore internal
  */
 public static function texyCb($m)
 {
     list(, $mAttrs, $mContent) = $m;
     // parse attributes
     $attrs = array();
     if ($mAttrs) {
         foreach (String::matchAll($mAttrs, '#([a-z0-9:-]+)\\s*(?:=\\s*(\'[^\']*\'|"[^"]*"|[^\'"\\s]+))?()#isu') as $m) {
             $key = strtolower($m[1]);
             $val = $m[2];
             if ($val == NULL) {
                 $attrs[$key] = TRUE;
             } elseif ($val[0] === '\'' || $val[0] === '"') {
                 $attrs[$key] = html_entity_decode(substr($val, 1, -1), ENT_QUOTES, 'UTF-8');
             } else {
                 $attrs[$key] = html_entity_decode($val, ENT_QUOTES, 'UTF-8');
             }
         }
     }
     return self::$texy->process($m[2]);
 }
Example #9
0
 function process($text, $useCache = TRUE)
 {
     $this->time = -microtime(TRUE);
     if ($useCache) {
         $md5 = md5($text);
         // md5 is key for caching
         // check, if cached file exists
         $cacheFile = $this->cachePath . $md5 . '.html';
         $content = is_file($cacheFile) ? unserialize(file_get_contents($cacheFile)) : NULL;
         if ($content) {
             // read from cache
             list($html, $this->styleSheet, $this->headingModule->title) = $content;
         } else {
             // doesn't exists
             $html = parent::process($text);
             file_put_contents($cacheFile, serialize(array($html, $this->styleSheet, $this->headingModule->title)));
         }
     } else {
         // if caching is disabled
         $html = parent::process($text);
     }
     $this->time += microtime(TRUE);
     return $html;
 }
 public function processNewMessageForm(Form $form)
 {
     $values = $form->getValues();
     $recipients = is_array($values->recipients) ? $values->recipients : [$values->recipients];
     if (!$this->authorizator->isAllowed($this->user, 'message', 'sent_to_restricted_recipients')) {
         $s = $this->messagesFacade->canMessageBeSentTo($values->recipients, $this->restrictedUsers, $this->users);
         if ($s === false) {
             $form->addError('Nelze odeslat zprávu vybranému příjemci.');
             return;
         }
     }
     if ($values['isSendAsAdmin'] == true and !$this->authorizator->isAllowed($this->user, 'message', 'send_as_admin')) {
         $form->addError('Nemáte dostatečná oprávnění k akci.');
         return;
     }
     $texy = new \Texy();
     $texy->setOutputMode(\Texy::HTML4_TRANSITIONAL);
     $texy->encoding = 'utf-8';
     $texy->allowedTags = \Texy::ALL;
     $text = $texy->process($values->text);
     $message = new SentMessage($values->subject, $text, $this->user);
     if ($values['isSendAsAdmin']) {
         $message->sendByAuthorRole();
     }
     try {
         $this->messagesFacade->sendMessage($message, $recipients);
     } catch (MessageLengthException $ml) {
         $form->addError('Zprávu nelze uložit, protože je příliš dlouhá.');
         return;
     } catch (DBALException $e) {
         $this->flashMessage('Zpráva nemohla být odeslána. Zkuste akci opakovat později.', 'errror');
         $this->redirect('this');
     }
     $this->presenter->flashMessage('Zpráva byla úspěšně odeslána', 'success');
     $this->presenter->redirect('MailBox:sent');
 }
Example #11
0
 */
function imageHandler($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 : 425) . '" height="' . ($image->height ? $image->height : 350) . '"';
            $code = '<div><object ' . $dimensions . '>' . '<param name="movie" value="http://www.youtube.com/v/' . $video . '" /><param name="wmode" value="transparent" />' . '<embed src="http://www.youtube.com/v/' . $video . '" type="application/x-shockwave-flash" wmode="transparent" ' . $dimensions . ' /></object></div>';
            $texy = $invocation->getTexy();
            return $texy->protect($code, Texy::CONTENT_BLOCK);
    }
    return $invocation->proceed();
}
$texy = new Texy();
$texy->addHandler('image', 'imageHandler');
// processing
$text = file_get_contents('sample.texy');
$html = $texy->process($text);
// that's all folks!
// echo formated output
header('Content-type: text/html; charset=utf-8');
echo $html;
// echo generated HTML code
echo '<hr />';
echo '<pre>';
echo htmlSpecialChars($html);
echo '</pre>';
Example #12
0
 static function formattingByTexy($source)
 {
     static $texy;
     if (is_null($texy)) {
         if (!class_exists('Texy', false)) {
             $dir = Q::ini('vendor_dir');
             require_once "{$dir}/geshi/geshi.php";
             require_once "{$dir}/texy/texy.php";
         }
         Texy::$advertisingNotice = false;
         $texy = new Texy();
         $options = self::$_texy_options;
         foreach ($options as $module => $config) {
             foreach ($config as $key => $value) {
                 $m = $module . 'Module';
                 $texy->{$m}->{$key} = $value;
             }
         }
         $texy->addHandler('block', array(__CLASS__, 'texyBlockHandler'));
     }
     return $texy->process($source);
 }
Example #13
0
 public function actionDefault()
 {
     $texy = new Texy();
     $this->template->text = $texy->process(dibi::query('SELECT text FROM [options] WHERE [name]=%s', 'home')->fetchSingle());
 }
Example #14
0
 function process($text)
 {
     $texy = new Texy();
     return $texy->process($text);
 }
Example #15
0
 public function beforeRender()
 {
     parent::beforeRender();
     $nastaveni = $this->database->table('nastaveni');
     $this->template->nastaveni = $nastaveni;
     $this->template->basicMenu = $this->getBasicMenu();
     $zmeneneStranky = $this->database->table('stranka')->where('editor_zmeneno != ?', 'ne')->where('redirect IS NULL');
     //\Tracy\Debugger::barDump($zmeneneStranky->count());
     if ($zmeneneStranky->count() > 0) {
         $texy = new \Texy();
         $texy->headingModule->top = (int) $nastaveni->get('texy_heading_top')->hodnota;
         $texy->imageModule->root = '/images/main-content/';
         $texy->imageModule->leftClass = 'tifl';
         $texy->imageModule->rightClass = 'tifr';
         $now = new Nette\DateTime();
         $menuTable = $this->getBasicMenu(TRUE);
         foreach ($zmeneneStranky as $stranka) {
             $obsahujeGalerii = 'ne';
             $tempTemplate = NULL;
             $fragmentHtml = array();
             $castiStranky = $stranka->related('editor_obsahu_stranky')->order('poradi, id');
             if ($castiStranky->count() > 0) {
                 foreach ($castiStranky as $fragment) {
                     $zaloha = array();
                     $posledniZalohaTexy = NULL;
                     if ($fragment->galerie_skupina_fotek_id == NULL) {
                         $posledniZaloha = $this->database->table('zaloha_obsah')->where('editor_obsahu_stranky_id = ?', $fragment->id)->order('id DESC')->limit(1)->fetch();
                         if ($posledniZaloha) {
                             $posledniZalohaTexy = $posledniZaloha->texy;
                         } else {
                             $posledniZalohaTexy = NULL;
                         }
                         $posledniZaloha = NULL;
                         if ($posledniZalohaTexy != $fragment->obsah_texy) {
                             $zaloha = array('editor_obsahu_stranky_id' => $fragment->id, 'stranka_id' => $fragment->stranka_id, 'poradi' => $fragment->poradi, 'pocet_sloupcu' => $fragment->pocet_sloupcu, 'texy' => $fragment->obsah_texy, 'datum' => $now);
                             $this->database->table('zaloha_obsah')->insert($zaloha);
                         }
                         $posledniZalohaTexy = NULL;
                         $zaloha = array();
                         $fragmentHtml[$fragment->id] = $texy->process($fragment->obsah_texy);
                     } else {
                         $obsahujeGalerii = 'ano';
                     }
                 }
                 $tempTemplate = NULL;
                 $tempTemplate = $this->createTemplate()->setFile(__DIR__ . '/templates/components/renderMainContent.latte')->setParameters(array('casti' => $castiStranky, 'htmlFragmenty' => $fragmentHtml));
                 $tempTemplate = (string) $tempTemplate;
             }
             $bigTemplate = NULL;
             $bigTemplate = $this->createTemplate()->setFile(__DIR__ . '/templates/components/renderStandardPage.latte')->setParameters(array('stranka' => $stranka, 'sGalerii' => $obsahujeGalerii, 'upperContent' => $tempTemplate, 'basicMenu' => $menuTable, 'noflashes' => 'noflashes', 'nastaveni' => $nastaveni));
             $bigTemplate = (string) $bigTemplate;
             $tempTemplate = NULL;
             $proVlozeni = array();
             $proVlozeni = array('html' => $bigTemplate, 'stranka_id' => $stranka->id);
             $bigTemplate = NULL;
             if ($stranka->related('stranka_html_celek')->count() > 0) {
                 $stranka->related('stranka_html_celek')->order('id')->limit(1)->fetch()->update($proVlozeni);
             } else {
                 $this->database->table('stranka_html_celek')->insert($proVlozeni);
             }
             $proVlozeni = NULL;
             $stranka->update(array('obsahuje_galerii' => $obsahujeGalerii, 'editor_zmeneno' => 'ne'));
             $this->flashMessage('Upravena stránka id ' . $stranka->id);
         }
     }
 }
Example #16
0
<?php

require_once dirname(__FILE__) . '/texy.min.php';
if ($_SERVER["argc"] == 2) {
    Texy::$advertisingNotice = NULL;
    $texy = new Texy();
    $texy->imageModule->root = '';
    $texy->imageModule->linkedRoot = '';
    echo trim($texy->process($_SERVER["argv"][1]));
} else {
    echo "Texy! " . Texy::VERSION;
}
Example #17
0
	/**
	 * Process <texy>...</texy> elements.
	 * @param  string
	 * @return string
	 */
	public static function texyElements($s)
	{
		return String::replace($s, '#<texy([^>]*)>(.*?)</texy>#s', function ($m) {
				list(, $mAttrs, $mContent) = $m;
				// parse attributes
				$attrs = array();
				if ($mAttrs) {
					foreach (String::matchAll($mAttrs, '#([a-z0-9:-]+)\s*(?:=\s*(\'[^\']*\'|"[^"]*"|[^\'"\s]+))?()#isu') as $m) {
						$key = strtolower($m[1]);
						$val = $m[2];
						if ($val == NULL) $attrs[$key] = TRUE;
						elseif ($val{0} === '\'' || $val{0} === '"') $attrs[$key] = html_entity_decode(substr($val, 1, -1), ENT_QUOTES, 'UTF-8');
						else $attrs[$key] = html_entity_decode($val, ENT_QUOTES, 'UTF-8');
					}
				}
				return TemplateFilters::$texy->process($m[2]);
			}
		);
	}
Example #18
0
<?php

$cfg = isset($_POST["cfg"]) ? $_POST["cfg"] : null;
if ($cfg === "admin") {
    require_once __DIR__ . "/AdminTexy.php";
    $texy = new AdminTexy();
} elseif ($cfg === "forum") {
    require_once __DIR__ . "/ForumTexy.php";
    $texy = new ForumTexy();
} else {
    require_once __DIR__ . "/../libs/texy.min.php";
    $texy = new Texy();
}
header("Content-Type: text/html; charset=UTF-8");
$code = get_magic_quotes_gpc() ? stripslashes($_POST["texy"]) : $_POST["texy"];
echo $texy->process($code);
Example #19
0
 public function parse()
 {
     return $this->texy->process($this->content);
 }
 /**
  * Formats text as documentation block or line.
  *
  * @param string                    $text    Text
  * @param \ApiGen\ReflectionElement $context Reflection object
  * @param boolean                   $block   Parse text as block
  *
  * @return string
  */
 public function doc($text, ReflectionElement $context, $block = false)
 {
     return $this->resolveLinks($this->texy->process($this->resolveInternal($text), !$block), $context);
 }
Example #21
0
<!doctype HTML>
<html>
<head>
	<meta charset="utf-8">
	<title>Přihlašování uživatelů v Nette 2.0</title>
	<link rel="stylesheet" href="style.css">
	<script src="jquery.js"></script>
		<script type="text/javascript" src="jush.js"></script>
	<script src="slidy.js"></script>
</head>
<body>
<?php 
require __DIR__ . '/texy.min.php';
$texy = new Texy();
$texy->imageModule->root = '';
$texy->imageModule->fileRoot = __DIR__;
$html = $texy->process(file_get_contents('content.texy'));
$html = str_replace('<h1', '</div><div class="slide"><h1', $html);
//$html = str_replace('<code><pre>', '<pre><code>', $html);
//$html = str_replace('</pre></code>', '</code></pre>', $html);
//$html = str_replace('<code class="jush"><pre>', '<pre><code class="jush">', $html);
//$html = str_replace('<code class="jush-php"><pre>', '<pre><code class="jush-php">', $html);
echo "<div>{$html}</div>";
?>
</body>
</html>
Example #22
0
 public function render($args = NULL)
 {
     parent::render($args);
     $this->template->new = $this->new;
     if (isset($this->params['set_subject_id'])) {
         $subject_id = $this->params['set_subject_id'];
     } elseif (isset($args['subjectid'])) {
         $subject_id = (int) $args['subjectid'];
     } else {
         $subject_id = false;
     }
     if (isset($this->params['rewrite'])) {
         $this->rewrite = (bool) $this->params['rewrite'];
     }
     if (isset($args['id'])) {
         $this->id = (int) $args['id'];
         // kdyz NULL tak vraci 0
         //$this->type = (string) $args['type'];
         $this['eventForm']['id']->setValue($this->id);
         //$this['eventForm']['type']->setValue($this->id);
         $event = $this->context->createService('events')->get($this->id);
         if ($event) {
             $tx = new Texy();
             $tx->alignClasses['left'] = 'fl';
             $tx->alignClasses['right'] = 'fr';
             //$tx->imageModule->root = $this->httpRequest->url->baseUrl;
             //				$tx->imageModule->fileRoot = $this->getHttpRequest()->url->baseUrl;
             //				$tx->imageModule->linkedRoot = $this->getHttpRequest()->url->baseUrl;
             //				$tx->linkModule->root = $this->getHttpRequest()->url->baseUrl;
             $tx->headingModule->top = 4;
             $pl = (array) $event->toArray();
             $pl['description'] = $tx->process($pl['description']);
             $this['eventForm']->setDefaults($pl);
             $this['eventForm']['categories']->setDefaultValue($event->related('event_x_category')->fetchPairs('category_id', 'category_id'));
             $this->template->id = $args['id'];
             //$this->template->type = $args['type'];
         } else {
             throw new Exception('There is no event with ID #' . $this->id);
         }
     }
     if ($subject_id) {
         $place = $this->context->createService('places')->get($subject_id);
         $session = $this->presenter->getSession(get_class($this));
         $form = $session['form'];
         if ($form) {
             $this['eventForm']->setDefaults($form);
         }
         if ($this->rewrite) {
             $this['eventForm']['subject_name']->setDefaultValue($place->name);
             $this['eventForm']['shire_id']->setDefaultValue($place->locality->shire_id);
             $this['eventForm']['subject_city']->setDefaultValue($place->locality->name);
             $this['eventForm']['subject_locality_nickname']->setDefaultValue($place->locality_nickname);
             $this['eventForm']['subject_street']->setDefaultValue($place->street);
             $this['eventForm']['subject_zip']->setDefaultValue($place->zip);
             $this['eventForm']['subject_gps']->setDefaultValue($place->map_coords);
             $this['eventForm']['subject_www']->setDefaultValue($place->web);
             $this['eventForm']['subject_phone']->setDefaultValue($place->phone);
             $this['eventForm']['subject_email']->setDefaultValue($place->email);
             $this['eventForm']['subject_facebook']->setDefaultValue($place->facebook);
         } else {
             $this['eventForm']['subject_name']->setDefaultValue($form['subject_name'] != '' ? $form['subject_name'] : $place->name);
             $this['eventForm']['shire_id']->setDefaultValue($form['shire_id'] != '' ? $form['shire_id'] : $place->locality->shire_id);
             $this['eventForm']['subject_city']->setDefaultValue($form['subject_city'] != '' ? $form['subject_city'] : $place->locality->name);
             $this['eventForm']['subject_locality_nickname']->setDefaultValue($form['subject_locality_nickname'] != '' ? $form['subject_locality_nickname'] : $place->locality_nickname);
             $this['eventForm']['subject_street']->setDefaultValue($form['subject_street'] != '' ? $form['subject_street'] : $place->street);
             $this['eventForm']['subject_zip']->setDefaultValue($form['subject_zip'] != '' ? $form['subject_zip'] : $place->zip);
             $this['eventForm']['subject_gps']->setDefaultValue($form['subject_gps'] != '' ? $form['subject_gps'] : $place->map_coords);
             $this['eventForm']['subject_www']->setDefaultValue($form['subject_www'] != '' ? $form['subject_www'] : $place->web);
             $this['eventForm']['subject_phone']->setDefaultValue($form['subject_phone'] != '' ? $form['subject_phone'] : $place->phone);
             $this['eventForm']['subject_email']->setDefaultValue($form['subject_email'] != '' ? $form['subject_email'] : $place->email);
             $this['eventForm']['subject_facebook']->setDefaultValue($form['subject_facebook'] != '' ? $form['subject_facebook'] : $place->facebook);
         }
         $this['eventForm']['subject_id']->setDefaultValue($subject_id);
     }
     $this->template->setFile(__DIR__ . "/EventDescriptionControl.latte");
     $this->template->render();
 }
Example #23
0
function texyla($content, $texyCfg, $charset = 'utf-8', $oneLine = false)
{
    if (empty($content)) {
        # protože je obsah prázdný vrátíme ho prázdný zpátky bez zpracování
        return $content;
    }
    if (!function_exists('iconv') && $charset != 'utf-8') {
        # ověření existence fce iconv(), která se používá pro zmenu
        # kodování vstupního textu při jiném než utf-8 kodování
        trigger_error(texylaErrorMsg(TEXYLA_ICONV_MISSING), E_USER_ERROR);
    }
    # jaky pouzit configurační soubor pro zpracování vstupního textu
    # defaultní hodnota je forum, takže není třeba uvádět.
    $texyCfg = texylaTexyCfg($texyCfg);
    # sestaveni cesty ke konfigu
    $texyCfgFile = dirname(__FILE__) . '/cfg/' . $texyCfg . '.php';
    if (!is_bool($oneLine)) {
        # pokud není bool nastavíme na false (blokový text)
        $oneLine = false;
    }
    if (!class_exists('Texy')) {
        # Neexistuje třída Texy
        trigger_error(texylaErrorMsg(TEXYLA_CLASS_NOT_TEXY_FOUND, $texyFile), E_USER_ERROR);
    }
    # iniciace texy
    $texy = new Texy();
    $texy->alignClasses['left'] = 'fl';
    $texy->alignClasses['right'] = 'fr';
    # nastavíme kódování v kterém je zpracováváný text
    # default je utf-8, není třeba uvádět při volání funkce texyla() [pokud nenásleduje další parametr]
    $texy->encoding = $charset;
    # proměnná, podle které se řídí přidávání hlášky  <!-- by Texy2! --> na konec zpracovávaného textu
    # $GLOBALS['Texy::$advertisingNotice'] = false;
    # verze pro php5
    Texy::$advertisingNotice = false;
    # Odstranění diakritiky z textu, vytvoření
    if ($texyCfg == 'webalize') {
        /*
        	*******************************************************************************************
        	!!! Toto je v Testovací fázi !!! Bugreporty prosím na http://texyla.jaknato.com/khostu.php
        	*******************************************************************************************
        	Jedná se o odstranění diakritiky...
        	Výsledek obsahuje pouze a-z, čísla a spojovník.
        	Není třeba načítat konfiguraci, 
        	Pokud používáte jiné kódování než je utf-8, je text překodován na utf-8 a je z něj 
        	odstraněna diakritika, výsledný text je čisté ASCII, takže se zpštně nepřevádí na 
        	původní kódóvání.
        	Poznámky dgx k webalize:
        	========================
        		Je však možné povolit i další ASCII znaky:
        	
        			$nadpis = "článek/PHP 5.2.1 a funkce is_array()";
        			echo Texy::webalize($nadpis); // standardní chování
        	
        			→ clanek-php-5-2-1-a-funkce-is-array
        	
        			$addChar = '/_.';// navíc povolíme znaky: / _ .
        			echo Texy::webalize($nadpis,$addChar);
        			
        			→ clanek/php-5.2.1-a-funkce-is_array
        	
        			Ještě dodám, že funkce funguje korektně i při chybné implementaci iconv (glibc).
        */
        $content = strtolower($charset) == 'utf-8' ? $content : iconv($charset, 'utf-8', $content);
        $addChar = '';
        return Texy::webalize($content, $addChar);
    }
    # kontrola existence konfiguračního souboru
    if (!file_exists($texyCfgFile)) {
        # neexistuje (nebyl nalezen/includován) soubor s konfigurací pro texy
        return texylaErrorMsg(TEXYLA_FILE_CFG_NOT_FOUND, $texyCfgFile);
    }
    # includujeme soubor s nastavením pro Texy!
    if (!(include $texyCfgFile)) {
        # Nepodařilo se načíst konfigurační soubor,
        # nejspíš špatné práva pro přístup k souboru
        return texylaErrorMsg(TEXYLA_ACCESS_DENIED, $texyFile);
    }
    # kontrola existence pomocné třídy FshlHandler (propojení Texy s fshlParser)
    # a třídy fshlParser (ta se stará o samotné obarvení kodu)
    if (function_exists('TexylaFSHLBlockHandler') && class_exists('fshlParser') && !empty($useFSHL) && $useFSHL === true) {
        # iniciace pomocné třídy starající se o obarvení zdrojovách kódů
        # Autor třídy je: Juraj 'hvge' Durech
        $texy->addHandler('block', 'TexylaFSHLBlockHandler');
    }
    # Provedeme zpracování poslaného obsahu pomocí Texy!
    if (!empty($addTargetBlank) && $addTargetBlank === true) {
        return preg_replace_callback("~<a href~iU", "texylaAddTargetBlank", $texy->process($content, $oneLine));
    }
    return $texy->process($content, $oneLine);
}