PageRenderTime 50ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/Haanga/Extension/Filter/Substr.php

https://bitbucket.org/jonarano/joneame
PHP | 16 lines | 15 code | 1 blank | 0 comment | 3 complexity | ab7c4ea0e64d061f8a6bf48e661d6588 MD5 | raw file
Possible License(s): AGPL-1.0
  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. }