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

/libs/popoon/components/selectors/eval.php

http://github.com/chregu/planet-php
PHP | 50 lines | 18 code | 6 blank | 26 comment | 1 complexity | 3706990713a7b43e3accb71e069c1596 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | popoon |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 2001,2002,2003,2004 Bitflux GmbH |
  6. // +----------------------------------------------------------------------+
  7. // | Licensed under the Apache License, Version 2.0 (the "License"); |
  8. // | you may not use this file except in compliance with the License. |
  9. // | You may obtain a copy of the License at |
  10. // | http://www.apache.org/licenses/LICENSE-2.0 |
  11. // | Unless required by applicable law or agreed to in writing, software |
  12. // | distributed under the License is distributed on an "AS IS" BASIS, |
  13. // | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
  14. // | implied. See the License for the specific language governing |
  15. // | permissions and limitations under the License. |
  16. // +----------------------------------------------------------------------+
  17. // | Author: Christian Stocker <chregu@bitflux.ch> |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: eval.php 1255 2004-04-22 17:15:25Z chregu $
  21. include_once("popoon/components/selector.php");
  22. /**
  23. *
  24. *
  25. * @author Christian Stocker <chregu@bitflux.ch>
  26. * @version $Id: eval.php 1255 2004-04-22 17:15:25Z chregu $
  27. * @package popoon
  28. */
  29. class selector_eval extends selector
  30. {
  31. function selector_eval (&$sitemap)
  32. {
  33. parent::selector($sitemap);
  34. }
  35. function init($attribs) {
  36. parent::init($attribs);
  37. $this->var = $this->getAttrib("var");
  38. }
  39. function match($value)
  40. {
  41. eval('$_result = '.$this->var.';');
  42. return $_result == $value;
  43. }
  44. }