Beispiel #1
0
date_default_timezone_set(@date_default_timezone_get());
// Set the zlib config values if the extension has been loaded.
if (extension_loaded('zlib')) {
    ini_set('zlib.output_compression', true);
    ini_set('zlib.output_compression_level', '5');
}
// Strip slashes from superglobals to avoid problems with PHP's magic_quotes.
if (get_magic_quotes_gpc()) {
    $_GET = stripslashes_deep($_GET);
    $_POST = stripslashes_deep($_POST);
    $_COOKIE = stripslashes_deep($_COOKIE);
    $_REQUEST = stripslashes_deep($_REQUEST);
}
// Add the libraries and models directories to the include path.
set_include_path(LIB_DIR . PATH_SEPARATOR . MODEL_DIR . PATH_SEPARATOR . get_include_path());
// Set up the Zend autoloader to work for all classes.
require_once 'Zend/Loader/StandardAutoloader.php';
$autoloader = new Zend_Loader_StandardAutoloader(array('prefixes' => array('Omeka_Form_' => APP_DIR . '/forms', 'Omeka_View_Helper_' => APP_DIR . '/views/helpers', 'Omeka_Controller_Action_Helper' => APP_DIR . '/controllers/helpers'), 'fallback_autoloader' => true));
$autoloader->register();
// Define the theme directory path.
define('THEME_DIR', defined('ADMIN') ? ADMIN_THEME_DIR : PUBLIC_THEME_DIR);
/**
 * Strip slashes recursively.
 *
 * @param array|string $value
 * @return array
 */
function stripslashes_deep($value)
{
    return is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
}
Beispiel #2
0
    // Try to load StandardAutoloader from include_path
    if (false === (include 'Zend/Loader/StandardAutoloader.php')) {
        echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL;
        exit(2);
    }
} else {
    // Try to load StandardAutoloader from library
    if (false === (include dirname(__FILE__) . '/../library/Zend/Loader/StandardAutoloader.php')) {
        echo "Unable to locate autoloader via library; aborting" . PHP_EOL;
        exit(2);
    }
}
// Setup autoloading
$loader = new Zend_Loader_StandardAutoloader();
$loader->setFallbackAutoloader(true);
$loader->register();
$rules = array('help|h' => 'Get usage message', 'library|l-s' => 'Library to parse; if none provided, assumes current directory', 'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory', 'overwrite|w' => 'Whether or not to overwrite existing autoload file');
try {
    $opts = new Zend_Console_Getopt($rules);
    $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getUsageMessage();
    exit(2);
}
if ($opts->getOption('h')) {
    echo $opts->getUsageMessage();
    exit;
}
$path = $libPath;
if (array_key_exists('PWD', $_SERVER)) {
    $path = $_SERVER['PWD'];
 public function testRegisterRegistersCallbackWithSplAutoload()
 {
     $loader = new Zend_Loader_StandardAutoloader();
     $loader->register();
     $loaders = spl_autoload_functions();
     $this->assertTrue(count($this->loaders) < count($loaders));
     $test = array_pop($loaders);
     $this->assertEquals(array($loader, 'autoload'), $test);
 }