function populateFromDomNode($rootNode) { $children = new xArray($rootNode->get_elements_by_tagname('*')); // Tags may occur out of a container. if ($children->length() == 0) { $children = new xArray(array($rootNode)); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("rel" == $value->name && preg_match("/\\btag\\b|\\blicense\\b|\\bbookmark\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->name = $res->get_content(); $atts = new xArray($res->attributes()); $url = $atts->detect('return ("href" == $value->name);'); $this->url = $url ? $url->value : $res->get_content(); $type = $atts->detect('return ("rel" == $value->name);'); $this->type = $type->value; } }
/** * Returns current xArray without supplied keys. * * @param mixed $passedArray Either an array, xArray, or a list of keys to exclude * @return xArray Resulting xArray */ function withoutKeys($passedArray) { if (!is_array($passedArray) && (is_object($passedArray) && get_class($this) == get_class($passedArray))) { $passedArray = $passedArray->toArray(); } if (!is_array($passedArray)) { $passedArray = func_get_args(); } $result = new xArray($this->toArray()); foreach ($passedArray as $reject) { $result->remove($reject); } return $result; }
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("/\\bcategory\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->category = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bclass\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->class = $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("/\\bdtend\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->dateEnd = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bdtstart\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->dateStart = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bduration\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->duration = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bnickname\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->nickname = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\blocation\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->location = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bstatus\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->status = $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("/\\buid\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->uid = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\burl\\b/", $value->value)) ? true : false; \'); '); if ($res) { $atts = new xArray($res->attributes()); $url = $atts->detect('return ("href" == $value->name);'); $this->url = $url ? $url->value : $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\blast-modified\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->lastModified = $res->get_content(); } }
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("/\\bclass\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->class = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bfn\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->name = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bgiven-name\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->givenName = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bfamily-name\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->familyName = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\badditional-name\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->additionalName = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bhonorific-prefix\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->honorificPrefix = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bhonorific-suffix\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->honorificSuffix = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bnickname\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->nickname = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bsort-string\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->sortString = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\burl\\b/", $value->value)) ? true : false; \'); '); if ($res) { $atts = new xArray($res->attributes()); $url = $atts->detect('return ("href" == $value->name);'); $this->url = $url ? $url->value : $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bphoto\\b/", $value->value)) ? true : false; \'); '); if ($res) { $atts = new xArray($res->attributes()); $src = $atts->detect('return ("src" == $value->name);'); // IMG tag $data = $atts->detect('return ("data" == $value->name);'); // OBJECT tag $this->photo = $src ? $src->value : ($data ? $data->value : false); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bemail\\b/", $value->value)) ? true : false; \'); '); if ($res) { $atts = new xArray($res->attributes()); $url = $atts->detect('return ("href" == $value->name);'); $this->email = $url ? $url->value : $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\btel\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->telephone = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\badr\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->fullAddress = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bpost-office-box\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->poBox = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bextended-address\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->extendedAddress = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bstreet-address\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->streetAddress = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\blocality\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->locality = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bregion\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->region = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bpostal-code\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->postalCode = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bcountry-name\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->countryName = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bgeo\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->fullGeo = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\blatitude\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->latitude = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\blongitude\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->longitude = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\btz\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->timezone = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bbday\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->birthday = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\btitle\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->title = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\brole\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->role = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\borg\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->organization = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bcategory\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->category = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bnote\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->note = $res->get_content(); } }
/** * RelTag-specific first level parser. * This is where all the relTags container elements are detected. * Accepts a DOM XML node, and returns an xArray of found relTags. * * Normaly, there should be no need to call this yourself. * Use parseSource method with appropriate parser setup instead. */ function parseRel($child) { $elems = array(); $atts = new xArray($child->attributes()); $class = $atts->detect(' $valid = array ("tag", "bookmark", "license"); return ("rel" == $value->name && in_array($value->value, $valid)) ? true : false; '); if ($class) { $elems[] = new relElement($child); } else { foreach ($child->child_nodes() as $n) { $res = $this->parseRel($n); if ($res) { $elems = array_merge($elems, $res->toArray()); } } } return new xArray(@$elems); }
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); } }