Source for file Validator.php
Documentation is available at Validator.php
* Created on 10.02.2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This software consists of voluntary contributions made by many individuals
* and is licensed under the GPL. For more information please see
* <http://opendocumentphp.org>.
* $Id: Validator.php 161 2007-03-19 09:35:16Z nmarkgraf $
* This class will have several static methods to check if a input string is of
* Most of the definition is reight out of the original RelaxNG schemata for
* @author Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
* @copyright Copyright in 2006, 2007 by OpenDocumentPHP Team
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
* @version $Revision: 161 $
* @package OpenDocumentPHP
* @since 0.5.1 - 10.02.2007
* Checks if the input is a positive integer (input > 0).
* @param mixed $input Input which is been testet.
* @return bool Is true, only if it is a positive integer.
* @since 0.5.1 - 10.02.2007
return ((int) $input > 0);
* Checks if the input is a integer.
* @param mixed $input Input which is been testet.
* @return bool Is true, only if it is a positive integer.
* @since 0.5.1 - 10.02.2007
* Checks if the input string is 'non-colonized name' (NCName).
* @param mixed $input Input which is been tested.
* @return bool Is true, only if $input is a non-colonized name.
* @since 0.5.1 - 10.02.2007
* @todo This should be something like '([a-zA-Z_])(a-zA-Z0-9.-_)*'...?
return ereg('([a-zA-z_])(a-zA-Z0-9\.-_)',$input); [\i-[:]][\c-[:]]*
* Checks if the input string is of "styleNameRef" type. Which is eigther
* a NCName string or empty.
* @param mixed $input Input which is been tested.
* @return bool Is true, only if $input is of "styleNameRef" type.
* @since 0.5.1 - 10.02.2007
* Checks if the input string represents a color, like #00FF00 is green.
* @since 0.5.1 - 10.02.2007
static public function isColor($input) {
return ereg('#[0-9a-fA-F]{6}', $input);
* Checks if the input is a positiveLength.
* @since 0.5.1 - 10.02.2007
return ereg('([0-9]*[1-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))', $input);
* Checks if the input is a family value.
* @since 0.5.2 - 19.03.2007
|