本文整理汇总了PHP中Configure::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::getInstance方法的具体用法?PHP Configure::getInstance怎么用?PHP Configure::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$this->name = 'configuration';
$themes_config = $themes_fallback = array();
$Configure =& Configure::getInstance('jreviews');
$App =& App::getInstance('jreviews');
$ThemeArray = $App->jreviewsPaths['Theme'];
foreach ($ThemeArray as $theme_name => $files) {
if (!isset($themes_config[$theme_name]) && isset($files['.info']) && $files['.info']['configuration'] == 1) {
$themes_config[$theme_name] = $files['.info']['title'] . ' (' . $files['.info']['location'] . ')';
}
if (!isset($themes_mobile[$theme_name]) && isset($files['.info']) && $files['.info']['configuration'] == 1) {
$themes_mobile[$theme_name] = $files['.info']['title'] . ' (' . $files['.info']['location'] . ')';
}
if (!isset($themes_fallback[$theme_name]) && isset($files['.info']) && $files['.info']['fallback'] == 1) {
$themes_fallback[$theme_name] = $files['.info']['title'] . ' (' . $files['.info']['location'] . ')';
}
if ($files['.info']['mobile'] == 1) {
$themes_config[$theme_name] = $themes_config[$theme_name] . ' -mobile';
$themes_mobile[$theme_name] = $themes_mobile[$theme_name] . ' -mobile';
}
$themes_description[$theme_name] = $files['.info']['description'];
}
unset($ThemeArray);
unset($App);
$this->set(array('stats' => $this->stats, 'version' => $this->Config->version, 'Config' => $this->Config, 'themes_config' => $themes_config, 'themes_mobile' => empty($themes_mobile) ? array('' => 'No theme available') : $themes_mobile, 'themes_fallback' => $themes_fallback, 'themes_description' => $themes_description));
return $this->render();
}
示例2: write
/**
* Accesseur en écriture des données de la classe
*
* @param varchar $var Variable à modifier
* @param mixed $value Valeur de la variable à modifier
* @version 0.1 - 29/12/2011
*/
static function write($var, $value)
{
$_this = Configure::getInstance();
//On va créer une instence de la classe car en static l'objet $this n'est pas accessible
$_this->{$var} = $value;
unset($o);
}
示例3: _readConfigure
function _readConfigure()
{
$configure = Configure::getInstance();
$config_array = array();
$start = false;
foreach ($configure as $key => $value) {
if ($key == "SettingsEnd") {
break;
}
if ($start) {
foreach ($value as $key2 => $value2) {
if (is_array($value2)) {
foreach ($value2 as $key3 => $value3) {
$thekey = $key . "." . $key2 . "." . $key3;
$config_array[$thekey] = $value3;
}
} else {
$thekey = $key . "." . $key2;
$config_array[$thekey] = $value2;
}
//Configure::write($thekey, $value2);
//echo $key . "." . $key2 . "." . $value2 . "<br />\n";
}
}
if ($key == "SettingsStart") {
$start = true;
}
}
return $config_array;
}
示例4: return_packages
/**
* Return all packeges included
*
* @return array
* @access public
*/
function return_packages()
{
$_this =& Configure::getInstance();
if (count($_this->packages) > 0) {
return $_this->packages;
} else {
return array();
}
}
示例5: _initialize
function _initialize()
{
Configure::write('localePaths', am(Configure::getInstance()->localePaths, dirname(dirname(dirname(__FILE__))) . DS . 'locale' . DS));
Configure::write('Cache.disable', true);
if (!defined('DEFAULT_LANGUAGE')) {
define('DEFAULT_LANGUAGE', 'pt-br');
}
if (!empty($this->params['proxy'])) {
$this->proxy = $this->params['proxy'];
}
}
示例6: array
/**
* &getInstance method
*
* @param bool $boot
* @access public
* @return void
*/
function &getInstance($boot = true)
{
/**
* instance property
*
* @var array
* @access public
*/
static $instance = array();
if (!$instance) {
$instance[0] =& Configure::getInstance();
$instance[0]->__loadBootstrap(false);
}
return $instance[0];
}
示例7: __parseUrl
function __parseUrl($url)
{
$paths = Configure::getInstance();
$params = Router::parse(Router::url($url));
if ($paths->Routing['prefixes']) {
if (isset($params[$paths->Routing['prefixes'][0]])) {
if (empty($params['action'])) {
$params['action'] = $paths->Routing['prefixes'][0] . '_' . 'index';
} else {
$params['action'] = $paths->Routing['prefixes'][0] . '_' . $params['action'];
}
} elseif (strpos($params['action'], $paths->Routing['prefixes'][0]) === 0) {
$privateAction = true;
}
}
return $params;
}
示例8: paths
/**
* Get CakePHP basic paths as an indexed array.
* Resulting array will contain array of paths
* indexed by: Models, Behaviors, Controllers,
* Components, and Helpers.
*
* @return array Array of paths indexed by type
*/
function paths()
{
$directories = Configure::getInstance();
$paths = array();
foreach ($directories->modelPaths as $path) {
$paths['Models'][] = $path;
}
foreach ($directories->behaviorPaths as $path) {
$paths['Behaviors'][] = $path;
}
foreach ($directories->controllerPaths as $path) {
$paths['Controllers'][] = $path;
}
foreach ($directories->componentPaths as $path) {
$paths['Components'][] = $path;
}
foreach ($directories->helperPaths as $path) {
$paths['Helpers'][] = $path;
}
if (!class_exists('Folder')) {
App::import('Core', 'Folder');
}
$folder =& new Folder(APP . 'plugins' . DS);
$plugins = $folder->ls();
$classPaths = array('models', 'models' . DS . 'behaviors', 'controllers', 'controllers' . DS . 'components', 'views' . DS . 'helpers');
foreach ($plugins[0] as $plugin) {
foreach ($classPaths as $path) {
if (strpos($path, DS) !== false) {
$key = explode(DS, $path);
$key = $key[1];
} else {
$key = $path;
}
$folder->path = APP . 'plugins' . DS . $plugin . DS . $path;
$paths[Inflector::camelize($plugin)][Inflector::camelize($key)][] = $folder->path;
}
}
return $paths;
}
示例9: _getViewFileName
function _getViewFileName($action)
{
$action = Inflector::underscore($action);
$paths = Configure::getInstance();
$type = null;
if (empty($action)) {
$action = $this->action;
}
$position = strpos($action, '..');
if ($position === false) {
} else {
$action = explode('/', $action);
$i = array_search('..', $action);
unset($action[$i - 1]);
unset($action[$i]);
$action = '..' . DS . implode(DS, $action);
}
foreach ($paths->viewPaths as $path) {
if (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext)) {
$viewFileName = $path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext;
return $viewFileName;
}
}
// added for .ctp viewPath fallback
foreach ($paths->viewPaths as $path) {
if (file_exists($path . $this->viewPath . DS . $type . $action . '.ctp')) {
$viewFileName = $path . $this->viewPath . DS . $type . $action . '.ctp';
return $viewFileName;
}
}
if ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . $type . $action . '.ctp')) {
} elseif ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $this->viewPath . DS . $type . $action . '.ctp')) {
} else {
$viewFileName = VIEWS . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext;
}
return $viewFileName;
}
示例10: testStaticAssets
/**
* testStaticAssets method
*
* @access public
* @return void
*/
function testStaticAssets()
{
Router::reload();
$Configure = Configure::getInstance();
$Configure->__objects = null;
App::build(array('plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS), 'vendors' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS)));
$Dispatcher =& new TestDispatcher();
Configure::write('debug', 0);
ob_start();
$Dispatcher->dispatch('/img/test.jpg');
$result = ob_get_clean();
$file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'img' . DS . 'test.jpg');
$this->assertEqual($file, $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('css/test_asset.css');
ob_start();
$Dispatcher->cached('css/test_asset.css');
$result = ob_get_clean();
$this->assertEqual('this is the test asset css file', $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css');
ob_start();
$Dispatcher->cached('test_plugin/css/test_plugin_asset.css');
$result = ob_get_clean();
$this->assertEqual('this is the test plugin asset css file', $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/img/cake.icon.gif');
ob_start();
$Dispatcher->cached('test_plugin/img/cake.icon.gif');
$result = ob_get_clean();
$file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'vendors' . DS . 'img' . DS . 'cake.icon.gif');
$this->assertEqual($file, $result);
header('Content-type: text/html');
//reset the header content-type without page can render as plain text.
}
示例11: endTest
/**
* Clean up after yourself
*
* @return void
* @access public
*/
public function endTest()
{
$Configure = Configure::getInstance();
$Configure = $this->_Configure;
MiCache::clear();
}
示例12: _getPluginControllerNames
/**
* Get the names of the plugin controllers ...
*
* This function will get an array of the plugin controller names, and
* also makes sure the controllers are available for us to get the
* method names by doing an App::import for each plugin controller.
*
* @return array of plugin names.
*
*/
function _getPluginControllerNames()
{
App::import('Core', 'File', 'Folder');
$paths = Configure::getInstance();
$folder =& new Folder();
$folder->cd(APP . 'plugins');
// Get the list of plugins
$Plugins = $folder->read();
$Plugins = $Plugins[0];
$arr = array();
// Loop through the plugins
foreach ($Plugins as $pluginName) {
// Change directory to the plugin
$didCD = $folder->cd(APP . 'plugins' . DS . $pluginName . DS . 'controllers');
// Get a list of the files that have a file name that ends
// with controller.php
$files = $folder->findRecursive('.*_controller\\.php');
// Loop through the controllers we found in the plugins directory
foreach ($files as $fileName) {
// Get the base file name
$file = basename($fileName);
// Get the controller name
$file = Inflector::camelize(substr($file, 0, strlen($file) - strlen('_controller.php')));
if (!preg_match('/^' . Inflector::humanize($pluginName) . 'App/', $file)) {
if (!App::import('Controller', $pluginName . '.' . $file)) {
debug('Error importing ' . $file . ' for plugin ' . $pluginName);
} else {
/// Now prepend the Plugin name ...
// This is required to allow us to fetch the method names.
$arr[] = Inflector::humanize($pluginName) . "/" . $file;
}
}
}
}
return $arr;
}
示例13: setUp
function setUp()
{
$this->Configure =& Configure::getInstance();
}
示例14: version
/**
* Used to determine the current version of CakePHP.
*
* Usage `Configure::version();`
*
* @link http://book.cakephp.org/view/930/version
* @return string Current version of CakePHP
* @access public
*/
function version()
{
$_this =& Configure::getInstance();
if (!isset($_this->Cake['version'])) {
require CORE_PATH . 'cake' . DS . 'config' . DS . 'config.php';
$_this->write($config);
}
return $_this->Cake['version'];
}
示例15: define
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'include');
//define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . 'cake' . DS);
//define('APP', ROOT.DS.APP_DIR.DS);
define('CONFIGS', CAKE . 'configs' . DS);
define('LIBS', CAKE . 'libs' . DS);
include CAKE . DS . 'basics.php';
include LIBS . DS . 'object.php';
include LIBS . DS . 'configure.php';
include LIBS . DS . 'inflector.php';
include LIBS . DS . 'cache.php';
include LIBS . DS . 'session.php';
include LIBS . DS . 'sanitize.php';
include CAKE . DS . 'compat.php';
$cConfigure =& Configure::getInstance(false);
// Config
Configure::write('Session.save', 'php');
Configure::write('Session.cookie', 'SSESSID');
Configure::write('Session.timeout', '120');
Configure::write('Session.start', true);
Configure::write('Session.checkAgent', true);
Configure::write('Security.level', 'high');
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
/*
Cache::config('default', array(
'engine' => 'File', //[required]
'duration' => 3600, //[optional]
'probability' => 100, //[optional]
'path' => SE_ROOT . DS . 'cache', //[optional] use system tmp directory - remember to use absolute path
'prefix' => 'se_', //[optional] prefix every cache file with this string