Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
This commit is contained in:
ADmad 2013-05-05 14:36:46 +05:30
commit a10275fb8b
80 changed files with 325 additions and 703 deletions

View file

@ -113,7 +113,7 @@
Define the package.xml. Using xml to make xml is fun! Define the package.xml. Using xml to make xml is fun!
--> -->
<target name="define-pear-package" depends="copy-files"> <target name="define-pear-package" depends="copy-files">
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/${pear.package}"> <d51pearpkg2 addhiddenfiles="true" baseinstalldir="/" dir="${build.dir}/${pear.package}">
<name>CakePHP</name> <name>CakePHP</name>
<summary>CakePHP Rapid Development Framework</summary> <summary>CakePHP Rapid Development Framework</summary>
<channel>pear.cakephp.org</channel> <channel>pear.cakephp.org</channel>
@ -152,6 +152,8 @@
<exceptions key="Cake/VERSION.txt">php</exceptions> <exceptions key="Cake/VERSION.txt">php</exceptions>
<exceptions key="Cake/LICENSE.txt">php</exceptions> <exceptions key="Cake/LICENSE.txt">php</exceptions>
<exceptions key="Cake/Config/cacert.pem">php</exceptions> <exceptions key="Cake/Config/cacert.pem">php</exceptions>
<exceptions key="Cake/Console/Templates/skel/.htaccess">php</exceptions>
<exceptions key="Cake/Console/Templates/skel/webroot/.htaccess">php</exceptions>
</d51pearpkg2> </d51pearpkg2>
</target> </target>

View file

@ -36,7 +36,7 @@ class RedisEngine extends CacheEngine {
/** /**
* Settings * Settings
* *
* - server = string url or ip to the Redis server host * - server = string URL or ip to the Redis server host
* - port = integer port number to the Redis server (default: 6379) * - port = integer port number to the Redis server (default: 6379)
* - timeout = float timeout in seconds (default: 0) * - timeout = float timeout in seconds (default: 0)
* - persistent = bool Connects to the Redis server with a persistent connection (default: true) * - persistent = bool Connects to the Redis server with a persistent connection (default: true)

View file

@ -632,8 +632,8 @@ class UpgradeShell extends AppShell {
/** /**
* Move application php files to where they now should be * Move application php files to where they now should be
* *
* Find all php files in the folder (honoring recursive) and determine where cake expects the file to be * Find all php files in the folder (honoring recursive) and determine where CakePHP expects the file to be
* If the file is not exactly where cake expects it - move it. * If the file is not exactly where CakePHP expects it - move it.
* *
* @param string $path * @param string $path
* @param array $options array(recursive, checkFolder) * @param array $options array(recursive, checkFolder)

View file

@ -89,7 +89,7 @@
* *
* And uncomment the App.baseUrl below. But keep in mind * And uncomment the App.baseUrl below. But keep in mind
* that plugin assets such as images, CSS and Javascript files * that plugin assets such as images, CSS and Javascript files
* will not work without url rewriting! * will not work without URL rewriting!
* To work around this issue you should either symlink or copy * To work around this issue you should either symlink or copy
* the plugin assets into you app's webroot directory. This is * the plugin assets into you app's webroot directory. This is
* recommended even when you are using mod_rewrite. Handling static * recommended even when you are using mod_rewrite. Handling static

View file

@ -4,7 +4,7 @@
* *
* In this file, you set up routes to your controllers and their actions. * In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect * Routes are very important mechanism that allows you to freely connect
* different urls to chosen controllers and their actions (functions). * different URLs to chosen controllers and their actions (functions).
* *
* PHP 5 * PHP 5
* *
@ -19,7 +19,7 @@
*/ */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/** /**
* ...and connect the rest of 'Pages' controller's urls. * ...and connect the rest of 'Pages' controller's URLs.
*/ */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

View file

@ -18,7 +18,7 @@ if (!defined('DS')) {
} }
/** /**
* These defines should only be edited if you have cake installed in * These defines should only be edited if you have CakePHP installed in
* a directory layout other than the way it is distributed. * a directory layout other than the way it is distributed.
* When using custom settings be sure to use the DS and do not add a trailing DS. * When using custom settings be sure to use the DS and do not add a trailing DS.
*/ */

View file

@ -142,8 +142,8 @@ class Component extends Object {
} }
/** /**
* Called before Controller::redirect(). Allows you to replace the url that will * Called before Controller::redirect(). Allows you to replace the URL that will
* be redirected to with a new url. The return of this method can either be an array or a string. * be redirected to with a new URL. The return of this method can either be an array or a string.
* *
* If the return is an array and contains a 'url' key. You may also supply the following: * If the return is an array and contains a 'url' key. You may also supply the following:
* *
@ -151,10 +151,10 @@ class Component extends Object {
* - `exit` Whether or not the redirect should exit. * - `exit` Whether or not the redirect should exit.
* *
* If your response is a string or an array that does not contain a 'url' key it will * If your response is a string or an array that does not contain a 'url' key it will
* be used as the new url to redirect to. * be used as the new URL to redirect to.
* *
* @param Controller $controller Controller with components to beforeRedirect * @param Controller $controller Controller with components to beforeRedirect
* @param string|array $url Either the string or url array that is being redirected to. * @param string|array $url Either the string or URL array that is being redirected to.
* @param integer $status The status code of the redirect * @param integer $status The status code of the redirect
* @param boolean $exit Will the script exit. * @param boolean $exit Will the script exit.
* @return array|void Either an array or null. * @return array|void Either an array or null.

View file

@ -174,7 +174,7 @@ class AuthComponent extends Component {
protected static $_user = array(); protected static $_user = array();
/** /**
* A URL (defined as a string or array) to the controller action that handles * An URL (defined as a string or array) to the controller action that handles
* logins. Defaults to `/users/login` * logins. Defaults to `/users/login`
* *
* @var mixed * @var mixed
@ -218,9 +218,9 @@ class AuthComponent extends Component {
/** /**
* Controls handling of unauthorized access. * Controls handling of unauthorized access.
* - For default value `true` unauthorized user is redirected to the referrer url * - For default value `true` unauthorized user is redirected to the referrer URL
* or AuthComponent::$loginRedirect or '/'. * or AuthComponent::$loginRedirect or '/'.
* - If set to a string or array the value is used as an url to redirect to. * - If set to a string or array the value is used as an URL to redirect to.
* - If set to false a ForbiddenException exception is thrown instead of redirecting. * - If set to false a ForbiddenException exception is thrown instead of redirecting.
* *
* @var mixed * @var mixed
@ -701,10 +701,10 @@ class AuthComponent extends Component {
/** /**
* Get the URL a use should be redirected to upon login. * Get the URL a use should be redirected to upon login.
* *
* Pass a url in to set the destination a user should be redirected to upon * Pass an URL in to set the destination a user should be redirected to upon
* logging in. * logging in.
* *
* If no parameter is passed, gets the authentication redirect URL. The url * If no parameter is passed, gets the authentication redirect URL. The URL
* returned is as per following rules: * returned is as per following rules:
* *
* - Returns the session Auth.redirect value if it is present and for the same * - Returns the session Auth.redirect value if it is present and for the same

View file

@ -212,6 +212,9 @@ class PaginatorComponent extends Component {
$pageCount = intval(ceil($count / $limit)); $pageCount = intval(ceil($count / $limit));
$requestedPage = $page; $requestedPage = $page;
$page = max(min($page, $pageCount), 1); $page = max(min($page, $pageCount), 1);
if ($requestedPage > $page) {
throw new NotFoundException();
}
$paging = array( $paging = array(
'page' => $page, 'page' => $page,
@ -234,10 +237,6 @@ class PaginatorComponent extends Component {
array($object->alias => $paging) array($object->alias => $paging)
); );
if ($requestedPage > $page) {
throw new NotFoundException();
}
if ( if (
!in_array('Paginator', $this->Controller->helpers) && !in_array('Paginator', $this->Controller->helpers) &&
!array_key_exists('Paginator', $this->Controller->helpers) !array_key_exists('Paginator', $this->Controller->helpers)
@ -384,10 +383,11 @@ class PaginatorComponent extends Component {
if (strpos($key, '.') !== false) { if (strpos($key, '.') !== false) {
list($alias, $field) = explode('.', $key); list($alias, $field) = explode('.', $key);
} }
$correctAlias = ($object->alias == $alias);
if ($object->hasField($field)) { if ($correctAlias && $object->hasField($field)) {
$order[$object->alias . '.' . $field] = $value; $order[$object->alias . '.' . $field] = $value;
} elseif ($object->hasField($key, true)) { } elseif ($correctAlias && $object->hasField($key, true)) {
$order[$field] = $value; $order[$field] = $value;
} elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field, true)) { } elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field, true)) {
$order[$alias . '.' . $field] = $value; $order[$alias . '.' . $field] = $value;

View file

@ -40,7 +40,7 @@ App::uses('CakeEventManager', 'Event');
* `$this->response` allows you to manipulate all aspects of the response. * `$this->response` allows you to manipulate all aspects of the response.
* *
* Controllers are created by Dispatcher based on request parameters and routing. By default controllers and actions * Controllers are created by Dispatcher based on request parameters and routing. By default controllers and actions
* use conventional names. For example `/posts/index` maps to `PostsController::index()`. You can re-map urls * use conventional names. For example `/posts/index` maps to `PostsController::index()`. You can re-map URLs
* using Router::connect(). * using Router::connect().
* *
* @package Cake.Controller * @package Cake.Controller
@ -259,7 +259,7 @@ class Controller extends Object implements CakeEventListener {
/** /**
* Holds current methods of the controller. This is a list of all the methods reachable * Holds current methods of the controller. This is a list of all the methods reachable
* via url. Modifying this array, will allow you to change which methods can be reached. * via URL. Modifying this array, will allow you to change which methods can be reached.
* *
* @var array * @var array
*/ */
@ -1011,7 +1011,7 @@ class Controller extends Object implements CakeEventListener {
* @param boolean $exclusive If true, and $op is an array, fields not included in $op will not be * @param boolean $exclusive If true, and $op is an array, fields not included in $op will not be
* included in the returned conditions * included in the returned conditions
* @return array An array of model conditions * @return array An array of model conditions
* @deprecated * @deprecated Will be removed in 3.0
*/ */
public function postConditions($data = array(), $op = null, $bool = 'AND', $exclusive = false) { public function postConditions($data = array(), $op = null, $bool = 'AND', $exclusive = false) {
if (!is_array($data) || empty($data)) { if (!is_array($data) || empty($data)) {

View file

@ -58,8 +58,8 @@ class Object {
* POST and GET data can be simulated in requestAction. Use `$extra['url']` for * POST and GET data can be simulated in requestAction. Use `$extra['url']` for
* GET data. The `$extra['data']` parameter allows POST data simulation. * GET data. The `$extra['data']` parameter allows POST data simulation.
* *
* @param string|array $url String or array-based url. Unlike other url arrays in CakePHP, this * @param string|array $url String or array-based URL. Unlike other URL arrays in CakePHP, this
* url will not automatically handle passed and named arguments in the $url parameter. * URL will not automatically handle passed and named arguments in the $url parameter.
* @param array $extra if array includes the key "return" it sets the AutoRender to true. Can * @param array $extra if array includes the key "return" it sets the AutoRender to true. Can
* also be used to submit GET/POST data, and named/passed arguments. * also be used to submit GET/POST data, and named/passed arguments.
* @return mixed Boolean true or false on success/failure, or contents * @return mixed Boolean true or false on success/failure, or contents

View file

@ -250,7 +250,6 @@ class CakeSession {
self::_overwrite($_SESSION, Hash::remove($_SESSION, $name)); self::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
return !self::check($name); return !self::check($name);
} }
self::_setError(2, __d('cake_dev', "%s doesn't exist", $name));
return false; return false;
} }
@ -370,7 +369,6 @@ class CakeSession {
if (isset($result)) { if (isset($result)) {
return $result; return $result;
} }
self::_setError(2, "$name doesn't exist");
return null; return null;
} }

View file

@ -633,16 +633,10 @@ class Postgres extends DboSource {
*/ */
public function limit($limit, $offset = null) { public function limit($limit, $offset = null) {
if ($limit) { if ($limit) {
$rt = ''; $rt = sprintf(' LIMIT %u', $limit);
if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) {
$rt = ' LIMIT';
}
$rt .= ' ' . $limit;
if ($offset) { if ($offset) {
$rt .= ' OFFSET ' . $offset; $rt .= sprintf(' OFFSET %u', $offset);
} }
return $rt; return $rt;
} }
return null; return null;

View file

@ -377,13 +377,9 @@ class Sqlite extends DboSource {
*/ */
public function limit($limit, $offset = null) { public function limit($limit, $offset = null) {
if ($limit) { if ($limit) {
$rt = ''; $rt = sprintf(' LIMIT %u', $limit);
if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) {
$rt = ' LIMIT';
}
$rt .= ' ' . $limit;
if ($offset) { if ($offset) {
$rt .= ' OFFSET ' . $offset; $rt .= sprintf(' OFFSET %u', $offset);
} }
return $rt; return $rt;
} }

View file

@ -389,9 +389,9 @@ class Sqlserver extends DboSource {
if (!strpos(strtolower($limit), 'top') || strpos(strtolower($limit), 'top') === 0) { if (!strpos(strtolower($limit), 'top') || strpos(strtolower($limit), 'top') === 0) {
$rt = ' TOP'; $rt = ' TOP';
} }
$rt .= ' ' . $limit; $rt .= sprintf(' %u', $limit);
if (is_int($offset) && $offset > 0) { if (is_int($offset) && $offset > 0) {
$rt = ' OFFSET ' . intval($offset) . ' ROWS FETCH FIRST ' . intval($limit) . ' ROWS ONLY'; $rt = sprintf(' OFFSET %u ROWS FETCH FIRST %u ROWS ONLY', $offset, $limit);
} }
return $rt; return $rt;
} }

View file

@ -1529,7 +1529,6 @@ class DboSource extends DataSource {
if (empty($assocData['offset']) && !empty($assocData['page'])) { if (empty($assocData['offset']) && !empty($assocData['page'])) {
$assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit']; $assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit'];
} }
$assocData['limit'] = $this->limit($assocData['limit'], $assocData['offset']);
switch ($type) { switch ($type) {
case 'hasOne': case 'hasOne':
@ -1555,7 +1554,6 @@ class DboSource extends DataSource {
'alias' => $association, 'alias' => $association,
'group' => null 'group' => null
)); ));
$query += array('order' => $assocData['order'], 'limit' => $assocData['limit']);
} else { } else {
$join = array( $join = array(
'table' => $linkModel, 'table' => $linkModel,
@ -1586,6 +1584,7 @@ class DboSource extends DataSource {
'alias' => $association, 'alias' => $association,
'order' => $assocData['order'], 'order' => $assocData['order'],
'limit' => $assocData['limit'], 'limit' => $assocData['limit'],
'offset' => $assocData['offset'],
'group' => null 'group' => null
); );
break; break;
@ -1613,6 +1612,7 @@ class DboSource extends DataSource {
$query = array( $query = array(
'conditions' => $assocData['conditions'], 'conditions' => $assocData['conditions'],
'limit' => $assocData['limit'], 'limit' => $assocData['limit'],
'offset' => $assocData['offset'],
'table' => $this->fullTableName($linkModel), 'table' => $this->fullTableName($linkModel),
'alias' => $association, 'alias' => $association,
'fields' => array_merge($this->fields($linkModel, $association, $assocData['fields']), $joinFields), 'fields' => array_merge($this->fields($linkModel, $association, $assocData['fields']), $joinFields),
@ -2672,16 +2672,13 @@ class DboSource extends DataSource {
*/ */
public function limit($limit, $offset = null) { public function limit($limit, $offset = null) {
if ($limit) { if ($limit) {
$rt = ''; $rt = ' LIMIT';
if (!strpos(strtolower($limit), 'limit')) {
$rt = ' LIMIT';
}
if ($offset) { if ($offset) {
$rt .= ' ' . $offset . ','; $rt .= sprintf(' %u,', $offset);
} }
$rt .= ' ' . $limit; $rt .= sprintf(' %u', $limit);
return $rt; return $rt;
} }
return null; return null;

View file

@ -603,10 +603,10 @@ class CakeRequest implements ArrayAccess {
} }
/** /**
* Get the value of the current requests url. Will include named parameters and querystring arguments. * Get the value of the current requests URL. Will include named parameters and querystring arguments.
* *
* @param boolean $base Include the base path, set to false to trim the base path off. * @param boolean $base Include the base path, set to false to trim the base path off.
* @return string the current request url including query string args. * @return string the current request URL including query string args.
*/ */
public function here($base = true) { public function here($base = true) {
$url = $this->here; $url = $this->here;

View file

@ -319,8 +319,8 @@ class CakeEmail {
/** /**
* Constructor * Constructor
* @param array|string $config Array of configs, or string to load configs from email.php
* *
* @param array|string $config Array of configs, or string to load configs from email.php
*/ */
public function __construct($config = null) { public function __construct($config = null) {
$this->_appCharset = Configure::read('App.encoding'); $this->_appCharset = Configure::read('App.encoding');
@ -1576,6 +1576,12 @@ class CakeEmail {
$render = str_replace(array("\r\n", "\r"), "\n", $render); $render = str_replace(array("\r\n", "\r"), "\n", $render);
$rendered[$type] = $this->_encodeString($render, $this->charset); $rendered[$type] = $this->_encodeString($render, $this->charset);
} }
foreach ($rendered as $type => $content) {
$rendered[$type] = $this->_wrap($content);
$rendered[$type] = implode("\n", $rendered[$type]);
$rendered[$type] = rtrim($rendered[$type], "\n");
}
return $rendered; return $rendered;
} }

View file

@ -132,7 +132,7 @@ class HttpSocket extends CakeSocket {
/** /**
* Build an HTTP Socket using the specified configuration. * Build an HTTP Socket using the specified configuration.
* *
* You can use a url string to set the url and use default configurations for * You can use an URL string to set the URL and use default configurations for
* all other options: * all other options:
* *
* `$http = new HttpSocket('http://cakephp.org/');` * `$http = new HttpSocket('http://cakephp.org/');`
@ -148,7 +148,7 @@ class HttpSocket extends CakeSocket {
* *
* See HttpSocket::$config for options that can be used. * See HttpSocket::$config for options that can be used.
* *
* @param string|array $config Configuration information, either a string url or an array of options. * @param string|array $config Configuration information, either a string URL or an array of options.
*/ */
public function __construct($config = array()) { public function __construct($config = array()) {
if (is_string($config)) { if (is_string($config)) {
@ -462,7 +462,7 @@ class HttpSocket extends CakeSocket {
/** /**
* Issues a POST request to the specified URI, query, and request. * Issues a POST request to the specified URI, query, and request.
* *
* `post()` can be used to post simple data arrays to a url: * `post()` can be used to post simple data arrays to an URL:
* *
* {{{ * {{{
* $response = $http->post('http://example.com', array( * $response = $http->post('http://example.com', array(
@ -508,14 +508,14 @@ class HttpSocket extends CakeSocket {
} }
/** /**
* Normalizes urls into a $uriTemplate. If no template is provided * Normalizes URLs into a $uriTemplate. If no template is provided
* a default one will be used. Will generate the url using the * a default one will be used. Will generate the URL using the
* current config information. * current config information.
* *
* ### Usage: * ### Usage:
* *
* After configuring part of the request parameters, you can use url() to generate * After configuring part of the request parameters, you can use url() to generate
* urls. * URLs.
* *
* {{{ * {{{
* $http = new HttpSocket('http://www.cakephp.org'); * $http = new HttpSocket('http://www.cakephp.org');
@ -530,9 +530,9 @@ class HttpSocket extends CakeSocket {
* *
* Would return `/search?q=socket`. * Would return `/search?q=socket`.
* *
* @param string|array Either a string or array of url options to create a url with. * @param string|array Either a string or array of URL options to create an URL with.
* @param string $uriTemplate A template string to use for url formatting. * @param string $uriTemplate A template string to use for URL formatting.
* @return mixed Either false on failure or a string containing the composed url. * @return mixed Either false on failure or a string containing the composed URL.
*/ */
public function url($url = null, $uriTemplate = null) { public function url($url = null, $uriTemplate = null) {
if (is_null($url)) { if (is_null($url)) {

View file

@ -54,7 +54,7 @@ abstract class DispatcherFilter implements CakeEventListener {
/** /**
* Method called before the controller is instantiated and called to serve a request. * Method called before the controller is instantiated and called to serve a request.
* If used with default priority, it will be called after the Router has parsed the * If used with default priority, it will be called after the Router has parsed the
* url and set the routing params into the request object. * URL and set the routing params into the request object.
* *
* If a CakeResponse object instance is returned, it will be served at the end of the * If a CakeResponse object instance is returned, it will be served at the end of the
* event cycle, not calling any controller as a result. This will also have the effect of * event cycle, not calling any controller as a result. This will also have the effect of

View file

@ -178,9 +178,9 @@ class CakeRoute {
* Checks to see if the given URL can be parsed by this route. * Checks to see if the given URL can be parsed by this route.
* *
* If the route can be parsed an array of parameters will be returned; if not * If the route can be parsed an array of parameters will be returned; if not
* false will be returned. String urls are parsed if they match a routes regular expression. * false will be returned. String URLs are parsed if they match a routes regular expression.
* *
* @param string $url The url to attempt to parse. * @param string $url The URL to attempt to parse.
* @return mixed Boolean false on failure, otherwise an array or parameters * @return mixed Boolean false on failure, otherwise an array or parameters
*/ */
public function parse($url) { public function parse($url) {
@ -368,9 +368,9 @@ class CakeRoute {
} }
/** /**
* Apply persistent parameters to a url array. Persistent parameters are a special * Apply persistent parameters to an URL array. Persistent parameters are a special
* key used during route creation to force route parameters to persist when omitted from * key used during route creation to force route parameters to persist when omitted from
* a url array. * an URL array.
* *
* @param array $url The array to apply persistent parameters to. * @param array $url The array to apply persistent parameters to.
* @param array $params An array of persistent values to replace persistent ones. * @param array $params An array of persistent values to replace persistent ones.
@ -386,14 +386,14 @@ class CakeRoute {
} }
/** /**
* Check if a url array matches this route instance. * Check if an URL array matches this route instance.
* *
* If the url matches the route parameters and settings, then * If the URL matches the route parameters and settings, then
* return a generated string url. If the url doesn't match the route parameters, false will be returned. * return a generated string URL. If the URL doesn't match the route parameters, false will be returned.
* This method handles the reverse routing or conversion of url arrays into string urls. * This method handles the reverse routing or conversion of URL arrays into string URLs.
* *
* @param array $url An array of parameters to check matching with. * @param array $url An array of parameters to check matching with.
* @return mixed Either a string url for the parameters if they match or false. * @return mixed Either a string URL for the parameters if they match or false.
*/ */
public function match($url) { public function match($url) {
if (!$this->compiled()) { if (!$this->compiled()) {
@ -481,12 +481,12 @@ class CakeRoute {
} }
/** /**
* Converts a matching route array into a url string. * Converts a matching route array into an URL string.
* *
* Composes the string url using the template * Composes the string URL using the template
* used to create the route. * used to create the route.
* *
* @param array $params The params to convert to a string url. * @param array $params The params to convert to a string URL.
* @return string Composed route string. * @return string Composed route string.
*/ */
protected function _writeUrl($params) { protected function _writeUrl($params) {

View file

@ -24,10 +24,10 @@ App::uses('CakeRoute', 'Routing/Route');
class PluginShortRoute extends CakeRoute { class PluginShortRoute extends CakeRoute {
/** /**
* Parses a string url into an array. If a plugin key is found, it will be copied to the * Parses a string URL into an array. If a plugin key is found, it will be copied to the
* controller parameter * controller parameter
* *
* @param string $url The url to parse * @param string $url The URL to parse
* @return mixed false on failure, or an array of request parameters * @return mixed false on failure, or an array of request parameters
*/ */
public function parse($url) { public function parse($url) {
@ -40,11 +40,11 @@ class PluginShortRoute extends CakeRoute {
} }
/** /**
* Reverse route plugin shortcut urls. If the plugin and controller * Reverse route plugin shortcut URLs. If the plugin and controller
* are not the same the match is an auto fail. * are not the same the match is an auto fail.
* *
* @param array $url Array of parameters to convert to a string. * @param array $url Array of parameters to convert to a string.
* @return mixed either false or a string url. * @return mixed either false or a string URL.
*/ */
public function match($url) { public function match($url) {
if (isset($url['controller']) && isset($url['plugin']) && $url['plugin'] != $url['controller']) { if (isset($url['controller']) && isset($url['plugin']) && $url['plugin'] != $url['controller']) {

View file

@ -34,14 +34,14 @@ class RedirectRoute extends CakeRoute {
public $response = null; public $response = null;
/** /**
* The location to redirect to. Either a string or a cake array url. * The location to redirect to. Either a string or a CakePHP array URL.
* *
* @var mixed * @var mixed
*/ */
public $redirect; public $redirect;
/** /**
* Flag for disabling exit() when this route parses a url. * Flag for disabling exit() when this route parses an URL.
* *
* @var boolean * @var boolean
*/ */
@ -60,10 +60,10 @@ class RedirectRoute extends CakeRoute {
} }
/** /**
* Parses a string url into an array. Parsed urls will result in an automatic * Parses a string URL into an array. Parsed URLs will result in an automatic
* redirection * redirection
* *
* @param string $url The url to parse * @param string $url The URL to parse
* @return boolean False on failure * @return boolean False on failure
*/ */
public function parse($url) { public function parse($url) {
@ -96,7 +96,7 @@ class RedirectRoute extends CakeRoute {
* There is no reverse routing redirection routes * There is no reverse routing redirection routes
* *
* @param array $url Array of parameters to convert to a string. * @param array $url Array of parameters to convert to a string.
* @return mixed either false or a string url. * @return mixed either false or a string URL.
*/ */
public function match($url) { public function match($url) {
return false; return false;

View file

@ -23,9 +23,9 @@ App::uses('CakeRoute', 'Routing/Route');
/** /**
* Parses the request URL into controller, action, and parameters. Uses the connected routes * Parses the request URL into controller, action, and parameters. Uses the connected routes
* to match the incoming url string to parameters that will allow the request to be dispatched. Also * to match the incoming URL string to parameters that will allow the request to be dispatched. Also
* handles converting parameter lists into url strings, using the connected routes. Routing allows you to decouple * handles converting parameter lists into URL strings, using the connected routes. Routing allows you to decouple
* the way the world interacts with your application (urls) and the implementation (controllers and actions). * the way the world interacts with your application (URLs) and the implementation (controllers and actions).
* *
* ### Connecting routes * ### Connecting routes
* *
@ -36,7 +36,7 @@ App::uses('CakeRoute', 'Routing/Route');
* ### Named parameters * ### Named parameters
* *
* Named parameters allow you to embed key:value pairs into path segments. This allows you create hash * Named parameters allow you to embed key:value pairs into path segments. This allows you create hash
* structures using urls. You can define how named parameters work in your application using Router::connectNamed() * structures using URLs. You can define how named parameters work in your application using Router::connectNamed()
* *
* @package Cake.Routing * @package Cake.Routing
*/ */
@ -72,7 +72,7 @@ class Router {
protected static $_parseExtensions = false; protected static $_parseExtensions = false;
/** /**
* List of valid extensions to parse from a URL. If null, any extension is allowed. * List of valid extensions to parse from an URL. If null, any extension is allowed.
* *
* @var array * @var array
*/ */
@ -238,7 +238,7 @@ class Router {
/** /**
* Connects a new Route in the router. * Connects a new Route in the router.
* *
* Routes are a way of connecting request urls to objects in your application. At their core routes * Routes are a way of connecting request URLs to objects in your application. At their core routes
* are a set or regular expressions that are used to match requests to destinations. * are a set or regular expressions that are used to match requests to destinations.
* *
* Examples: * Examples:
@ -270,7 +270,7 @@ class Router {
* - `pass` is used to define which of the routed parameters should be shifted into the pass array. Adding a * - `pass` is used to define which of the routed parameters should be shifted into the pass array. Adding a
* parameter to pass will remove it from the regular route array. Ex. `'pass' => array('slug')` * parameter to pass will remove it from the regular route array. Ex. `'pass' => array('slug')`
* - `persist` is used to define which route parameters should be automatically included when generating * - `persist` is used to define which route parameters should be automatically included when generating
* new urls. You can override persistent parameters by redefining them in a url or remove them by * new URLs. You can override persistent parameters by redefining them in an URL or remove them by
* setting the parameter to `false`. Ex. `'persist' => array('lang')` * setting the parameter to `false`. Ex. `'persist' => array('lang')`
* - `routeClass` is used to extend and change how individual routes parse requests and handle reverse routing, * - `routeClass` is used to extend and change how individual routes parse requests and handle reverse routing,
* via a custom routing class. Ex. `'routeClass' => 'SlugRoute'` * via a custom routing class. Ex. `'routeClass' => 'SlugRoute'`
@ -348,10 +348,10 @@ class Router {
* *
* Examples: * Examples:
* *
* `Router::redirect('/home/*', array('controller' => 'posts', 'action' => 'view', array('persist' => true)));` * `Router::redirect('/home/*', array('controller' => 'posts', 'action' => 'view'), array('persist' => true));`
* *
* Redirects /home/* to /posts/view and passes the parameters to /posts/view. Using an array as the * Redirects /home/* to /posts/view and passes the parameters to /posts/view. Using an array as the
* redirect destination allows you to use other routes to define where a url string should be redirected to. * redirect destination allows you to use other routes to define where an URL string should be redirected to.
* *
* `Router::redirect('/posts/*', 'http://google.com', array('status' => 302));` * `Router::redirect('/posts/*', 'http://google.com', array('status' => 302));`
* *
@ -361,10 +361,10 @@ class Router {
* *
* - `status` Sets the HTTP status (default 301) * - `status` Sets the HTTP status (default 301)
* - `persist` Passes the params to the redirected route, if it can. This is useful with greedy routes, * - `persist` Passes the params to the redirected route, if it can. This is useful with greedy routes,
* routes that end in `*` are greedy. As you can remap urls and not loose any passed/named args. * routes that end in `*` are greedy. As you can remap URLs and not loose any passed/named args.
* *
* @param string $route A string describing the template of the route * @param string $route A string describing the template of the route
* @param array $url A url to redirect to. Can be a string or a Cake array-based url * @param array $url An URL to redirect to. Can be a string or a Cake array-based URL
* @param array $options An array matching the named elements in the route to regular expressions which that * @param array $options An array matching the named elements in the route to regular expressions which that
* element should match. Also contains additional parameters such as which routed parameters should be * element should match. Also contains additional parameters such as which routed parameters should be
* shifted into the passed arguments. As well as supplying patterns for routing parameters. * shifted into the passed arguments. As well as supplying patterns for routing parameters.
@ -381,7 +381,7 @@ class Router {
} }
/** /**
* Specifies what named parameters CakePHP should be parsing out of incoming urls. By default * Specifies what named parameters CakePHP should be parsing out of incoming URLs. By default
* CakePHP will parse every named parameter out of incoming URLs. However, if you want to take more * CakePHP will parse every named parameter out of incoming URLs. However, if you want to take more
* control over how named parameters are parsed you can use one of the following setups: * control over how named parameters are parsed you can use one of the following setups:
* *
@ -576,7 +576,7 @@ class Router {
} }
/** /**
* Parses a file extension out of a URL, if Router::parseExtensions() is enabled. * Parses a file extension out of an URL, if Router::parseExtensions() is enabled.
* *
* @param string $url * @param string $url
* @return array Returns an array containing the altered URL and the parsed extension. * @return array Returns an array containing the altered URL and the parsed extension.
@ -750,16 +750,16 @@ class Router {
* *
* - Empty - the method will find address to actual controller/action. * - Empty - the method will find address to actual controller/action.
* - '/' - the method will find base URL of application. * - '/' - the method will find base URL of application.
* - A combination of controller/action - the method will find url for it. * - A combination of controller/action - the method will find URL for it.
* *
* There are a few 'special' parameters that can change the final URL string that is generated * There are a few 'special' parameters that can change the final URL string that is generated
* *
* - `base` - Set to false to remove the base path from the generated url. If your application * - `base` - Set to false to remove the base path from the generated url. If your application
* is not in the root directory, this can be used to generate urls that are 'cake relative'. * is not in the root directory, this can be used to generate URLs that are 'cake relative'.
* cake relative urls are required when using requestAction. * cake relative URLs are required when using requestAction.
* - `?` - Takes an array of query string parameters * - `?` - Takes an array of query string parameters
* - `#` - Allows you to set url hash fragments. * - `#` - Allows you to set URL hash fragments.
* - `full_base` - If true the `FULL_BASE_URL` constant will be prepended to generated urls. * - `full_base` - If true the `FULL_BASE_URL` constant will be prepended to generated URLs.
* *
* @param string|array $url Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4" * @param string|array $url Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4"
* or an array specifying any of the following: 'controller', 'action', * or an array specifying any of the following: 'controller', 'action',
@ -767,7 +767,7 @@ class Router {
* and standard URL arguments (indexed array elements) * and standard URL arguments (indexed array elements)
* @param bool|array $full If (bool) true, the full base URL will be prepended to the result. * @param bool|array $full If (bool) true, the full base URL will be prepended to the result.
* If an array accepts the following keys * If an array accepts the following keys
* - escape - used when making urls embedded in html escapes query string '&' * - escape - used when making URLs embedded in html escapes query string '&'
* - full - if true the full base URL will be prepended. * - full - if true the full base URL will be prepended.
* @return string Full translated URL with base path. * @return string Full translated URL with base path.
*/ */
@ -895,11 +895,11 @@ class Router {
} }
/** /**
* A special fallback method that handles url arrays that cannot match * A special fallback method that handles URL arrays that cannot match
* any defined routes. * any defined routes.
* *
* @param array $url A url that didn't match any routes * @param array $url An URL that didn't match any routes
* @return string A generated url for the array * @return string A generated URL for the array
* @see Router::url() * @see Router::url()
*/ */
protected static function _handleNoRoute($url) { protected static function _handleNoRoute($url) {
@ -1012,14 +1012,14 @@ class Router {
* *
* Works similarly to Router::url(), but since parsed URL's contain additional * Works similarly to Router::url(), but since parsed URL's contain additional
* 'pass' and 'named' as well as 'url.url' keys. Those keys need to be specially * 'pass' and 'named' as well as 'url.url' keys. Those keys need to be specially
* handled in order to reverse a params array into a string url. * handled in order to reverse a params array into a string URL.
* *
* This will strip out 'autoRender', 'bare', 'requested', and 'return' param names as those * This will strip out 'autoRender', 'bare', 'requested', and 'return' param names as those
* are used for CakePHP internals and should not normally be part of an output url. * are used for CakePHP internals and should not normally be part of an output URL.
* *
* @param CakeRequest|array $params The params array or CakeRequest object that needs to be reversed. * @param CakeRequest|array $params The params array or CakeRequest object that needs to be reversed.
* @param boolean $full Set to true to include the full url including the protocol when reversing * @param boolean $full Set to true to include the full URL including the protocol when reversing
* the url. * the URL.
* @return string The string that is the reversed result of the array * @return string The string that is the reversed result of the array
*/ */
public static function reverse($params, $full = false) { public static function reverse($params, $full = false) {
@ -1045,12 +1045,12 @@ class Router {
} }
/** /**
* Normalizes a URL for purposes of comparison. * Normalizes an URL for purposes of comparison.
* *
* Will strip the base path off and replace any double /'s. * Will strip the base path off and replace any double /'s.
* It will not unify the casing and underscoring of the input value. * It will not unify the casing and underscoring of the input value.
* *
* @param array|string $url URL to normalize Either an array or a string url. * @param array|string $url URL to normalize Either an array or a string URL.
* @return string Normalized URL * @return string Normalized URL
*/ */
public static function normalize($url = '/') { public static function normalize($url = '/') {

View file

@ -149,7 +149,7 @@ class ExtractTaskTest extends CakeTestCase {
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = '/\#: (\\\\|\/)extract\.ctp:14\n'; $pattern = '/\#: (\\\\|\/)extract\.ctp:14\n';
$pattern .= '\#: (\\\\|\/)home\.ctp:100\n'; $pattern .= '\#: (\\\\|\/)home\.ctp:83\n';
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/'; $pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);

View file

@ -889,33 +889,42 @@ class PaginatorComponentTest extends CakeTestCase {
$Controller->Paginator->paginate('PaginatorControllerPost'); $Controller->Paginator->paginate('PaginatorControllerPost');
} }
/**
* Test that a really REALLY large page number gets clamped to the max page size.
*
*
* @expectedException NotFoundException
* @return void
*/
public function testOutOfVeryBigPageNumberGetsClamped() {
$Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost');
$Controller->params['named'] = array(
'page' => '3000000000000000000000000',
);
$Controller->constructClasses();
$Controller->PaginatorControllerPost->recursive = 0;
$Controller->Paginator->paginate('PaginatorControllerPost');
}
/** /**
* testOutOfRangePageNumberAndPageCountZero * testOutOfRangePageNumberAndPageCountZero
* *
* @expectedException NotFoundException
* @return void * @return void
*/ */
public function testOutOfRangePageNumberAndPageCountZero() { public function testOutOfRangePageNumberAndPageCountZero() {
$Controller = new PaginatorTestController($this->request); $Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost'); $Controller->uses = array('PaginatorControllerPost');
$Controller->params['named'] = array( $Controller->params['named'] = array(
'page' => 3000, 'page' => '3000',
); );
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->PaginatorControllerPost->recursive = 0; $Controller->PaginatorControllerPost->recursive = 0;
$Controller->paginate = array( $Controller->paginate = array(
'conditions' => array('PaginatorControllerPost.id >' => 100) 'conditions' => array('PaginatorControllerPost.id >' => 100)
); );
try { $Controller->Paginator->paginate('PaginatorControllerPost');
$Controller->Paginator->paginate('PaginatorControllerPost');
} catch (NotFoundException $e) {
$this->assertEquals(
1,
$Controller->request->params['paging']['PaginatorControllerPost']['page'],
'Page number should not be 0'
);
return;
}
$this->fail();
} }
/** /**
@ -959,6 +968,30 @@ class PaginatorComponentTest extends CakeTestCase {
$this->assertEquals('desc', $result['order']['something']); $this->assertEquals('desc', $result['order']['something']);
} }
/**
* test that sorting fields is alias specific
*
* @return void
*/
public function testValidateSortSharedFields() {
$model = $this->getMock('Model');
$model->alias = 'Parent';
$model->Child = $this->getMock('Model');
$model->Child->alias = 'Child';
$model->expects($this->never())
->method('hasField');
$model->Child->expects($this->at(0))
->method('hasField')
->with('something')
->will($this->returnValue(true));
$options = array('sort' => 'Child.something', 'direction' => 'desc');
$result = $this->Paginator->validateSort($model, $options);
$this->assertEquals('desc', $result['order']['Child.something']);
}
/** /**
* test that multiple sort works. * test that multiple sort works.
* *
@ -1016,7 +1049,7 @@ class PaginatorComponentTest extends CakeTestCase {
$options = array('sort' => 'Derp.id'); $options = array('sort' => 'Derp.id');
$result = $this->Paginator->validateSort($model, $options); $result = $this->Paginator->validateSort($model, $options);
$this->assertEquals(array('Model.id' => 'asc'), $result['order']); $this->assertEquals(array(), $result['order']);
} }
/** /**

View file

@ -801,8 +801,8 @@ class RequestHandlerComponentTest extends CakeTestCase {
/** /**
* test that the beforeRedirect callback properly converts * test that the beforeRedirect callback properly converts
* array urls into their correct string ones, and adds base => false so * array URLs into their correct string ones, and adds base => false so
* the correct urls are generated. * the correct URLs are generated.
* *
* @link http://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/276 * @link http://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/276
* @return void * @return void

View file

@ -97,7 +97,7 @@ class AppTest extends CakeTestCase {
} }
/** /**
* tests that it is possible to set up paths using the cake 1.3 notation for them (models, behaviors, controllers...) * tests that it is possible to set up paths using the CakePHP 1.3 notation for them (models, behaviors, controllers...)
* *
* @return void * @return void
*/ */

View file

@ -349,7 +349,7 @@ class Test2Behavior extends TestBehavior {
* *
* @package Cake.Test.Case.Model * @package Cake.Test.Case.Model
*/ */
class Test3Behavior extends TestBehavior{ class Test3Behavior extends TestBehavior {
} }
/** /**
@ -357,7 +357,7 @@ class Test3Behavior extends TestBehavior{
* *
* @package Cake.Test.Case.Model * @package Cake.Test.Case.Model
*/ */
class Test4Behavior extends ModelBehavior{ class Test4Behavior extends ModelBehavior {
public function setup(Model $model, $config = null) { public function setup(Model $model, $config = null) {
$model->bindModel( $model->bindModel(
@ -372,7 +372,7 @@ class Test4Behavior extends ModelBehavior{
* *
* @package Cake.Test.Case.Model * @package Cake.Test.Case.Model
*/ */
class Test5Behavior extends ModelBehavior{ class Test5Behavior extends ModelBehavior {
public function setup(Model $model, $config = null) { public function setup(Model $model, $config = null) {
$model->bindModel( $model->bindModel(
@ -387,7 +387,7 @@ class Test5Behavior extends ModelBehavior{
* *
* @package Cake.Test.Case.Model * @package Cake.Test.Case.Model
*/ */
class Test6Behavior extends ModelBehavior{ class Test6Behavior extends ModelBehavior {
public function setup(Model $model, $config = null) { public function setup(Model $model, $config = null) {
$model->bindModel( $model->bindModel(
@ -402,7 +402,7 @@ class Test6Behavior extends ModelBehavior{
* *
* @package Cake.Test.Case.Model * @package Cake.Test.Case.Model
*/ */
class Test7Behavior extends ModelBehavior{ class Test7Behavior extends ModelBehavior {
public function setup(Model $model, $config = null) { public function setup(Model $model, $config = null) {
$model->bindModel( $model->bindModel(

View file

@ -347,21 +347,6 @@ class CakeSessionTest extends CakeTestCase {
$this->assertTrue(TestCakeSession::started()); $this->assertTrue(TestCakeSession::started());
} }
/**
* testError method
*
* @return void
*/
public function testError() {
TestCakeSession::read('Does.not.exist');
$result = TestCakeSession::error();
$this->assertEquals("Does.not.exist doesn't exist", $result);
TestCakeSession::delete('Failing.delete');
$result = TestCakeSession::error();
$this->assertEquals("Failing.delete doesn't exist", $result);
}
/** /**
* testDel method * testDel method
* *

View file

@ -1018,4 +1018,28 @@ class PostgresTest extends CakeTestCase {
$dbo2->disconnect(); $dbo2->disconnect();
} }
/**
* Test the limit function.
*
* @return void
*/
public function testLimit() {
$db = $this->Dbo;
$result = $db->limit('0');
$this->assertNull($result);
$result = $db->limit('10');
$this->assertEquals(' LIMIT 10', $result);
$result = $db->limit('FARTS', 'BOOGERS');
$this->assertEquals(' LIMIT 0 OFFSET 0', $result);
$result = $db->limit(20, 10);
$this->assertEquals(' LIMIT 20 OFFSET 10', $result);
$result = $db->limit(10, 300000000000000000000000000000);
$this->assertEquals(' LIMIT 10 OFFSET 0', $result);
}
} }

View file

@ -473,4 +473,28 @@ class SqliteTest extends CakeTestCase {
$this->assertNotEmpty($model->read(null, 1)); $this->assertNotEmpty($model->read(null, 1));
} }
/**
* Test the limit function.
*
* @return void
*/
public function testLimit() {
$db = $this->Dbo;
$result = $db->limit('0');
$this->assertNull($result);
$result = $db->limit('10');
$this->assertEquals(' LIMIT 10', $result);
$result = $db->limit('FARTS', 'BOOGERS');
$this->assertEquals(' LIMIT 0 OFFSET 0', $result);
$result = $db->limit(20, 10);
$this->assertEquals(' LIMIT 20 OFFSET 10', $result);
$result = $db->limit(10, 300000000000000000000000000000);
$this->assertEquals(' LIMIT 10 OFFSET 0', $result);
}
} }

View file

@ -1229,4 +1229,28 @@ class DboSourceTest extends CakeTestCase {
$this->assertEquals($expected, $result[0]); $this->assertEquals($expected, $result[0]);
} }
/**
* Test the limit function.
*
* @return void
*/
public function testLimit() {
$db = new DboTestSource;
$result = $db->limit('0');
$this->assertNull($result);
$result = $db->limit('10');
$this->assertEquals(' LIMIT 10', $result);
$result = $db->limit('FARTS', 'BOOGERS');
$this->assertEquals(' LIMIT 0, 0', $result);
$result = $db->limit(20, 10);
$this->assertEquals(' LIMIT 10, 20', $result);
$result = $db->limit(10, 300000000000000000000000000000);
$this->assertEquals(' LIMIT 0, 10', $result);
}
} }

View file

@ -1315,7 +1315,7 @@ class NodeNoAfterFind extends CakeTestModel {
* *
* @package Cake.Test.Case.Model * @package Cake.Test.Case.Model
*/ */
class Node extends CakeTestModel{ class Node extends CakeTestModel {
/** /**
* name property * name property

View file

@ -1110,6 +1110,30 @@ class CakeEmailTest extends CakeTestCase {
$this->assertContains('To: ', $result['headers']); $this->assertContains('To: ', $result['headers']);
} }
/**
* testSendRenderWithHTML method and assert line length is kept below the required limit
*
* @return void
*/
public function testSendRenderWithHTML() {
$this->CakeEmail->reset();
$this->CakeEmail->transport('debug');
$this->CakeEmail->from('cake@cakephp.org');
$this->CakeEmail->to(array('you@cakephp.org' => 'You'));
$this->CakeEmail->subject('My title');
$this->CakeEmail->config(array('empty'));
$this->CakeEmail->emailFormat('html');
$this->CakeEmail->template('html', 'default');
$result = $this->CakeEmail->send();
$this->assertTextContains('<h1>HTML Ipsum Presents</h1>', $result['message']);
$lines = explode("\n", $result['message']);
foreach ($lines as $line) {
$this->assertTrue(strlen($line) <= CakeEmail::LINE_LENGTH_MUST);
}
}
/** /**
* testSendRenderWithVars method * testSendRenderWithVars method
* *

View file

@ -593,7 +593,7 @@ class HttpSocketTest extends CakeTestCase {
} }
/** /**
* Test urls like http://cakephp.org/index.php?somestring without key/value pair for query * Test URLs like http://cakephp.org/index.php?somestring without key/value pair for query
* *
* @return void * @return void
*/ */
@ -780,7 +780,7 @@ class HttpSocketTest extends CakeTestCase {
} }
/** /**
* Test that redirect urls are urldecoded * Test that redirect URLs are urldecoded
* *
* @return void * @return void
*/ */

View file

@ -1128,7 +1128,7 @@ class DispatcherTest extends CakeTestCase {
} }
/** /**
* test plugin shortcut urls with controllers that need to be loaded, * test plugin shortcut URLs with controllers that need to be loaded,
* the above test uses a controller that has already been included. * the above test uses a controller that has already been included.
* *
* @return void * @return void

View file

@ -57,7 +57,7 @@ class PluginShortRouteTest extends CakeTestCase {
} }
/** /**
* test the reverse routing of the plugin shortcut urls. * test the reverse routing of the plugin shortcut URLs.
* *
* @return void * @return void
*/ */

View file

@ -59,7 +59,7 @@ class RouterTest extends CakeTestCase {
public function testFullBaseURL() { public function testFullBaseURL() {
$skip = PHP_SAPI === 'cli'; $skip = PHP_SAPI === 'cli';
if ($skip) { if ($skip) {
$this->markTestSkipped('Cannot validate base urls in CLI'); $this->markTestSkipped('Cannot validate base URLs in CLI');
} }
$this->assertRegExp('/^http(s)?:\/\//', Router::url('/', true)); $this->assertRegExp('/^http(s)?:\/\//', Router::url('/', true));
$this->assertRegExp('/^http(s)?:\/\//', Router::url(null, true)); $this->assertRegExp('/^http(s)?:\/\//', Router::url(null, true));
@ -315,7 +315,7 @@ class RouterTest extends CakeTestCase {
} }
/** /**
* test generation of basic urls. * test generation of basic URLs.
* *
* @return void * @return void
*/ */

View file

@ -1895,6 +1895,7 @@ class ValidationTest extends CakeTestCase {
$this->assertFalse(Validation::url('http://_jabber._tcp.g_mail.com')); $this->assertFalse(Validation::url('http://_jabber._tcp.g_mail.com'));
$this->assertFalse(Validation::url('http://en.(wikipedia).org/')); $this->assertFalse(Validation::url('http://en.(wikipedia).org/'));
$this->assertFalse(Validation::url('http://www.domain.com/fakeenco%ode')); $this->assertFalse(Validation::url('http://www.domain.com/fakeenco%ode'));
$this->assertFalse(Validation::url('--.example.com'));
$this->assertFalse(Validation::url('www.cakephp.org', true)); $this->assertFalse(Validation::url('www.cakephp.org', true));
$this->assertTrue(Validation::url('http://example.com/~userdir/subdir/index.html')); $this->assertTrue(Validation::url('http://example.com/~userdir/subdir/index.html'));
@ -1997,29 +1998,37 @@ class ValidationTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testMoney() { public function testMoney() {
$this->assertTrue(Validation::money('100'));
$this->assertTrue(Validation::money('100.11'));
$this->assertTrue(Validation::money('100.112'));
$this->assertTrue(Validation::money('100.1'));
$this->assertTrue(Validation::money('100.111,1'));
$this->assertTrue(Validation::money('100.111,11'));
$this->assertFalse(Validation::money('100.111,111'));
$this->assertTrue(Validation::money('$100')); $this->assertTrue(Validation::money('$100'));
$this->assertTrue(Validation::money('$100.11')); $this->assertTrue(Validation::money('$100.11'));
$this->assertTrue(Validation::money('$100.112')); $this->assertTrue(Validation::money('$100.112'));
$this->assertFalse(Validation::money('$100.1')); $this->assertTrue(Validation::money('$100.1'));
$this->assertFalse(Validation::money('$100.1111')); $this->assertFalse(Validation::money('$100.1111'));
$this->assertFalse(Validation::money('text')); $this->assertFalse(Validation::money('text'));
$this->assertTrue(Validation::money('100', 'right')); $this->assertTrue(Validation::money('100', 'right'));
$this->assertTrue(Validation::money('100.11$', 'right')); $this->assertTrue(Validation::money('100.11$', 'right'));
$this->assertTrue(Validation::money('100.112$', 'right')); $this->assertTrue(Validation::money('100.112$', 'right'));
$this->assertFalse(Validation::money('100.1$', 'right')); $this->assertTrue(Validation::money('100.1$', 'right'));
$this->assertFalse(Validation::money('100.1111$', 'right')); $this->assertFalse(Validation::money('100.1111$', 'right'));
$this->assertTrue(Validation::money('€100')); $this->assertTrue(Validation::money('€100'));
$this->assertTrue(Validation::money('€100.11')); $this->assertTrue(Validation::money('€100.11'));
$this->assertTrue(Validation::money('€100.112')); $this->assertTrue(Validation::money('€100.112'));
$this->assertFalse(Validation::money('€100.1')); $this->assertTrue(Validation::money('€100.1'));
$this->assertFalse(Validation::money('€100.1111')); $this->assertFalse(Validation::money('€100.1111'));
$this->assertTrue(Validation::money('100', 'right')); $this->assertTrue(Validation::money('100', 'right'));
$this->assertTrue(Validation::money('100.11€', 'right')); $this->assertTrue(Validation::money('100.11€', 'right'));
$this->assertTrue(Validation::money('100.112€', 'right')); $this->assertTrue(Validation::money('100.112€', 'right'));
$this->assertFalse(Validation::money('100.1€', 'right')); $this->assertTrue(Validation::money('100.1€', 'right'));
$this->assertFalse(Validation::money('100.1111€', 'right')); $this->assertFalse(Validation::money('100.1111€', 'right'));
} }

View file

@ -2474,7 +2474,7 @@ class PaginatorHelperTest extends CakeTestCase {
} }
/** /**
* test that querystring urls can be generated. * test that query string URLs can be generated.
* *
* @return void * @return void
*/ */
@ -2490,7 +2490,7 @@ class PaginatorHelperTest extends CakeTestCase {
} }
/** /**
* test querystring paging link. * test query string paging link.
* *
* @return void * @return void
*/ */

View file

@ -296,6 +296,18 @@ class TextHelperTest extends CakeTestCase {
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }
/**
* Test autoLinkUrls with query strings.
*
* @return void
*/
public function testAutoLinkUrlsQueryString() {
$text = 'Text with a partial http://www.cakephp.org?product_id=123&foo=bar link';
$expected = 'Text with a partial <a href="http://www.cakephp.org?product_id=123&amp;foo=bar">http://www.cakephp.org?product_id=123&amp;foo=bar</a> link';
$result = $this->Text->autoLinkUrls($text);
$this->assertEquals($expected, $result);
}
/** /**
* testAutoLinkEmails method * testAutoLinkEmails method
* *

View file

@ -1,6 +1,6 @@
<?php <?php
/** /**
* TestPluginController used by Dispatcher test to test plugin shortcut urls. * TestPluginController used by Dispatcher test to test plugin shortcut URLs.
* *
* PHP 5 * PHP 5
* *

View file

@ -20,8 +20,7 @@
App::uses('CakeLogInterface', 'Log'); App::uses('CakeLogInterface', 'Log');
class TestPluginLog implements CakeLogInterface class TestPluginLog implements CakeLogInterface {
{
public function write($type, $message) { public function write($type, $message) {
} }

View file

@ -1,23 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<p>Here is your value: <b><?php echo $value; ?></b></p> <p>Here is your value: <b><?php echo $value; ?></b></p>

View file

@ -1,23 +1,4 @@
<?php <?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php
$content = explode("\n", $content); $content = explode("\n", $content);
foreach ($content as $line): foreach ($content as $line):

View file

@ -0,0 +1,8 @@
<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul>
<pre><code>
#header h1 a {
display: block;
width: 300px;
height: 80px;
}</code></pre>
<p>Some more <b>Bold</b> test.</p>

View file

@ -1,20 +1,4 @@
<?php <?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @since CakePHP(tm) v 2.1
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
echo $this->Html->image('image.gif', array( echo $this->Html->image('image.gif', array(
'alt' => 'cool image', 'alt' => 'cool image',

View file

@ -1,23 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<p>ここにあなたの設定した値が入ります: <b><?php echo $value; ?></b></p> <p>ここにあなたの設定した値が入ります: <b><?php echo $value; ?></b></p>

View file

@ -1,23 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
Here is your value: <?php echo $value; ?> Here is your value: <?php echo $value; ?>

View file

@ -1,20 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.pages
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
Right now: <?php echo $this->Time->toAtom($time); ?> Right now: <?php echo $this->Time->toAtom($time); ?>

View file

@ -1,20 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php echo $content; ?> <?php echo $content; ?>

View file

@ -1,23 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
ここにあなたの設定した値が入ります: <?php echo $value; ?> ここにあなたの設定した値が入ります: <?php echo $value; ?>

View file

@ -1,21 +1,2 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.elements.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
This element has some text that is just too wide to comply with email standards. This element has some text that is just too wide to comply with email standards.
<?php echo $content; ?> <?php echo $content; ?>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.View.Errors
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<h2><?php echo $name; ?></h2> <h2><?php echo $name; ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong> <strong><?php echo __d('cake', 'Error'); ?>: </strong>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.View.Errors
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<h2><?php echo $name; ?></h2> <h2><?php echo $name; ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong> <strong><?php echo __d('cake', 'Error'); ?>: </strong>

View file

@ -1,21 +1,4 @@
<?php <?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Test.test_app.View.Helper
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Helper', 'View'); App::uses('Helper', 'View');

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html> <html>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html> <html>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html> <html>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php echo $content_for_layout; ?> <?php echo $content_for_layout; ?>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php echo $content_for_layout; ?> <?php echo $content_for_layout; ?>

View file

@ -1,20 +1 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php echo $content_for_layout; ?> <?php echo $content_for_layout; ?>

View file

@ -1,23 +1,2 @@
<?php
/* SVN FILE: $Id: ajax2.ctp 7062 2008-05-30 11:29:53Z nate $ */
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
Ajax! Ajax!
<?php echo $content_for_layout; ?> <?php echo $content_for_layout; ?>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<p>This is regular text</p> <p>This is regular text</p>
<!--nocache--> <!--nocache-->
<?php echo microtime(); ?> <?php echo microtime(); ?>

View file

@ -1,21 +1,5 @@
<?php <?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$this->loadHelper('Html'); $this->loadHelper('Html');
$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework'); $cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<p>This is regular text</p> <p>This is regular text</p>
<!--nocache--> <!--nocache-->
<p>A. Layout Before Content</p> <p>A. Layout Before Content</p>

View file

@ -1,21 +1,4 @@
<?php <?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.pages
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Debugger', 'Utility'); App::uses('Debugger', 'Utility');
?> ?>
<h2><?php echo __d('cake_dev', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2> <h2><?php echo __d('cake_dev', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2>

View file

@ -1,21 +1,4 @@
<?php <?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Test.test_app.View.Json
* @since CakePHP(tm) v 2.1.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$paging = isset($this->Paginator->options['url']) ? $this->Paginator->options['url'] : null; $paging = isset($this->Paginator->options['url']) ? $this->Paginator->options['url'] : null;

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.pages
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<h1>Content</h1> <h1>Content</h1>
<!--nocache--> <!--nocache-->
<p>D. In View File</p> <p>D. In View File</p>

View file

@ -1,22 +1,3 @@
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.libs.view.templates.pages
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<p> <p>
<!--nocache--> <!--nocache-->
<span class="notice"> <span class="notice">

View file

@ -1,7 +1,5 @@
<?php <?php
/** /**
* Validation Class. Used for validation of model data
*
* PHP Version 5.x * PHP Version 5.x
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
@ -13,7 +11,6 @@
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Utility
* @since CakePHP(tm) v 1.2.0.3830 * @since CakePHP(tm) v 1.2.0.3830
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
@ -21,16 +18,18 @@
App::uses('Multibyte', 'I18n'); App::uses('Multibyte', 'I18n');
App::uses('File', 'Utility'); App::uses('File', 'Utility');
App::uses('CakeNumber', 'Utility'); App::uses('CakeNumber', 'Utility');
// Load multibyte if the extension is missing. // Load multibyte if the extension is missing.
if (!function_exists('mb_strlen')) { if (!function_exists('mb_strlen')) {
class_exists('Multibyte'); class_exists('Multibyte');
} }
/** /**
* Validation Class. Used for validation of model data
*
* Offers different validation methods. * Offers different validation methods.
* *
* @package Cake.Utility * @package Cake.Utility
* @since CakePHP v 1.2.0.3830
*/ */
class Validation { class Validation {
@ -40,7 +39,7 @@ class Validation {
* @var array * @var array
*/ */
protected static $_pattern = array( protected static $_pattern = array(
'hostname' => '(?:[-_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,})' 'hostname' => '(?:[_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,})'
); );
/** /**
@ -532,7 +531,7 @@ class Validation {
* @return boolean Success * @return boolean Success
*/ */
public static function money($check, $symbolPosition = 'left') { public static function money($check, $symbolPosition = 'left') {
$money = '(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?'; $money = '(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{1,2})?';
if ($symbolPosition === 'right') { if ($symbolPosition === 'right') {
$regex = '/^' . $money . '(?<!\x{00a2})\p{Sc}?$/u'; $regex = '/^' . $money . '(?<!\x{00a2})\p{Sc}?$/u';
} else { } else {

View file

@ -241,10 +241,10 @@ class Helper extends Object {
/** /**
* Finds URL for specified action. * Finds URL for specified action.
* *
* Returns a URL pointing at the provided parameters. * Returns an URL pointing at the provided parameters.
* *
* @param string|array $url Either a relative string url like `/products/view/23` or * @param string|array $url Either a relative string url like `/products/view/23` or
* an array of url parameters. Using an array for urls will allow you to leverage * an array of url parameters. Using an array for URLs will allow you to leverage
* the reverse routing features of CakePHP. * the reverse routing features of CakePHP.
* @param boolean $full If true, the full base URL will be prepended to the result * @param boolean $full If true, the full base URL will be prepended to the result
* @return string Full translated URL with base path. * @return string Full translated URL with base path.
@ -297,7 +297,7 @@ class Helper extends Object {
* @param string|array Path string or url array * @param string|array Path string or url array
* @param array $options Options array. Possible keys: * @param array $options Options array. Possible keys:
* `fullBase` Return full url with domain name * `fullBase` Return full url with domain name
* `pathPrefix` Path prefix for relative urls * `pathPrefix` Path prefix for relative URLs
* `ext` Asset extension to append * `ext` Asset extension to append
* `plugin` False value will prevent parsing path as a plugin * `plugin` False value will prevent parsing path as a plugin
* @return string Generated url * @return string Generated url
@ -334,7 +334,7 @@ class Helper extends Object {
} }
/** /**
* Encodes a URL for use in HTML attributes. * Encodes an URL for use in HTML attributes.
* *
* @param string $url The url to encode. * @param string $url The url to encode.
* @return string The url encoded for both URL & HTML contexts. * @return string The url encoded for both URL & HTML contexts.

View file

@ -293,7 +293,7 @@ class FormHelper extends AppHelper {
* *
* - `type` Form method defaults to POST * - `type` Form method defaults to POST
* - `action` The controller action the form submits to, (optional). * - `action` The controller action the form submits to, (optional).
* - `url` The url the form submits to. Can be a string or a url array. If you use 'url' * - `url` The URL the form submits to. Can be a string or an URL array. If you use 'url'
* you should leave 'action' undefined. * you should leave 'action' undefined.
* - `default` Allows for the creation of Ajax forms. Set this to false to prevent the default event handler. * - `default` Allows for the creation of Ajax forms. Set this to false to prevent the default event handler.
* Will create an onsubmit attribute if it doesn't not exist. If it does, default action suppression * Will create an onsubmit attribute if it doesn't not exist. If it does, default action suppression
@ -1749,7 +1749,7 @@ class FormHelper extends AppHelper {
unset($options['confirm']); unset($options['confirm']);
} }
$formName = uniqid('post_'); $formName = str_replace('.', '', uniqid('post_', true));
$formUrl = $this->url($url); $formUrl = $this->url($url);
$formOptions = array( $formOptions = array(
'name' => $formName, 'name' => $formName,
@ -2215,7 +2215,7 @@ class FormHelper extends AppHelper {
if ($attributes['value'] > 12 && !$format24Hours) { if ($attributes['value'] > 12 && !$format24Hours) {
$attributes['value'] -= 12; $attributes['value'] -= 12;
} }
if ($attributes['value'] === '00' && !$format24Hours) { if (($attributes['value'] === 0 || $attributes['value'] === '00') && !$format24Hours) {
$attributes['value'] = 12; $attributes['value'] = 12;
} }

View file

@ -1042,7 +1042,7 @@ class HtmlHelper extends AppHelper {
* - `tag` Type of media element to generate, either "audio" or "video". * - `tag` Type of media element to generate, either "audio" or "video".
* If tag is not provided it's guessed based on file's mime type. * If tag is not provided it's guessed based on file's mime type.
* - `text` Text to include inside the audio/video tag * - `text` Text to include inside the audio/video tag
* - `pathPrefix` Path prefix to use for relative urls, defaults to 'files/' * - `pathPrefix` Path prefix to use for relative URLs, defaults to 'files/'
* - `fullBase` If provided the src attribute will get a full address including domain name * - `fullBase` If provided the src attribute will get a full address including domain name
* *
* @param string|array $path Path to the video file, relative to the webroot/{$options['pathPrefix']} directory. * @param string|array $path Path to the video file, relative to the webroot/{$options['pathPrefix']} directory.

View file

@ -67,7 +67,7 @@ abstract class JsBaseEngineHelper extends AppHelper {
} }
/** /**
* Redirects to a URL. Creates a window.location modification snippet * Redirects to an URL. Creates a window.location modification snippet
* that can be used to trigger 'redirects' from Javascript. * that can be used to trigger 'redirects' from Javascript.
* *
* @param string|array $url URL * @param string|array $url URL

View file

@ -285,7 +285,7 @@ class JsHelper extends AppHelper {
* - `buffer` - Disable the buffering and return a script tag in addition to the link. * - `buffer` - Disable the buffering and return a script tag in addition to the link.
* *
* @param string $title Title for the link. * @param string $title Title for the link.
* @param string|array $url Mixed either a string URL or an cake url array. * @param string|array $url Mixed either a string URL or a CakePHP URL array.
* @param array $options Options for both the HTML element and Js::request() * @param array $options Options for both the HTML element and Js::request()
* @return string Completed link. If buffering is disabled a script tag will be returned as well. * @return string Completed link. If buffering is disabled a script tag will be returned as well.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::link * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::link

View file

@ -105,7 +105,7 @@ class TextHelper extends AppHelper {
$this->_placeholders = array(); $this->_placeholders = array();
$options += array('escape' => true); $options += array('escape' => true);
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[a-z0-9.\-:]+(?:/[^\s]*)?)#i'; $pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[a-z0-9.\-:]+(?:[/?][^\s]*)?)#i';
$text = preg_replace_callback( $text = preg_replace_callback(
$pattern, $pattern,
array(&$this, '_insertPlaceHolder'), array(&$this, '_insertPlaceHolder'),

View file

@ -141,7 +141,7 @@ require CAKE . 'Core' . DS . 'App.php';
require CAKE . 'Error' . DS . 'exceptions.php'; require CAKE . 'Error' . DS . 'exceptions.php';
/** /**
* Full url prefix * Full URL prefix
*/ */
if (!defined('FULL_BASE_URL')) { if (!defined('FULL_BASE_URL')) {
$s = null; $s = null;
@ -174,6 +174,9 @@ if (function_exists('mb_internal_encoding')) {
if (!empty($encoding)) { if (!empty($encoding)) {
mb_internal_encoding($encoding); mb_internal_encoding($encoding);
} }
if (!empty($encoding) && function_exists('mb_regex_encoding')) {
mb_regex_encoding($encoding);
}
} }
if (!function_exists('mb_stripos')) { if (!function_exists('mb_stripos')) {