cvs: pear /XML_Feed_Parser/Parser Type.php

From: Date: Tue, 18 Oct 2005 12:20:44 +0000
Subject: cvs: pear /XML_Feed_Parser/Parser Type.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35665@lists.php.net to get a copy of this message
jystewart Tue Oct 18 08:20:44 2005 EDT Modified files: /pear/XML_Feed_Parser/Parser Type.php Log: Added case-insensitive check for element names as a fallback http://cvs.php.net/diff.php/pear/XML_Feed_Parser/Parser/Type.php?r1=1.4&r2=1.5&ty=u Index: pear/XML_Feed_Parser/Parser/Type.php diff -u pear/XML_Feed_Parser/Parser/Type.php:1.4 pear/XML_Feed_Parser/Parser/Type.php:1.5 --- pear/XML_Feed_Parser/Parser/Type.php:1.4 Sat Oct 15 11:06:22 2005 +++ pear/XML_Feed_Parser/Parser/Type.php Tue Oct 18 08:20:42 2005 @@ -18,7 +18,7 @@ * @author James Stewart <james@jystewart.net> * @copyright 2005 James Stewart <james@jystewart.net> * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL 2.1 - * @version CVS: $Id: Type.php,v 1.4 2005/10/15 15:06:22 jystewart Exp $ + * @version CVS: $Id: Type.php,v 1.5 2005/10/18 12:20:42 jystewart Exp $ * @link http://dev.jystewart.net/XML_Feed_Parser/ */ @@ -70,18 +70,29 @@ $call = $this->compatMap[$call][0]; } - if (isset($this->map[$call])) { - $method = 'get' . $this->map[$call][0]; - if ($method == 'getLink') { - $offset = isset($arguments[0][0]) ? $arguments[0][0] : 0; - $attribute = isset($arguments[0][1]) ? $arguments[0][1] : 'href'; - $params = isset($arguments[0][2]) ? $arguments[0][2] : array(); - return $this->getLink($offset, $attribute, $params); + /* To be helpful, we allow a case-insensitive search for this method */ + if (! isset($this->map[$call])) { + foreach (array_keys($this->map) as $key) { + if (strtoupper($key) == strtoupper($call)) { + $call = $key; + break; + } } - } else { - return false; } + if (empty($this->map[$call])) + { + return false; + } + + $method = 'get' . $this->map[$call][0]; + if ($method == 'getLink') { + $offset = isset($arguments[0][0]) ? $arguments[0][0] : 0; + $attribute = isset($arguments[0][1]) ? $arguments[0][1] : 'href'; + $params = isset($arguments[0][2]) ? $arguments[0][2] : array(); + return $this->getLink($offset, $attribute, $params); + } + if (method_exists($this, $method)) { return $this->$method($call, $arguments); }

« previous php.pear.cvs (#35665) next »