mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 06:56:24 +00:00
Removed all references to Router::url in all helpers. Closes #4880. Fixed failing test in RssHelper, added more tests.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7164 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
68af2bb1ed
commit
44159ec303
5 changed files with 33 additions and 11 deletions
|
@ -425,7 +425,7 @@ class HtmlHelper extends AppHelper {
|
||||||
*/
|
*/
|
||||||
function image($path, $options = array()) {
|
function image($path, $options = array()) {
|
||||||
if (is_array($path)) {
|
if (is_array($path)) {
|
||||||
$path = Router::url($path);
|
$path = $this->url($path);
|
||||||
} elseif ($path{0} === '/') {
|
} elseif ($path{0} === '/') {
|
||||||
$path = $this->webroot($path);
|
$path = $this->webroot($path);
|
||||||
} elseif (strpos($path, '://') !== false) {
|
} elseif (strpos($path, '://') !== false) {
|
||||||
|
|
|
@ -281,7 +281,7 @@ class PaginatorHelper extends AppHelper {
|
||||||
if ($asArray) {
|
if ($asArray) {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
return Router::url($url);
|
return parent::url($url);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Protected method for generating prev/next links
|
* Protected method for generating prev/next links
|
||||||
|
|
|
@ -196,14 +196,14 @@ class RssHelper extends XmlHelper {
|
||||||
unset($attrib['url']);
|
unset($attrib['url']);
|
||||||
$val = $val['url'];
|
$val = $val['url'];
|
||||||
}
|
}
|
||||||
$val = Router::url($val, true);
|
$val = $this->url($val, true);
|
||||||
break;
|
break;
|
||||||
case 'source':
|
case 'source':
|
||||||
if (is_array($val) && isset($val['url'])) {
|
if (is_array($val) && isset($val['url'])) {
|
||||||
$attrib['url'] = Router::url($val['url'], true);
|
$attrib['url'] = $this->url($val['url'], true);
|
||||||
$val = $val['title'];
|
$val = $val['title'];
|
||||||
} elseif (is_array($val)) {
|
} elseif (is_array($val)) {
|
||||||
$attrib['url'] = Router::url($val[0], true);
|
$attrib['url'] = $this->url($val[0], true);
|
||||||
$val = $val[1];
|
$val = $val[1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -216,13 +216,18 @@ class RssHelper extends XmlHelper {
|
||||||
$val['type'] = mime_content_type(WWW_ROOT . $val['url']);
|
$val['type'] = mime_content_type(WWW_ROOT . $val['url']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$val['url'] = Router::url($val['url'], true);
|
$val['url'] = $this->url($val['url'], true);
|
||||||
$attrib = $val;
|
$attrib = $val;
|
||||||
$val = null;
|
$val = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($val != null) {
|
$escape = true;
|
||||||
$val = h($val);
|
if (is_array($val) && isset($val['convertEntities'])) {
|
||||||
|
$escape = $val['convertEntities'];
|
||||||
|
unset($val['convertEntities']);
|
||||||
|
}
|
||||||
|
if (!is_null($val) && $escape) {
|
||||||
|
$val = h($val);
|
||||||
}
|
}
|
||||||
$elements[$key] = $this->elem($key, $attrib, $val);
|
$elements[$key] = $this->elem($key, $attrib, $val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(!class_exists('cakesession')) {
|
if(!class_exists('cakesession')) {
|
||||||
uses('session');
|
App::import('Core', 'Session');
|
||||||
}
|
}
|
||||||
class SessionHelper extends CakeSession {
|
class SessionHelper extends CakeSession {
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +148,7 @@ class SessionHelper extends CakeSession {
|
||||||
$out = $view->renderLayout($flash['message']);
|
$out = $view->renderLayout($flash['message']);
|
||||||
list($view->layout, $view->viewVars, $view->pageTitle) = array($tmpLayout, $tmpVars, $tmpTitle);
|
list($view->layout, $view->viewVars, $view->pageTitle) = array($tmpLayout, $tmpVars, $tmpTitle);
|
||||||
}
|
}
|
||||||
e($out);
|
echo($out);
|
||||||
parent::del('Message.' . $key);
|
parent::del('Message.' . $key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ class RssTest extends CakeTestCase {
|
||||||
$item = array(
|
$item = array(
|
||||||
'title' => array(
|
'title' => array(
|
||||||
'value' => 'My Title & more',
|
'value' => 'My Title & more',
|
||||||
'strip' => false
|
'convertEntities' => false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $this->Rss->item(null, $item);
|
$result = $this->Rss->item(null, $item);
|
||||||
|
@ -256,6 +256,23 @@ class RssTest extends CakeTestCase {
|
||||||
'/item'
|
'/item'
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$item = array(
|
||||||
|
'title' => array(
|
||||||
|
'value' => 'My Title & more',
|
||||||
|
'cdata' => true,
|
||||||
|
'convertEntities' => false,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result = $this->Rss->item(null, $item);
|
||||||
|
$expected = array(
|
||||||
|
'<item',
|
||||||
|
'<title',
|
||||||
|
'<![CDATA[My Title & more]]',
|
||||||
|
'/title',
|
||||||
|
'/item'
|
||||||
|
);
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testTime method
|
* testTime method
|
||||||
|
|
Loading…
Add table
Reference in a new issue