本文整理汇总了PHP中Configure::corePaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::corePaths方法的具体用法?PHP Configure::corePaths怎么用?PHP Configure::corePaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::corePaths方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMakeAbosolute
/**
* test that makeAbsolute adds on the CAKE_CORE_INCLUDE_PATH
*
* @return void
*/
function testMakeAbosolute()
{
$path = 'view/helpers/xml.php';
$roots = Configure::corePaths();
$result = $this->ApiConfig->makeAbsolute($path, $roots['libs']);
$this->assertEqual($result, $roots['libs'][0] . $path);
}
示例2: __paths
/**
* Return all possible paths to find view files in order
*
* ※ _paths より直接呼び出されるようにする為だけに、Viewクラスより中身をコピー
*
* @param string $plugin
* @return array paths
* @access protected
*/
function __paths($plugin = null, $cached = true)
{
if ($plugin === null && $cached === true && !empty($this->__paths)) {
return $this->__paths;
}
$paths = array();
$viewPaths = Configure::read('viewPaths');
$corePaths = array_flip(Configure::corePaths('view'));
if (!empty($plugin)) {
$count = count($viewPaths);
for ($i = 0; $i < $count; $i++) {
if (!isset($corePaths[$viewPaths[$i]])) {
$paths[] = $viewPaths[$i] . 'plugins' . DS . $plugin . DS;
}
}
$pluginPaths = Configure::read('pluginPaths');
$count = count($pluginPaths);
for ($i = 0; $i < $count; $i++) {
$paths[] = $pluginPaths[$i] . $plugin . DS . 'views' . DS;
}
}
$paths = array_merge($paths, $viewPaths);
if (empty($this->__paths)) {
$this->__paths = $paths;
}
return $paths;
}
示例3: startup
function startup()
{
$appPaths = array_diff(Configure::read('modelPaths'), Configure::corePaths('model'));
$this->models = Configure::listObjects('model', $appPaths, false);
if (empty($this->params['src'])) {
$this->params['src'] = ROOT . DS . 'src';
}
}
示例4: index
function index()
{
if (!empty($this->data)) {
$this->log("Trying To Save Settings:" . print_r($this->data, true), 'debug');
$this->SettingsHandler->setSettings('settings', $this->data);
}
$settings = $this->SettingsHandler->getSettings();
$this->log("Loading Settings:" . print_r($settings, true) . "\nCheck Paths:" . print_r(Configure::corePaths('cake'), true), 'debug');
$this->data = $settings;
}
示例5: initialize
/**
* Initialization method installs Simpletest and loads all plugins
*
* @return void
* @access public
*/
function initialize()
{
$corePath = Configure::corePaths('cake');
if (isset($corePath[0])) {
define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS);
} else {
define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
}
$this->__installSimpleTest();
require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_manager.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cli_reporter.php';
$plugins = Configure::listObjects('plugin');
foreach ($plugins as $p) {
$this->plugins[] = Inflector::underscore($p);
}
}
示例6: trimPath
/**
* Shortens file paths by replacing the application base path with 'APP', and the CakePHP core
* path with 'CORE'.
*
* @param string $path Path to shorten
* @return string Normalized path
* @access public
* @static
*/
function trimPath($path)
{
if (!defined('CAKE_CORE_INCLUDE_PATH') || !defined('APP')) {
return $path;
}
if (strpos($path, APP) === 0) {
return str_replace(APP, 'APP' . DS, $path);
} elseif (strpos($path, CAKE_CORE_INCLUDE_PATH) === 0) {
return str_replace(CAKE_CORE_INCLUDE_PATH, 'CORE', $path);
} elseif (strpos($path, ROOT) === 0) {
return str_replace(ROOT, 'ROOT', $path);
}
$corePaths = Configure::corePaths('cake');
foreach ($corePaths as $corePath) {
if (strpos($path, $corePath) === 0) {
return str_replace($corePath, 'CORE' . DS . 'cake' . DS, $path);
}
}
return $path;
}
示例7: define
if (!defined('WWW_ROOT')) {
define('WWW_ROOT', dirname(__FILE__) . DS);
}
if (!defined('CORE_PATH')) {
if (function_exists('ini_set') && ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'))) {
define('APP_PATH', null);
define('CORE_PATH', null);
} else {
define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
}
}
if (!(include CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}
$corePath = Configure::corePaths('cake');
if (isset($corePath[0])) {
define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS);
} else {
define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
}
require_once CAKE_TESTS_LIB . 'test_manager.php';
if (Configure::read('debug') < 1) {
die(__('Debug setting does not allow access to this url.', true));
}
if (!isset($_SERVER['SERVER_NAME'])) {
$_SERVER['SERVER_NAME'] = '';
}
if (empty($_GET['output'])) {
$_GET['output'] = 'html';
}
示例8: __destruct
/**
* Object destructor.
*
* Writes cache file if changes have been made to the $__map or $__paths
*
* @return void
* @access private
*/
function __destruct()
{
if ($this->__cache) {
$core = Configure::corePaths('cake');
unset($this->__paths[rtrim($core[0], DS)]);
Cache::write('dir_map', array_filter($this->__paths), '_cake_core_');
Cache::write('file_map', array_filter($this->__map), '_cake_core_');
}
}
示例9: startTest
/**
* setUp method
*
* @access public
* @return void
*/
function startTest()
{
$this->_get = $_GET;
$_GET = array();
$this->_post = $_POST;
$this->_files = $_FILES;
$this->_server = $_SERVER;
$this->_app = Configure::read('App');
Configure::write('App.base', false);
Configure::write('App.baseUrl', false);
Configure::write('App.dir', 'app');
Configure::write('App.webroot', 'webroot');
$this->_cache = Configure::read('Cache');
Configure::write('Cache.disable', true);
$this->_vendorPaths = Configure::read('vendorPaths');
$this->_pluginPaths = Configure::read('pluginPaths');
$this->_viewPaths = Configure::read('viewPaths');
$this->_controllerPaths = Configure::read('controllerPaths');
$this->_debug = Configure::read('debug');
Configure::write('controllerPaths', Configure::corePaths('controller'));
Configure::write('viewPaths', Configure::corePaths('view'));
}
示例10: _buildPaths
/**
* buildPaths method
*
* @return void
* @access protected
*/
function _buildPaths()
{
$this->paths = array('console' => array_pop(Configure::corePaths('cake')) . 'console' . DS . 'cake');
}
示例11: _loadFixtures
/**
* Load fixtures specified in var $fixtures.
*
* @access private
*/
function _loadFixtures()
{
if (!isset($this->fixtures) || empty($this->fixtures)) {
return;
}
if (!is_array($this->fixtures)) {
$this->fixtures = array_map('trim', explode(',', $this->fixtures));
}
$this->_fixtures = array();
foreach ($this->fixtures as $index => $fixture) {
$fixtureFile = null;
if (strpos($fixture, 'core.') === 0) {
$fixture = substr($fixture, strlen('core.'));
foreach (Configure::corePaths('cake') as $key => $path) {
$fixturePaths[] = $path . DS . 'tests' . DS . 'fixtures';
}
} elseif (strpos($fixture, 'app.') === 0) {
$fixture = substr($fixture, strlen('app.'));
$fixturePaths = array(TESTS . 'fixtures', VENDORS . 'tests' . DS . 'fixtures');
} elseif (strpos($fixture, 'plugin.') === 0) {
$parts = explode('.', $fixture, 3);
$pluginName = $parts[1];
$fixture = $parts[2];
$fixturePaths = array(APP . 'plugins' . DS . $pluginName . DS . 'tests' . DS . 'fixtures', TESTS . 'fixtures', VENDORS . 'tests' . DS . 'fixtures');
} else {
$fixturePaths = array(TESTS . 'fixtures', VENDORS . 'tests' . DS . 'fixtures', TEST_CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'tests' . DS . 'fixtures');
}
foreach ($fixturePaths as $path) {
if (is_readable($path . DS . $fixture . '_fixture.php')) {
$fixtureFile = $path . DS . $fixture . '_fixture.php';
break;
}
}
if (isset($fixtureFile)) {
require_once $fixtureFile;
$fixtureClass = Inflector::camelize($fixture) . 'Fixture';
$this->_fixtures[$this->fixtures[$index]] =& new $fixtureClass($this->db);
$this->_fixtureClassMap[Inflector::camelize($fixture)] = $this->fixtures[$index];
}
}
if (empty($this->_fixtures)) {
unset($this->_fixtures);
}
}
示例12: __paths
/**
* Returns default paths to search
*
* @param string $type type of object to be searched
* @return array list of paths
* @access private
*/
function __paths($type)
{
if (strtolower($type) === 'core') {
$path = Configure::corePaths();
foreach ($path as $key => $value) {
$count = count($key);
for ($i = 0; $i < $count; $i++) {
$paths[] = $path[$key][$i];
}
}
return $paths;
}
$paths = Configure::read(strtolower($type) . 'Paths');
if (empty($paths)) {
if (strtolower($type) === 'plugin') {
$paths = array(APP . 'plugins' . DS);
} elseif (strtolower($type) === 'vendor') {
$paths = array(APP . 'vendors' . DS, VENDORS, APP . 'plugins' . DS);
} elseif (strtolower($type) === 'controller') {
$paths = array(APP . 'controllers' . DS, APP);
} elseif (strtolower($type) === 'model') {
$paths = array(APP . 'models' . DS, APP);
} elseif (strtolower($type) === 'view') {
$paths = array(APP . 'views' . DS);
}
}
return $paths;
}
示例13: __paths
/**
* Returns default paths to search
*
* @param string $type type of object to be searched
* @return array list of paths
* @access private
*/
function __paths($type)
{
if ($type === 'Core') {
$path = Configure::corePaths();
foreach ($path as $key => $value) {
$count = count($key);
for ($i = 0; $i < $count; $i++) {
$paths[] = $path[$key][$i];
}
}
return $paths;
}
$paths = Configure::read(strtolower($type) . 'Paths');
return $paths;
}
示例14: createShell
/**
* undocumented function
*
* @param string $data
* @return void
*/
function createShell($data = array())
{
$template = CONFIGS . 'templates' . DS;
$chaw = Configure::read('Content.base');
if (file_exists($template . 'chaw') && !file_exists($chaw . 'chaw')) {
$console = array_pop(Configure::corePaths('cake')) . 'console' . DS;
ob_start();
include $template . 'chaw';
$data = ob_get_clean();
$File = new File($chaw . 'chaw', true, 0775);
@chmod($File->pwd(), 0775);
return $File->write($data);
}
return true;
}
示例15: __models
function __models()
{
$appPaths = array_diff(Configure::read('modelPaths'), Configure::corePaths('model'));
$models = Configure::listObjects('model', $appPaths, false);
return $models;
}