From 204ff6bcbb16f2f28dfc373a5297a5058f35c9d7 Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 22 Nov 2006 03:16:34 +0000 Subject: [PATCH] Refactoring Helper class and adding tags.php as a var. Removing old /config/tags.php git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3890 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/bootstrap.php | 7 -- cake/config/tags.php | 146 -------------------------------------- cake/libs/view/helper.php | 52 ++++++++++++-- cake/libs/view/view.php | 6 +- 4 files changed, 49 insertions(+), 162 deletions(-) delete mode 100644 cake/config/tags.php diff --git a/cake/bootstrap.php b/cake/bootstrap.php index d9d1c127a..e3fb562ff 100644 --- a/cake/bootstrap.php +++ b/cake/bootstrap.php @@ -41,7 +41,6 @@ if (!defined('PHP5')) { require LIBS . 'object.php'; require LIBS . 'session.php'; require LIBS . 'security.php'; - //require LIBS . 'neat_array.php'; require LIBS . 'inflector.php'; require LIBS . 'configure.php'; $paths = Configure::getInstance(); @@ -105,13 +104,7 @@ if (!defined('PHP5')) { } require CAKE . 'dispatcher.php'; - //require LIBS . 'model' . DS . 'connection_manager.php'; - //config('database'); - //if (!class_exists('AppModel')) { - // require LIBS . 'model' . DS . 'model.php'; - // loadModels(); - //} if (defined('CACHE_CHECK') && CACHE_CHECK === true) { if (empty($uri)) { $uri = setUri(); diff --git a/cake/config/tags.php b/cake/config/tags.php deleted file mode 100644 index febf632d7..000000000 --- a/cake/config/tags.php +++ /dev/null @@ -1,146 +0,0 @@ - - * Copyright (c) 2006, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright (c) 2006, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.app.config - * @since CakePHP v 0.2.9 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -$tags = array( - -// Tag template for a link tag. -'metalink' => '', - -// Tag template for a link. -'link' => '%s', - -// Tag template for a mailto: link. -'mailto' => '%s', - -// Tag template for opening form tag. -'form' => '
', - -// Tag template for an input type='text' tag. -'input' => '', - -// Tag template for an input type='textarea' tag -'textarea' => '', - -// Tag template for an input type='hidden' tag. -'hidden' => '', - -// Tag template for a textarea tag. -'textarea' => '', - -// Tag template for a input type='checkbox ' tag. -'checkbox' => '', - -// Tag template for a input type='radio' tag. -'radio' => '%s', - -// Tag template for a select opening tag. -'selectstart' => '', - -// Tag template for an empty select option tag. -'selectempty' => '', - -// Tag template for a select option tag. -'selectoption' => '', - -// Tag template for a closing select tag. -'selectend' => '', - -// Tag template for a option group tag. -'optiongroup' => '', -'optiongroupend' => '', - -// Tag template for a password tag. -'password' => '', - -// Tag template for a file input tag. -'file' => '', - -// Tag template for a file input tag with no associated model. -'file_no_model' => '', - -// Tag template for a submit button tag. -'submit' => '', - -// Tag template for a image input tag. -'submitimage' => '', - -// Tag template for an image tag. -'image' => '', - -// Tag template for a table header tag. -'tableheader' => '%s', - -// Tag template for table headers row tag. -'tableheaderrow' => '%s', - -// Tag template for a table cell tag. -'tablecell' => '%s', - -// Tag template for a table row tag. -'tablerow' => '%s', - -// Tag templates for a block-level element (DIV). -'block' => '%s', -'blockstart' => '', -'blockend' => '', - -// Tag templates for a paragraph element. -'para' => '%s

', -'parastart' => '', - -// Tag templates for a label element. -'label' => '', - -// Tag templates for fieldset and legend element. -'fieldset' => '
%s%s
', -'fieldsetstart' => '
%s', -'fieldsetend' => '
', -'legend' => '%s', - -// Tag template for a CSS link tag. -'css' => '', - -// Tag template for a CSS tag block. -'style' => '', - -// Tag template for a charset meta-tag. -'charset' => '', - -// Tag template for inline JavaScript. -'javascriptblock' => '', -'javascriptstart' => '' - -); diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index 004b932e3..b7bb46f4b 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -79,21 +79,61 @@ class Helper extends Overloadable { * @access public * @var array */ - var $tags = array(); + var $tags = array('metalink' => '', + 'link' => '%s', + 'mailto' => '%s', + 'form' => '', + 'input' => '', + 'textarea' => '', + 'hidden' => '', + 'textarea' => '', + 'checkbox' => '', + 'radio' => '%s', + 'selectstart' => '', + 'selectempty' => '', + 'selectoption' => '', + 'selectend' => '', + 'optiongroup' => '', + 'optiongroupend' => '', + 'password' => '', + 'file' => '', + 'file_no_model' => '', + 'submit' => '', + 'submitimage' => '', + 'image' => '', + 'tableheader' => '%s', + 'tableheaderrow' => '%s', + 'tablecell' => '%s', + 'tablerow' => '%s', + 'block' => '%s', + 'blockstart' => '', + 'blockend' => '', + 'para' => '%s

', + 'parastart' => '', + 'label' => '', + 'fieldset' => '
%s%s
', + 'fieldsetstart' => '
%s', + 'fieldsetend' => '
', + 'legend' => '%s', + 'css' => '', + 'style' => '', + 'charset' => '', + 'javascriptblock' => '', + 'javascriptstart' => ''); + /** * Parses tag templates into $this->tags. * * @return void */ function loadConfig() { - require(CAKE . 'config' . DS . 'tags.php'); - $cakeConfig = $tags; - if (file_exists(APP . 'config' . DS . 'tags.ini.php')) { $appConfig = $this->readConfigFile(APP . 'config' . DS . 'tags.ini.php'); - $cakeConfig = am($cakeConfig, $appConfig); + $this->tags = am($this->tags, $appConfig); } - return $cakeConfig; + return $this->tags; } /** * Finds URL for specified action. diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 56d7eae79..422412f71 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -783,9 +783,9 @@ class View extends Object { $camelBackedHelper = Inflector::variable($helper); - ${$camelBackedHelper} =& new $helperCn; - ${$camelBackedHelper}->view =& $this; - ${$camelBackedHelper}->tags = $tags; + ${$camelBackedHelper} =& new $helperCn(); + ${$camelBackedHelper}->view =& $this; + //${$camelBackedHelper}->tags = $tags; $vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin', 'namedArgs', 'argSeparator'); $c = count($vars);