Ejemplo n.º 1
0
 /**
  * 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();
     }
 }
Ejemplo n.º 2
0
 /**
  * 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();
     }
 }
Ejemplo n.º 3
0
 /**
  * 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);
 }
Ejemplo n.º 4
0
 /**
  * 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}"];
             }
         }
     }
 }
Ejemplo n.º 5
0
	function vB_BbCodeParser_Blog(&$registry, $tag_list = array(), $append_custom_tags = true)
	{
		parent::vB_BbCodeParser($registry, $tag_list, $append_custom_tags);
	}