From 28d3488cb2c47ea8c908a37178abbc9ac68d5af5 Mon Sep 17 00:00:00 2001 From: mark_story <mark@mark-story.com> Date: Sun, 15 Nov 2009 18:09:04 -0500 Subject: [PATCH] Adding file headers to config files in test app. Updating doc blocks. Updating formatting. --- cake/libs/configure.php | 41 +++++++++++-------- .../plugins/test_plugin/config/load.php | 20 +++++++++ .../plugins/test_plugin/config/more.load.php | 20 +++++++++ 3 files changed, 64 insertions(+), 17 deletions(-) diff --git a/cake/libs/configure.php b/cake/libs/configure.php index a8f4cd7f6..7c919de01 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -130,12 +130,14 @@ class Configure extends Object { /** * 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 */ @@ -165,10 +167,12 @@ class Configure extends Object { * 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 @@ -188,27 +192,28 @@ class Configure extends Object { /** * 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'); @@ -241,9 +246,9 @@ class Configure extends Object { /** * 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 */ @@ -260,9 +265,11 @@ class Configure extends Object { /** * 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. @@ -1231,8 +1238,8 @@ class App extends Object { /** * 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) { diff --git a/cake/tests/test_app/plugins/test_plugin/config/load.php b/cake/tests/test_app/plugins/test_plugin/config/load.php index 4074ddf0c..75c7e0bb2 100644 --- a/cake/tests/test_app/plugins/test_plugin/config/load.php +++ b/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'; ?> \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/config/more.load.php b/cake/tests/test_app/plugins/test_plugin/config/more.load.php index de3f167de..fe20ef087 100644 --- a/cake/tests/test_app/plugins/test_plugin/config/more.load.php +++ b/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'; ?> \ No newline at end of file