Beispiel #1
0
 public function attribute($name)
 {
     if ($this->tagType() != 'attribute') {
         return null;
     }
     // Get the array of the attributes, we will call on the attributes
     // method, which will parse them out if need be.
     $attributes = $this->attributes();
     // Now return the attribute value, if any.
     return array_key_exists(SpeedyBBC::strtolower($name), $attributes) ? $attributes[SpeedyBBC::strtolower($name)] : false;
 }
Beispiel #2
0
 public function setAllowedChildren($allowed)
 {
     if (is_array($allowed)) {
         $this->allowed_children = array();
         foreach ($allowed as $tag_name) {
             $tag_name = SpeedyBBC::strtolower($tag_name);
             if ($tag_name == '[text]' || preg_match('~^([a-z0-9_-])+$~i', $tag_name) > 0) {
                 $this->allowed_children[] = $tag_name;
             }
         }
         // Did anything even get added?
         if (count($this->allowed_children) == 0) {
             $this->allowed_children = null;
         }
         // Now disable the disallowed children option.
         $this->setDisallowedChildren(false);
     } else {
         $this->allowed_children = null;
     }
 }