Example #1
0
 private static function parse($svg)
 {
     $image = new self($svg['width'], $svg['height']);
     $doc = $image->getDocument();
     $children = $svg->children();
     foreach ($children as $child) {
         $childNode = self::parseNode($child);
         if (!$childNode) {
             continue;
         }
         $doc->addChild($childNode);
     }
     return $image;
 }
 /**
 Static validation method of an HTML fragment. Returns an array with the
 following parameters:
 
 - valid (boolean)
 _ errors (string)
 
 @param	fragment	<b>string</b>		HTML content
 @param	charset	<b>string</b>			Document charset
 @return	<b>array</b>
 */
 public static function validate($fragment, $charset = 'UTF-8')
 {
     $o = new self();
     $fragment = $o->getDocument($fragment, $charset);
     if ($o->perform($fragment, $charset)) {
         return array('valid' => true, 'errors' => null);
     } else {
         return array('valid' => false, 'errors' => $o->getErrors());
     }
 }