コード例 #1
0
    function populateFromDomNode($rootNode)
    {
        $children = new xArray($rootNode->get_elements_by_tagname('*'));
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\bversion\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->version = $res->get_content();
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\bsummary\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->summary = $res->get_content();
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\btype\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->type = $res->get_content();
        }
        //REWIEVER
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\breviewer\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->reviewer = new hCard($res);
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\bdtreviewed\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->dateReviewed = $res->get_content();
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\brating\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->rating = $res->get_content();
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\bdescription\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->description = $res->get_content();
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\btags\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->tags = new xArray($this->tags);
            $m = new MicroFormatParser();
            foreach ($res->child_nodes() as $rcn) {
                $e = $m->parseRel($rcn);
                $this->tags->append($e->toArray());
            }
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\bpermalink\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->permalink = new relElement($res);
        }
        $res = $children->detect('
			$atts = new xArray($value->attributes());
			return $atts->detect(\'
				return ("class" == $value->name && preg_match("/\\blicense\\b/", $value->value)) 
					? true : false;
			\');
		');
        if ($res) {
            $this->license = new relElement($res);
        }
    }