mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Replaced all instances of ife() in /cake
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7387 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
565163303c
commit
b6e9888753
19 changed files with 133 additions and 97 deletions
|
@ -380,7 +380,7 @@ class SecurityComponent extends Object {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __requireMethod($method, $actions = array()) {
|
function __requireMethod($method, $actions = array()) {
|
||||||
$this->{'require' . $method} = ife(empty($actions), array('*'), $actions);
|
$this->{'require' . $method} = (empty($actions)) ? array('*'): $actions;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Check if HTTP methods are required
|
* Check if HTTP methods are required
|
||||||
|
|
|
@ -505,53 +505,58 @@ class Controller extends Object {
|
||||||
|
|
||||||
if (!empty($status)) {
|
if (!empty($status)) {
|
||||||
$codes = array(
|
$codes = array(
|
||||||
100 => "Continue",
|
100 => 'Continue',
|
||||||
101 => "Switching Protocols",
|
101 => 'Switching Protocols',
|
||||||
200 => "OK",
|
200 => 'OK',
|
||||||
201 => "Created",
|
201 => 'Created',
|
||||||
202 => "Accepted",
|
202 => 'Accepted',
|
||||||
203 => "Non-Authoritative Information",
|
203 => 'Non-Authoritative Information',
|
||||||
204 => "No Content",
|
204 => 'No Content',
|
||||||
205 => "Reset Content",
|
205 => 'Reset Content',
|
||||||
206 => "Partial Content",
|
206 => 'Partial Content',
|
||||||
300 => "Multiple Choices",
|
300 => 'Multiple Choices',
|
||||||
301 => "Moved Permanently",
|
301 => 'Moved Permanently',
|
||||||
302 => "Found",
|
302 => 'Found',
|
||||||
303 => "See Other",
|
303 => 'See Other',
|
||||||
304 => "Not Modified",
|
304 => 'Not Modified',
|
||||||
305 => "Use Proxy",
|
305 => 'Use Proxy',
|
||||||
307 => "Temporary Redirect",
|
307 => 'Temporary Redirect',
|
||||||
400 => "Bad Request",
|
400 => 'Bad Request',
|
||||||
401 => "Unauthorized",
|
401 => 'Unauthorized',
|
||||||
402 => "Payment Required",
|
402 => 'Payment Required',
|
||||||
403 => "Forbidden",
|
403 => 'Forbidden',
|
||||||
404 => "Not Found",
|
404 => 'Not Found',
|
||||||
405 => "Method Not Allowed",
|
405 => 'Method Not Allowed',
|
||||||
406 => "Not Acceptable",
|
406 => 'Not Acceptable',
|
||||||
407 => "Proxy Authentication Required",
|
407 => 'Proxy Authentication Required',
|
||||||
408 => "Request Time-out",
|
408 => 'Request Time-out',
|
||||||
409 => "Conflict",
|
409 => 'Conflict',
|
||||||
410 => "Gone",
|
410 => 'Gone',
|
||||||
411 => "Length Required",
|
411 => 'Length Required',
|
||||||
412 => "Precondition Failed",
|
412 => 'Precondition Failed',
|
||||||
413 => "Request Entity Too Large",
|
413 => 'Request Entity Too Large',
|
||||||
414 => "Request-URI Too Large",
|
414 => 'Request-URI Too Large',
|
||||||
415 => "Unsupported Media Type",
|
415 => 'Unsupported Media Type',
|
||||||
416 => "Requested range not satisfiable",
|
416 => 'Requested range not satisfiable',
|
||||||
417 => "Expectation Failed",
|
417 => 'Expectation Failed',
|
||||||
500 => "Internal Server Error",
|
500 => 'Internal Server Error',
|
||||||
501 => "Not Implemented",
|
501 => 'Not Implemented',
|
||||||
502 => "Bad Gateway",
|
502 => 'Bad Gateway',
|
||||||
503 => "Service Unavailable",
|
503 => 'Service Unavailable',
|
||||||
504 => "Gateway Time-out"
|
504 => 'Gateway Time-out'
|
||||||
);
|
);
|
||||||
if (is_string($status)) {
|
if (is_string($status)) {
|
||||||
$codes = array_combine(array_values($codes), array_keys($codes));
|
$codes = array_combine(array_values($codes), array_keys($codes));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($codes[$status])) {
|
if (isset($codes[$status])) {
|
||||||
$code = ife(is_numeric($status), $status, $codes[$status]);
|
$code = $status = $codes[$status];
|
||||||
$msg = ife(is_string($status), $status, $codes[$status]);
|
if (is_numeric($status)) {
|
||||||
|
$code = $status;
|
||||||
|
}
|
||||||
|
if (is_string($status)) {
|
||||||
|
$msg = $status;
|
||||||
|
}
|
||||||
$status = "HTTP/1.1 {$code} {$msg}";
|
$status = "HTTP/1.1 {$code} {$msg}";
|
||||||
} else {
|
} else {
|
||||||
$status = null;
|
$status = null;
|
||||||
|
|
|
@ -349,7 +349,7 @@ class Debugger extends Object {
|
||||||
$_this = Debugger::getInstance();
|
$_this = Debugger::getInstance();
|
||||||
switch(strtolower(gettype($var))) {
|
switch(strtolower(gettype($var))) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return ife($var, 'true', 'false');
|
return ($var) ? 'true' : 'false';
|
||||||
break;
|
break;
|
||||||
case 'integer':
|
case 'integer':
|
||||||
case 'double':
|
case 'double':
|
||||||
|
|
|
@ -741,7 +741,10 @@ class Folder extends Object{
|
||||||
}
|
}
|
||||||
$parts = explode(DS, $path);
|
$parts = explode(DS, $path);
|
||||||
$newparts = array();
|
$newparts = array();
|
||||||
$newpath = ife($path[0] == DS, DS, '');
|
$newpath = '';
|
||||||
|
if ($path[0] == DS) {
|
||||||
|
$newpath = DS;
|
||||||
|
}
|
||||||
|
|
||||||
while (($part = array_shift($parts)) !== NULL) {
|
while (($part = array_shift($parts)) !== NULL) {
|
||||||
if ($part == '.' || $part == '') {
|
if ($part == '.' || $part == '') {
|
||||||
|
|
|
@ -70,7 +70,10 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
if (!isset($this->settings[$Model->alias])) {
|
if (!isset($this->settings[$Model->alias])) {
|
||||||
$this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true);
|
$this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true);
|
||||||
}
|
}
|
||||||
$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], ife(is_array($settings), $settings, array()));
|
if (!is_array($settings)) {
|
||||||
|
$settings = array();
|
||||||
|
}
|
||||||
|
$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Runs before a find() operation. Used to allow 'contain' setting
|
* Runs before a find() operation. Used to allow 'contain' setting
|
||||||
|
|
|
@ -121,7 +121,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
$addFields = array();
|
$addFields = array();
|
||||||
if (is_array($query['fields'])) {
|
if (is_array($query['fields'])) {
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
$field = ife(is_numeric($key), $value, $key);
|
$field = (is_numeric($key)) ? $value : $key;
|
||||||
|
|
||||||
if (in_array($model->alias.'.*', $query['fields']) || $autoFields || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) {
|
if (in_array($model->alias.'.*', $query['fields']) || $autoFields || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) {
|
||||||
$addFields[] = $field;
|
$addFields[] = $field;
|
||||||
|
@ -194,7 +194,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
$beforeFind = $this->runtime[$model->alias]['beforeFind'];
|
$beforeFind = $this->runtime[$model->alias]['beforeFind'];
|
||||||
|
|
||||||
foreach ($results as $key => $row) {
|
foreach ($results as $key => $row) {
|
||||||
$results[$key][$model->alias]['locale'] = ife(is_array($locale), @$locale[0], $locale);
|
$results[$key][$model->alias]['locale'] = (is_array($locale)) ? @$locale[0] : $locale;
|
||||||
|
|
||||||
foreach ($beforeFind as $field) {
|
foreach ($beforeFind as $field) {
|
||||||
if (is_array($locale)) {
|
if (is_array($locale)) {
|
||||||
|
@ -209,7 +209,10 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
$results[$key][$model->alias][$field] = '';
|
$results[$key][$model->alias][$field] = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$value = ife(empty($results[$key]['I18n__'.$field]['content']), '', $results[$key]['I18n__'.$field]['content']);
|
$value = '';
|
||||||
|
if (!empty($results[$key]['I18n__'.$field]['content'])) {
|
||||||
|
$value = $results[$key]['I18n__'.$field]['content'];
|
||||||
|
}
|
||||||
$results[$key][$model->alias][$field] = $value;
|
$results[$key][$model->alias][$field] = $value;
|
||||||
unset($results[$key]['I18n__'.$field]);
|
unset($results[$key]['I18n__'.$field]);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +232,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
$tempData = array();
|
$tempData = array();
|
||||||
|
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
$field = ife(is_numeric($key), $value, $key);
|
$field = (is_numeric($key)) ? $value : $key;
|
||||||
|
|
||||||
if (isset($model->data[$model->alias][$field])) {
|
if (isset($model->data[$model->alias][$field])) {
|
||||||
$tempData[$field] = $model->data[$model->alias][$field];
|
$tempData[$field] = $model->data[$model->alias][$field];
|
||||||
|
|
|
@ -886,7 +886,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
'fields' => $db->calculate($model, 'max', array($right)),
|
'fields' => $db->calculate($model, 'max', array($right)),
|
||||||
'recursive' => $recursive
|
'recursive' => $recursive
|
||||||
)));
|
)));
|
||||||
return ife(empty ($edge[$right]), 0, $edge[$right]);
|
return (empty($edge[$right])) ? 0 : $edge[$right];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get the minimum index value in the table.
|
* get the minimum index value in the table.
|
||||||
|
@ -904,7 +904,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
'fields' => $db->calculate($model, 'min', array($left)),
|
'fields' => $db->calculate($model, 'min', array($left)),
|
||||||
'recursive' => $recursive
|
'recursive' => $recursive
|
||||||
)));
|
)));
|
||||||
return ife(empty($edge[$left]), 0, $edge[$left]);
|
return (empty($edge[$left])) ? 0 : $edge[$left];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Table sync method.
|
* Table sync method.
|
||||||
|
|
|
@ -514,7 +514,7 @@ class DboMysql extends DboSource {
|
||||||
foreach ($keys as $i => $key) {
|
foreach ($keys as $i => $key) {
|
||||||
if(!isset($index[$key['Key_name']])) {
|
if(!isset($index[$key['Key_name']])) {
|
||||||
$index[$key['Key_name']]['column'] = $key['Column_name'];
|
$index[$key['Key_name']]['column'] = $key['Column_name'];
|
||||||
$index[$key['Key_name']]['unique'] = ife($key['Non_unique'] == 0, 1, 0);
|
$index[$key['Key_name']]['unique'] = intval($key['Non_unique'] == 0);
|
||||||
} else {
|
} else {
|
||||||
if(!is_array($index[$key['Key_name']]['column'])) {
|
if(!is_array($index[$key['Key_name']]['column'])) {
|
||||||
$col[] = $index[$key['Key_name']]['column'];
|
$col[] = $index[$key['Key_name']]['column'];
|
||||||
|
|
|
@ -650,7 +650,7 @@ class DboOracle extends DboSource {
|
||||||
}
|
}
|
||||||
if(!isset($index[$key])) {
|
if(!isset($index[$key])) {
|
||||||
$index[$key]['column'] = strtolower($idx['cc']['column_name']);
|
$index[$key]['column'] = strtolower($idx['cc']['column_name']);
|
||||||
$index[$key]['unique'] = ife($idx['i']['uniqueness'] == 'UNIQUE', 1, 0);
|
$index[$key]['unique'] = intval($idx['i']['uniqueness'] == 'UNIQUE');
|
||||||
} else {
|
} else {
|
||||||
if(!is_array($index[$key]['column'])) {
|
if(!is_array($index[$key]['column'])) {
|
||||||
$col[] = $index[$key]['column'];
|
$col[] = $index[$key]['column'];
|
||||||
|
|
|
@ -292,7 +292,7 @@ class Multibyte extends Object {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (count($values) == 0) {
|
if (count($values) == 0) {
|
||||||
$find = ife($value < 224, 2, 3);
|
$find = ($value < 224) ? 2 : 3;
|
||||||
}
|
}
|
||||||
$values[] = $value;
|
$values[] = $value;
|
||||||
|
|
||||||
|
@ -639,8 +639,7 @@ class Multibyte extends Object {
|
||||||
}
|
}
|
||||||
$position++;
|
$position++;
|
||||||
}
|
}
|
||||||
$return = ife($found, $position, false);
|
return ($found) ? $position : false;
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
return strripos($haystack, $needle, $offset);
|
return strripos($haystack, $needle, $offset);
|
||||||
}
|
}
|
||||||
|
@ -689,8 +688,7 @@ class Multibyte extends Object {
|
||||||
}
|
}
|
||||||
$position++;
|
$position++;
|
||||||
}
|
}
|
||||||
$return = ife($found, $position, false);
|
return ($found) ? $position : false;
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
return strrpos($haystack, $needle, $offset);
|
return strrpos($haystack, $needle, $offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,10 +298,11 @@ class Router extends Object {
|
||||||
|
|
||||||
foreach ($_this->__resourceMap as $params) {
|
foreach ($_this->__resourceMap as $params) {
|
||||||
extract($params);
|
extract($params);
|
||||||
$id = ife($id, '/:id', '');
|
$url = $prefix . $urlName;
|
||||||
|
if ($id) {
|
||||||
Router::connect(
|
$url .= '/:id';
|
||||||
"{$prefix}{$urlName}{$id}",
|
}
|
||||||
|
Router::connect($url,
|
||||||
array('controller' => $urlName, 'action' => $action, '[method]' => $params['method']),
|
array('controller' => $urlName, 'action' => $action, '[method]' => $params['method']),
|
||||||
array('id' => $options['id'], 'pass' => array('id'))
|
array('id' => $options['id'], 'pass' => array('id'))
|
||||||
);
|
);
|
||||||
|
|
|
@ -297,7 +297,10 @@ class Helper extends Overloadable {
|
||||||
$attribute = sprintf($attributeFormat, $key, $key);
|
$attribute = sprintf($attributeFormat, $key, $key);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$attribute = sprintf($attributeFormat, $key, ife($escape, h($value), $value));
|
if ($escape) {
|
||||||
|
$value = htmlspecialchars($value);
|
||||||
|
}
|
||||||
|
$attribute = sprintf($attributeFormat, $key, $value);
|
||||||
}
|
}
|
||||||
return $attribute;
|
return $attribute;
|
||||||
}
|
}
|
||||||
|
|
|
@ -682,10 +682,10 @@ class AjaxHelper extends AppHelper {
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
switch($key) {
|
switch($key) {
|
||||||
case 'type':
|
case 'type':
|
||||||
$jsOptions['asynchronous'] = ife(($value == 'synchronous'), 'false', 'true');
|
$jsOptions['asynchronous'] = ($value == 'synchronous') ? 'false' : 'true';
|
||||||
break;
|
break;
|
||||||
case 'evalScripts':
|
case 'evalScripts':
|
||||||
$jsOptions['evalScripts'] = ife($value, 'true', 'false');
|
$jsOptions['evalScripts'] = ($value) ? 'true' : 'false';
|
||||||
break;
|
break;
|
||||||
case 'position':
|
case 'position':
|
||||||
$jsOptions['insertion'] = "Insertion." . Inflector::camelize($options['position']);
|
$jsOptions['insertion'] = "Insertion." . Inflector::camelize($options['position']);
|
||||||
|
|
|
@ -171,7 +171,7 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($options['action'])) {
|
if (empty($options['action'])) {
|
||||||
$options['action'] = ife($created, 'edit', 'add');
|
$options['action'] = ($created) ? 'edit' : 'add';
|
||||||
}
|
}
|
||||||
|
|
||||||
$actionDefaults = array(
|
$actionDefaults = array(
|
||||||
|
@ -195,7 +195,7 @@ class FormHelper extends AppHelper {
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case 'file':
|
||||||
$htmlAttributes['enctype'] = 'multipart/form-data';
|
$htmlAttributes['enctype'] = 'multipart/form-data';
|
||||||
$options['type'] = ife($created, 'put', 'post');
|
$options['type'] = ($created) ? 'put' : 'post';
|
||||||
case 'post':
|
case 'post':
|
||||||
case 'put':
|
case 'put':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
@ -1579,7 +1579,9 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($showParents || (!in_array($title, $parents))) {
|
if ($showParents || (!in_array($title, $parents))) {
|
||||||
$title = ife($attributes['escape'], h($title), $title);
|
if ($attributes['escape']) {
|
||||||
|
$title = htmlspecialchars($title);
|
||||||
|
}
|
||||||
|
|
||||||
if ($attributes['style'] === 'checkbox') {
|
if ($attributes['style'] === 'checkbox') {
|
||||||
$htmlOptions['value'] = $name;
|
$htmlOptions['value'] = $name;
|
||||||
|
|
|
@ -196,8 +196,10 @@ class JavascriptHelper extends AppHelper {
|
||||||
if ($options['inline']) {
|
if ($options['inline']) {
|
||||||
if ($block) {
|
if ($block) {
|
||||||
return sprintf($this->tags['javascriptblock'], $script);
|
return sprintf($this->tags['javascriptblock'], $script);
|
||||||
|
} elseif ($safe) {
|
||||||
|
return $this->tags['javascriptstart'] . "\n" . '//<![CDATA[' . "\n";
|
||||||
} else {
|
} else {
|
||||||
return sprintf($this->tags['javascriptstart']).ife($safe, "\n" . '//<![CDATA[' . "\n", '');
|
return $this->tags['javascriptstart'];
|
||||||
}
|
}
|
||||||
} elseif ($block) {
|
} elseif ($block) {
|
||||||
$view =& ClassRegistry::getObject('view');
|
$view =& ClassRegistry::getObject('view');
|
||||||
|
@ -230,7 +232,10 @@ class JavascriptHelper extends AppHelper {
|
||||||
$this->_cachedEvents[] = $script;
|
$this->_cachedEvents[] = $script;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ife($safe, "\n" . '//]]>' . "\n", '').$this->tags['javascriptend'];
|
if ($safe) {
|
||||||
|
return "\n" . '//]]>' . "\n" . $this->tags['javascriptend'];
|
||||||
|
}
|
||||||
|
return $this->tags['javascriptend'];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns a JavaScript include tag (SCRIPT element). If the filename is prefixed with "/",
|
* Returns a JavaScript include tag (SCRIPT element). If the filename is prefixed with "/",
|
||||||
|
@ -549,7 +554,7 @@ class JavascriptHelper extends AppHelper {
|
||||||
$val = 'null';
|
$val = 'null';
|
||||||
break;
|
break;
|
||||||
case (is_bool($val)):
|
case (is_bool($val)):
|
||||||
$val = ife($val, 'true', 'false');
|
$val = ($val) ? 'true' : 'false';
|
||||||
break;
|
break;
|
||||||
case (is_int($val)):
|
case (is_int($val)):
|
||||||
$val = $val;
|
$val = $val;
|
||||||
|
|
|
@ -408,10 +408,17 @@ class PaginatorHelper extends AppHelper {
|
||||||
$options);
|
$options);
|
||||||
|
|
||||||
$paging = $this->params($options['model']);
|
$paging = $this->params($options['model']);
|
||||||
$paging['pageCount'] = ife($paging['pageCount'] == 0, 1, $paging['pageCount']);
|
if ($paging['pageCount'] == 0) {
|
||||||
|
$paging['pageCount'] = 1;
|
||||||
$start = ife($paging['count'] >= 1, ($paging['page'] - 1) * ($paging['options']['limit']) + 1, '0');
|
}
|
||||||
$end = ife(($paging['count'] < ($start + $paging['options']['limit'] - 1)), $paging['count'], ($start + $paging['options']['limit'] - 1));
|
$start = 0;
|
||||||
|
if ($paging['count'] >= 1) {
|
||||||
|
$start = (($paging['page'] - 1) * $paging['options']['limit']) + 1;
|
||||||
|
}
|
||||||
|
$end = $start + $paging['options']['limit'] - 1;
|
||||||
|
if ($paging['count'] < $end) {
|
||||||
|
$end = $paging['count'];
|
||||||
|
}
|
||||||
|
|
||||||
switch ($options['format']) {
|
switch ($options['format']) {
|
||||||
case 'range':
|
case 'range':
|
||||||
|
|
|
@ -275,21 +275,29 @@ class TextHelper extends AppHelper {
|
||||||
return $this->truncate($text, $radius * 2, $ending);
|
return $this->truncate($text, $radius * 2, $ending);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($radius < strlen($phrase)) {
|
$phraseLen = strlen($phrase);
|
||||||
$radius = strlen($phrase);
|
if ($radius < $phraseLen) {
|
||||||
|
$radius = $phraseLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = strpos(strtolower($text), strtolower($phrase));
|
$pos = strpos(strtolower($text), strtolower($phrase));
|
||||||
$startPos = ife($pos <= $radius, 0, $pos - $radius);
|
$startPos = 0;
|
||||||
$endPos = ife($pos + strlen($phrase) + $radius >= strlen($text), strlen($text), $pos + strlen($phrase) + $radius);
|
if ($pos > $radius) {
|
||||||
|
$startPos = $pos - $radius;
|
||||||
|
}
|
||||||
|
$textLen = strlen($text);
|
||||||
|
$endPos = $pos + $phraseLen + $radius;
|
||||||
|
if ($endPos >= $textLen) {
|
||||||
|
$endPos = $textLen;
|
||||||
|
}
|
||||||
$excerpt = substr($text, $startPos, $endPos - $startPos);
|
$excerpt = substr($text, $startPos, $endPos - $startPos);
|
||||||
|
|
||||||
if ($startPos != 0) {
|
if ($startPos != 0) {
|
||||||
$excerpt = substr_replace($excerpt, $ending, 0, strlen($phrase));
|
$excerpt = substr_replace($excerpt, $ending, 0, $phraseLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($endPos != strlen($text)) {
|
if ($endPos != $textLen) {
|
||||||
$excerpt = substr_replace($excerpt, $ending, -strlen($phrase));
|
$excerpt = substr_replace($excerpt, $ending, -$phraseLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $excerpt;
|
return $excerpt;
|
||||||
|
|
|
@ -91,7 +91,7 @@ class TimeHelper extends AppHelper {
|
||||||
$date = time();
|
$date = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = date("D, M jS Y, H:i", $date);
|
$ret = i18n::strftime('%A, %B %e %Y, H:i', $date);
|
||||||
return $this->output($ret);
|
return $this->output($ret);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -557,10 +557,8 @@ class View extends Object {
|
||||||
* @return array An array containing the identity elements of an entity
|
* @return array An array containing the identity elements of an entity
|
||||||
*/
|
*/
|
||||||
function entity() {
|
function entity() {
|
||||||
return array_values(Set::filter(array(
|
$assoc = ($this->association) ? $this->association : $this->model;
|
||||||
ife($this->association, $this->association, $this->model),
|
return array_values(Set::filter(array($assoc, $this->modelId, $this->field, $this->fieldSuffix)));
|
||||||
$this->modelId, $this->field, $this->fieldSuffix
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allows a template or element to set a variable that will be available in
|
* Allows a template or element to set a variable that will be available in
|
||||||
|
|
Loading…
Reference in a new issue