本文整理汇总了PHP中restore_include_path函数的典型用法代码示例。如果您正苦于以下问题:PHP restore_include_path函数的具体用法?PHP restore_include_path怎么用?PHP restore_include_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了restore_include_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLocateFindsIncludePath
/**
* locate() should find paths from the include path
*
* @param string[] $paths
* @dataProvider provideTestLocateFindsIncludePath
* @see ConfigurationLocator::locate();
*/
public function testLocateFindsIncludePath($includePath, array $paths)
{
set_include_path(get_include_path() . PATH_SEPARATOR . $includePath);
$locator = new ConfigurationLocator($paths);
$configuration = $locator->locate();
$this->assertInstanceOf("malkusch\\bav\\Configuration", $configuration);
$this->assertEquals("test", $configuration->getTempDirectory());
restore_include_path();
}
示例2: testInitWithIncludePathConfiguration
/**
* Tests the initialization with a configuration from the include path.
*
* @see ConfigurationRegistry::classConstructor()
*/
public function testInitWithIncludePathConfiguration()
{
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . "/../data/");
ConfigurationRegistry::classConstructor();
$configuration = ConfigurationRegistry::getConfiguration();
$this->assertInstanceOf("malkusch\\bav\\Configuration", $configuration);
$this->assertEquals("test", $configuration->getTempDirectory());
restore_include_path();
}
示例3: isActive
/**
* Is the module active ?
*
* @return int
*/
public function isActive()
{
try {
set_include_path('/usr/share/php/');
$res = @(include_once 'FirePHPCore/FirePHP.class.php');
restore_include_path();
if ($res) {
return 1;
}
} catch (Exception $e) {
print '<!-- FirePHP not available into PHP -->' . "\n";
}
return -1;
}
示例4: __construct
function __construct($__DIR__)
{
set_include_path($__DIR__);
$c = \Pyrus\Config::singleton(dirname($__DIR__), dirname($__DIR__) . '/pearconfig.xml');
$c->bin_dir = $__DIR__ . '/bin';
restore_include_path();
$c->saveConfig();
$chan = new PEAR2\SimpleChannelServer\Channel('pear2.php.net', 'unit test channel');
$scs = new PEAR2\SimpleChannelServer\Main($chan, $__DIR__, dirname($__DIR__) . '/PEAR2');
$scs->saveChannel();
$this->chan = $chan;
$this->scs = $scs;
$this->__DIR__ = $__DIR__;
}
示例5: isActive
/**
* Is the module active ?
*
* @return boolean
*/
public function isActive()
{
global $conf;
try {
if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) {
$conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = '/usr/share/php';
}
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
$res = @(include_once 'ChromePhp.class.php');
restore_include_path();
if ($res) {
return 1;
}
} catch (Exception $e) {
print '<!-- ChromePHP not available into PHP -->' . "\n";
}
return -1;
}
示例6: isActive
/**
* Is the module active ?
*
* @return int
*/
public function isActive()
{
global $conf;
try {
if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) {
$conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path;
}
set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH);
$res = @(include_once self::$firephp_class_path);
restore_include_path();
if ($res) {
return 1;
} else {
return 0;
}
} catch (Exception $e) {
print '<!-- FirePHP not available into PHP -->' . "\n";
}
return -1;
}
示例7: isActive
/**
* Is the module active ?
*
* @return int
*/
public function isActive()
{
global $conf;
try {
if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) {
$conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/chromephp/';
}
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
//print 'rrrrr'.get_include_path();
$res = @(include_once 'ChromePhp.php');
if (!$res) {
$res = @(include_once 'ChromePhp.class.php');
}
restore_include_path();
if ($res) {
return 1;
}
} catch (Exception $e) {
print '<!-- ChromePHP not available into PHP -->' . "\n";
}
return -1;
}
示例8: openid_add_sreg_extension
/**
* Build an SReg attribute query extension if we've never seen this OpenID before.
*/
function openid_add_sreg_extension($extensions, $auth_request)
{
if (!get_user_by_openid($auth_request->endpoint->claimed_id)) {
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
require_once 'Auth/OpenID/SReg.php';
restore_include_path();
$extensions[] = Auth_OpenID_SRegRequest::build(array(), array('nickname', 'email', 'fullname'));
}
return $extensions;
}
示例9: dispatch
public static function dispatch($request)
{
$registry = Registry::getInstance();
$config = $registry->get('config');
$carray = $config->getArray();
self::$_request = $request;
if (self::$_request->isComponent()) {
$componente = self::$_request->getComponent();
restore_include_path();
set_include_path('../lib/' . PATH_SEPARATOR . get_include_path());
set_include_path('../app/Components/' . $componente . '/app/' . PATH_SEPARATOR . get_include_path());
set_include_path('../app/Components/' . $componente . '/app/Controller/' . PATH_SEPARATOR . get_include_path());
set_include_path('../app/Model/' . PATH_SEPARATOR . get_include_path());
self::initSite('../app/Components/' . $componente . '/app/Config/config.ini', $componente);
self::$_request->constructsFromGet();
}
if ($carray['general']['debug'] != true) {
ob_start();
}
$controller = self::$_request->getController();
$action = self::$_request->getAction();
$params = self::$_request->getParams();
self::preController();
$app = self::runController();
self::postController();
if ($carray['general']['debug'] != true) {
ob_end_clean();
}
// Manage view
ob_start();
$layout = NULL;
if (!empty($carray['general']['layout'])) {
$layout = $carray['general']['layout'];
}
$template = $app->getView()->getTemplate($layout);
self::loadTemplate($app->getView(), $template);
$output = ob_get_clean();
echo $output;
}
示例10: LoadTPL
function LoadTPL($TPLName, $Values = "")
{
global $TEMPLATES;
$TPLFile = MAINTEMPLATES . $TPLName . ".php";
if (is_file($TPLFile) && !strstr($TPLName, "..")) {
if (is_array($Values)) {
reset($Values);
while ($key = key($Values)) {
${"TPL_" . $key} = current($Values);
// lokale Variablen für die zu ersetzenden Werte erstellen
next($Values);
}
} else {
$Value = $Values;
}
ob_start("TemplateOB");
restore_include_path();
include $TPLFile;
// Template-Datei einbinden.
$Return = ob_get_clean();
$TEMPLATES[count($TEMPLATES)] = $TPLFile;
// DEBUG
return $Return;
} else {
Error("Unknown File: " . $TPLFile);
}
}
示例11: _dispatchEnd
function _dispatchEnd()
{
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $user, $auth, $template, $cache, $db, $config, $phpbb_hook;
global $action, $module, $mode, $starttime;
global $forum_id, $topic_id, $post_id, $user_id;
$contents = ob_get_contents();
ob_end_clean();
restore_include_path();
return $contents;
}
示例12: error_reporting
<?php
// disable array -> "Array" conversion notice
error_reporting(error_reporting() & ~E_NOTICE);
// originally came from ext/standard/tests/general_functions/include_path.phpt
var_dump(get_include_path());
var_dump(get_include_path("var"));
var_dump(restore_include_path());
var_dump(restore_include_path(""));
var_dump(set_include_path());
var_dump(get_include_path());
var_dump(set_include_path("var"));
var_dump(get_include_path());
var_dump(restore_include_path());
var_dump(get_include_path());
var_dump(set_include_path(".:/path/to/dir"));
var_dump(get_include_path());
var_dump(restore_include_path());
var_dump(get_include_path());
var_dump(set_include_path(""));
var_dump(get_include_path());
var_dump(restore_include_path());
var_dump(get_include_path());
var_dump(set_include_path(array()));
var_dump(get_include_path());
var_dump(restore_include_path());
var_dump(get_include_path());
echo "Done\n";
示例13: late_bind
/**
* Initialize required store and consumer and make a few sanity checks. This method
* does a lot of the heavy lifting to get everything initialized, so we don't call it
* until we actually need it.
*/
function late_bind($reload = false)
{
global $wpdb;
$this->core->log->debug('beginning late binding');
$this->enabled = true;
// Be Optimistic
if ($this->bind_done && !$reload) {
$this->core->log->debug('we\'ve already done the late bind... moving on');
return $this->uptodate();
}
$this->bind_done = true;
$f = @fopen('/dev/urandom', 'r');
if ($f === false) {
define('Auth_OpenID_RAND_SOURCE', null);
}
// include required JanRain OpenID library files
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
$this->core->log->debug('temporary include path for importing = ' . get_include_path());
require_once 'Auth/OpenID/Discover.php';
require_once 'Auth/OpenID/DatabaseConnection.php';
require_once 'Auth/OpenID/MySQLStore.php';
require_once 'Auth/OpenID/Consumer.php';
require_once 'Auth/OpenID/SReg.php';
restore_include_path();
$this->core->setStatus('database: WordPress\' table prefix', 'info', isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix);
$this->core->log->debug("Bootstrap -- checking tables");
if ($this->enabled) {
$store =& $this->getStore();
if (!$store) {
return;
}
// something broke
$this->enabled = $store->check_tables();
if (!$this->uptodate()) {
update_option('oid_plugin_enabled', true);
update_option('oid_plugin_revision', WPOPENID_PLUGIN_REVISION);
update_option('oid_db_revision', WPOPENID_DB_REVISION);
$this->uptodate();
}
} else {
$this->error = 'WPOpenID Core is Disabled!';
update_option('oid_plugin_enabled', false);
}
return $this->enabled;
}
示例14: restore
/**
* @return string
*/
public static function restore()
{
restore_include_path();
return static::get();
}
示例15: GenerateFile
/**
* Generates a php code using a template file
*
* @param string $strModuleName
* @param string $strFilename
* @param boolean $blnOverrideFlag whether we are using the _core template, or using a custom one
* @param mixed[] $mixArgumentArray
* @param boolean $blnSave whether or not to actually perform the save
* @throws QCallerException
* @throws Exception
* @return mixed returns the evaluated template or boolean save success.
*/
public function GenerateFile($strModuleName, $strFilename, $blnOverrideFlag, $mixArgumentArray, $blnSave = true)
{
// Figure out the actual TemplateFilePath
if ($blnOverrideFlag) {
$strTemplateFilePath = __QCUBED__ . QCodeGen::TemplatesPathCustom . $strModuleName . '/' . $strFilename;
} else {
$strTemplateFilePath = __QCUBED_CORE__ . QCodeGen::TemplatesPath . $strModuleName . '/' . $strFilename;
}
// Setup Debug/Exception Message
if (QCodeGen::DebugMode) {
_p("Evaluating {$strTemplateFilePath}<br/>", false);
}
// Check to see if the template file exists, and if it does, Load It
if (!file_exists($strTemplateFilePath)) {
throw new QCallerException('Template File Not Found: ' . $strTemplateFilePath);
}
// Evaluate the Template
if (substr($strFilename, strlen($strFilename) - 8) == '.tpl.php') {
// make sure paths are set up to pick up included files from both the override directory and _core directory
$strSearchPath = __QCUBED__ . QCodeGen::TemplatesPathCustom . $strModuleName . PATH_SEPARATOR . __QCUBED_CORE__ . QCodeGen::TemplatesPath . $strModuleName . PATH_SEPARATOR . get_include_path();
set_include_path($strSearchPath);
if ($strSearchPath != get_include_path()) {
throw new QCallerException('Can\'t override include path. Make sure your apache or server settings allow include paths to be overridden. ');
}
$strTemplate = $this->EvaluatePHP($strTemplateFilePath, $strModuleName, $mixArgumentArray, $templateSettings);
restore_include_path();
if (!isset($templateSettings) || !$templateSettings) {
// check if we have old style <template .../> settings
$templateSettings = $this->getTemplateSettings($strTemplateFilePath, $strTemplate);
}
} else {
$strTemplate = file_get_contents($strTemplateFilePath);
$strTemplate = $this->EvaluateTemplate($strTemplate, $strModuleName, $mixArgumentArray);
$templateSettings = $this->getTemplateSettings($strTemplateFilePath, $strTemplate);
}
$blnOverwriteFlag = QType::Cast($templateSettings['OverwriteFlag'], QType::Boolean);
$blnDocrootFlag = QType::Cast($templateSettings['DocrootFlag'], QType::Boolean);
$strTargetDirectory = QType::Cast($templateSettings['TargetDirectory'], QType::String);
$strDirectorySuffix = QType::Cast($templateSettings['DirectorySuffix'], QType::String);
$strTargetFileName = QType::Cast($templateSettings['TargetFileName'], QType::String);
if (is_null($blnOverwriteFlag) || is_null($strTargetFileName) || is_null($strTargetDirectory) || is_null($strDirectorySuffix) || is_null($blnDocrootFlag)) {
throw new Exception('the template settings cannot be null');
}
if ($blnSave && $strTargetDirectory) {
// Figure out the REAL target directory
if ($blnDocrootFlag) {
$strTargetDirectory = __DOCROOT__ . $strTargetDirectory . $strDirectorySuffix;
} else {
$strTargetDirectory = $strTargetDirectory . $strDirectorySuffix;
}
// Create Directory (if needed)
if (!is_dir($strTargetDirectory)) {
if (!QApplication::MakeDirectory($strTargetDirectory, 0777)) {
throw new Exception('Unable to mkdir ' . $strTargetDirectory);
}
}
// Save to Disk
$strFilePath = sprintf('%s/%s', $strTargetDirectory, $strTargetFileName);
if ($blnOverwriteFlag || !file_exists($strFilePath)) {
$intBytesSaved = file_put_contents($strFilePath, $strTemplate);
$this->setGeneratedFilePermissions($strFilePath);
return $intBytesSaved == strlen($strTemplate);
} else {
// Becuase we are not supposed to overwrite, we should return "true" by default
return true;
}
}
// Why Did We Not Save?
if ($blnSave) {
// We WANT to Save, but QCubed Configuration says that this functionality/feature should no longer be generated
// By definition, we should return "true"
return true;
}
// Running GenerateFile() specifically asking it not to save -- so return the evaluated template instead
return $strTemplate;
}