mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Remove use of deprecated each method
This commit is contained in:
parent
33d2df1bf5
commit
a20b0a4aa6
@ -278,15 +278,17 @@ class _DiffEngine
|
|||||||
if (empty($ymatches[$line]))
|
if (empty($ymatches[$line]))
|
||||||
continue;
|
continue;
|
||||||
$matches = $ymatches[$line];
|
$matches = $ymatches[$line];
|
||||||
reset($matches);
|
$y = reset($matches);
|
||||||
while (list ($junk, $y) = each($matches))
|
do {
|
||||||
if (empty($this->in_seq[$y])) {
|
if (empty($this->in_seq[$y])) {
|
||||||
$k = $this->_lcs_pos($y);
|
$k = $this->_lcs_pos($y);
|
||||||
USE_ASSERTS && assert($k > 0);
|
USE_ASSERTS && assert($k > 0);
|
||||||
$ymids[$k] = $ymids[$k-1];
|
$ymids[$k] = $ymids[$k - 1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (list ($junk, $y) = each($matches)) {
|
} while (false !== ($y = next($matches)));
|
||||||
|
|
||||||
|
while (false !== ($y = next($matches))) {
|
||||||
if ($y > $this->seq[$k-1]) {
|
if ($y > $this->seq[$k-1]) {
|
||||||
USE_ASSERTS && assert($y < $this->seq[$k]);
|
USE_ASSERTS && assert($y < $this->seq[$k]);
|
||||||
// Optimization: this is a common case:
|
// Optimization: this is a common case:
|
||||||
@ -797,18 +799,19 @@ class Diff
|
|||||||
|
|
||||||
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
||||||
$candidateChunks = preg_split("/[\t\r\n ]+/", $content);
|
$candidateChunks = preg_split("/[\t\r\n ]+/", $content);
|
||||||
while(list($i,$item) = each($candidateChunks)) {
|
$item = reset($candidateChunks);
|
||||||
|
do {
|
||||||
if(isset($item[0]) && $item[0] == "<") {
|
if(isset($item[0]) && $item[0] == "<") {
|
||||||
$newChunk = $item;
|
$newChunk = $item;
|
||||||
while($item[strlen($item)-1] != ">") {
|
while($item[strlen($item)-1] != ">") {
|
||||||
list($i,$item) = each($candidateChunks);
|
$item = next($candidateChunks);
|
||||||
$newChunk .= ' ' . $item;
|
$newChunk .= ' ' . $item;
|
||||||
}
|
}
|
||||||
$chunks[] = $newChunk;
|
$chunks[] = $newChunk;
|
||||||
} else {
|
} else {
|
||||||
$chunks[] = $item;
|
$chunks[] = $item;
|
||||||
}
|
}
|
||||||
}
|
} while (false !== ($item = next($candidateChunks)));
|
||||||
return $chunks;
|
return $chunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ class Profiler {
|
|||||||
echo"============================================================================\n";
|
echo"============================================================================\n";
|
||||||
print( "Calls Time Routine\n");
|
print( "Calls Time Routine\n");
|
||||||
echo"-----------------------------------------------------------------------------\n";
|
echo"-----------------------------------------------------------------------------\n";
|
||||||
while (list ($key, $val) = each ($this->description)) {
|
foreach ($this->description as $key => $val) {
|
||||||
$t = $this->elapsedTime($key);
|
$t = $this->elapsedTime($key);
|
||||||
$total = $this->running[$key];
|
$total = $this->running[$key];
|
||||||
$count = $this->count[$key];
|
$count = $this->count[$key];
|
||||||
|
@ -337,26 +337,34 @@ class GridField extends FormField {
|
|||||||
'before' => true,
|
'before' => true,
|
||||||
'after' => true,
|
'after' => true,
|
||||||
);
|
);
|
||||||
|
$fragmentDeferred = array();
|
||||||
|
|
||||||
reset($content);
|
// TODO: Break the below into separate reducer methods
|
||||||
|
|
||||||
while(list($contentKey, $contentValue) = each($content)) {
|
// Continue looping if any placeholders exist
|
||||||
if(preg_match_all('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $contentValue, $matches)) {
|
while (array_filter($content, function ($value) {
|
||||||
foreach($matches[1] as $match) {
|
return preg_match('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $value);
|
||||||
|
})) {
|
||||||
|
foreach ($content as $contentKey => $contentValue) {
|
||||||
|
// Skip if this specific content has no placeholders
|
||||||
|
if (!preg_match_all('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $contentValue, $matches)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($matches[1] as $match) {
|
||||||
$fragmentName = strtolower($match);
|
$fragmentName = strtolower($match);
|
||||||
$fragmentDefined[$fragmentName] = true;
|
$fragmentDefined[$fragmentName] = true;
|
||||||
|
|
||||||
$fragment = '';
|
$fragment = '';
|
||||||
|
|
||||||
if(isset($content[$fragmentName])) {
|
if (isset($content[$fragmentName])) {
|
||||||
$fragment = $content[$fragmentName];
|
$fragment = $content[$fragmentName];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the fragment still has a fragment definition in it, when we should defer
|
// If the fragment still has a fragment definition in it, when we should defer
|
||||||
// this item until later.
|
// this item until later.
|
||||||
|
|
||||||
if(preg_match('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $fragment, $matches)) {
|
if (preg_match('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $fragment, $matches)) {
|
||||||
if(isset($fragmentDeferred[$contentKey]) && $fragmentDeferred[$contentKey] > 5) {
|
if (isset($fragmentDeferred[$contentKey]) && $fragmentDeferred[$contentKey] > 5) {
|
||||||
throw new LogicException(sprintf(
|
throw new LogicException(sprintf(
|
||||||
'GridField HTML fragment "%s" and "%s" appear to have a circular dependency.',
|
'GridField HTML fragment "%s" and "%s" appear to have a circular dependency.',
|
||||||
$fragmentName,
|
$fragmentName,
|
||||||
@ -368,7 +376,7 @@ class GridField extends FormField {
|
|||||||
|
|
||||||
$content[$contentKey] = $contentValue;
|
$content[$contentKey] = $contentValue;
|
||||||
|
|
||||||
if(!isset($fragmentDeferred[$contentKey])) {
|
if (!isset($fragmentDeferred[$contentKey])) {
|
||||||
$fragmentDeferred[$contentKey] = 0;
|
$fragmentDeferred[$contentKey] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,6 +394,7 @@ class GridField extends FormField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check for any undefined fragments, and if so throw an exception.
|
// Check for any undefined fragments, and if so throw an exception.
|
||||||
// While we're at it, trim whitespace off the elements.
|
// While we're at it, trim whitespace off the elements.
|
||||||
|
|
||||||
@ -587,7 +596,7 @@ class GridField extends FormField {
|
|||||||
} else {
|
} else {
|
||||||
$classes[] = 'odd';
|
$classes[] = 'odd';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->extend('updateNewRowClasses', $classes, $total, $index, $record);
|
$this->extend('updateNewRowClasses', $classes, $total, $index, $record);
|
||||||
|
|
||||||
return $classes;
|
return $classes;
|
||||||
|
@ -247,8 +247,10 @@ class Hierarchy extends DataExtension {
|
|||||||
$this->markedNodes = array($this->owner->ID => $this->owner);
|
$this->markedNodes = array($this->owner->ID => $this->owner);
|
||||||
$this->owner->markUnexpanded();
|
$this->owner->markUnexpanded();
|
||||||
|
|
||||||
|
$node = reset($this->markedNodes);
|
||||||
|
|
||||||
// foreach can't handle an ever-growing $nodes list
|
// foreach can't handle an ever-growing $nodes list
|
||||||
while(list($id, $node) = each($this->markedNodes)) {
|
do {
|
||||||
// first determine the number of children, if it's too high the tree view can't be used
|
// first determine the number of children, if it's too high the tree view can't be used
|
||||||
// so will will not even bother to display the subtree
|
// so will will not even bother to display the subtree
|
||||||
// this covers two cases:
|
// this covers two cases:
|
||||||
@ -267,7 +269,7 @@ class Hierarchy extends DataExtension {
|
|||||||
if($children) foreach($children as $child) $child->markClosed();
|
if($children) foreach($children as $child) $child->markClosed();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while (false !== ($node = next($this->markedNodes)));
|
||||||
return sizeof($this->markedNodes);
|
return sizeof($this->markedNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
thirdparty/Zend/Cache/Backend.php
vendored
4
thirdparty/Zend/Cache/Backend.php
vendored
@ -63,7 +63,7 @@ class Zend_Cache_Backend
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $options = array())
|
public function __construct(array $options = array())
|
||||||
{
|
{
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$this->setOption($name, $value);
|
$this->setOption($name, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ class Zend_Cache_Backend
|
|||||||
public function setDirectives($directives)
|
public function setDirectives($directives)
|
||||||
{
|
{
|
||||||
if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array');
|
if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array');
|
||||||
while (list($name, $value) = each($directives)) {
|
foreach ($directives as $name => $value) {
|
||||||
if (!is_string($name)) {
|
if (!is_string($name)) {
|
||||||
Zend_Cache::throwException("Incorrect option name : $name");
|
Zend_Cache::throwException("Incorrect option name : $name");
|
||||||
}
|
}
|
||||||
|
4
thirdparty/Zend/Cache/Core.php
vendored
4
thirdparty/Zend/Cache/Core.php
vendored
@ -143,7 +143,7 @@ class Zend_Cache_Core
|
|||||||
Zend_Cache::throwException("Options passed were not an array"
|
Zend_Cache::throwException("Options passed were not an array"
|
||||||
. " or Zend_Config instance.");
|
. " or Zend_Config instance.");
|
||||||
}
|
}
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$this->setOption($name, $value);
|
$this->setOption($name, $value);
|
||||||
}
|
}
|
||||||
$this->_loggerSanity();
|
$this->_loggerSanity();
|
||||||
@ -158,7 +158,7 @@ class Zend_Cache_Core
|
|||||||
public function setConfig(Zend_Config $config)
|
public function setConfig(Zend_Config $config)
|
||||||
{
|
{
|
||||||
$options = $config->toArray();
|
$options = $config->toArray();
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$this->setOption($name, $value);
|
$this->setOption($name, $value);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
2
thirdparty/Zend/Cache/Frontend/Class.php
vendored
2
thirdparty/Zend/Cache/Frontend/Class.php
vendored
@ -107,7 +107,7 @@ class Zend_Cache_Frontend_Class extends Zend_Cache_Core
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $options = array())
|
public function __construct(array $options = array())
|
||||||
{
|
{
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$this->setOption($name, $value);
|
$this->setOption($name, $value);
|
||||||
}
|
}
|
||||||
if ($this->_specificOptions['cached_entity'] === null) {
|
if ($this->_specificOptions['cached_entity'] === null) {
|
||||||
|
2
thirdparty/Zend/Cache/Frontend/File.php
vendored
2
thirdparty/Zend/Cache/Frontend/File.php
vendored
@ -88,7 +88,7 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $options = array())
|
public function __construct(array $options = array())
|
||||||
{
|
{
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$this->setOption($name, $value);
|
$this->setOption($name, $value);
|
||||||
}
|
}
|
||||||
if (!isset($this->_specificOptions['master_files'])) {
|
if (!isset($this->_specificOptions['master_files'])) {
|
||||||
|
2
thirdparty/Zend/Cache/Frontend/Function.php
vendored
2
thirdparty/Zend/Cache/Frontend/Function.php
vendored
@ -63,7 +63,7 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $options = array())
|
public function __construct(array $options = array())
|
||||||
{
|
{
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$this->setOption($name, $value);
|
$this->setOption($name, $value);
|
||||||
}
|
}
|
||||||
$this->setOption('automatic_serialization', true);
|
$this->setOption('automatic_serialization', true);
|
||||||
|
2
thirdparty/Zend/Cache/Frontend/Page.php
vendored
2
thirdparty/Zend/Cache/Frontend/Page.php
vendored
@ -129,7 +129,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $options = array())
|
public function __construct(array $options = array())
|
||||||
{
|
{
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'regexps':
|
case 'regexps':
|
||||||
|
Loading…
Reference in New Issue
Block a user