PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/Library/Kumbia/Filter/BaseFilters/Md5.php

http://kumbia-enterprise.googlecode.com/
PHP | 54 lines | 10 code | 4 blank | 40 comment | 2 complexity | 80e9d14643366fdbec1b80a4059efa64 MD5 | raw file
  1. <?php
  2. /**
  3. * Kumbia Enterprise Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the New BSD License that is bundled
  8. * with this package in the file docs/LICENSE.txt.
  9. *
  10. * If you did not receive a copy of the license and are unable to
  11. * obtain it through the world-wide-web, please send an email
  12. * to license@loudertechnology.com so we can send you a copy immediately.
  13. *
  14. * @category Kumbia
  15. * @package Filter
  16. * @subpackage BaseFilters
  17. * @copyright Copyright (c) 2008-2010 Louder Technology COL. (http://www.loudertechnology.com)
  18. * @copyright Copyright (c) 2007-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
  19. * @copyright Copyright (c) 2007-2007 Emilio Rafael Silveira Tovar(emilio.rst at gmail.com)
  20. * @copyright Copyright (c) 2007-2007 Deivinson Tejeda Brito (deivinsontejeda at gmail.com)
  21. * @license New BSD License
  22. * @version $Id: Md5.php 148 2010-04-20 22:17:31Z gutierrezandresfelipe $
  23. */
  24. /**
  25. * Md5Filter
  26. *
  27. * Convierte una cadena a un string MD5
  28. *
  29. * @category Kumbia
  30. * @package Filter
  31. * @subpackage BaseFilters
  32. * @copyright Copyright (c) 2008-2010 Louder Technology COL. (http://www.loudertechnology.com)
  33. * @copyright Copyright (c) 2007-2008 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
  34. * @license New BSD License
  35. */
  36. class Md5Filter implements FilterInterface {
  37. /**
  38. * Ejecuta el filtro
  39. *
  40. * @param string $s
  41. * @return int
  42. */
  43. public function execute($s){
  44. if(strlen($s)==32){
  45. return preg_replace('/[^a-fA-F0-9]/', '', $s);
  46. } else {
  47. return null;
  48. }
  49. }
  50. }