Exemple #1
0
 function test_pathSeparator()
 {
     $rv = fbSystem::pathSeparator();
     $this->assertTrue(!empty($rv));
 }
Exemple #2
0
// Licensed under the BSD or LGPL License. See license.txt for details.
require_once './_demo.php';
require_once FREEBEER_BASE . '/lib/System.php';
echo html_header_demo('fbSystem Class', FREEBEER_BASE . '/lib/System.php');
echo "\n<pre>\n";
echo 'platform=', fbSystem::platform(), "\n";
echo 'isCLI=', fbSystem::isCLI(), "\n";
echo 'isApache=', fbSystem::isApache(), "\n";
echo 'directorySeparator=', fbSystem::directorySeparator(), "\n";
$nl = fbSystem::lineSeparator();
echo 'lineSeparator=';
for ($i = 0; $i < strlen($nl); ++$i) {
    printf("%d: %d ", $i + 1, ord($nl[$i]));
}
echo "\n";
echo 'pathSeparator=', fbSystem::pathSeparator(), "\n";
echo 'tempDirectory=', fbSystem::tempDirectory(), "\n";
echo 'extensionSuffix=', fbSystem::extensionSuffix(), "\n";
echo 'hostname=', fbSystem::hostname(), "\n";
echo 'username='******'include_path=', ini_get('include_path'), "\n";
fbSystem::appendIncludePath('appendme');
echo 'include_path=', ini_get('include_path'), "\n";
fbSystem::prependIncludePath('prependme');
echo 'include_path=', ini_get('include_path'), "\n";
echo 'loadExtension(\'standard\')=', fbSystem::loadExtension('standard'), "\n";
echo 'loadExtension(\'curl\')=', fbSystem::loadExtension('curl'), "\n";
echo 'loadExtension(\'failme\')=', fbSystem::loadExtension('failme'), "\n";
echo 'getLastError()=', fbSystem::getLastError(), "\n";
?>
</pre>
Exemple #3
0
 function includeFile($file, $search_paths = array())
 {
     $track_errors = @ini_set('track_errors', true);
     $php_errormsg = '';
     @(include_once $file);
     @ini_set('track_errors', $track_errors);
     if (!$php_errormsg) {
         return true;
     }
     $pathinfo = pathinfo($file);
     if ($pathinfo['dirname']) {
         trigger_error($php_errormsg, E_USER_WARNING);
         return false;
     }
     if (!$search_paths) {
         return false;
     }
     if (!is_array($search_paths)) {
         $search_paths = array($search_paths);
     }
     $platform = fbSystem::platform();
     if (isset($search_paths[$platform])) {
         $search_path = $search_paths[$platform];
     } else {
         $search_path = $search_paths;
     }
     foreach ($search_path as $dir) {
         $path = $dir . fbSystem::directorySeparator() . $file;
         if (is_file($path)) {
             break;
         }
     }
     if (!is_file($path)) {
         trigger_error(sprintf("Can't find '%s' in '%s' or '%s'", $file, join(fbSystem::pathSeparator(), $search_path), ini_get('include_path')), E_USER_WARNING);
     }
     //		fbSystem::appendIncludePath($dir);
     include_once $path;
     return true;
 }