Beispiel #1
0
$profile = false;
if (extension_loaded('xhprof')) {
    // check whether one of the arguments is --profile; this will enable the profiler
    $profile = array_search('--profile', $argv);
    if (false !== $profile) {
        unset($_SERVER['argv'][$profile]);
        $_SERVER['argc']--;
        xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
    }
}
// determine base include folder, if @php_bin@ contains @php_bin then we do not install via PEAR
$base_include_folder = strpos('@php_dir@', '@php_dir') === 0 ? dirname(__FILE__) . '/../src' : '@php_dir@/DocBlox/src';
// set path to add lib folder, load the Zend Autoloader
set_include_path($base_include_folder . PATH_SEPARATOR . get_include_path());
require_once $base_include_folder . '/ZendX/Loader/StandardAutoloader.php';
$autoloader = new ZendX_Loader_StandardAutoloader(array('prefixes' => array('Zend' => $base_include_folder . '/Zend', 'DocBlox' => $base_include_folder . '/DocBlox'), 'fallback_autoloader' => true));
$autoloader->register();
$application = new DocBlox_Core_Application();
$application->main();
if (false !== $profile) {
    include_once 'XHProf/utils/xhprof_lib.php';
    include_once 'XHProf/utils/xhprof_runs.php';
    $xhprof_data = xhprof_disable();
    if ($xhprof_data !== null) {
        $xhprof_runs = new XHProfRuns_Default();
        $run_id = $xhprof_runs->save_run($xhprof_data, 'docblox');
        $profiler_url = sprintf('index.php?run=%s&source=%s', $run_id, 'docblox');
        echo 'Profile can be found at: ' . $profiler_url . PHP_EOL;
    }
}
// disable E_STRICT reporting on the end to prevent PEAR from throwing Strict warnings.
Beispiel #2
0
if (!is_dir(LOGS_PATH)) {
    mkdir(LOGS_PATH, 0775);
}
// Set up image path
defined('IMAGE_PATH') || define('IMAGE_PATH', realpath(dirname(__FILE__) . '/images/'));
if (!is_dir(IMAGE_PATH)) {
    mkdir(IMAGE_PATH, 0775);
}
// Set up assets constant for path
defined('ASSETS_PATH') || define('ASSETS_PATH', realpath(dirname(__FILE__) . '/assets/'));
if (!is_dir(ASSETS_PATH)) {
    mkdir(ASSETS_PATH, 0775);
}
// check for apc support
define('APC_SUPPORT', extension_loaded('apc') && ini_get('apc.enabled'));
// Set Memory limit
ini_set('memory_limit', '128M');
ini_set("pcre.backtrack_limit", "1000000");
ini_set("magic_quotes_runtime", 0);
//Set upload max size
ini_set('upload_max_filesize', '20M');
// Ensure libraries are on include_path
set_include_path('.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . '../library/Zend/library' . PATH_SEPARATOR . '../library/ZendX/' . PATH_SEPARATOR . '../library/Pas/' . PATH_SEPARATOR . '../library/HTMLPurifier/library/' . PATH_SEPARATOR . '../library/EasyBib/library/' . PATH_SEPARATOR . '../library/mpdf/' . PATH_SEPARATOR . '../library/easyrdf/lib/' . PATH_SEPARATOR . '../library/imagecow/' . PATH_SEPARATOR . '../library/Solarium/' . PATH_SEPARATOR . '../app/models/' . PATH_SEPARATOR . '../app/forms/' . PATH_SEPARATOR . get_include_path());
require_once '../library/ZendX/Loader/StandardAutoloader.php';
$loader = new ZendX_Loader_StandardAutoloader(array('prefixes' => array('Zend' => '../library/Zend/library', 'HTMLPurifier' => '../library/HTMLPurifier/library/', 'Pas' => '../library/Pas/', 'ZendX' => '../library/ZendX/', 'Imagecow' => '../library/imagecow/src/', 'easyRDF' => '../library/easyrdf/lib/', 'mPDF' => '../library/mpdf/', 'Solarium' => '../library/Solarium/'), 'namespaces' => array('Imagecow' => '../library/imagecow/src/', 'mPDF' => '../library/mPDF/'), 'fallback_autoloader' => true));
$loader->register();
require_once 'HTMLPurifier/Bootstrap.php';
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, array('config' => array(APPLICATION_PATH . '/config/application.ini', APPLICATION_PATH . '/config/config.ini', APPLICATION_PATH . '/config/webservices.ini', APPLICATION_PATH . '/config/emails.ini', APPLICATION_PATH . '/config/routes.ini')));
$application->bootstrap()->run();
 /**
  * Get an instance of the standard autoloader
  *
  * Used to attempt to resolve autoloader classes, using the 
  * StandardAutoloader. The instance is marked as a fallback autoloader, to 
  * allow resolving autoloaders not under the "Zend" or "ZendX" namespaces.
  * 
  * @return ZendX_Loader_SplAutoloader
  */
 protected static function getStandardAutoloader()
 {
     if (null !== self::$standardAutoloader) {
         return self::$standardAutoloader;
     }
     require_once dirname(__FILE__) . '/StandardAutoloader.php';
     $loader = new ZendX_Loader_StandardAutoloader();
     $loader->setFallbackAutoloader(true);
     self::$standardAutoloader = $loader;
     return self::$standardAutoloader;
 }