/libraries/koowa/filter/dirname.php
PHP | 43 lines | 14 code | 2 blank | 27 comment | 0 complexity | 4c4c349c302d32ef8173413015b750d4 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-2.0, MIT, BSD-3-Clause, LGPL-2.1
- <?php
- /**
- * @version $Id: dirname.php 4477 2012-02-10 01:06:38Z johanjanssens $
- * @category Koowa
- * @package Koowa_Filter
- * @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
- * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
- * @link http://www.nooku.org
- */
- /**
- * Dirname filter
- *
- * @author Johan Janssens <johan@nooku.org>
- * @category Koowa
- * @package Koowa_Filter
- */
- class KFilterDirname extends KFilterAbstract
- {
- /**
- * Validate a value
- *
- * @param scalar Variable to be validated
- * @return bool True when the variable is valid
- */
- protected function _validate($value)
- {
- $value = trim($value);
- return ((string) $value === $this->sanitize($value));
- }
-
- /**
- * Sanitize a value
- *
- * @param scalar Variable to be sanitized
- * @return string
- */
- protected function _sanitize($value)
- {
- $value = trim($value);
- return dirname($value);
- }
- }