/libraries/koowa/filter/dirname.php

https://bitbucket.org/organicdevelopment/joomla-2.5 · PHP · 43 lines · 14 code · 2 blank · 27 comment · 0 complexity · 4c4c349c302d32ef8173413015b750d4 MD5 · raw file

  1. <?php
  2. /**
  3. * @version $Id: dirname.php 4477 2012-02-10 01:06:38Z johanjanssens $
  4. * @category Koowa
  5. * @package Koowa_Filter
  6. * @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
  7. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
  8. * @link http://www.nooku.org
  9. */
  10. /**
  11. * Dirname filter
  12. *
  13. * @author Johan Janssens <johan@nooku.org>
  14. * @category Koowa
  15. * @package Koowa_Filter
  16. */
  17. class KFilterDirname extends KFilterAbstract
  18. {
  19. /**
  20. * Validate a value
  21. *
  22. * @param scalar Variable to be validated
  23. * @return bool True when the variable is valid
  24. */
  25. protected function _validate($value)
  26. {
  27. $value = trim($value);
  28. return ((string) $value === $this->sanitize($value));
  29. }
  30. /**
  31. * Sanitize a value
  32. *
  33. * @param scalar Variable to be sanitized
  34. * @return string
  35. */
  36. protected function _sanitize($value)
  37. {
  38. $value = trim($value);
  39. return dirname($value);
  40. }
  41. }