本文整理汇总了PHP中Gdn_Format::Mentions方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::Mentions方法的具体用法?PHP Gdn_Format::Mentions怎么用?PHP Gdn_Format::Mentions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::Mentions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Markdown
/**
* Format a string using Markdown syntax. Also purifies the output html.
*
* @param mixed $Mixed An object, array, or string to be formatted.
* @return string
*/
public static function Markdown($Mixed)
{
if (!is_string($Mixed)) {
return self::To($Mixed, 'Markdown');
} else {
$Formatter = Gdn::Factory('HtmlFormatter');
if (is_null($Formatter)) {
return Gdn_Format::Display($Mixed);
} else {
require_once PATH_LIBRARY . DS . 'vendors' . DS . 'markdown' . DS . 'markdown.php';
$Mixed = Markdown($Mixed);
$Mixed = Gdn_Format::Links($Mixed);
$Mixed = Gdn_Format::Mentions($Mixed);
return $Formatter->Format($Mixed);
}
}
}
示例2: Wysiwyg
public static function Wysiwyg($Mixed)
{
static $CustomFormatter;
if (!isset($CustomFormatter)) {
$CustomFormatter = C('Garden.Format.WysiwygFunction', FALSE);
}
if (!is_string($Mixed)) {
return self::To($Mixed, 'Wysiwyg');
} elseif (is_callable($CustomFormatter)) {
return $CustomFormatter($Mixed);
} else {
// The text contains html and must be purified.
$Formatter = Gdn::Factory('HtmlFormatter');
if (is_null($Formatter)) {
// If there is no HtmlFormatter then make sure that script injections won't work.
return self::Display($Mixed);
}
// HTML filter first
$Mixed = $Formatter->Format($Mixed);
// Links
$Mixed = Gdn_Format::Links($Mixed);
// Mentions & Hashes
$Mixed = Gdn_Format::Mentions($Mixed);
$Mixed = Emoji::instance()->translateToHtml($Mixed);
return $Mixed;
}
}