public static function checkRequirement($item, $type, $expected)
 {
     switch ($type) {
         case 'func':
             $test = function_exists($item);
             if ($test != $expected) {
                 return false;
             }
             break;
         case 'setting':
             $test = ini_get($item);
             if (strtolower($test) != strtolower($expected)) {
                 return false;
             }
             break;
         case 'ext':
             foreach (explode(':', $item) as $ext) {
                 $test = extension_loaded($ext);
                 if ($test == $expected) {
                     return true;
                 }
             }
             return false;
             break;
         case 'version':
             if (version_compare($item, $expected, '>=') != 1) {
                 return false;
             }
             break;
         case 'permission':
             if (!is_writable($item)) {
                 return false;
             }
             break;
         case 'remote':
             $result = curler($item);
             if (strpos(strtolower($result), 'error') !== false) {
                 return false;
             }
             break;
     }
     return true;
 }
Exemple #2
0
 function checkRequirement($item, $type, $expected)
 {
     switch ($type) {
         case "func":
             $test = function_exists($item);
             if ($test != $expected) {
                 return false;
             }
             break;
         case "setting":
             $test = ini_get($item);
             if (strtolower($test) != strtolower($expected)) {
                 return false;
             }
             break;
         case "ext":
             foreach (explode(":", $item) as $ext) {
                 $test = extension_loaded($ext);
                 if ($test == $expected) {
                     return true;
                 }
             }
             return false;
             break;
         case "version":
             if (version_compare($item, $expected, ">=") != 1) {
                 return false;
             }
             break;
         case "permission":
             if (!is_writable($item)) {
                 return false;
             }
             break;
         case "remote":
             $result = curler($item);
             if (strpos(strtolower($result), "error") !== false) {
                 return false;
             }
             break;
     }
     return true;
 }