mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
57b8008dbe
2 changed files with 11 additions and 7 deletions
|
@ -516,7 +516,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
protected function _assertAttributes($assertions, $string) {
|
protected function _assertAttributes($assertions, $string) {
|
||||||
$asserts = $assertions['attrs'];
|
$asserts = $assertions['attrs'];
|
||||||
$explains = $assertions['explains'];
|
$explains = $assertions['explains'];
|
||||||
while (count($asserts) > 0) {
|
$len = count($asserts);
|
||||||
|
do {
|
||||||
$matches = false;
|
$matches = false;
|
||||||
foreach ($asserts as $j => $assert) {
|
foreach ($asserts as $j => $assert) {
|
||||||
if (preg_match(sprintf('/^%s/s', $assert), $string, $match)) {
|
if (preg_match(sprintf('/^%s/s', $assert), $string, $match)) {
|
||||||
|
@ -530,7 +531,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
if ($matches === false) {
|
if ($matches === false) {
|
||||||
$this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]);
|
$this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]);
|
||||||
}
|
}
|
||||||
}
|
$len = count($asserts);
|
||||||
|
} while ($len > 0);
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -713,14 +713,15 @@ class HtmlHelper extends AppHelper {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
|
||||||
*/
|
*/
|
||||||
public function getCrumbList($options = array(), $startText = false) {
|
public function getCrumbList($options = array(), $startText = false) {
|
||||||
$defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '');
|
$defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '', 'escape' => true);
|
||||||
$options = array_merge($defaults, (array)$options);
|
$options = array_merge($defaults, (array)$options);
|
||||||
$firstClass = $options['firstClass'];
|
$firstClass = $options['firstClass'];
|
||||||
$lastClass = $options['lastClass'];
|
$lastClass = $options['lastClass'];
|
||||||
$separator = $options['separator'];
|
$separator = $options['separator'];
|
||||||
unset($options['firstClass'], $options['lastClass'], $options['separator']);
|
$escape = $options['escape'];
|
||||||
|
unset($options['firstClass'], $options['lastClass'], $options['separator'], $options['escape']);
|
||||||
|
|
||||||
$crumbs = $this->_prepareCrumbs($startText);
|
$crumbs = $this->_prepareCrumbs($startText, $escape);
|
||||||
if (empty($crumbs)) {
|
if (empty($crumbs)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -752,9 +753,10 @@ class HtmlHelper extends AppHelper {
|
||||||
* Prepends startText to crumbs array if set
|
* Prepends startText to crumbs array if set
|
||||||
*
|
*
|
||||||
* @param string $startText Text to prepend
|
* @param string $startText Text to prepend
|
||||||
|
* @param boolean $escape If the output should be escaped or not
|
||||||
* @return array Crumb list including startText (if provided)
|
* @return array Crumb list including startText (if provided)
|
||||||
*/
|
*/
|
||||||
protected function _prepareCrumbs($startText) {
|
protected function _prepareCrumbs($startText, $escape = true) {
|
||||||
$crumbs = $this->_crumbs;
|
$crumbs = $this->_crumbs;
|
||||||
if ($startText) {
|
if ($startText) {
|
||||||
if (!is_array($startText)) {
|
if (!is_array($startText)) {
|
||||||
|
@ -766,7 +768,7 @@ class HtmlHelper extends AppHelper {
|
||||||
$startText += array('url' => '/', 'text' => __d('cake', 'Home'));
|
$startText += array('url' => '/', 'text' => __d('cake', 'Home'));
|
||||||
list($url, $text) = array($startText['url'], $startText['text']);
|
list($url, $text) = array($startText['url'], $startText['text']);
|
||||||
unset($startText['url'], $startText['text']);
|
unset($startText['url'], $startText['text']);
|
||||||
array_unshift($crumbs, array($text, $url, $startText));
|
array_unshift($crumbs, array($text, $url, $startText + array('escape' => $escape)));
|
||||||
}
|
}
|
||||||
return $crumbs;
|
return $crumbs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue