core.get_include_path.php 1002 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * Get path to file from include_path
  9. *
  10. * @param string $file_path
  11. * @param string $new_file_path
  12. * @return boolean
  13. * @staticvar array|null
  14. */
  15. // $file_path, &$new_file_path
  16. function smarty_core_get_include_path(&$params, &$smarty)
  17. {
  18. static $_path_array = null;
  19. if(!isset($_path_array)) {
  20. $_ini_include_path = ini_get('include_path');
  21. if(strstr($_ini_include_path,';')) {
  22. // windows pathnames
  23. $_path_array = explode(';',$_ini_include_path);
  24. } else {
  25. $_path_array = explode(':',$_ini_include_path);
  26. }
  27. }
  28. foreach ($_path_array as $_include_path) {
  29. if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
  30. $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. /* vim: set expandtab: */
  37. ?>