Permalink
Browse files

Merge branch '1.2' of github.com:cakephp/cakephp1x into 1.2

  • Loading branch information...
2 parents 66a8910 + 205c95e commit 7daad4acaf67fcfbdada30cfd165b938ec02fa29 @markstory markstory committed Feb 3, 2010
View
@@ -1 +1 @@
-1.2.5
+1.2.6
View
@@ -21,5 +21,5 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
-return $config['Cake.version'] = '1.2.5';
+return $config['Cake.version'] = '1.2.6';
?>
View
@@ -366,21 +366,24 @@ function baseUrl() {
$this->webroot = $base .'/';
return $base;
}
- $file = '/' . basename($baseUrl);
- $base = dirname($baseUrl);
- if ($base === DS || $base === '.') {
- $base = '';
- }
- $this->webroot = $base .'/';
+ $file = '/' . basename($baseUrl);
+ $base = dirname($baseUrl);
+ if ($base === DS || $base === '.') {
+ $base = '';
+ }
+ $this->webroot = $base .'/';
+
+ if (!empty($base)) {
if (strpos($this->webroot, $dir) === false) {
$this->webroot .= $dir . '/' ;
}
if (strpos($this->webroot, $webroot) === false) {
$this->webroot .= $webroot . '/';
}
- return $base . $file;
+ }
+ return $base . $file;
}
/**
* Restructure params in case we're serving a plugin.
@@ -807,11 +807,16 @@ function _setParent(&$Model, $parentId = null, $created = false) {
$this->__sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
$this->__sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
} else {
- $parentNode = array_values($Model->find('first', array(
+ $values = $Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $parentId),
'fields' => array($Model->primaryKey, $left, $right),
'recursive' => $recursive
- )));
+ ));
+
+ if ($values === false) {
+ return false;
+ }
+ $parentNode = array_values($values);
if (empty($parentNode) || empty($parentNode[0])) {
return false;
@@ -1824,14 +1824,15 @@ function _deleteDependent($id, $cascade) {
*/
function _deleteLinks($id) {
foreach ($this->hasAndBelongsToMany as $assoc => $data) {
- $records = $this->{$data['with']}->find('all', array(
- 'conditions' => array_merge(array($this->{$data['with']}->escapeField($data['foreignKey']) => $id)),
- 'fields' => $this->{$data['with']}->primaryKey,
+ $joinModel = $data['with'];
+ $records = $this->{$joinModel}->find('all', array(
+ 'conditions' => array_merge(array($this->{$joinModel}->escapeField($data['foreignKey']) => $id)),
+ 'fields' => $this->{$joinModel}->primaryKey,
'recursive' => -1
));
if (!empty($records)) {
foreach ($records as $record) {
- $this->{$data['with']}->delete($record[$this->{$data['with']}->alias][$this->{$data['with']}->primaryKey]);
+ $this->{$joinModel}->delete($record[$this->{$joinModel}->alias][$this->{$joinModel}->primaryKey]);
}
}
}
@@ -167,7 +167,7 @@ function truncate($text, $length = 100, $ending = '...', $exact = true, $conside
if (mb_strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
return $text;
}
- $totalLength = mb_strlen($ending);
+ $totalLength = mb_strlen(strip_tags($ending));
$openTags = array();
$truncate = '';
preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
@@ -209,7 +209,6 @@ function truncate($text, $length = 100, $ending = '...', $exact = true, $conside
break;
}
}
-
} else {
if (mb_strlen($text) <= $length) {
return $text;
@@ -25,7 +25,7 @@ if (Configure::read() == 0):
endif;
?>
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
-<a href="http://code.cakephp.org/wiki/changelog/1_2_x_x"><?php __('Read the changelog'); ?> </a>
+<a href="http://cakephp.lighthouseapp.com/projects/42648/changelog-1-2-6"><?php __('Read the changelog'); ?> </a>
<?php
if (Configure::read() > 0):
Debugger::checkSessionKey();
@@ -135,8 +135,10 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
<ul><li><?php __('Community mailing list'); ?></li></ul></li>
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
<ul><li><?php __('Live chat about CakePHP'); ?></li></ul></li>
- <li><a href="https://code.cakephp.org/"><?php __('CakePHP Code'); ?> </a>
- <ul><li><?php __('For the Development of CakePHP (Tickets, Git browser, Roadmap, Changelogs)'); ?></li></ul></li>
+ <li><a href="http://github.com/cakephp/"><?php __('CakePHP Code'); ?> </a>
+ <ul><li><?php __('For the Development of CakePHP Git repository, Downloads'); ?></li></ul></li>
+ <li><a href="http://cakephp.lighthouseapp.com/"><?php __('CakePHP Lighthouse'); ?> </a>
+ <ul><li><?php __('CakePHP Tickets, Wiki pages, Roadmap'); ?></li></ul></li>
<li><a href="http://www.cakeforge.org"><?php __('CakeForge'); ?> </a>
<ul><li><?php __('Open Development for CakePHP'); ?></li></ul></li>
<li><a href="http://astore.amazon.com/cakesoftwaref-20/"><?php __('Book Store'); ?> </a>
@@ -1102,7 +1102,7 @@ function testBaseUrlAndWebrootWithBaseUrl() {
$result = $Dispatcher->baseUrl();
$expected = '/index.php';
$this->assertEqual($expected, $result);
- $expectedWebroot = '/app/webroot/';
+ $expectedWebroot = '/';
$this->assertEqual($expectedWebroot, $Dispatcher->webroot);
Configure::write('App.baseUrl', '/CakeBB/app/webroot/index.php');
@@ -1173,12 +1173,12 @@ function testBaseUrlAndWebrootWithBase() {
*/
function testMissingController() {
$Dispatcher =& new TestDispatcher();
- Configure::write('App.baseUrl','/index.php');
+ Configure::write('App.baseUrl', '/index.php');
$url = 'some_controller/home/param:value/param2:value2';
$controller = $Dispatcher->dispatch($url, array('return' => 1));
$expected = array('missingController', array(array(
'className' => 'SomeControllerController',
- 'webroot' => '/app/webroot/',
+ 'webroot' => '/',
'url' => 'some_controller/home/param:value/param2:value2',
'base' => '/index.php'
)));
@@ -1200,7 +1200,7 @@ function testPrivate() {
$expected = array('privateAction', array(array(
'className' => 'SomePagesController',
'action' => '_protected',
- 'webroot' => '/app/webroot/',
+ 'webroot' => '/',
'url' => 'some_pages/_protected/param:value/param2:value2',
'base' => '/index.php'
)));
@@ -1214,15 +1214,15 @@ function testPrivate() {
*/
function testMissingAction() {
$Dispatcher =& new TestDispatcher();
- Configure::write('App.baseUrl','/index.php');
+ Configure::write('App.baseUrl', '/index.php');
$url = 'some_pages/home/param:value/param2:value2';
$controller = $Dispatcher->dispatch($url, array('return'=> 1));
$expected = array('missingAction', array(array(
'className' => 'SomePagesController',
'action' => 'home',
- 'webroot' => '/app/webroot/',
+ 'webroot' => '/',
'url' => '/index.php/some_pages/home/param:value/param2:value2',
'base' => '/index.php'
)));
@@ -1237,7 +1237,7 @@ function testMissingAction() {
$expected = array('missingAction', array(array(
'className' => 'SomePagesController',
'action' => 'redirect',
- 'webroot' => '/app/webroot/',
+ 'webroot' => '/',
'url' => '/index.php/some_pages/redirect/param:value/param2:value2',
'base' => '/index.php'
)));
@@ -99,7 +99,9 @@ function testTruncate() {
$this->assertIdentical($this->Text->{$m}($text7, 255), $text7);
$this->assertIdentical($this->Text->{$m}($text7, 15), 'El moño está...');
$this->assertIdentical($this->Text->{$m}($text8, 15), 'Vive la R'.chr(195).chr(169).'pu...');
-
+ $this->assertIdentical($this->Text->{$m}($text1, 25, 'Read more'), 'The quick brown Read more');
+ $this->assertIdentical($this->Text->{$m}($text1, 25, '<a href="http://www.google.com/">Read more</a>', true, true), 'The quick brown <a href="http://www.google.com/">Read more</a>');
+
if ($this->method == 'truncate') {
$this->method = 'trim';
$this->testTruncate();

0 comments on commit 7daad4a

Please sign in to comment.