当前位置: 首页>>代码示例>>PHP>>正文


PHP Utf8\Bootup类代码示例

本文整理汇总了PHP中Patchwork\Utf8\Bootup的典型用法代码示例。如果您正苦于以下问题:PHP Bootup类的具体用法?PHP Bootup怎么用?PHP Bootup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Bootup类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initializeClasses

 /**
  * @inheritdoc
  */
 public function initializeClasses(SymfonyRequest $symfonyRequest)
 {
     Utf8\Bootup::initAll();
     // Enables the portability layer and configures PHP for UTF-8
     Utf8\Bootup::filterRequestUri();
     // Redirects to an UTF-8 encoded URL if it's not already the case
     Utf8\Bootup::filterRequestInputs();
     // Normalizes HTTP inputs to UTF-8 NFC
     $file = $this->appPath->getCacheDir() . 'container.php';
     $this->dumpContainer($symfonyRequest, $file);
     require_once $file;
     $this->container = new \ACP3ServiceContainer();
     $this->container->set('core.environment.application_path', $this->appPath);
     $this->container->set('core.http.symfony_request', $symfonyRequest);
 }
开发者ID:acp3,项目名称:core,代码行数:18,代码来源:Bootstrap.php

示例2: __construct

 /**
  * Application constructor.
  *
  * @param object $loader The autoloader instance.
  * @param array $config The custom configuration of the application.
  * @param string $appPath The application absolute path.
  * @param array $classesMap The custom classes map of the application.
  */
 public function __construct($loader, array $config = [], $appPath = null, array $classesMap = [])
 {
     # Utilities
     $this->utilities = new Utilities($this);
     # Register start time
     $this->utilities->registerStartTime();
     # Store application path
     $this->utilities->setApplicationPath($appPath);
     # Store classes map
     $this['class'] = $this->utilities->setClassesMap($classesMap);
     # Call container constructor
     parent::__construct($this->utilities->setConfiguration($config));
     # Register core services providers
     $this->register(new FilesystemServiceProvider());
     $this->register(new FinderServiceProvider());
     $this->register(new HttpServiceProvider());
     $this->register(new LoggerServiceProvider());
     $this->register(new MessagesServiceProvider());
     $this->register(new RouterServiceProvider());
     $this->register(new SupportServiceProvider());
     $this->register(new TemplatingServiceProvider());
     $this->register(new TriggersServiceProvider());
     # Enables the portablity layer and configures PHP for UTF-8
     Utf8Bootup::initAll();
     # Redirects to an UTF-8 encoded URL if it's not already the case
     Utf8Bootup::filterRequestUri();
     # Normalizes HTTP inputs to UTF-8 NFC
     Utf8Bootup::filterRequestInputs();
     # Print errors in debug mode
     if ($this['debug']) {
         $whoops = new WhoopsRun();
         $whoops->pushHandler(new WhoopsHandler());
         $whoops->register();
     } else {
         ErrorHandler::register($this['phpLogger']);
     }
     # Only enable Kint in debug mode
     \Kint::enabled($this['debug']);
 }
开发者ID:forxer,项目名称:tao,代码行数:47,代码来源:Application.php

示例3:

 * ----------------------------------------------------------------------------
 */
use Concrete\Core\Application\Application;
use Concrete\Core\Asset\AssetList;
use Concrete\Core\File\Type\TypeList;
use Concrete\Core\Foundation\ClassAliasList;
use Concrete\Core\Foundation\Service\ProviderList;
use Concrete\Core\Permission\Key\Key as PermissionKey;
use Concrete\Core\Support\Facade\Facade;
use Patchwork\Utf8\Bootup as PatchworkUTF8;
/**
 * ----------------------------------------------------------------------------
 * Handle text encoding.
 * ----------------------------------------------------------------------------
 */
PatchworkUTF8::initAll();
/**
 * ----------------------------------------------------------------------------
 * Instantiate concrete5.
 * ----------------------------------------------------------------------------
 */
/** @var Application $cms */
$cms = (require DIR_APPLICATION . '/bootstrap/start.php');
$cms->instance('app', $cms);
// Bind fully application qualified class names
$cms->instance('Concrete\\Core\\Application\\Application', $cms);
$cms->instance('Illuminate\\Container\\Container', $cms);
/**
 * ----------------------------------------------------------------------------
 * Bind the IOC container to our facades
 * Completely indebted to Taylor Otwell & Laravel for this.
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:31,代码来源:start.php

示例4: isSetLocaleWorking

 /**
  * Check if the setlocal call does not work. This can happen if the right
  * local packages are not available on the server.
  *
  * @return bool
  */
 public static function isSetLocaleWorking()
 {
     // setlocale test is pointless on Windows
     if (OC_Util::runningOnWindows()) {
         return true;
     }
     \Patchwork\Utf8\Bootup::initLocale();
     if ('' === basename('§')) {
         return false;
     }
     return true;
 }
开发者ID:pinoniq,项目名称:core,代码行数:18,代码来源:util.php

示例5: init

 public static function init()
 {
     // calculate the root directories
     OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));
     // register autoloader
     $loaderStart = microtime(true);
     require_once __DIR__ . '/autoloader.php';
     self::$loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib', OC::$SERVERROOT . '/core', OC::$SERVERROOT . '/settings', OC::$SERVERROOT . '/ocs', OC::$SERVERROOT . '/ocs-provider', OC::$SERVERROOT . '/3rdparty']);
     spl_autoload_register(array(self::$loader, 'load'));
     $loaderEnd = microtime(true);
     self::$CLI = php_sapi_name() == 'cli';
     try {
         self::initPaths();
         // setup 3rdparty autoloader
         $vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
         if (!file_exists($vendorAutoLoad)) {
             throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty". Running "git submodule update --init" will initialize the git submodule that handles the subfolder "3rdparty".');
         }
         require_once $vendorAutoLoad;
     } catch (\RuntimeException $e) {
         OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
         // we can't use the template error page here, because this needs the
         // DI container which isn't available yet
         print $e->getMessage();
         exit;
     }
     foreach (OC::$APPSROOTS as $appRoot) {
         self::$loader->addValidRoot($appRoot['path']);
     }
     // setup the basic server
     self::$server = new \OC\Server(\OC::$WEBROOT);
     \OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
     \OC::$server->getEventLogger()->start('boot', 'Initialize');
     // Don't display errors and log them
     error_reporting(E_ALL | E_STRICT);
     @ini_set('display_errors', 0);
     @ini_set('log_errors', 1);
     date_default_timezone_set('UTC');
     //try to configure php to enable big file uploads.
     //this doesn´t work always depending on the webserver and php configuration.
     //Let´s try to overwrite some defaults anyways
     //try to set the maximum execution time to 60min
     @set_time_limit(3600);
     @ini_set('max_execution_time', 3600);
     @ini_set('max_input_time', 3600);
     //try to set the maximum filesize to 10G
     @ini_set('upload_max_filesize', '10G');
     @ini_set('post_max_size', '10G');
     @ini_set('file_uploads', '50');
     self::setRequiredIniValues();
     self::handleAuthHeaders();
     self::registerAutoloaderCache();
     // initialize intl fallback is necessary
     \Patchwork\Utf8\Bootup::initIntl();
     OC_Util::isSetLocaleWorking();
     if (!defined('PHPUNIT_RUN')) {
         $logger = \OC::$server->getLogger();
         OC\Log\ErrorHandler::setLogger($logger);
         if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
             OC\Log\ErrorHandler::register(true);
             set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
         } else {
             OC\Log\ErrorHandler::register();
         }
     }
     // register the stream wrappers
     stream_wrapper_register('fakedir', 'OC\\Files\\Stream\\Dir');
     stream_wrapper_register('static', 'OC\\Files\\Stream\\StaticStream');
     stream_wrapper_register('close', 'OC\\Files\\Stream\\Close');
     stream_wrapper_register('quota', 'OC\\Files\\Stream\\Quota');
     stream_wrapper_register('oc', 'OC\\Files\\Stream\\OC');
     \OC::$server->getEventLogger()->start('init_session', 'Initialize session');
     OC_App::loadApps(array('session'));
     if (!self::$CLI) {
         self::initSession();
     }
     \OC::$server->getEventLogger()->end('init_session');
     self::initTemplateEngine();
     self::checkConfig();
     self::checkInstalled();
     OC_Response::addSecurityHeaders();
     if (self::$server->getRequest()->getServerProtocol() === 'https') {
         ini_set('session.cookie_secure', true);
     }
     if (!defined('OC_CONSOLE')) {
         $errors = OC_Util::checkServer(\OC::$server->getConfig());
         if (count($errors) > 0) {
             if (self::$CLI) {
                 // Convert l10n string into regular string for usage in database
                 $staticErrors = [];
                 foreach ($errors as $error) {
                     echo $error['error'] . "\n";
                     echo $error['hint'] . "\n\n";
                     $staticErrors[] = ['error' => (string) $error['error'], 'hint' => (string) $error['hint']];
                 }
                 try {
                     \OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors));
                 } catch (\Exception $e) {
                     echo 'Writing to database failed';
                 }
//.........这里部分代码省略.........
开发者ID:krsvital,项目名称:core,代码行数:101,代码来源:base.php

示例6: spl_autoload_register

// increase maximum execution time for php scripts
// (does not work in safe mode)
@set_time_limit(120);
// include composer autoloader (if available)
if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) {
    require INSTALL_PATH . 'vendor/autoload.php';
}
// include Roundcube Framework
require_once 'Roundcube/bootstrap.php';
// register autoloader for rcmail app classes
spl_autoload_register('rcmail_autoload');
// backward compatybility (to be removed)
require_once INSTALL_PATH . 'program/include/bc.php';
// load the UTF-8 portablity layer from Patchwor
if (!function_exists('iconv') || !function_exists('utf8_encode') || !extension_loaded('mbstring')) {
    \Patchwork\Utf8\Bootup::initAll();
}
/**
 * PHP5 autoloader routine for dynamic class loading
 */
function rcmail_autoload($classname)
{
    if (strpos($classname, 'rcmail') === 0) {
        $filepath = INSTALL_PATH . "program/include/{$classname}.php";
        if (is_readable($filepath)) {
            include_once $filepath;
            return true;
        }
    }
    return false;
}
开发者ID:alecchisi,项目名称:roundcubemail,代码行数:31,代码来源:iniset.php

示例7: with

// Emulate PHP 5.4 feature that allows us to create/use an object without a temporary.
// PHP 5.4: (new X)->y()
// PHP 5.3: with(new X)->y()
function with($x)
{
    return $x;
}
// Use the patchwork/utf8 library to:
// 1) set all PHP defaults to UTF-8
// 2) create shims for missing mb_string functions such as mb_strlen()
// 3) check that requests are valid UTF-8
\Patchwork\Utf8\Bootup::initAll();
// Enables the portablity layer and configures PHP for UTF-8
\Patchwork\Utf8\Bootup::filterRequestUri();
// Redirects to an UTF-8 encoded URL if it's not already the case
\Patchwork\Utf8\Bootup::filterRequestInputs();
// Normalizes HTTP inputs to UTF-8 NFC
// Use the fisharebest/ext-calendar library to
// 1) provide shims for the PHP ext/calendar extension, such as JewishToJD()
// 2) provide calendar conversions for the Arabic and Persian calendars
\Fisharebest\ExtCalendar\Shim::create();
// Split the request protocol://host:port/path/to/script.php?var=value into parts
// WT_SERVER_NAME  = protocol://host:port
// WT_SCRIPT_PATH  = /path/to/   (begins and ends with /)
// WT_SCRIPT_NAME  = script.php  (already defined in the calling script)
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
define('WT_SERVER_NAME', ($https ? 'https://' : 'http://') . (empty($_SERVER['SERVER_NAME']) ? '' : $_SERVER['SERVER_NAME']) . (empty($_SERVER['SERVER_PORT']) || !$https && $_SERVER['SERVER_PORT'] == 80 || $https && $_SERVER['SERVER_PORT'] == 443 ? '' : ':' . $_SERVER['SERVER_PORT']));
// REDIRECT_URL should be set in the case of Apache following a RedirectRule
// SCRIPT_NAME should always be correct, but is not always present.
// PHP_SELF should always be present, but may have trailing path: /path/to/script.php/FOO/BAR
if (!empty($_SERVER['REDIRECT_URL'])) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:session.php

示例8: init

	public static function init() {
		// register autoloader
		$loaderStart = microtime(true);
		require_once __DIR__ . '/autoloader.php';
		self::$loader = new \OC\Autoloader();
		spl_autoload_register(array(self::$loader, 'load'));
		$loaderEnd = microtime(true);

		self::initPaths();

		// setup 3rdparty autoloader
		$vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
		if (file_exists($vendorAutoLoad)) {
			require_once $vendorAutoLoad;
		} else {
			OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
			// we can't use the template error page here, because this needs the
			// DI container which isn't available yet
			print('Composer autoloader not found, unable to continue. Check the folder "3rdparty".');
			exit();
		}

		// setup the basic server
		self::$server = new \OC\Server(\OC::$WEBROOT);
		\OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
		\OC::$server->getEventLogger()->start('boot', 'Initialize');

		// set some stuff
		//ob_start();
		error_reporting(E_ALL | E_STRICT);
		if (defined('DEBUG') && DEBUG) {
			ini_set('display_errors', 1);
		}
		self::$CLI = (php_sapi_name() == 'cli');

		date_default_timezone_set('UTC');
		ini_set('arg_separator.output', '&');

		//try to configure php to enable big file uploads.
		//this doesn´t work always depending on the webserver and php configuration.
		//Let´s try to overwrite some defaults anyways

		//try to set the maximum execution time to 60min
		@set_time_limit(3600);
		@ini_set('max_execution_time', 3600);
		@ini_set('max_input_time', 3600);

		//try to set the maximum filesize to 10G
		@ini_set('upload_max_filesize', '10G');
		@ini_set('post_max_size', '10G');
		@ini_set('file_uploads', '50');

		self::handleAuthHeaders();
		self::registerAutoloaderCache();

		// initialize intl fallback is necessary
		\Patchwork\Utf8\Bootup::initIntl();
		OC_Util::isSetLocaleWorking();

		if (!defined('PHPUNIT_RUN')) {
			OC\Log\ErrorHandler::setLogger(OC_Log::$object);
			if (defined('DEBUG') and DEBUG) {
				OC\Log\ErrorHandler::register(true);
				set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
			} else {
				OC\Log\ErrorHandler::register();
			}
		}

		// register the stream wrappers
		stream_wrapper_register('fakedir', 'OC\Files\Stream\Dir');
		stream_wrapper_register('static', 'OC\Files\Stream\StaticStream');
		stream_wrapper_register('close', 'OC\Files\Stream\Close');
		stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
		stream_wrapper_register('oc', 'OC\Files\Stream\OC');

		\OC::$server->getEventLogger()->start('init_session', 'Initialize session');
		OC_App::loadApps(array('session'));
		if (!self::$CLI) {
			self::initSession();
		}
		\OC::$server->getEventLogger()->end('init_session');
		self::initTemplateEngine();
		self::checkConfig();
		self::checkInstalled();
		self::checkSSL();
		OC_Response::addSecurityHeaders();

		$errors = OC_Util::checkServer(\OC::$server->getConfig());
		if (count($errors) > 0) {
			if (self::$CLI) {
				foreach ($errors as $error) {
					echo $error['error'] . "\n";
					echo $error['hint'] . "\n\n";
				}
			} else {
				OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
				OC_Template::printGuestPage('', 'error', array('errors' => $errors));
			}
			exit;
//.........这里部分代码省略.........
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:101,代码来源:base.php

示例9: gethostname

<?php

//-------------------------------------------------------------------------------------
// autoloading
//-------------------------------------------------------------------------------------
require_once __DIR__ . '/vendor/autoload.php';
//-------------------------------------------------------------------------------------
// initializing components
//-------------------------------------------------------------------------------------
\Patchwork\Utf8\Bootup::initMbstring();
//-------------------------------------------------------------------------------------
// determining environment
//-------------------------------------------------------------------------------------
$host = gethostname();
$envs = (require_once __DIR__ . '/environment.php');
$env = in_array($host, $envs['production']) ? 'production' : in_array($host, $envs['staging']) ? 'staging' : 'development';
$mod = getenv('OITO_MODULE') ?: 'frontend';
$dir = __DIR__;
//-------------------------------------------------------------------------------------
// php configuration
//-------------------------------------------------------------------------------------
date_default_timezone_set('UTC');
ini_set('error_reporting', E_ALL);
ini_set('display_errors', (int) ($env === 'development'));
//-------------------------------------------------------------------------------------
// include the config based on the environment
//-------------------------------------------------------------------------------------
$config1 = (require_once __DIR__ . '/config/production.php');
$config2 = $env !== 'production' ? require_once sprintf('%s/config/%s.php', __DIR__, $env) : [];
$config3 = sprintf('%s/module/%s/config/%s.php', __DIR__, $mod, $env);
$config = Zend\Stdlib\ArrayUtils::merge($config1, $config2);
开发者ID:oito,项目名称:php-micro-skeleton,代码行数:31,代码来源:init.php

示例10: ProviderList

 */
$list = new ProviderList($cms);
$list->registerProviders($config->get('app.providers'));
/**
 * ----------------------------------------------------------------------------
 * Setup file cache directories. Has to come after we define services
 * because we use the file service.
 * ----------------------------------------------------------------------------
 */
$cms->setupFilesystem();
/**
 * ----------------------------------------------------------------------------
 * Handle text encoding.
 * ----------------------------------------------------------------------------
 */
Bootup::initAll();
/**
 * ----------------------------------------------------------------------------
 * Registries for theme paths, assets, routes and file types.
 * ----------------------------------------------------------------------------
 */
$asset_list = AssetList::getInstance();
$asset_list->registerMultiple($config->get('app.assets', array()));
$asset_list->registerGroupMultiple($config->get('app.asset_groups', array()));
Route::registerMultiple($config->get('app.routes'));
Route::setThemesByRoutes($config->get('app.theme_paths', array()));
$type_list = TypeList::getInstance();
$type_list->defineMultiple($config->get('app.file_types', array()));
$type_list->defineImporterAttributeMultiple($config->get('app.importer_attributes', array()));
/**
 * ----------------------------------------------------------------------------
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:start.php

示例11: spl_autoload_register

if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) {
    require INSTALL_PATH . 'vendor/autoload.php';
}
// include Roundcube Framework
require_once 'Roundcube/bootstrap.php';
// register autoloader for rcmail app classes
spl_autoload_register('rcmail_autoload');
// backward compatybility (to be removed)
require_once INSTALL_PATH . 'program/include/bc.php';
// load the UTF-8 portability layers from Patchwork
// don't load mbstring layer as it conflicts with Roundcube Framework (#1490280)
if (!function_exists('iconv')) {
    \Patchwork\Utf8\Bootup::initIconv();
}
if (!function_exists('utf8_encode')) {
    \Patchwork\Utf8\Bootup::initUtf8Encode();
}
/**
 * PHP5 autoloader routine for dynamic class loading
 */
function rcmail_autoload($classname)
{
    if (strpos($classname, 'rcmail') === 0) {
        $filepath = INSTALL_PATH . "program/include/{$classname}.php";
        if (is_readable($filepath)) {
            include_once $filepath;
            return true;
        }
    }
    return false;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:31,代码来源:iniset.php

示例12: boot

 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     Bootup::initAll();
     $this->container->addScope(new Scope(self::SCOPE_BACKEND, 'request'));
     $this->container->addScope(new Scope(self::SCOPE_FRONTEND, 'request'));
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:9,代码来源:ContaoCoreBundle.php

示例13: boot

 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     Bootup::initAll();
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:7,代码来源:ContaoCoreBundle.php


注:本文中的Patchwork\Utf8\Bootup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。