Skip to content

Commit

Permalink
Adding file headers to config files in test app.
Browse files Browse the repository at this point in the history
Updating doc blocks.
Updating formatting.
  • Loading branch information
markstory committed Nov 15, 2009
1 parent 7a4793a commit 28d3488
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 17 deletions.
41 changes: 24 additions & 17 deletions cake/libs/configure.php
Expand Up @@ -130,12 +130,14 @@ function write($config, $value = null) {
/**
* Used to read information stored in the Configure instance.
*
* Usage
* Usage:
* {{{
* Configure::read('Name'); will return all values for Name
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
* }}}
*
* @link http://book.cakephp.org/view/413/read
* @param string $var Variable to obtain
* @link http://book.cakephp.org/view/413/read
* @param string $var Variable to obtain. Use '.' to access array elements.
* @return string value of Configure::$var
* @access public
*/
Expand Down Expand Up @@ -165,10 +167,12 @@ function read($var = 'debug') {
* Used to delete a variable from the Configure instance.
*
* Usage:
* {{{
* Configure::delete('Name'); will delete the entire Configure::Name
* Configure::delete('Name.key'); will delete only the Configure::Name[key]
* }}}
*
* @link http://book.cakephp.org/view/414/delete
* @link http://book.cakephp.org/view/414/delete
* @param string $var the var to be deleted
* @return void
* @access public
Expand All @@ -188,27 +192,28 @@ function delete($var = null) {
/**
* Loads a file from app/config/configure_file.php.
* Config file variables should be formated like:
* $config['name'] = 'value';
* These will be used to create dynamic Configure vars.
* `$config['name'] = 'value';`
* These will be used to create dynamic Configure vars. load() is also used to
* load stored config files created with Configure::store()
*
* Usage Configure::load('configure_file');
* - To load config files from app/config use `Configure::load('configure_file');`.
* - To load config files from a plugin `Configure::load('plugin.configure_file');`.
*
* @link http://book.cakephp.org/view/415/load
* @link http://book.cakephp.org/view/415/load
* @param string $fileName name of file to load, extension must be .php and only the name
* should be used, not the extenstion
* should be used, not the extenstion
* @return mixed false if file not found, void if load successful
* @access public
*/
function load($fileName) {
$found = false;
$pluginPath = false;
if(strpos($fileName, '.') !== false) {
$found = $pluginPath = false;
if (strpos($fileName, '.') !== false) {
$plugin = explode('.', $fileName, 2);
$pluginPath = App::pluginPath($plugin[0]);
}

if ($pluginPath && file_exists($pluginPath . 'config' . DS . $plugin[1] . '.php')) {
include($pluginPath . 'config' . DS . $plugin[1] . '.php');
include($pluginPath . 'config' . DS . $plugin[1] . '.php');
$found = true;
} elseif (file_exists(CONFIGS . $fileName . '.php')) {
include(CONFIGS . $fileName . '.php');
Expand Down Expand Up @@ -241,9 +246,9 @@ function load($fileName) {
/**
* Used to determine the current version of CakePHP.
*
* Usage Configure::version();
* Usage `Configure::version();`
*
* @link http://book.cakephp.org/view/416/version
* @link http://book.cakephp.org/view/416/version
* @return string Current version of CakePHP
* @access public
*/
Expand All @@ -260,9 +265,11 @@ function version() {
/**
* Used to write a config file to disk.
*
* {{{
* Configure::store('Model', 'class.paths', array('Users' => array(
* 'path' => 'users', 'plugin' => true
* )));
* }}}
*
* @param string $type Type of config file to write, ex: Models, Controllers, Helpers, Components
* @param string $name file name.
Expand Down Expand Up @@ -1231,8 +1238,8 @@ function __remove($name, $type, $plugin) {
/**
* Returns an array of filenames of PHP files in the given directory.
*
* @param string $path Path to scan for files
* @param string $suffix if false, return only directories. if string, match and return files
* @param string $path Path to scan for files
* @param string $suffix if false, return only directories. if string, match and return files
* @return array List of directories or files in directory
*/
function __list($path, $suffix = false, $extension = false) {
Expand Down
20 changes: 20 additions & 0 deletions cake/tests/test_app/plugins/test_plugin/config/load.php
@@ -1,3 +1,23 @@
<?php
/**
* Test Suite TestPlugin config file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.test_app
* @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
$config['plugin_load'] = '/test_app/plugins/test_plugin/config/load.php';
?>
20 changes: 20 additions & 0 deletions cake/tests/test_app/plugins/test_plugin/config/more.load.php
@@ -1,3 +1,23 @@
<?php
/**
* Test Suite TestPlugin config file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.test_app
* @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
$config['plugin_more_load'] = '/test_app/plugins/test_plugin/config/more.load.php';
?>

0 comments on commit 28d3488

Please sign in to comment.