diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index 2a9aa6749..c85cecaf9 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -28,6 +28,11 @@ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ +/** + * Included libs + */ +uses('overloadable'); + /** * Backend for helpers. * @@ -36,7 +41,7 @@ * @package cake * @subpackage cake.cake.libs.view */ -class Helper extends Object { +class Helper extends Overloadable { /** * Base URL diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index db1969bbd..c80291145 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -36,7 +36,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class AjaxHelper extends Helper { +class AjaxHelper extends AppHelper { /** * Included helpers. @@ -105,8 +105,6 @@ class AjaxHelper extends Helper { * (using the url() format) that's called in the background using * XMLHttpRequest. The result of that request can then be inserted into a * DOM object whose id can be specified with options[update]. - * Usually, the result would be a partial prepared by the controller with - * either renderPartial or renderPartialCollection. * * Examples: * diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index 003631b8b..0ab95de8d 100644 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -36,7 +36,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class CacheHelper extends Helper{ +class CacheHelper extends AppHelper { /** * Array of strings replaced in cached views. * The strings are found between in views diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index bb47b3313..f29103eb5 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -53,7 +53,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class FormHelper extends Helper { +class FormHelper extends AppHelper { var $helpers = array('Html'); diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 9d1176b71..3b18afefa 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class HtmlHelper extends Helper { +class HtmlHelper extends AppHelper { /************************************************************************* * Public variables *************************************************************************/ diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index ebefccf8a..287bad19b 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -35,8 +35,9 @@ * @subpackage cake.cake.libs.view.helpers */ -class JavascriptHelper extends Helper{ +class JavascriptHelper extends AppHelper { + var $__scriptBuffer = null; var $_cachedEvents = array(); var $_cacheEvents = false; var $_cacheToFile = false; @@ -57,13 +58,20 @@ class JavascriptHelper extends Helper{ $this->_cachedEvents[] = $script; } else { $block = ($script !== null); - if ($safe || $this->safe) { + if (($safe || $this->safe) && !($this->_cacheAll && $allowCache)) { $script = "\n" . '' . "\n"; } } + if ($script === null && $this->_cacheAll && $allowCache) { + $this->__scriptBuffer = @ob_get_contents(); + @ob_end_clean(); + ob_start(); + return null; + } + if ($block) { return sprintf($this->tags['javascriptblock'], $script); } else { @@ -72,6 +80,24 @@ class JavascriptHelper extends Helper{ } } /** + * Ends a block of cached JavaScript code + * + * @return mixed + */ + function blockEnd() { + $script = @ob_get_contents(); + @ob_end_clean(); + ob_start(); + echo $this->__scriptBuffer; + $this->__scriptBuffer = null; + + if (!empty($script)) { + $this->_cachedEvents[] = $script; + } + + + } +/** * Returns a JavaScript include tag (SCRIPT element) * * @param string $url URL to JavaScript file. diff --git a/cake/libs/view/helpers/number.php b/cake/libs/view/helpers/number.php index b91e1b5f6..81b917f9b 100644 --- a/cake/libs/view/helpers/number.php +++ b/cake/libs/view/helpers/number.php @@ -36,7 +36,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class NumberHelper extends Helper { +class NumberHelper extends AppHelper { /** * Formats a number with a level of precision. * diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index f84875c47..faeeb2835 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class PaginatorHelper extends Helper { +class PaginatorHelper extends AppHelper { /** * Helper dependencies diff --git a/cake/libs/view/helpers/rss.php b/cake/libs/view/helpers/rss.php index 5dbb00dee..7c24f60e8 100644 --- a/cake/libs/view/helpers/rss.php +++ b/cake/libs/view/helpers/rss.php @@ -150,6 +150,7 @@ class RssHelper extends XmlHelper { $out = ''; $c = count($items); + for ($i = 0; $i < $c; $i++) { $out .= $this->item(array(), $items[$i]); } @@ -165,6 +166,7 @@ class RssHelper extends XmlHelper { function item($attrib = array(), $elements = array()) { $content = null; foreach ($elements as $key => $val) { + $attrib = array(); switch ($key) { case 'pubDate' : @@ -208,6 +210,11 @@ class RssHelper extends XmlHelper { } $elements[$key] = $this->elem($key, array(), $val); } + + if (isset($elements['link']) && !isset($elements['guid'])) { + $elements['guid'] = $elements['link']; + } + if (!empty($elements)) { $content = join('', $elements); } diff --git a/cake/libs/view/helpers/session.php b/cake/libs/view/helpers/session.php index d4b1e1e60..ae849747a 100644 --- a/cake/libs/view/helpers/session.php +++ b/cake/libs/view/helpers/session.php @@ -37,7 +37,7 @@ * @subpackage cake.cake.libs.view.helpers * */ -class SessionHelper extends Helper{ +class SessionHelper extends AppHelper { var $__Session; var $__active = true; diff --git a/cake/libs/view/helpers/text.php b/cake/libs/view/helpers/text.php index 93993fa32..93b1b81f1 100644 --- a/cake/libs/view/helpers/text.php +++ b/cake/libs/view/helpers/text.php @@ -45,7 +45,7 @@ if (!class_exists('HtmlHelper')) { * @package cake * @subpackage cake.cake.libs.view.helpers */ -class TextHelper extends Helper { +class TextHelper extends AppHelper { /** * Highlights a given phrase in a text. diff --git a/cake/libs/view/helpers/time.php b/cake/libs/view/helpers/time.php index be323a40a..86545ad56 100644 --- a/cake/libs/view/helpers/time.php +++ b/cake/libs/view/helpers/time.php @@ -34,7 +34,7 @@ * @package cake * @subpackage cake.cake.libs.view.helpers */ -class TimeHelper extends Helper { +class TimeHelper extends AppHelper { /** * Returns given string trimmed to given length, adding an ending (default: "..") if necessary. diff --git a/cake/libs/view/helpers/xml.php b/cake/libs/view/helpers/xml.php index d6d736006..c1e56a897 100644 --- a/cake/libs/view/helpers/xml.php +++ b/cake/libs/view/helpers/xml.php @@ -34,7 +34,7 @@ uses('set'); * @package cake * @subpackage cake.cake.libs.view.helpers */ -class XmlHelper extends Helper { +class XmlHelper extends AppHelper { var $helpers = array('Html'); /**