Пример #1
0
<?php

require_once \Scoop\Config::get_option('install_dir') . '/scoop/path.php';
/**************
 * composer
 * ************/
$composerAutoloaderPath = \Scoop\Config::get_option('install_dir') . '/vendor/autoload.php';
if (file_exists($composerAutoloaderPath)) {
    require_once $composerAutoloaderPath;
    $run = new Whoops\Run();
    $handler = new Whoops\Handler\PrettyPageHandler();
    // Set the title of the error page:
    $handler->setPageTitle("Whoops! There was a problem.");
    $run->pushHandler($handler);
    // Add a special handler to deal with AJAX requests with an
    // equally-informative JSON response. Since this handler is
    // first in the stack, it will be executed before the error
    // page handler, and will have a chance to decide if anything
    // needs to be done.
    if (Whoops\Util\Misc::isAjaxRequest()) {
        $run->pushHandler(new Whoops\Handler\JsonResponseHandler());
    }
    // Register the handler with PHP, and you're set!
    $run->register();
}
/**************
 * Scoop
 **************/
// load all classpaths that exist
foreach (\Scoop\Config::get_class_paths() as $classPath) {
    if ($classPath = realpath($classPath)) {
Пример #2
0
 public function test_set_options()
 {
     $options = ['dummy1' => 'value1', 'dummy2' => 'value2', 'dummy3' => 'value3'];
     Config::set_options($options);
     $this->assertEquals('value1', Config::get_option('dummy1'));
     $this->assertEquals('value2', Config::get_option('dummy2'));
     $this->assertEquals('value3', Config::get_option('dummy3'));
 }
Пример #3
0
if (isset($siteName)) {
    \Scoop\Config::set_option('site_name', $siteName);
}
// load config
$frameworkConfig = (include \Scoop\Config::get_option('config_dir') . '/framework.php');
// load user config file if one exists
foreach ([__DIR__ . '/../../scoop/custom.php', __DIR__ . '/../../../../scoop/custom.php'] as $customConfigFilePath) {
    if (file_exists($customConfigFilePath)) {
        $customConfig = (include_once $customConfigFilePath);
        if (is_array($customConfig)) {
            $frameworkConfig = array_replace_recursive($frameworkConfig, $customConfig);
        }
    }
}
// set main options
\Scoop\Config::set_options($frameworkConfig);
// set the timezone if one was provided
if (\Scoop\Config::option_exists('timezone')) {
    date_default_timezone_set(\Scoop\Config::get_option('timezone'));
}
// the autoloader
require_once \Scoop\Config::get_option('bootstrap_dir') . '/autoloader.php';
$clientIP = array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
$serverIP = array_key_exists('SERVER_ADDR', $_SERVER) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0';
if (\Scoop\Environment::is_internal_ip($clientIP, $serverIP)) {
    ini_set('display_errors', 'On');
    ini_set('display_startup_errors', 'On');
} else {
    ini_set('display_errors', 'Off');
    ini_set('display_startup_errors', 'Off');
}