Permalink
Browse files

use stream_resolve_include_path instead of custom method

  • Loading branch information...
cweiske committed Aug 27, 2012
1 parent 63ece44 commit 6397fd9c3881d8f7771e84296c010c0cb18eb89e
Showing with 1 addition and 18 deletions.
  1. +1 −18 src/Date/HumanDiff.php
View
@@ -243,7 +243,7 @@ public function setLocale($lang)
$class = 'Date_HumanDiff_Locale_' . $lang;
$file = str_replace('_', '/', $class) . '.php';
- if ($this->isIncludable($file)) {
+ if (stream_resolve_include_path($file) !== false) {
include_once $file;
}
if (!class_exists($class)) {
@@ -258,23 +258,6 @@ public function setLocale($lang)
$this->setTranslator($translator);
return true;
}
-
- /**
- * Check if the given file is includable
- *
- * @param string $file Path to file (relative to include path)
- *
- * @return boolean True if one can include() it
- */
- protected function isIncludable($file)
- {
- $hdl = @fopen($file, 'r', true);
- if ($hdl === false) {
- return false;
- }
- fclose($hdl);
- return true;
- }
}
?>

0 comments on commit 6397fd9

Please sign in to comment.