Example #1
0
File: Tag.php Project: xiphe/html
 /**
  * Updates class variables.
  *
  * @param string $what set to just update a specific part of the tag
  * 
  * @return void
  */
 public function update($what = 'all')
 {
     /*
      * Generate Class array.
      */
     if ($what == 'all' || $what == 'classes') {
         Generator::updateClasses($this);
     }
     /*
      * Generate Class array.
      */
     if ($what == 'all' || $what == 'urls') {
         Generator::magicUrls($this);
     }
     /*
      * Parse the content.
      */
     if ($what == 'content') {
         Content::parse($this);
     }
     if ($what == 'content' || $what == 'all' || $what == 'inlineInner') {
         if ($this->hasOption('inlineInner') || $this->name !== 'blank' && !$this->hasOption('forbidInlineInner') && !$this->isSelfClosing() && !$this->hasOption('start') && strlen($this->content) < Config::get('maxLineWidth') && !preg_match('/\\r\\n|\\n|\\r/', $this->content)) {
             $this->inlineInner = true;
         } else {
             $this->inlineInner = false;
         }
     }
     if ($what == 'all' || $what == 'attributes') {
         /*
          * Sort Atrributes and Classes.
          */
         ksort($this->attributes);
         /*
          * Parse the attributes to string format.
          */
         $this->attributeString = Generator::attsToString($this);
     }
 }