mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.3
Conflicts: lib/Cake/View/Helper.php
This commit is contained in:
commit
739982addb
4 changed files with 50 additions and 32 deletions
|
@ -52,14 +52,12 @@ class CakeErrorController extends AppController {
|
|||
*/
|
||||
public function __construct($request = null, $response = null) {
|
||||
parent::__construct($request, $response);
|
||||
if (
|
||||
count(Router::extensions()) &&
|
||||
!array_key_exists('RequestHandler', $this->components) &&
|
||||
!in_array('RequestHandler', $this->components, true)
|
||||
) {
|
||||
$this->components[] = 'RequestHandler';
|
||||
}
|
||||
$this->constructClasses();
|
||||
if (count(Router::extensions()) &&
|
||||
!$this->Components->attached('RequestHandler')
|
||||
) {
|
||||
$this->RequestHandler = $this->Components->load('RequestHandler');
|
||||
}
|
||||
if ($this->Components->enabled('Auth')) {
|
||||
$this->Components->disable('Auth');
|
||||
}
|
||||
|
|
|
@ -288,6 +288,7 @@ class EmailComponent extends Component {
|
|||
public function send($content = null, $template = null, $layout = null) {
|
||||
$lib = new CakeEmail();
|
||||
$lib->charset = $this->charset;
|
||||
$lib->headerCharset = $this->charset;
|
||||
|
||||
$lib->from($this->_formatAddresses((array)$this->from));
|
||||
if (!empty($this->to)) {
|
||||
|
|
|
@ -622,6 +622,9 @@ class HelperTest extends CakeTestCase {
|
|||
$result = $this->Helper->assetUrl('style', array('ext' => '.css'));
|
||||
$this->assertEquals('style.css', $result);
|
||||
|
||||
$result = $this->Helper->assetUrl('dir/sub dir/my image', array('ext' => '.jpg'));
|
||||
$this->assertEquals('dir/sub%20dir/my%20image.jpg', $result);
|
||||
|
||||
$result = $this->Helper->assetUrl('foo.jpg?one=two&three=four');
|
||||
$this->assertEquals('foo.jpg?one=two&three=four', $result);
|
||||
}
|
||||
|
|
|
@ -295,7 +295,9 @@ class Helper extends Object {
|
|||
if (is_array($path)) {
|
||||
return $this->url($path, !empty($options['fullBase']));
|
||||
}
|
||||
if (strpos($path, '://') === false) {
|
||||
if (strpos($path, '://') !== false) {
|
||||
return $path;
|
||||
}
|
||||
if (!array_key_exists('plugin', $options) || $options['plugin'] !== false) {
|
||||
list($plugin, $path) = $this->_View->pluginSplit($path, false);
|
||||
}
|
||||
|
@ -312,7 +314,7 @@ class Helper extends Object {
|
|||
if (isset($plugin)) {
|
||||
$path = Inflector::underscore($plugin) . '/' . $path;
|
||||
}
|
||||
$path = h($this->assetTimestamp($this->webroot($path)));
|
||||
$path = $this->_encodeUrl($this->assetTimestamp($this->webroot($path)));
|
||||
|
||||
if (!empty($options['fullBase'])) {
|
||||
$base = $this->url('/', true);
|
||||
|
@ -322,10 +324,24 @@ class Helper extends Object {
|
|||
}
|
||||
$path = $base . $path;
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a URL for use in HTML attributes.
|
||||
*
|
||||
* @param string $url The url to encode.
|
||||
* @return string The url encoded for both URL & HTML contexts.
|
||||
*/
|
||||
protected function _encodeUrl($url) {
|
||||
$path = parse_url($url, PHP_URL_PATH);
|
||||
$encoded = implode('/', array_map(
|
||||
'rawurlencode',
|
||||
explode('/', $path)
|
||||
));
|
||||
return h(str_replace($path, $encoded, $url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a timestamp to a file based resource based on the value of `Asset.timestamp` in
|
||||
* Configure. If Asset.timestamp is true and debug > 0, or Asset.timestamp == 'force'
|
||||
|
|
Loading…
Reference in a new issue