本文整理汇总了PHP中Texy::setOutputMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Texy::setOutputMode方法的具体用法?PHP Texy::setOutputMode怎么用?PHP Texy::setOutputMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texy
的用法示例。
在下文中一共展示了Texy::setOutputMode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($content = "")
{
Object::__construct();
//FIXME: This should be done by TextParser
parent::__construct($content);
$this->texy = new SS_Texy();
$this->texy->setOutputMode(Texy::HTML5);
$this->setAllowedTags($this->config()->get('allowed_tags'));
$this->texy->headingModule->top = $this->config()->get('top_heading');
}
示例2: createTemplate
protected function createTemplate($class = NULL)
{
$template = parent::createTemplate($class);
$texy = new \Texy();
$texy->encoding = 'utf-8';
$texy->setOutputMode(\Texy::HTML5);
// config as in \TexyConfigurator::safeMode($texy);
$safeTags = array('a' => array('href', 'title'), 'acronym' => array('title'), 'b' => array(), 'br' => array(), 'cite' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'q' => array(), 'small' => array());
$texy->allowedClasses = \Texy::NONE;
// no class or ID are allowed
$texy->allowedStyles = \Texy::NONE;
// style modifiers are disabled
$texy->allowedTags = $safeTags;
// only some "safe" HTML tags and attributes are allowed
$texy->urlSchemeFilters[\Texy::FILTER_ANCHOR] = '#https?:|ftp:|mailto:#A';
$texy->urlSchemeFilters[\Texy::FILTER_IMAGE] = '#https?:#A';
$texy->allowed['image'] = FALSE;
// disable images
$texy->allowed['link/definition'] = FALSE;
// disable [ref]: URL reference definitions
$texy->allowed['html/comment'] = FALSE;
// disable HTML comments
# zakázaní nadpisů
$texy->allowed['heading/surrounded'] = FALSE;
$texy->allowed['heading/underlined'] = FALSE;
# zalamování textu v odstavcích po enteru
# false => nebude spojovat řádky, vloží místo enteru <br>
# true => řádky po jednom enteru spojí
$texy->mergeLines = false;
$texy->linkModule->forceNoFollow = TRUE;
// force rel="nofollow"
$template->registerHelper('texy', callback($texy, 'process'));
return $template;
}
示例3: createTexyForComment
/**
* @return \Texy
*/
public function createTexyForComment()
{
$texy = new \Texy();
$texy->headingModule->top = 3;
$texy->setOutputMode(\Texy::HTML5);
// Images
$texy->imageModule->root = '.' . $this->imagesRoot;
$texy->imageModule->fileRoot = $this->imagesFileRoot;
\TexyConfigurator::safeMode($texy);
\TexyConfigurator::disableImages($texy);
//$texy->allowed['blockquote'] = false;
$texy->allowed['emoticon'] = false;
$texy->allowed['heading/underlined'] = false;
$texy->allowed['heading/surrounded'] = false;
$texy->allowed['horizline'] = false;
//$texy->allowed['html/tag'] = false;
$texy->allowed['html/comment'] = false;
//$texy->allowed['list'] = false;
//$texy->allowed['list/definition'] = false;
$texy->allowed['script'] = false;
$texy->allowed['table'] = false;
$texy->linkModule->forceNoFollow = true;
$texy->addHandler('block', [$this, 'blockHandler']);
return $texy;
}
示例4: createTemplate
protected function createTemplate($class = NULL)
{
$template = parent::createTemplate($class);
$texy = new \Texy();
$texy->encoding = 'utf-8';
$texy->setOutputMode(\Texy::HTML5);
// config as in \TexyConfigurator::safeMode($texy);
$safeTags = array('a' => array('href', 'title'), 'acronym' => array('title'), 'b' => array(), 'br' => array(), 'cite' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'q' => array(), 'small' => array());
$texy->allowedClasses = \Texy::NONE;
// no class or ID are allowed
$texy->allowedStyles = \Texy::NONE;
// style modifiers are disabled
$texy->allowedTags = $safeTags;
// only some "safe" HTML tags and attributes are allowed
$texy->urlSchemeFilters[\Texy::FILTER_ANCHOR] = '#https?:|ftp:|mailto:#A';
$texy->urlSchemeFilters[\Texy::FILTER_IMAGE] = '#https?:#A';
$texy->allowed['image'] = FALSE;
// disable images
$texy->allowed['link/definition'] = FALSE;
// disable [ref]: URL reference definitions
$texy->allowed['html/comment'] = FALSE;
// disable HTML comments
$texy->linkModule->forceNoFollow = TRUE;
// force rel="nofollow"
$template->registerHelper('texy', callback($texy, 'process'));
return $template;
}
示例5: createTexy
/**
* @return Texy
*/
public static function createTexy()
{
$texy = new Texy();
$texy->encoding = 'utf-8';
$texy->setOutputMode(\Texy::HTML5);
// from https://github.com/nette/web-content/blob/convertor/src/Wiki/Convertor.php
$texy->linkModule->root = '';
$texy->alignClasses['left'] = 'left';
$texy->alignClasses['right'] = 'right';
$texy->emoticonModule->class = 'smiley';
$texy->headingModule->top = 1;
$texy->headingModule->generateID = TRUE;
$texy->tabWidth = 4;
$texy->typographyModule->locale = 'cs';
//en ?
$texy->tableModule->evenClass = 'alt';
$texy->dtd['body'][1]['style'] = TRUE;
$texy->allowed['longwords'] = FALSE;
$texy->allowed['block/html'] = FALSE;
$texy->phraseModule->tags['phrase/strong'] = 'b';
$texy->phraseModule->tags['phrase/em'] = 'i';
$texy->phraseModule->tags['phrase/em-alt'] = 'i';
$texy->phraseModule->tags['phrase/acronym'] = 'abbr';
$texy->phraseModule->tags['phrase/acronym-alt'] = 'abbr';
$texy->addHandler('block', array('TexyFactory', 'blockHandler'));
return $texy;
}
示例6: createTemplate
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;
}
示例7: processNewMessageForm
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');
}
示例8: createTexy
/**
* Texy factory
*
* @return \Texy
*/
protected function createTexy()
{
$texy = new \Texy();
$texy->encoding = 'utf-8';
$texy->setOutputMode(\Texy::HTML5);
$texy->headingModule->top = 3;
$texy->addHandler('image', ['Zax\\Texy\\Youtube', 'imageHandler']);
return $texy;
}