array_contains -> in_array
This commit is contained in:
parent
de0164647e
commit
f77c6e64cd
8 changed files with 9 additions and 18 deletions
|
@ -41,7 +41,7 @@ class ArchiveFileHandler extends SimpleExtension {
|
|||
|
||||
private function supported_ext($ext) {
|
||||
$exts = array("zip");
|
||||
return array_contains($exts, strtolower($ext));
|
||||
return in_array(strtolower($ext), $exts);
|
||||
}
|
||||
|
||||
// copied from bulk add extension
|
||||
|
|
|
@ -41,7 +41,7 @@ class FlashFileHandler extends SimpleExtension {
|
|||
|
||||
private function supported_ext($ext) {
|
||||
$exts = array("swf");
|
||||
return array_contains($exts, strtolower($ext));
|
||||
return in_array(strtolower($ext), $exts);
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
|
@ -124,7 +124,7 @@ class FlashFileHandler extends SimpleExtension {
|
|||
$fp = fopen($file, "r");
|
||||
$head = fread($fp, 3);
|
||||
fclose($fp);
|
||||
if(!array_contains(array("CWS", "FWS"), $head)) return false;
|
||||
if(!in_array($head, array("CWS", "FWS"))) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class IcoFileHandler extends SimpleExtension {
|
|||
|
||||
private function supported_ext($ext) {
|
||||
$exts = array("ico", "ani", "cur");
|
||||
return array_contains($exts, strtolower($ext));
|
||||
return in_array(strtolower($ext), $exts);
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class MP3FileHandler implements Extension {
|
|||
|
||||
private function supported_ext($ext) {
|
||||
$exts = array("mp3");
|
||||
return array_contains($exts, strtolower($ext));
|
||||
return in_array(strtolower($ext), $exts);
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
|
|
|
@ -63,7 +63,7 @@ class SVGFileHandler implements Extension {
|
|||
|
||||
private function supported_ext($ext) {
|
||||
$exts = array("svg");
|
||||
return array_contains($exts, strtolower($ext));
|
||||
return in_array(strtolower($ext), $exts);
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
|
|
|
@ -256,15 +256,6 @@ function array_add($array, $element) {
|
|||
return $array;
|
||||
}
|
||||
|
||||
function array_contains($array, $target) {
|
||||
foreach($array as $element) {
|
||||
if($target == $element) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// case insensetive uniqueness
|
||||
function array_iunique($array) {
|
||||
$ok = array();
|
||||
|
|
|
@ -37,7 +37,7 @@ class PixelFileHandler implements Extension {
|
|||
|
||||
private function supported_ext($ext) {
|
||||
$exts = array("jpg", "jpeg", "gif", "png");
|
||||
return array_contains($exts, strtolower($ext));
|
||||
return in_array(strtolower($ext), $exts);
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
|
@ -66,7 +66,7 @@ class PixelFileHandler implements Extension {
|
|||
if(!file_exists($file)) return false;
|
||||
$info = getimagesize($file);
|
||||
if(is_null($info)) return false;
|
||||
if(array_contains($valid, $info[2])) return true;
|
||||
if(in_array($info[2], $valid)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ try {
|
|||
$m = array();
|
||||
foreach($custom_themelets as $filename) {
|
||||
if(preg_match("/themes\/$_theme\/(.*)\.theme\.php/",$filename,$m)
|
||||
&& array_contains($themelets, "ext/{$m[1]}/theme.php")) {
|
||||
&& in_array("ext/{$m[1]}/theme.php", $themelets)) {
|
||||
require_once $filename;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue