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

/lib/Haanga/Extension/Filter/Substr.php

http://github.com/crodas/Haanga
PHP | 16 lines | 15 code | 1 blank | 0 comment | 3 complexity | 6e8ba2a0c8af535bf08e30ace92ab5d2 MD5 | raw file
  1. <?php
  2. class Haanga_Extension_Filter_Substr
  3. {
  4. public static function generator($cmp, $args)
  5. {
  6. if (count($args) != 2) {
  7. $cmp->Error("substr parameter must have one param");
  8. }
  9. if (!isset($args[1]['string'])) {
  10. $cmp->Error("substr parameter must be a string");
  11. }
  12. list($start, $end) = explode(",", $args[1]['string']);
  13. return hexec('substr', $args[0], (int)$start, (int)$end);
  14. }
  15. }