mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge branch 'master' into 2.7
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
63769ae4a6
10 changed files with 104 additions and 13 deletions
|
@ -432,6 +432,7 @@ class ExtractTask extends AppShell {
|
|||
$category = isset($category) ? $category : 6;
|
||||
$category = (int)$category;
|
||||
$categoryName = $categories[$category];
|
||||
|
||||
$domain = isset($domain) ? $domain : 'default';
|
||||
$details = array(
|
||||
'file' => $this->_file,
|
||||
|
@ -443,7 +444,10 @@ class ExtractTask extends AppShell {
|
|||
if (isset($context)) {
|
||||
$details['msgctxt'] = $context;
|
||||
}
|
||||
$this->_addTranslation($categoryName, $domain, $singular, $details);
|
||||
// Skip LC_TIME files as we use a special file format for them.
|
||||
if ($categoryName !== 'LC_TIME') {
|
||||
$this->_addTranslation($categoryName, $domain, $singular, $details);
|
||||
}
|
||||
} else {
|
||||
$this->_markerError($this->_file, $line, $functionName, $count);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
echo "\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('View'), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Edit'), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Form->postLink(__('Delete'), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), array(), __('Are you sure you want to delete # %s?', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Form->postLink(__('Delete'), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), array('confirm' => __('Are you sure you want to delete # %s?', \${$singularVar}['{$modelClass}']['{$primaryKey}']))); ?>\n";
|
||||
echo "\t\t</td>\n";
|
||||
echo "\t</tr>\n";
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
<p>
|
||||
<?php echo "<?php
|
||||
echo \$this->Paginator->counter(array(
|
||||
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
|
||||
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
|
||||
));
|
||||
?>"; ?>
|
||||
</p>
|
||||
|
|
|
@ -388,6 +388,10 @@ class PaginatorComponent extends Component {
|
|||
if (!empty($options['order']) && is_array($options['order'])) {
|
||||
$order = array();
|
||||
foreach ($options['order'] as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
$key = $value;
|
||||
$value = 'asc';
|
||||
}
|
||||
$field = $key;
|
||||
$alias = $object->alias;
|
||||
if (strpos($key, '.') !== false) {
|
||||
|
|
|
@ -162,19 +162,19 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
|
||||
$this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:34\nmsgid "letter"/';
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:36\nmsgid "letter"/';
|
||||
$this->assertRegExp($pattern, $result, 'Strings with context should not overwrite strings without context');
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:35;37\nmsgctxt "A"\nmsgid "letter"/';
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:37;39\nmsgctxt "A"\nmsgid "letter"/';
|
||||
$this->assertRegExp($pattern, $result, 'Should contain string with context "A"');
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:36\nmsgctxt "B"\nmsgid "letter"/';
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:38\nmsgctxt "B"\nmsgid "letter"/';
|
||||
$this->assertRegExp($pattern, $result, 'Should contain string with context "B"');
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:38\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:40\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||
$this->assertRegExp($pattern, $result, 'Plural strings with context should not overwrite strings without context');
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:39\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:41\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||
$this->assertRegExp($pattern, $result, 'Should contain plural string with context "A"');
|
||||
|
||||
// extract.ctp - reading the domain.pot
|
||||
|
@ -209,12 +209,16 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->Task->expects($this->never())->method('_stop');
|
||||
|
||||
$this->Task->execute();
|
||||
$this->assertTrue(file_exists($this->path . DS . 'LC_TIME' . DS . 'default.pot'));
|
||||
$this->assertTrue(file_exists($this->path . DS . 'LC_NUMERIC' . DS . 'default.pot'));
|
||||
$this->assertFalse(file_exists($this->path . DS . 'LC_TIME' . DS . 'default.pot'));
|
||||
|
||||
$result = file_get_contents($this->path . DS . 'default.pot');
|
||||
|
||||
$pattern = '/\#: .*extract\.ctp:31\n/';
|
||||
$this->assertNotRegExp($pattern, $result);
|
||||
|
||||
$pattern = '/\#: .*extract\.ctp:33\n/';
|
||||
$this->assertNotRegExp($pattern, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -323,10 +323,11 @@ class ViewTaskTest extends CakeTestCase {
|
|||
public function testBakeIndex() {
|
||||
$this->Task->controllerName = 'ViewTaskComments';
|
||||
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'View' . DS . 'index.ctp');
|
||||
$this->Task->expects($this->at(0))->method('createFile')
|
||||
->with(
|
||||
TMP . 'ViewTaskComments' . DS . 'index.ctp',
|
||||
$this->stringContains("\$viewTaskComment['Article']['title']")
|
||||
$expected
|
||||
);
|
||||
$this->Task->bake('index', true);
|
||||
}
|
||||
|
|
|
@ -454,6 +454,13 @@ class PaginatorComponentTest extends CakeTestCase {
|
|||
$this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id'));
|
||||
$this->assertTrue(!isset($Controller->PaginatorControllerPost->lastQueries[1]['contain']));
|
||||
|
||||
$Controller->Paginator->settings = array(
|
||||
'order' => array('PaginatorControllerPost.author_id')
|
||||
);
|
||||
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
|
||||
$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']);
|
||||
$this->assertEquals(array(1, 3, 2), Hash::extract($result, '{n}.PaginatorControllerPost.id'));
|
||||
|
||||
$Controller->request->params['named'] = array('page' => '-1');
|
||||
$Controller->Paginator->settings = array(
|
||||
'PaginatorControllerPost' => array(
|
||||
|
@ -606,7 +613,7 @@ class PaginatorComponentTest extends CakeTestCase {
|
|||
|
||||
$Controller->PaginatorControllerPost->order = array('PaginatorControllerPost.id');
|
||||
$result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
|
||||
$this->assertEmpty($result['order']);
|
||||
$this->assertEquals(array('PaginatorControllerPost.id' => 'asc'), $result['order']);
|
||||
|
||||
$Controller->PaginatorControllerPost->order = 'PaginatorControllerPost.id';
|
||||
$result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
|
||||
|
@ -617,7 +624,10 @@ class PaginatorComponentTest extends CakeTestCase {
|
|||
'PaginatorControllerPost.created' => 'asc'
|
||||
);
|
||||
$result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
|
||||
$expected = array('PaginatorControllerPost.created' => 'asc');
|
||||
$expected = array(
|
||||
'PaginatorControllerPost.id' => 'asc',
|
||||
'PaginatorControllerPost.created' => 'asc'
|
||||
);
|
||||
$this->assertEquals($expected, $result['order']);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,10 @@ class TextHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testAutoLink() {
|
||||
$text = 'The AWWWARD show happened today';
|
||||
$result = $this->Text->autoLink($text);
|
||||
$this->assertEquals($text, $result);
|
||||
|
||||
$text = 'This is a test text';
|
||||
$expected = 'This is a test text';
|
||||
$result = $this->Text->autoLink($text);
|
||||
|
@ -127,6 +131,10 @@ class TextHelperTest extends CakeTestCase {
|
|||
$expected = 'Text with a partial <a href="http://www.cakephp.org">www.cakephp.org</a> URL and <a href="mailto:test@cakephp\.org">test@cakephp\.org</a> email address';
|
||||
$this->assertRegExp('#^' . $expected . '$#', $result);
|
||||
|
||||
$text = 'Text with a partial <a href="//www.cakephp.org">link</a> link';
|
||||
$result = $this->Text->autoLink($text, array('escape' => false));
|
||||
$this->assertEquals($text, $result);
|
||||
|
||||
$text = 'This is a test text with URL http://www.cakephp.org';
|
||||
$expected = 'This is a test text with URL <a href="http://www.cakephp.org">http://www.cakephp.org</a>';
|
||||
$result = $this->Text->autoLink($text);
|
||||
|
|
58
lib/Cake/Test/bake_compare/View/index.ctp
Normal file
58
lib/Cake/Test/bake_compare/View/index.ctp
Normal file
|
@ -0,0 +1,58 @@
|
|||
<div class="viewTaskComments index">
|
||||
<h2><?php echo __('View Task Comments'); ?></h2>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo $this->Paginator->sort('id'); ?></th>
|
||||
<th><?php echo $this->Paginator->sort('article_id'); ?></th>
|
||||
<th><?php echo $this->Paginator->sort('user_id'); ?></th>
|
||||
<th><?php echo $this->Paginator->sort('comment'); ?></th>
|
||||
<th><?php echo $this->Paginator->sort('published'); ?></th>
|
||||
<th><?php echo $this->Paginator->sort('created'); ?></th>
|
||||
<th><?php echo $this->Paginator->sort('updated'); ?></th>
|
||||
<th class="actions"><?php echo __('Actions'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($viewTaskComments as $viewTaskComment): ?>
|
||||
<tr>
|
||||
<td><?php echo h($viewTaskComment['ViewTaskComment']['id']); ?> </td>
|
||||
<td>
|
||||
<?php echo $this->Html->link($viewTaskComment['Article']['title'], array('controller' => 'view_task_articles', 'action' => 'view', $viewTaskComment['Article']['id'])); ?>
|
||||
</td>
|
||||
<td><?php echo h($viewTaskComment['ViewTaskComment']['user_id']); ?> </td>
|
||||
<td><?php echo h($viewTaskComment['ViewTaskComment']['comment']); ?> </td>
|
||||
<td><?php echo h($viewTaskComment['ViewTaskComment']['published']); ?> </td>
|
||||
<td><?php echo h($viewTaskComment['ViewTaskComment']['created']); ?> </td>
|
||||
<td><?php echo h($viewTaskComment['ViewTaskComment']['updated']); ?> </td>
|
||||
<td class="actions">
|
||||
<?php echo $this->Html->link(__('View'), array('action' => 'view', $viewTaskComment['ViewTaskComment']['id'])); ?>
|
||||
<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $viewTaskComment['ViewTaskComment']['id'])); ?>
|
||||
<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $viewTaskComment['ViewTaskComment']['id']), array('confirm' => __('Are you sure you want to delete # %s?', $viewTaskComment['ViewTaskComment']['id']))); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
<?php
|
||||
echo $this->Paginator->counter(array(
|
||||
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
|
||||
));
|
||||
?> </p>
|
||||
<div class="paging">
|
||||
<?php
|
||||
echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
|
||||
echo $this->Paginator->numbers(array('separator' => ''));
|
||||
echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<h3><?php echo __('Actions'); ?></h3>
|
||||
<ul>
|
||||
<li><?php echo $this->Html->link(__('New View Task Comment'), array('action' => 'add')); ?></li>
|
||||
<li><?php echo $this->Html->link(__('List View Task Articles'), array('controller' => 'view_task_articles', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $this->Html->link(__('New Article'), array('controller' => 'view_task_articles', 'action' => 'add')); ?> </li>
|
||||
</ul>
|
||||
</div>
|
|
@ -28,6 +28,8 @@ __('Hot features!'
|
|||
. ' Join us #cakephp on IRC. We\'d love to help you get started');
|
||||
|
||||
// Category
|
||||
echo __c('You have a new message (category: LC_NUMERIC).', 4);
|
||||
// LC_TIME is skipped.
|
||||
echo __c('You have a new message (category: LC_TIME).', 5);
|
||||
|
||||
// Context
|
||||
|
|
|
@ -114,7 +114,7 @@ class TextHelper extends AppHelper {
|
|||
$text
|
||||
);
|
||||
$text = preg_replace_callback(
|
||||
'#(?<!href="|">)(?<!\b[[:punct:]])(?<!http://|https://|ftp://|nntp://)www.[^\n\%\ <]+[^<\n\%\,\.\ <](?<!\))#i',
|
||||
'#(?<!href="|">)(?<!\b[[:punct:]])(?<!http://|https://|ftp://|nntp://|//)www\.[^\n\%\ <]+[^<\n\%\,\.\ <](?<!\))#i',
|
||||
array(&$this, '_insertPlaceHolder'),
|
||||
$text
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue