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]))
|
||||
continue;
|
||||
$matches = $ymatches[$line];
|
||||
reset($matches);
|
||||
while (list ($junk, $y) = each($matches))
|
||||
$y = reset($matches);
|
||||
do {
|
||||
if (empty($this->in_seq[$y])) {
|
||||
$k = $this->_lcs_pos($y);
|
||||
USE_ASSERTS && assert($k > 0);
|
||||
$ymids[$k] = $ymids[$k - 1];
|
||||
break;
|
||||
}
|
||||
while (list ($junk, $y) = each($matches)) {
|
||||
} while (false !== ($y = next($matches)));
|
||||
|
||||
while (false !== ($y = next($matches))) {
|
||||
if ($y > $this->seq[$k-1]) {
|
||||
USE_ASSERTS && assert($y < $this->seq[$k]);
|
||||
// Optimization: this is a common case:
|
||||
@ -797,18 +799,19 @@ class Diff
|
||||
|
||||
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
||||
$candidateChunks = preg_split("/[\t\r\n ]+/", $content);
|
||||
while(list($i,$item) = each($candidateChunks)) {
|
||||
$item = reset($candidateChunks);
|
||||
do {
|
||||
if(isset($item[0]) && $item[0] == "<") {
|
||||
$newChunk = $item;
|
||||
while($item[strlen($item)-1] != ">") {
|
||||
list($i,$item) = each($candidateChunks);
|
||||
$item = next($candidateChunks);
|
||||
$newChunk .= ' ' . $item;
|
||||
}
|
||||
$chunks[] = $newChunk;
|
||||
} else {
|
||||
$chunks[] = $item;
|
||||
}
|
||||
}
|
||||
} while (false !== ($item = next($candidateChunks)));
|
||||
return $chunks;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ class Profiler {
|
||||
echo"============================================================================\n";
|
||||
print( "Calls Time Routine\n");
|
||||
echo"-----------------------------------------------------------------------------\n";
|
||||
while (list ($key, $val) = each ($this->description)) {
|
||||
foreach ($this->description as $key => $val) {
|
||||
$t = $this->elapsedTime($key);
|
||||
$total = $this->running[$key];
|
||||
$count = $this->count[$key];
|
||||
|
@ -337,11 +337,19 @@ class GridField extends FormField {
|
||||
'before' => true,
|
||||
'after' => true,
|
||||
);
|
||||
$fragmentDeferred = array();
|
||||
|
||||
reset($content);
|
||||
// TODO: Break the below into separate reducer methods
|
||||
|
||||
while(list($contentKey, $contentValue) = each($content)) {
|
||||
if(preg_match_all('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $contentValue, $matches)) {
|
||||
// Continue looping if any placeholders exist
|
||||
while (array_filter($content, function ($value) {
|
||||
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);
|
||||
$fragmentDefined[$fragmentName] = true;
|
||||
@ -386,6 +394,7 @@ class GridField extends FormField {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for any undefined fragments, and if so throw an exception.
|
||||
// While we're at it, trim whitespace off the elements.
|
||||
|
||||
|
@ -247,8 +247,10 @@ class Hierarchy extends DataExtension {
|
||||
$this->markedNodes = array($this->owner->ID => $this->owner);
|
||||
$this->owner->markUnexpanded();
|
||||
|
||||
$node = reset($this->markedNodes);
|
||||
|
||||
// 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
|
||||
// so will will not even bother to display the subtree
|
||||
// this covers two cases:
|
||||
@ -267,7 +269,7 @@ class Hierarchy extends DataExtension {
|
||||
if($children) foreach($children as $child) $child->markClosed();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (false !== ($node = next($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())
|
||||
{
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$this->setOption($name, $value);
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ class Zend_Cache_Backend
|
||||
public function setDirectives($directives)
|
||||
{
|
||||
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)) {
|
||||
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"
|
||||
. " or Zend_Config instance.");
|
||||
}
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$this->setOption($name, $value);
|
||||
}
|
||||
$this->_loggerSanity();
|
||||
@ -158,7 +158,7 @@ class Zend_Cache_Core
|
||||
public function setConfig(Zend_Config $config)
|
||||
{
|
||||
$options = $config->toArray();
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$this->setOption($name, $value);
|
||||
}
|
||||
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())
|
||||
{
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$this->setOption($name, $value);
|
||||
}
|
||||
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())
|
||||
{
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$this->setOption($name, $value);
|
||||
}
|
||||
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())
|
||||
{
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$this->setOption($name, $value);
|
||||
}
|
||||
$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())
|
||||
{
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
$name = strtolower($name);
|
||||
switch ($name) {
|
||||
case 'regexps':
|
||||
|
Loading…
Reference in New Issue
Block a user