本文整理汇总了PHP中vB_BbCodeParser::vB_BbCodeParser方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_BbCodeParser::vB_BbCodeParser方法的具体用法?PHP vB_BbCodeParser::vB_BbCodeParser怎么用?PHP vB_BbCodeParser::vB_BbCodeParser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_BbCodeParser
的用法示例。
在下文中一共展示了vB_BbCodeParser::vB_BbCodeParser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
/**
* Constructor. Sets up the tag permissions list.
*
* @param vB_Registry Reference to registry object
* @param array The tag_list array for the parent class parser
* @param integer The permssions number for the user from their usergroup i.e. $vbulletin->userinfo['permissions']
* @param integer The user this signature belongs to. Required
* @param boolean Whether to append custom tags (they will not be parsed anyway)
*/
function vB_SignatureParser(&$registry, $tag_list, $usergroup_signature_permission, $userid, $append_custom_tags = true)
{
parent::vB_BbCodeParser($registry, $tag_list, false);
$this->userid = intval($userid);
if (!$this->userid) {
trigger_error("User ID is 0. A signature cannot be parsed unless it belongs to a user.", E_USER_ERROR);
}
$this->permissions =& $usergroup_signature_permission;
$this->tag_groups = array('b' => 'basic', 'i' => 'basic', 'u' => 'basic', 'color' => 'color', 'size' => 'size', 'font' => 'font', 'left' => 'align', 'center' => 'align', 'right' => 'align', 'indent' => 'align', 'list' => 'list', 'url' => 'link', 'email' => 'link', 'thread' => 'link', 'post' => 'link', 'code' => 'code', 'php' => 'php', 'html' => 'html', 'quote' => 'quote');
// General, allowed or not
foreach ($this->tag_groups as $tag => $tag_group) {
if (isset($this->tag_list['no_option']["{$tag}"])) {
$this->tag_list['no_option']["{$tag}"]['callback'] = 'check_bbcode_general';
unset($this->tag_list['no_option']["{$tag}"]['html']);
}
if (isset($this->tag_list['option']["{$tag}"])) {
$this->tag_list['option']["{$tag}"]['callback'] = 'check_bbcode_general';
unset($this->tag_list['option']["{$tag}"]['html']);
}
}
// Specific functions
$this->tag_list['option']['size']['callback'] = 'check_bbcode_size';
$this->tag_list['no_option']['img']['callback'] = 'check_bbcode_img';
// needs to parse sig pics like any other bb code
$this->tag_list['no_option']['sigpic'] = array('strip_empty' => false, 'callback' => 'check_bbcode_sigpic');
if ($append_custom_tags) {
$this->append_custom_tags();
}
}
示例2: foreach
/**
* Constructor. Sets up the tag permissions list.
*
* @param vB_Registry Reference to registry object
* @param array The tag_list array for the parent class parser
* @param boolean Whether to append custom tags
*/
function vB_SocialMessageParser(&$registry, $tag_list, $append_custom_tags = true)
{
parent::vB_BbCodeParser($registry, $tag_list, false);
// Load the information regarding allowed tags from the options
$this->allow_bbcodes();
// General, whether allowed or not
foreach ($this->tag_groupings as $tag => $tag_group) {
if (isset($this->tag_list['no_option']["{$tag}"])) {
$this->tag_list['no_option']["{$tag}"]['callback'] = 'check_bbcode_general';
unset($this->tag_list['no_option']["{$tag}"]['html']);
}
if (isset($this->tag_list['option']["{$tag}"])) {
$this->tag_list['option']["{$tag}"]['callback'] = 'check_bbcode_general';
unset($this->tag_list['option']["{$tag}"]['html']);
}
}
// lets treat the image tag like a full tag here
$this->tag_list['no_option']['img']['callback'] = 'check_bbcode_general';
if ($append_custom_tags) {
$this->append_custom_tags();
}
}
示例3: array
/**
* Constructor. Sets up the tag list.
*
* @param vB_Registry Reference to registry object
* @param array List of tags to parse
* @param boolean Whether to append custom tags (they will not be parsed anyway)
*/
function vB_BbCodeParser_Video_PreParse(&$registry, $tag_list = array(), $append_custom_tags = true)
{
parent::vB_BbCodeParser($registry, $tag_list, $append_custom_tags);
$this->tag_list = array();
// [NOPARSE]-- doesn't need a callback, just some flags
$this->tag_list['no_option']['noparse'] = array('strip_empty' => false, 'stop_parse' => true, 'disable_smilies' => true, 'callback' => 'handle_noparse');
// [VIDEO]
$this->tag_list['no_option']['video'] = array('callback' => 'handle_bbcode_video', 'strip_empty' => true);
}
示例4: array
/**
* Constructor. Sets up the tag list.
*
* @param vB_Registry Reference to registry object
* @param array List of tags to parse
* @param boolean Whether to append custom tags (they will not be parsed anyway)
*/
function vB_BbCodeParser_PlainText(&$registry, $tag_list = array(), $append_custom_tags = true)
{
parent::vB_BbCodeParser($registry, $tag_list, $append_custom_tags);
// add thread and post tags as parsed -- this can't be done above
// because I need to use a variable in $registry
$this->plaintext_tags['option']['thread'] = array('html' => '%1$s (' . $registry->options['bburl'] . '/showthread.php?t=%2$s)', 'option_regex' => '#^\\d+$#', 'strip_empty' => true);
$this->plaintext_tags['no_option']['thread'] = array('html' => $registry->options['bburl'] . '/showthread.php?t=%1$s', 'data_regex' => '#^\\d+$#', 'strip_empty' => true);
$this->plaintext_tags['option']['post'] = array('html' => '%1$s (' . $registry->options['bburl'] . '/showthread.php?p=%2$s#post%2$s)', 'option_regex' => '#^\\d+$#', 'strip_empty' => true);
$this->plaintext_tags['no_option']['post'] = array('html' => $registry->options['bburl'] . '/showthread.php?p=%1$s#post%1$s', 'data_regex' => '#^\\d+$#', 'strip_empty' => true);
// update all parsable tags to their new value and make unparsable tags disappear
foreach ($this->tag_list['option'] as $tagname => $info) {
if (!isset($this->plaintext_tags['option']["{$tagname}"])) {
$this->tag_list['option']["{$tagname}"]['html'] = '%1$s';
unset($this->tag_list['option']["{$tagname}"]['callback']);
} else {
if ($this->plaintext_tags['option']["{$tagname}"] !== false) {
$this->tag_list['option']["{$tagname}"] = $this->plaintext_tags['option']["{$tagname}"];
}
}
}
foreach ($this->tag_list['no_option'] as $tagname => $info) {
if (!isset($this->plaintext_tags['no_option']["{$tagname}"])) {
$this->tag_list['no_option']["{$tagname}"]['html'] = '%1$s';
unset($this->tag_list['no_option']["{$tagname}"]['callback']);
} else {
if ($this->plaintext_tags['no_option']["{$tagname}"] !== false) {
$this->tag_list['no_option']["{$tagname}"] = $this->plaintext_tags['no_option']["{$tagname}"];
}
}
}
}
示例5: array
function vB_BbCodeParser_Blog(&$registry, $tag_list = array(), $append_custom_tags = true)
{
parent::vB_BbCodeParser($registry, $tag_list, $append_custom_tags);
}