Merge branch '2.0' into 2.1

This commit is contained in:
mark_story 2011-10-23 21:07:09 -04:00
commit d6f7669f54
29 changed files with 325 additions and 221 deletions

View file

@ -65,7 +65,7 @@
* - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
* including anonymous functions.
* - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
* should place the file for that class in app/Error. This class needs to implement a render method.
* should place the file for that class in app/Lib/Error. This class needs to implement a render method.
* - `log` - boolean - Should Exceptions be logged?
*
* @see ErrorHandler for more information on exception handling and configuration.

View file

@ -451,6 +451,7 @@ class TestTask extends BakeTask {
*/
public function testCaseFileName($type, $className) {
$path = $this->getPath() . 'Case' . DS;
$type = Inflector::camelize($type);
if (isset($this->classTypes[$type])) {
$path .= $this->classTypes[$type] . DS;
}
@ -468,7 +469,13 @@ class TestTask extends BakeTask {
return $parser->description(__d('cake_console', 'Bake test case skeletons for classes.'))
->addArgument('type', array(
'help' => __d('cake_console', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
'choices' => array('controller', 'model', 'helper', 'component', 'behavior')
'choices' => array(
'Controller', 'controller',
'Model', 'model',
'Helper', 'helper',
'Component', 'component',
'Behavior', 'behavior'
)
))->addArgument('name', array(
'help' => __d('cake_console', 'An existing class to bake tests for.')
))->addOption('plugin', array(

View file

@ -65,7 +65,7 @@
* - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
* including anonymous functions.
* - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
* should place the file for that class in app/Error. This class needs to implement a render method.
* should place the file for that class in app/Lib/Error. This class needs to implement a render method.
* - `log` - boolean - Should Exceptions be logged?
*
* @see ErrorHandler for more information on exception handling and configuration.

View file

@ -160,6 +160,14 @@ class AuthComponent extends Component {
*/
public static $sessionKey = 'Auth.User';
/**
* The current user, used for stateless authentication when
* sessions are not available.
*
* @var array
*/
protected static $_user = array();
/**
* A URL (defined as a string or array) to the controller action that handles
* logins. Defaults to `/users/login`
@ -337,7 +345,7 @@ class AuthComponent extends Component {
protected function _setDefaults() {
$defaults = array(
'logoutRedirect' => $this->loginAction,
'authError' => __d('cake_dev', 'You are not authorized to access that location.')
'authError' => __d('cake', 'You are not authorized to access that location.')
);
foreach ($defaults as $key => $value) {
if (empty($this->{$key})) {
@ -534,22 +542,28 @@ class AuthComponent extends Component {
}
/**
* Get the current user from the session.
* Get the current user.
*
* Will prefer the static user cache over sessions. The static user
* cache is primarily used for stateless authentication. For stateful authentication,
* cookies + sessions will be used.
*
* @param string $key field to retrieve. Leave null to get entire User record
* @return mixed User record. or null if no user is logged in.
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#accessing-the-logged-in-user
*/
public static function user($key = null) {
if (!CakeSession::check(self::$sessionKey)) {
if (empty(self::$_user) && !CakeSession::check(self::$sessionKey)) {
return null;
}
if ($key == null) {
return CakeSession::read(self::$sessionKey);
if (!empty(self::$_user)) {
$user = self::$_user;
} else {
$user = CakeSession::read(self::$sessionKey);
}
if ($key === null) {
return $user;
}
$user = CakeSession::read(self::$sessionKey);
if (isset($user[$key])) {
return $user[$key];
}
@ -573,6 +587,7 @@ class AuthComponent extends Component {
foreach ($this->_authenticateObjects as $auth) {
$result = $auth->getUser($this->request);
if (!empty($result) && is_array($result)) {
self::$_user = $result;
return true;
}
}

View file

@ -125,7 +125,7 @@ class Scaffold {
$this->ScaffoldModel = $this->controller->{$this->modelClass};
$this->scaffoldTitle = Inflector::humanize(Inflector::underscore($this->viewPath));
$this->scaffoldActions = $controller->scaffold;
$title_for_layout = __d('cake_dev', 'Scaffold :: ') . Inflector::humanize($request->action) . ' :: ' . $this->scaffoldTitle;
$title_for_layout = __d('cake', 'Scaffold :: ') . Inflector::humanize($request->action) . ' :: ' . $this->scaffoldTitle;
$modelClass = $this->controller->modelClass;
$primaryKey = $this->ScaffoldModel->primaryKey;
$displayField = $this->ScaffoldModel->displayField;
@ -163,7 +163,7 @@ class Scaffold {
$this->ScaffoldModel->id = $request->params['pass'][0];
}
if (!$this->ScaffoldModel->exists()) {
throw new NotFoundException(__d('cake_dev', 'Invalid %s', Inflector::humanize($this->modelKey)));
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelKey)));
}
$this->ScaffoldModel->recursive = 1;
$this->controller->request->data = $this->ScaffoldModel->read();
@ -218,10 +218,10 @@ class Scaffold {
*/
protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
$formAction = 'edit';
$success = __d('cake_dev', 'updated');
$success = __d('cake', 'updated');
if ($action === 'add') {
$formAction = 'add';
$success = __d('cake_dev', 'saved');
$success = __d('cake', 'saved');
}
if ($this->controller->beforeScaffold($action)) {
@ -230,7 +230,7 @@ class Scaffold {
$this->ScaffoldModel->id = $request['pass'][0];
}
if (!$this->ScaffoldModel->exists()) {
throw new NotFoundException(__d('cake_dev', 'Invalid %s', Inflector::humanize($this->modelKey)));
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelKey)));
}
}
@ -241,7 +241,7 @@ class Scaffold {
if ($this->ScaffoldModel->save($request->data)) {
if ($this->controller->afterScaffoldSave($action)) {
$message = __d('cake_dev',
$message = __d('cake',
'The %1$s has been %2$s',
Inflector::humanize($this->modelKey),
$success
@ -252,7 +252,7 @@ class Scaffold {
}
} else {
if ($this->_validSession) {
$this->controller->Session->setFlash(__d('cake_dev', 'Please correct errors below.'));
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
}
}
}
@ -300,13 +300,13 @@ class Scaffold {
}
$this->ScaffoldModel->id = $id;
if (!$this->ScaffoldModel->exists()) {
throw new NotFoundException(__d('cake_dev', 'Invalid %s', Inflector::humanize($this->modelClass)));
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelClass)));
}
if ($this->ScaffoldModel->delete()) {
$message = __d('cake_dev', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
$message = __d('cake', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
return $this->_sendMessage($message);
} else {
$message = __d('cake_dev',
$message = __d('cake',
'There was an error deleting the %1$s with id: %2$d',
Inflector::humanize($this->modelClass),
$id

View file

@ -739,7 +739,6 @@ class App {
self::$_map += (array)Cache::read('file_map', '_cake_core_');
self::$_objects += (array)Cache::read('object_map', '_cake_core_');
register_shutdown_function(array('App', 'shutdown'));
self::uses('CakePlugin', 'Core');
}
/**

View file

@ -60,7 +60,7 @@ App::uses('AppController', 'Controller');
*
* If you don't want to take control of the exception handling, but want to change how exceptions are
* rendered you can use `Exception.renderer` to choose a class to render exception pages. By default
* `ExceptionRenderer` is used. Your custom exception renderer class should be placed in app/Error.
* `ExceptionRenderer` is used. Your custom exception renderer class should be placed in app/Lib/Error.
*
* Your custom renderer should expect an exception in its constructor, and implement a render method.
* Failing to do so will cause additional errors.
@ -100,7 +100,7 @@ class ErrorHandler {
/**
* Set as the default exception handler by the CakePHP bootstrap process.
*
* This will either use an AppError class if your application has one,
* This will either use custom exception renderer class if configured,
* or use the default ExceptionRenderer.
*
* @param Exception $exception

View file

@ -204,7 +204,7 @@ class ExceptionRenderer {
public function error400($error) {
$message = $error->getMessage();
if (Configure::read('debug') == 0 && $error instanceof CakeException) {
$message = __('Not Found');
$message = __d('cake', 'Not Found');
}
$url = $this->controller->request->here();
$this->controller->response->statusCode($error->getCode());
@ -227,7 +227,7 @@ class ExceptionRenderer {
$code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500;
$this->controller->response->statusCode($code);
$this->controller->set(array(
'name' => __('An Internal Error Has Occurred'),
'name' => __d('cake', 'An Internal Error Has Occurred'),
'message' => h($url),
'error' => $error,
));

View file

@ -426,7 +426,7 @@ class ConfigureException extends CakeException { }
/**
* Exception class for Socket. This exception will be thrown from CakeSocket, CakeEmail, HttpSocket
* SmtpTransport and HttpResponse when it encounters an error.
* SmtpTransport, MailTransport and HttpResponse when it encounters an error.
*
* @package Cake.Error
*/

View file

@ -34,7 +34,11 @@ class CakeRequest implements ArrayAccess {
*
* @var array
*/
public $params = array();
public $params = array(
'plugin' => null,
'controller' => null,
'action' => null,
);
/**
* Array of POST data. Will contain form data as well as uploaded files.

View file

@ -75,8 +75,8 @@ class Dispatcher {
return;
}
$request = $this->parseParams($request, $additionalParams);
Router::setRequestInfo($request);
$request = $this->parseParams($request, $additionalParams);
$controller = $this->_getController($request, $response);
if (!($controller instanceof Controller)) {

View file

@ -37,6 +37,13 @@ class RedirectRoute extends CakeRoute {
*/
public $redirect;
/**
* Flag for disabling exit() when this route parses a url.
*
* @var boolean
*/
public $stop = true;
/**
* Constructor
*
@ -79,6 +86,7 @@ class RedirectRoute extends CakeRoute {
$this->response->header(array('Location' => Router::url($redirect, true)));
$this->response->statusCode($status);
$this->response->send();
$this->_stop();
}
/**
@ -90,4 +98,17 @@ class RedirectRoute extends CakeRoute {
public function match($url) {
return false;
}
}
/**
* Stop execution of the current script. Wraps exit() making
* testing easier.
*
* @param integer|string $status see http://php.net/exit for values
* @return void
*/
protected function _stop($code = 0) {
if ($this->stop) {
exit($code);
}
}
}

View file

@ -283,7 +283,7 @@ class TestTaskTest extends CakeTestCase {
public function testMethodIntrospection() {
$result = $this->Task->getTestableMethods('TestTaskArticle');
$expected = array('dosomething', 'dosomethingelse');
$this->assertEqual(array_map('strtolower', $result), $expected);
$this->assertEquals($expected, array_map('strtolower', $result));
}
/**
@ -297,7 +297,7 @@ class TestTaskTest extends CakeTestCase {
$expected = array('plugin.test_task.test_task_comment', 'app.articles_tags',
'app.test_task_article', 'app.test_task_tag');
$this->assertEqual(sort($result), sort($expected));
$this->assertEquals(sort($expected), sort($result));
}
/**
@ -311,7 +311,7 @@ class TestTaskTest extends CakeTestCase {
$expected = array('plugin.test_task.test_task_comment', 'app.articles_tags',
'app.test_task_article', 'app.test_task_tag');
$this->assertEqual(sort($result), sort($expected));
$this->assertEquals(sort($result), sort($expected));
}
/**
@ -327,7 +327,7 @@ class TestTaskTest extends CakeTestCase {
$this->Task->getObjectType();
$result = $this->Task->getObjectType();
$this->assertEqual($result, $this->Task->classTypes['Controller']);
$this->assertEquals($this->Task->classTypes['Controller'], $result);
}
/**
@ -367,11 +367,11 @@ class TestTaskTest extends CakeTestCase {
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(1));
$result = $this->Task->getClassName('Model');
$this->assertEqual($result, 'MyCustomClass');
$this->assertEquals($result, 'MyCustomClass');
$result = $this->Task->getClassName('Model');
$options = App::objects('model');
$this->assertEqual($result, $options[0]);
$this->assertEquals($options[0], $result);
}
/**
@ -386,7 +386,7 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getUserFixtures();
$expected = array('app.pizza', 'app.topping', 'app.side_dish');
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -396,28 +396,28 @@ class TestTaskTest extends CakeTestCase {
*/
public function testGetRealClassname() {
$result = $this->Task->getRealClassname('Model', 'Post');
$this->assertEqual($result, 'Post');
$this->assertEquals('Post', $result);
$result = $this->Task->getRealClassname('Controller', 'Posts');
$this->assertEqual($result, 'PostsController');
$this->assertEquals('PostsController', $result);
$result = $this->Task->getRealClassname('Controller', 'PostsController');
$this->assertEqual($result, 'PostsController');
$this->assertEquals('PostsController', $result);
$result = $this->Task->getRealClassname('Helper', 'Form');
$this->assertEqual($result, 'FormHelper');
$this->assertEquals('FormHelper', $result);
$result = $this->Task->getRealClassname('Helper', 'FormHelper');
$this->assertEqual($result, 'FormHelper');
$this->assertEquals('FormHelper', $result);
$result = $this->Task->getRealClassname('Behavior', 'Containable');
$this->assertEqual($result, 'ContainableBehavior');
$this->assertEquals('ContainableBehavior', $result);
$result = $this->Task->getRealClassname('Behavior', 'ContainableBehavior');
$this->assertEqual($result, 'ContainableBehavior');
$this->assertEquals('ContainableBehavior', $result);
$result = $this->Task->getRealClassname('Component', 'Auth');
$this->assertEqual($result, 'AuthComponent');
$this->assertEquals('AuthComponent', $result);
}
/**
@ -491,15 +491,15 @@ class TestTaskTest extends CakeTestCase {
public function testGenerateConstructor() {
$result = $this->Task->generateConstructor('controller', 'PostsController');
$expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n";
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Task->generateConstructor('model', 'Post');
$expected = "ClassRegistry::init('Post');\n";
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
$result = $this->Task->generateConstructor('helper', 'FormHelper');
$expected = "new FormHelper();\n";
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -562,39 +562,48 @@ class TestTaskTest extends CakeTestCase {
$this->Task->execute();
}
public static function caseFileNameProvider() {
return array(
array('Model', 'Post', 'Case' . DS . 'Model' . DS . 'PostTest.php'),
array('Helper', 'Form', 'Case' . DS . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php'),
array('Controller', 'Posts', 'Case' . DS . 'Controller' . DS . 'PostsControllerTest.php'),
array('Behavior', 'Containable', 'Case' . DS . 'Model' . DS . 'Behavior' . DS . 'ContainableBehaviorTest.php'),
array('Component', 'Auth', 'Case' . DS . 'Controller' . DS . 'Component' . DS . 'AuthComponentTest.php'),
array('model', 'Post', 'Case' . DS . 'Model' . DS . 'PostTest.php'),
array('helper', 'Form', 'Case' . DS . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php'),
array('controller', 'Posts', 'Case' . DS . 'Controller' . DS . 'PostsControllerTest.php'),
array('behavior', 'Containable', 'Case' . DS . 'Model' . DS . 'Behavior' . DS . 'ContainableBehaviorTest.php'),
array('component', 'Auth', 'Case' . DS . 'Controller' . DS . 'Component' . DS . 'AuthComponentTest.php'),
);
}
/**
* Test filename generation for each type + plugins
*
* @dataProvider caseFileNameProvider
* @return void
*/
public function testTestCaseFileName() {
public function testTestCaseFileName($type, $class, $expected) {
$this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS;
$result = $this->Task->testCaseFileName('Model', 'Post');
$expected = $this->Task->path . 'Case' . DS . 'Model' . DS . 'PostTest.php';
$this->assertEqual($expected, $result);
$result = $this->Task->testCaseFileName($type, $class);
$expected = $this->Task->path . $expected;
$this->assertEquals($expected, $result);
}
$result = $this->Task->testCaseFileName('Helper', 'Form');
$expected = $this->Task->path . 'Case' . DS . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php';
$this->assertEqual($expected, $result);
$result = $this->Task->testCaseFileName('Controller', 'Posts');
$expected = $this->Task->path . 'Case' . DS . 'Controller' . DS . 'PostsControllerTest.php';
$this->assertEqual($expected, $result);
$result = $this->Task->testCaseFileName('Behavior', 'Containable');
$expected = $this->Task->path . 'Case' . DS . 'Model' . DS . 'Behavior' . DS . 'ContainableBehaviorTest.php';
$this->assertEqual($expected, $result);
$result = $this->Task->testCaseFileName('Component', 'Auth');
$expected = $this->Task->path . 'Case' . DS . 'Controller' . DS . 'Component' . DS . 'AuthComponentTest.php';
$this->assertEqual($expected, $result);
/**
* Test filename generation for plugins.
*
* @return void
*/
public function testTestCaseFileNamePlugin() {
$this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS;
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS ));
$this->Task->plugin = 'TestTest';
$result = $this->Task->testCaseFileName('Model', 'Post');
$expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php';
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
}
/**
@ -631,6 +640,23 @@ class TestTaskTest extends CakeTestCase {
$this->Task->execute();
}
/**
* test execute with type and class name defined and lower case.
*
* @return void
*/
public function testExecuteWithTwoArgsLowerCase() {
$this->Task->args = array('model', 'TestTaskTag');
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('TestTaskTag'));
$this->Task->expects($this->once())->method('createFile')
->with(
$this->anything(),
$this->stringContains('class TestTaskTagTestCase extends CakeTestCase')
);
$this->Task->expects($this->any())->method('isLoadableClass')->will($this->returnValue(true));
$this->Task->execute();
}
/**
* Data provider for mapType() tests.
*

View file

@ -46,6 +46,10 @@ class TestAuthComponent extends AuthComponent {
$this->testStop = true;
}
public static function clearUser() {
self::$_user = array();
}
}
/**
@ -339,6 +343,7 @@ class AuthComponentTest extends CakeTestCase {
$_SERVER = $this->_server;
$_ENV = $this->_env;
TestAuthComponent::clearUser();
$this->Auth->Session->delete('Auth');
$this->Auth->Session->delete('Message.auth');
unset($this->Controller, $this->Auth);
@ -975,6 +980,30 @@ class AuthComponentTest extends CakeTestCase {
Configure::write('Routing.prefixes', $admin);
}
/**
* Stateless auth methods like Basic should populate data that can be
* accessed by $this->user().
*
* @return void
*/
public function testStatelessAuthWorksWithUser() {
$_SERVER['PHP_AUTH_USER'] = 'mariano';
$_SERVER['PHP_AUTH_PW'] = 'cake';
$url = '/auth_test/add';
$this->Auth->request->addParams(Router::parse($url));
$this->Auth->authenticate = array(
'Basic' => array('userModel' => 'AuthUser')
);
$this->Auth->startup($this->Controller);
$result = $this->Auth->user();
$this->assertEquals('mariano', $result['username']);
$result = $this->Auth->user('username');
$this->assertEquals('mariano', $result);
}
/**
* Tests that shutdown destroys the redirect session var
*
@ -1033,6 +1062,11 @@ class AuthComponentTest extends CakeTestCase {
$this->assertNull($this->Auth->Session->read('Auth.redirect'));
}
/**
* Logout should trigger a logout method on authentication objects.
*
* @return void
*/
public function testLogoutTrigger() {
$this->getMock('BaseAuthenticate', array('authenticate', 'logout'), array(), 'LogoutTriggerMockAuthenticate', false);

View file

@ -45,43 +45,51 @@ class RedirectRouteTestCase extends CakeTestCase {
*/
public function testParsing() {
$route = new RedirectRoute('/home', array('controller' => 'posts'));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/home');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/posts', true)));
$route = new RedirectRoute('/home', array('controller' => 'posts', 'action' => 'index'));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/home');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/posts', true)));
$this->assertEqual($route->response->statusCode(), 301);
$route = new RedirectRoute('/google', 'http://google.com');
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/google');
$this->assertEqual($route->response->header(), array('Location' => 'http://google.com'));
$route = new RedirectRoute('/posts/*', array('controller' => 'posts', 'action' => 'view'), array('status' => 302));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/posts/2');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/posts/view', true)));
$this->assertEqual($route->response->statusCode(), 302);
$route = new RedirectRoute('/posts/*', array('controller' => 'posts', 'action' => 'view'), array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/posts/2');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/posts/view/2', true)));
$route = new RedirectRoute('/posts/*', '/test', array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/posts/2');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/test', true)));
$route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'), array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/my_controllers/do_something/passme/named:param');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/tags/add/passme/named:param', true)));
$route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/my_controllers/do_something/passme/named:param');
$this->assertEqual($route->response->header(), array('Location' => Router::url('/tags/add', true)));

View file

@ -2459,6 +2459,7 @@ class RouterTest extends CakeTestCase {
Router::redirect('/blog', array('controller' => 'posts'), array('status' => 302));
$this->assertEqual(count(Router::$routes), 1);
Router::$routes[0]->response = $this->getMock('CakeResponse', array('_sendHeader'));
Router::$routes[0]->stop = false;
$this->assertEqual(Router::$routes[0]->options['status'], 302);
Router::parse('/blog');

View file

@ -298,16 +298,6 @@ class ControllerTestCaseTest extends CakeTestCase {
include CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'routes.php';
$result = $this->Case->testAction('/some_alias');
$this->assertEquals($result, 5);
include CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'routes.php';
$this->Case->testAction('/redirect_me_now');
$result = $this->Case->headers['Location'];
$this->assertEquals($result, 'http://cakephp.org');
include CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'routes.php';
$this->Case->testAction('/redirect_me');
$result = $this->Case->headers['Location'];
$this->assertEquals($result, Router::url(array('controller' => 'tests_apps', 'action' => 'some_method'), true));
}
/**

View file

@ -21,5 +21,3 @@
Router::parseExtensions('json');
Router::connect('/some_alias', array('controller' => 'tests_apps', 'action' => 'some_method'));
Router::redirect('/redirect_me_now', 'http://cakephp.org');
Router::redirect('/redirect_me', array('controller' => 'tests_apps', 'action' => 'some_method'));

View file

@ -20,11 +20,11 @@
<!--nocache-->
<span class="notice">
<?php
echo __('Your tmp directory is ');
echo __d('cake', 'Your tmp directory is ');
if (is_writable(TMP)):
echo __('writable.');
echo __d('cake', 'writable.');
else:
echo __('NOT writable.');
echo __d('cake', 'NOT writable.');
endif;
?>
</span>
@ -33,12 +33,12 @@
<p>
<span class="notice">
<?php
echo __('Your cache is ');
echo __d('cake', 'Your cache is ');
if (Cache::isInitialized('default')):
echo __('set up and initialized properly.');
echo __d('cake', 'set up and initialized properly.');
$settings = Cache::settings();
echo '<p>' . $settings['engine'];
echo __(' is being used to cache, to change this edit config/core.php ');
echo __d('cake', ' is being used to cache, to change this edit config/core.php ');
echo '</p>';
echo 'Settings: <ul>';
@ -48,10 +48,10 @@
echo '</ul>';
else:
echo __('NOT working.');
echo __d('cake', 'NOT working.');
echo '<br />';
if (is_writable(TMP)):
echo __('Edit: config/core.php to insure you have the newset version of this file and the variable $cakeCache set properly');
echo __d('cake', 'Edit: config/core.php to insure you have the newset version of this file and the variable $cakeCache set properly');
endif;
endif;
?>
@ -60,15 +60,15 @@
<p>
<span class="notice">
<?php
echo __('Your database configuration file is ');
echo __d('cake', 'Your database configuration file is ');
$filePresent = null;
if (file_exists(APP . 'Config'.'database.php')):
echo __('present.');
echo __d('cake', 'present.');
$filePresent = true;
else:
echo __('NOT present.');
echo __d('cake', 'NOT present.');
echo '<br/>';
echo __('Rename config/database.php.default to config/database.php');
echo __d('cake', 'Rename config/database.php.default to config/database.php');
endif;
?>
</span>
@ -82,60 +82,60 @@ if (!empty($filePresent)):
?>
<p>
<span class="notice">
<?php echo __('Cake');
<?php echo __d('cake', 'Cake');
if ($connected->isConnected()):
__(' is able to ');
__d('cake', ' is able to ');
else:
__(' is NOT able to ');
__d('cake', ' is NOT able to ');
endif;
__('connect to the database.');
__d('cake', 'connect to the database.');
?>
</span>
</p>
<?php endif; ?>
<h2><?php echo __('Release Notes for CakePHP %s.', Configure::version()); ?></h2>
<a href="https://trac.cakephp.org/wiki/notes/1.2.x.x"><?php echo __('Read the release notes and get the latest version'); ?> </a>
<h2><?php echo __('Editing this Page'); ?></h2>
<h2><?php echo __d('cake', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2>
<a href="https://trac.cakephp.org/wiki/notes/1.2.x.x"><?php echo __d('cake', 'Read the release notes and get the latest version'); ?> </a>
<h2><?php echo __d('cake', 'Editing this Page'); ?></h2>
<p>
<?php echo __('To change the content of this page, create: /app/View/Pages/home.ctp.'); ?><br />
<?php echo __('To change its layout, create: /app/View/Layouts/default.ctp.'); ?><br />
<a href="http://manual.cakephp.org/"><?php echo __('See the views section of the manual for more info.'); ?> </a><br />
<?php echo __('You can also add some CSS styles for your pages at: app/webroot/css/.'); ?>
<?php echo __d('cake', 'To change the content of this page, create: /app/View/Pages/home.ctp.'); ?><br />
<?php echo __d('cake', 'To change its layout, create: /app/View/Layouts/default.ctp.'); ?><br />
<a href="http://manual.cakephp.org/"><?php echo __d('cake', 'See the views section of the manual for more info.'); ?> </a><br />
<?php echo __d('cake', 'You can also add some CSS styles for your pages at: app/webroot/css/.'); ?>
</p>
<h2><?php echo __('Getting Started'); ?></h2>
<h2><?php echo __d('cake', 'Getting Started'); ?></h2>
<p>
<a href="http://manual.cakephp.org/appendix/blog_tutorial"><?php echo __('The 15 min Blog Tutorial'); ?></a><br />
<a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html"><?php echo __('Cook up Web sites fast with CakePHP'); ?></a><br />
<a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-wiki1.html"><?php echo __('Create an interactive production wiki using PHP'); ?></a>
<a href="http://manual.cakephp.org/appendix/blog_tutorial"><?php echo __d('cake', 'The 15 min Blog Tutorial'); ?></a><br />
<a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html"><?php echo __d('cake', 'Cook up Web sites fast with CakePHP'); ?></a><br />
<a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-wiki1.html"><?php echo __d('cake', 'Create an interactive production wiki using PHP'); ?></a>
</p>
<h2><?php echo __('More about Cake'); ?></h2>
<h2><?php echo __d('cake', 'More about Cake'); ?></h2>
<p>
<?php echo __('CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.'); ?>
<?php echo __d('cake', 'CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.'); ?>
</p>
<p>
<?php echo __('Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.'); ?>
<?php echo __d('cake', 'Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.'); ?>
</p>
<ul>
<li><a href="http://cakefoundation.org/"><?php echo __('Cake Software Foundation'); ?> </a>
<ul><li><?php echo __('Promoting development related to CakePHP'); ?></li></ul></li>
<li><a href="http://bakery.cakephp.org"><?php echo __('The Bakery'); ?> </a>
<ul><li><?php echo __('Everything CakePHP'); ?></li></ul></li>
<li><a href="http://astore.amazon.com/cakesoftwaref-20/"><?php echo __('Book Store'); ?> </a>
<ul><li><?php echo __('Recommended Software Books'); ?></li></ul></li>
<li><a href="http://www.cafepress.com/cakefoundation"><?php echo __('CakeSchwag'); ?> </a>
<ul><li><?php echo __('Get your own CakePHP gear - Doughnate to Cake'); ?></li></ul></li>
<li><a href="http://www.cakephp.org"><?php echo __('CakePHP'); ?> </a>
<ul><li><?php echo __('The Rapid Development Framework'); ?></li></ul></li>
<li><a href="http://manual.cakephp.org"><?php echo __('CakePHP Manual'); ?> </a>
<ul><li><?php echo __('Your Rapid Development Cookbook'); ?></li></ul></li>
<li><a href="http://api.cakephp.org"><?php echo __('CakePHP API'); ?> </a>
<ul><li><?php echo __('Docblock Your Best Friend'); ?></li></ul></li>
<li><a href="http://www.cakeforge.org"><?php echo __('CakeForge'); ?> </a>
<ul><li><?php echo __('Open Development for CakePHP'); ?></li></ul></li>
<li><a href="https://trac.cakephp.org/"><?php echo __('CakePHP Trac'); ?> </a>
<ul><li><?php echo __('For the Development of CakePHP (Tickets, SVN browser, Roadmap, Changelogs)'); ?></li></ul></li>
<li><a href="http://groups-beta.google.com/group/cake-php"><?php echo __('CakePHP Google Group'); ?> </a>
<ul><li><?php echo __('Community mailing list'); ?></li></ul></li>
<li><a href="http://cakefoundation.org/"><?php echo __d('cake', 'Cake Software Foundation'); ?> </a>
<ul><li><?php echo __d('cake', 'Promoting development related to CakePHP'); ?></li></ul></li>
<li><a href="http://bakery.cakephp.org"><?php echo __d('cake', 'The Bakery'); ?> </a>
<ul><li><?php echo __d('cake', 'Everything CakePHP'); ?></li></ul></li>
<li><a href="http://astore.amazon.com/cakesoftwaref-20/"><?php echo __d('cake', 'Book Store'); ?> </a>
<ul><li><?php echo __d('cake', 'Recommended Software Books'); ?></li></ul></li>
<li><a href="http://www.cafepress.com/cakefoundation"><?php echo __d('cake', 'CakeSchwag'); ?> </a>
<ul><li><?php echo __d('cake', 'Get your own CakePHP gear - Doughnate to Cake'); ?></li></ul></li>
<li><a href="http://www.cakephp.org"><?php echo __d('cake', 'CakePHP'); ?> </a>
<ul><li><?php echo __d('cake', 'The Rapid Development Framework'); ?></li></ul></li>
<li><a href="http://manual.cakephp.org"><?php echo __d('cake', 'CakePHP Manual'); ?> </a>
<ul><li><?php echo __d('cake', 'Your Rapid Development Cookbook'); ?></li></ul></li>
<li><a href="http://api.cakephp.org"><?php echo __d('cake', 'CakePHP API'); ?> </a>
<ul><li><?php echo __d('cake', 'Docblock Your Best Friend'); ?></li></ul></li>
<li><a href="http://www.cakeforge.org"><?php echo __d('cake', 'CakeForge'); ?> </a>
<ul><li><?php echo __d('cake', 'Open Development for CakePHP'); ?></li></ul></li>
<li><a href="https://trac.cakephp.org/"><?php echo __d('cake', 'CakePHP Trac'); ?> </a>
<ul><li><?php echo __d('cake', 'For the Development of CakePHP (Tickets, SVN browser, Roadmap, Changelogs)'); ?></li></ul></li>
<li><a href="http://groups-beta.google.com/group/cake-php"><?php echo __d('cake', 'CakePHP Google Group'); ?> </a>
<ul><li><?php echo __d('cake', 'Community mailing list'); ?></li></ul></li>
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
<ul><li><?php echo __('Live chat about CakePHP'); ?></li></ul></li>
<ul><li><?php echo __d('cake', 'Live chat about CakePHP'); ?></li></ul></li>
</ul>

View file

@ -18,9 +18,9 @@
?>
<h2><?php echo $name; ?></h2>
<p class="error">
<strong><?php echo __('Error'); ?>: </strong>
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php printf(
__('The requested address %s was not found on this server.'),
__d('cake', 'The requested address %s was not found on this server.'),
"<strong>'{$url}'</strong>"
); ?>
</p>

View file

@ -18,8 +18,8 @@
?>
<h2><?php echo $name; ?></h2>
<p class="error">
<strong><?php echo __('Error'); ?>: </strong>
<?php echo __('An Internal Error Has Occurred.'); ?>
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php echo __d('cake', 'An Internal Error Has Occurred.'); ?>
</p>
<?php
if (Configure::read('debug') > 0 ):

View file

@ -683,7 +683,7 @@ class FormHelper extends AppHelper {
if (is_array($error)) {
foreach ($error as &$e) {
if (is_numeric($e)) {
$e = __('Error in field %s', Inflector::humanize($this->field()));
$e = __d('cake', 'Error in field %s', Inflector::humanize($this->field()));
}
}
}
@ -821,13 +821,13 @@ class FormHelper extends AppHelper {
}
if ($legend === true) {
$actionName = __('New %s');
$actionName = __d('cake', 'New %s');
$isEdit = (
strpos($this->request->params['action'], 'update') !== false ||
strpos($this->request->params['action'], 'edit') !== false
);
if ($isEdit) {
$actionName = __('Edit %s');
$actionName = __d('cake', 'Edit %s');
}
$modelName = Inflector::humanize(Inflector::underscore($model));
$legend = sprintf($actionName, __($modelName));
@ -1582,7 +1582,7 @@ class FormHelper extends AppHelper {
*/
public function submit($caption = null, $options = array()) {
if (!is_string($caption) && empty($caption)) {
$caption = __('Submit');
$caption = __d('cake', 'Submit');
}
$out = null;
$div = true;
@ -2435,18 +2435,18 @@ class FormHelper extends AppHelper {
break;
case 'month':
if ($options['monthNames'] === true) {
$data['01'] = __('January');
$data['02'] = __('February');
$data['03'] = __('March');
$data['04'] = __('April');
$data['05'] = __('May');
$data['06'] = __('June');
$data['07'] = __('July');
$data['08'] = __('August');
$data['09'] = __('September');
$data['10'] = __('October');
$data['11'] = __('November');
$data['12'] = __('December');
$data['01'] = __d('cake', 'January');
$data['02'] = __d('cake', 'February');
$data['03'] = __d('cake', 'March');
$data['04'] = __d('cake', 'April');
$data['05'] = __d('cake', 'May');
$data['06'] = __d('cake', 'June');
$data['07'] = __d('cake', 'July');
$data['08'] = __d('cake', 'August');
$data['09'] = __d('cake', 'September');
$data['10'] = __d('cake', 'October');
$data['11'] = __d('cake', 'November');
$data['12'] = __d('cake', 'December');
} else if (is_array($options['monthNames'])) {
$data = $options['monthNames'];
} else {

View file

@ -84,15 +84,15 @@ class NumberHelper extends AppHelper {
public function toReadableSize($size) {
switch (true) {
case $size < 1024:
return __n('%d Byte', '%d Bytes', $size, $size);
return __dn('cake', '%d Byte', '%d Bytes', $size, $size);
case round($size / 1024) < 1024:
return __('%d KB', $this->precision($size / 1024, 0));
return __d('cake', '%d KB', $this->precision($size / 1024, 0));
case round($size / 1024 / 1024, 2) < 1024:
return __('%.2f MB', $this->precision($size / 1024 / 1024, 2));
return __d('cake', '%.2f MB', $this->precision($size / 1024 / 1024, 2));
case round($size / 1024 / 1024 / 1024, 2) < 1024:
return __('%.2f GB', $this->precision($size / 1024 / 1024 / 1024, 2));
return __d('cake', '%.2f GB', $this->precision($size / 1024 / 1024 / 1024, 2));
default:
return __('%.2f TB', $this->precision($size / 1024 / 1024 / 1024 / 1024, 2));
return __d('cake', '%.2f TB', $this->precision($size / 1024 / 1024 / 1024 / 1024, 2));
}
}

View file

@ -557,7 +557,7 @@ class PaginatorHelper extends AppHelper {
array(
'model' => $this->defaultModel(),
'format' => 'pages',
'separator' => __(' of ')
'separator' => __d('cake', ' of ')
),
$options);

View file

@ -80,19 +80,19 @@ class TimeHelper extends AppHelper {
protected function _translateSpecifier($specifier) {
switch ($specifier[1]) {
case 'a':
$abday = __c('abday', 5);
$abday = __dc('cake', 'abday', 5);
if (is_array($abday)) {
return $abday[date('w', $this->__time)];
}
break;
case 'A':
$day = __c('day', 5);
$day = __dc('cake', 'day', 5);
if (is_array($day)) {
return $day[date('w', $this->__time)];
}
break;
case 'c':
$format = __c('d_t_fmt', 5);
$format = __dc('cake', 'd_t_fmt', 5);
if ($format != 'd_t_fmt') {
return $this->convertSpecifiers($format, $this->__time);
}
@ -114,13 +114,13 @@ class TimeHelper extends AppHelper {
return date('jS', $this->__time);
case 'b':
case 'h':
$months = __c('abmon', 5);
$months = __dc('cake', 'abmon', 5);
if (is_array($months)) {
return $months[date('n', $this->__time) -1];
}
return '%b';
case 'B':
$months = __c('mon', 5);
$months = __dc('cake', 'mon', 5);
if (is_array($months)) {
return $months[date('n', $this->__time) -1];
}
@ -131,14 +131,14 @@ class TimeHelper extends AppHelper {
case 'P':
$default = array('am' => 0, 'pm' => 1);
$meridiem = $default[date('a',$this->__time)];
$format = __c('am_pm', 5);
$format = __dc('cake', 'am_pm', 5);
if (is_array($format)) {
$meridiem = $format[$meridiem];
return ($specifier[1] == 'P') ? strtolower($meridiem) : strtoupper($meridiem);
}
break;
case 'r':
$complete = __c('t_fmt_ampm', 5);
$complete = __dc('cake', 't_fmt_ampm', 5);
if ($complete != 't_fmt_ampm') {
return str_replace('%p',$this->_translateSpecifier(array('%p', 'p')),$complete);
}
@ -152,13 +152,13 @@ class TimeHelper extends AppHelper {
case 'u':
return ($weekDay = date('w', $this->__time)) ? $weekDay : 7;
case 'x':
$format = __c('d_fmt', 5);
$format = __dc('cake', 'd_fmt', 5);
if ($format != 'd_fmt') {
return $this->convertSpecifiers($format, $this->__time);
}
break;
case 'X':
$format = __c('t_fmt', 5);
$format = __dc('cake', 't_fmt', 5);
if ($format != 't_fmt') {
return $this->convertSpecifiers($format, $this->__time);
}
@ -260,9 +260,9 @@ class TimeHelper extends AppHelper {
$y = $this->isThisYear($date) ? '' : ' %Y';
if ($this->isToday($dateString, $userOffset)) {
$ret = __('Today, %s', strftime("%H:%M", $date));
$ret = __d('cake', 'Today, %s', strftime("%H:%M", $date));
} elseif ($this->wasYesterday($dateString, $userOffset)) {
$ret = __('Yesterday, %s', strftime("%H:%M", $date));
$ret = __d('cake', 'Yesterday, %s', strftime("%H:%M", $date));
} else {
$format = $this->convertSpecifiers("%b %eS{$y}, %H:%M", $date);
$ret = strftime($format, $date);
@ -609,41 +609,41 @@ class TimeHelper extends AppHelper {
$diff = $futureTime - $pastTime;
if ($diff > abs($now - $this->fromString($end))) {
$relativeDate = __('on %s', date($format, $inSeconds));
$relativeDate = __d('cake', 'on %s', date($format, $inSeconds));
} else {
if ($years > 0) {
// years and months and days
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d year', '%d years', $years, $years);
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . __n('%d month', '%d months', $months, $months) : '';
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . __n('%d week', '%d weeks', $weeks, $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . __n('%d day', '%d days', $days, $days) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d year', '%d years', $years, $years);
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d month', '%d months', $months, $months) : '';
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d week', '%d weeks', $weeks, $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d day', '%d days', $days, $days) : '';
} elseif (abs($months) > 0) {
// months, weeks and days
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d month', '%d months', $months, $months);
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . __n('%d week', '%d weeks', $weeks, $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . __n('%d day', '%d days', $days, $days) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d month', '%d months', $months, $months);
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d week', '%d weeks', $weeks, $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d day', '%d days', $days, $days) : '';
} elseif (abs($weeks) > 0) {
// weeks and days
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d week', '%d weeks', $weeks, $weeks);
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . __n('%d day', '%d days', $days, $days) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d week', '%d weeks', $weeks, $weeks);
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d day', '%d days', $days, $days) : '';
} elseif (abs($days) > 0) {
// days and hours
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d day', '%d days', $days, $days);
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . __n('%d hour', '%d hours', $hours, $hours) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d day', '%d days', $days, $days);
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d hour', '%d hours', $hours, $hours) : '';
} elseif (abs($hours) > 0) {
// hours and minutes
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d hour', '%d hours', $hours, $hours);
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . __n('%d minute', '%d minutes', $minutes, $minutes) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d hour', '%d hours', $hours, $hours);
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . __dn('cake', '%d minute', '%d minutes', $minutes, $minutes) : '';
} elseif (abs($minutes) > 0) {
// minutes only
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d minute', '%d minutes', $minutes, $minutes);
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d minute', '%d minutes', $minutes, $minutes);
} else {
// seconds only
$relativeDate .= ($relativeDate ? ', ' : '') . __n('%d second', '%d seconds', $seconds, $seconds);
$relativeDate .= ($relativeDate ? ', ' : '') . __dn('cake', '%d second', '%d seconds', $seconds, $seconds);
}
if (!$backwards) {
$relativeDate = __('%s ago', $relativeDate);
$relativeDate = __d('cake', '%s ago', $relativeDate);
}
}
return $relativeDate;
@ -662,7 +662,7 @@ class TimeHelper extends AppHelper {
public function wasWithinLast($timeInterval, $dateString, $userOffset = null) {
$tmp = str_replace(' ', '', $timeInterval);
if (is_numeric($tmp)) {
$timeInterval = $tmp . ' ' . __('days');
$timeInterval = $tmp . ' ' . __d('cake', 'days');
}
$date = $this->fromString($dateString, $userOffset);

View file

@ -20,32 +20,32 @@
<?php
echo $this->Form->create();
echo $this->Form->inputs($scaffoldFields, array('created', 'modified', 'updated'));
echo $this->Form->end(__('Submit'));
echo $this->Form->end(__d('cake', 'Submit'));
?>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<h3><?php echo __d('cake', 'Actions'); ?></h3>
<ul>
<?php if ($this->request->action != 'add'): ?>
<li><?php echo $this->Form->postLink(
__('Delete'),
__d('cake', 'Delete'),
array('action' => 'delete', $this->Form->value($modelClass . '.' . $primaryKey)),
null,
__('Are you sure you want to delete # %s?', $this->Form->value($modelClass . '.' . $primaryKey)));
__d('cake', 'Are you sure you want to delete # %s?', $this->Form->value($modelClass . '.' . $primaryKey)));
?></li>
<?php endif;?>
<li><?php echo $this->Html->link(__('List') . ' ' . $pluralHumanName, array('action' => 'index'));?></li>
<li><?php echo $this->Html->link(__d('cake', 'List') . ' ' . $pluralHumanName, array('action' => 'index'));?></li>
<?php
$done = array();
foreach ($associations as $_type => $_data) {
foreach ($_data as $_alias => $_details) {
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
echo "\t\t<li>" . $this->Html->link(__('List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' =>'index')) . "</li>\n";
echo "\t\t<li>" . $this->Html->link(__('New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' =>'add')) . "</li>\n";
echo "\t\t<li>" . $this->Html->link(__d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' =>'index')) . "</li>\n";
echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' =>'add')) . "</li>\n";
$done[] = $_details['controller'];
}
}
}
?>
</ul>
</div>
</div>

View file

@ -23,7 +23,7 @@
<?php foreach ($scaffoldFields as $_field):?>
<th><?php echo $this->Paginator->sort($_field);?></th>
<?php endforeach;?>
<th><?php echo __('Actions');?></th>
<th><?php echo __d('cake', 'Actions');?></th>
</tr>
<?php
$i = 0;
@ -46,13 +46,13 @@ foreach (${$pluralVar} as ${$singularVar}):
}
echo '<td class="actions">';
echo $this->Html->link(__('View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey]));
echo $this->Html->link(__('Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
echo $this->Html->link(__d('cake', 'View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey]));
echo $this->Html->link(__d('cake', 'Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
echo $this->Form->postLink(
__('Delete'),
__d('cake', 'Delete'),
array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]),
null,
__('Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey]
__d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey]
);
echo '</td>';
echo '</tr>';
@ -63,28 +63,28 @@ endforeach;
</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}')
'format' => __d('cake', '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->prev('< ' . __d('cake', 'previous'), array(), null, array('class' => 'prev disabled'));
echo $this->Paginator->numbers(array('separator' => ''));
echo $this->Paginator->next(__('next') .' >', array(), null, array('class' => 'next disabled'));
echo $this->Paginator->next(__d('cake', 'next') .' >', array(), null, array('class' => 'next disabled'));
?>
</div>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<h3><?php echo __d('cake', 'Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('New %s', $singularHumanName), array('action' => 'add')); ?></li>
<li><?php echo $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')); ?></li>
<?php
$done = array();
foreach ($associations as $_type => $_data) {
foreach ($_data as $_alias => $_details) {
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
echo "<li>" . $this->Html->link(__('List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>";
echo "<li>" . $this->Html->link(__('New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>";
echo "<li>" . $this->Html->link(__d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>";
echo "<li>" . $this->Html->link(__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>";
$done[] = $_details['controller'];
}
}

View file

@ -17,7 +17,7 @@
*/
?>
<div class="<?php echo $pluralVar;?> view">
<h2><?php echo __('View %s', $singularHumanName); ?></h2>
<h2><?php echo __d('cake', 'View %s', $singularHumanName); ?></h2>
<dl>
<?php
$i = 0;
@ -42,20 +42,20 @@ foreach ($scaffoldFields as $_field) {
</dl>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<h3><?php echo __d('cake', 'Actions'); ?></h3>
<ul>
<?php
echo "\t\t<li>" .$this->Html->link(__('Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__('Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __('Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__('List %s', $pluralHumanName), array('action' => 'index')). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__('New %s', $singularHumanName), array('action' => 'add')). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')). " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')). " </li>\n";
$done = array();
foreach ($associations as $_type => $_data) {
foreach ($_data as $_alias => $_details) {
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
echo "\t\t<li>" . $this->Html->link(__('List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n";
echo "\t\t<li>" . $this->Html->link(__('New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n";
echo "\t\t<li>" . $this->Html->link(__d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n";
echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n";
$done[] = $_details['controller'];
}
}
@ -67,7 +67,7 @@ foreach ($scaffoldFields as $_field) {
if (!empty($associations['hasOne'])) :
foreach ($associations['hasOne'] as $_alias => $_details): ?>
<div class="related">
<h3><?php echo __("Related %s", Inflector::humanize($_details['controller'])); ?></h3>
<h3><?php echo __d('cake', "Related %s", Inflector::humanize($_details['controller'])); ?></h3>
<?php if (!empty(${$singularVar}[$_alias])):?>
<dl>
<?php
@ -82,7 +82,7 @@ foreach ($associations['hasOne'] as $_alias => $_details): ?>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $this->Html->link(__('Edit %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'edit', ${$singularVar}[$_alias][$_details['primaryKey']]))."</li>\n";?>
<li><?php echo $this->Html->link(__d('cake', 'Edit %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'edit', ${$singularVar}[$_alias][$_details['primaryKey']]))."</li>\n";?>
</ul>
</div>
</div>
@ -102,7 +102,7 @@ foreach ($relations as $_alias => $_details):
$otherSingularVar = Inflector::variable($_alias);
?>
<div class="related">
<h3><?php echo __("Related %s", Inflector::humanize($_details['controller'])); ?></h3>
<h3><?php echo __d('cake', "Related %s", Inflector::humanize($_details['controller'])); ?></h3>
<?php if (!empty(${$singularVar}[$_alias])):?>
<table cellpadding="0" cellspacing="0">
<tr>
@ -128,9 +128,9 @@ $otherSingularVar = Inflector::variable($_alias);
}
echo "\t\t\t<td class=\"actions\">\n";
echo "\t\t\t\t" . $this->Html->link(__('View'), array('controller' => $_details['controller'], 'action' => 'view', ${$otherSingularVar}[$_details['primaryKey']])). "\n";
echo "\t\t\t\t" . $this->Html->link(__('Edit'), array('controller' => $_details['controller'], 'action' => 'edit', ${$otherSingularVar}[$_details['primaryKey']])). "\n";
echo "\t\t\t\t" . $this->Html->link(__('Delete'), array('controller' => $_details['controller'], 'action' => 'delete', ${$otherSingularVar}[$_details['primaryKey']]), null, __('Are you sure you want to delete', true).' #' . ${$otherSingularVar}[$_details['primaryKey']] . '?'). "\n";
echo "\t\t\t\t" . $this->Html->link(__d('cake', 'View'), array('controller' => $_details['controller'], 'action' => 'view', ${$otherSingularVar}[$_details['primaryKey']])). "\n";
echo "\t\t\t\t" . $this->Html->link(__d('cake', 'Edit'), array('controller' => $_details['controller'], 'action' => 'edit', ${$otherSingularVar}[$_details['primaryKey']])). "\n";
echo "\t\t\t\t" . $this->Html->link(__d('cake', 'Delete'), array('controller' => $_details['controller'], 'action' => 'delete', ${$otherSingularVar}[$_details['primaryKey']]), null, __d('cake', 'Are you sure you want to delete', true).' #' . ${$otherSingularVar}[$_details['primaryKey']] . '?'). "\n";
echo "\t\t\t</td>\n";
echo "\t\t</tr>\n";
endforeach;
@ -139,7 +139,7 @@ $otherSingularVar = Inflector::variable($_alias);
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $this->Html->link(__("New %s", Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add'));?> </li>
<li><?php echo $this->Html->link(__d('cake', "New %s", Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add'));?> </li>
</ul>
</div>
</div>

View file

@ -130,6 +130,7 @@ spl_autoload_register(array('App', 'load'));
App::uses('ErrorHandler', 'Error');
App::uses('Configure', 'Core');
App::uses('CakePlugin', 'Core');
App::uses('Cache', 'Cache');
App::uses('Object', 'Core');
App::$bootstrapping = true;