Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F773228
D411.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 5:33 AM
Size
17 KB
Mime Type
text/x-diff
Expires
Mon, Feb 3, 5:33 AM (13 h, 44 m)
Engine
blob
Format
Raw Data
Handle
556480
Attached To
D411: INP-1757 - Replace "each" function usage with equivalent code
D411.id.diff
View Options
Index: branches/5.2.x/core/ckeditor/ckfinder/core/connector/php/php5/Core/Config.php
===================================================================
--- branches/5.2.x/core/ckeditor/ckfinder/core/connector/php/php5/Core/Config.php
+++ branches/5.2.x/core/ckeditor/ckfinder/core/connector/php/php5/Core/Config.php
@@ -435,7 +435,7 @@
}
reset($GLOBALS['config']['ResourceType']);
- while (list($_key,$_resourceTypeNode) = each($GLOBALS['config']['ResourceType'])) {
+ foreach ($GLOBALS['config']['ResourceType'] as $_resourceTypeNode ) {
if ($_resourceTypeNode['name'] === $resourceTypeName) {
$this->_resourceTypeConfigCache[$resourceTypeName] = new CKFinder_Connector_Core_ResourceTypeConfig($_resourceTypeNode);
Index: branches/5.2.x/core/ckeditor/ckfinder/core/connector/php/php5/Utils/Security.php
===================================================================
--- branches/5.2.x/core/ckeditor/ckfinder/core/connector/php/php5/Utils/Security.php
+++ branches/5.2.x/core/ckeditor/ckfinder/core/connector/php/php5/Utils/Security.php
@@ -43,7 +43,7 @@
$this->stripQuotes($_COOKIE);
}
if (!empty($_FILES)) {
- while (list($k,$v) = each($_FILES)) {
+ foreach ( array_keys($_FILES) as $k ) {
if (isset($_FILES[$k]['name'])) {
$this->stripQuotes($_FILES[$k]['name']);
}
@@ -64,7 +64,7 @@
{
if (is_array($var)) {
if ($depth++<$howDeep) {
- while (list($k,$v) = each($var)) {
+ foreach ( array_keys($var) as $k ) {
$this->stripQuotes($var[$k], $depth, $howDeep);
}
}
Index: branches/5.2.x/core/install.php
===================================================================
--- branches/5.2.x/core/install.php
+++ branches/5.2.x/core/install.php
@@ -1108,7 +1108,8 @@
continue;
}
- list ($parent_name, $parent_version) = each($version_dependencies);
+ $parent_name = key($version_dependencies);
+ $parent_version = $version_dependencies[$parent_name];
if (!array_key_exists($parent_name, $dependencies)) {
// parent module
@@ -1205,7 +1206,8 @@
if (array_key_exists($module_name, $this->upgradeDepencies) && array_key_exists($version, $this->upgradeDepencies[$module_name])) {
foreach ($this->upgradeDepencies[$module_name][$version] as $dependency_info) {
- list ($dependent_module, $dependent_version) = each($dependency_info);
+ $dependent_module = key($dependency_info);
+ $dependent_version = $dependency_info[$dependent_module];
if (!$this->RunUpgrade($dependent_module, $dependent_version, $upgrade_data, $start_from_query)) {
return false;
Index: branches/5.2.x/core/kernel/db/cat_event_handler.php
===================================================================
--- branches/5.2.x/core/kernel/db/cat_event_handler.php
+++ branches/5.2.x/core/kernel/db/cat_event_handler.php
@@ -202,7 +202,8 @@
if (!$items) {
// when item not present in temp table, then permission is not checked, because there are no data in db to check
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
- list ($id, $fields_hash) = each($items_info);
+ $id = key($items_info);
+ $fields_hash = $items_info[$id];
if (array_key_exists('CategoryId', $fields_hash)) {
$item_category = $fields_hash['CategoryId'];
@@ -2179,7 +2180,8 @@
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( $items_info ) {
- list($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
/** @var kDBItem $object */
$object = $event->getObject(Array ('skip_autoload' => true));
Index: branches/5.2.x/core/kernel/db/db_event_handler.php
===================================================================
--- branches/5.2.x/core/kernel/db/db_event_handler.php
+++ branches/5.2.x/core/kernel/db/db_event_handler.php
@@ -1235,7 +1235,7 @@
if ( isset($custom_filters[$grid_name]) ) {
foreach ($custom_filters[$grid_name] as $field_name => $field_options) {
- list ($filter_type, $field_options) = each($field_options);
+ $field_options = current($field_options);
if ( isset($field_options['value']) && $field_options['value'] ) {
$filter_type = ($field_options['sql_filter_type'] == 'having') ? kDBList::HAVING_FILTER : kDBList::WHERE_FILTER;
@@ -1569,7 +1569,8 @@
return;
}
- list($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
$object->setID($id);
$object->SetFieldsFromHash($field_values);
$event->setEventParam('form_data', $field_values);
@@ -2940,7 +2941,7 @@
$items_info = $this->Application->GetVar('u');
if ( $items_info ) {
- list ($user_id, ) = each($items_info);
+ $user_id = key($items_info);
$this->RemoveRequiredFields($object);
$is_new = !$object->isLoaded();
@@ -3293,7 +3294,8 @@
return;
}
- list ($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
$object->Load($id);
$object->SetFieldsFromHash($field_values);
$event->setEventParam('form_data', $field_values);
Index: branches/5.2.x/core/units/categories/categories_event_handler.php
===================================================================
--- branches/5.2.x/core/units/categories/categories_event_handler.php
+++ branches/5.2.x/core/units/categories/categories_event_handler.php
@@ -202,7 +202,8 @@
if (!$items) {
// when creating new category, then no IDs are stored in session
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
- list ($id, $fields_hash) = each($items_info);
+ $id = key($items_info);
+ $fields_hash = $items_info[$id];
if (array_key_exists('ParentId', $fields_hash)) {
$item_category = $fields_hash['ParentId'];
Index: branches/5.2.x/core/units/content/content_eh.php
===================================================================
--- branches/5.2.x/core/units/content/content_eh.php
+++ branches/5.2.x/core/units/content/content_eh.php
@@ -150,7 +150,7 @@
/** @var kDBItem $revision */
/** @var kDBItem $object */
- list (, $field_values) = each($items_info);
+ $field_values = current($items_info);
$object->SetFieldsFromHash($field_values);
$event->setEventParam('form_data', $field_values);
$updated = $object->Update();
@@ -236,7 +236,7 @@
return array();
}
- list ($id,) = each($items_info);
+ $id = key($items_info);
$object->Load($id);
/** @var kDBItem $revision */
Index: branches/5.2.x/core/units/email_templates/email_template_eh.php
===================================================================
--- branches/5.2.x/core/units/email_templates/email_template_eh.php
+++ branches/5.2.x/core/units/email_templates/email_template_eh.php
@@ -194,7 +194,7 @@
$items_info = $this->Application->GetVar('u');
if ( $items_info ) {
- list ($user_id, ) = each($items_info);
+ $user_id = key($items_info);
$ids = $this->Application->RecallVar($event->getPrefixSpecial() . '_selected_ids');
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
Index: branches/5.2.x/core/units/helpers/brackets_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/brackets_helper.php
+++ branches/5.2.x/core/units/helpers/brackets_helper.php
@@ -359,8 +359,6 @@
// sort brackets by 2nd column (Max values)
uasort($temp, Array (&$this, 'compareBrackets'));
reset($temp);
- $first_item = each($temp);
- $first_item_key = $first_item['key'];
$linked_info = $object->getLinkedInfo();
$sql = 'SELECT %s FROM %s WHERE %s = %s';
Index: branches/5.2.x/core/units/helpers/captcha_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/captcha_helper.php
+++ branches/5.2.x/core/units/helpers/captcha_helper.php
@@ -160,7 +160,7 @@
if ($check_request) {
// perform validation only when field is found on form
- list ($id, $field_values) = each($this->Application->GetVar($event->getPrefixSpecial()));
+ $field_values = current($this->Application->GetVar($event->getPrefixSpecial()));
if (!array_key_exists('Captcha', $field_values)) {
// when captcha code not submitted
return true;
@@ -182,4 +182,4 @@
return true;
}
-}
\ No newline at end of file
+}
Index: branches/5.2.x/core/units/helpers/cat_dbitem_export_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/cat_dbitem_export_helper.php
+++ branches/5.2.x/core/units/helpers/cat_dbitem_export_helper.php
@@ -1310,7 +1310,7 @@
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if ($items_info)
{
- list($item_id, $field_values) = each($items_info);
+ $field_values = current($items_info);
$export_keys = $field_values['ExportColumns'];
$export_keys = $export_keys ? explode('|', substr($export_keys, 1, -1) ) : Array();
}
@@ -1452,7 +1452,8 @@
$this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
}
- list($item_id, $field_values) = each($items_info);
+ $item_id = key($items_info);
+ $field_values = $items_info[$item_id];
/** @var kDBItem $object */
$object = $event->getObject(Array ('skip_autoload' => true));
Index: branches/5.2.x/core/units/helpers/controls/minput_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/controls/minput_helper.php
+++ branches/5.2.x/core/units/helpers/controls/minput_helper.php
@@ -84,7 +84,7 @@
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ($items_info) {
- list ($id, $field_values) = each($items_info);
+ $field_values = current($items_info);
foreach ($field_values as $field_name => $field_value) {
$object->SetField($field_name, $field_value);
@@ -215,4 +215,4 @@
}
}
}
- }
\ No newline at end of file
+ }
Index: branches/5.2.x/core/units/helpers/file_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/file_helper.php
+++ branches/5.2.x/core/units/helpers/file_helper.php
@@ -140,7 +140,7 @@
{
$items_info = $this->Application->GetVar($prefix);
if ($items_info) {
- list (, $fields_values) = each($items_info);
+ $fields_values = current($items_info);
$this->createUploadFields($prefix, $fields_values, $is_image);
}
else {
Index: branches/5.2.x/core/units/helpers/search_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/search_helper.php
+++ branches/5.2.x/core/units/helpers/search_helper.php
@@ -429,7 +429,8 @@
$submit_filters = getArrayValue($submit_filters, $event->getPrefixSpecial(), $grid_name);
if ($submit_filters) {
foreach ($submit_filters as $field_name => $field_options) {
- list ($filter_type, $field_value) = each($field_options);
+ $filter_type = key($field_options);
+ $field_value = $field_options[$filter_type];
$is_empty = strlen(is_array($field_value) ? implode('', $field_value) : $field_value) == 0;
if ($is_empty) {
if (isset($custom_filter[$field_name])) {
@@ -466,7 +467,8 @@
$object = $event->getObject(); // don't recall it each time in getCustomFilterSearchClause
$grid_info = $this->Application->getUnitOption($event->Prefix.'.'.$grid_name, 'Grids');
foreach ($custom_filter as $field_name => $field_options) {
- list ($filter_type, $field_options) = each($field_options);
+ $filter_type = key($field_options);
+ $field_options = $field_options[$filter_type];
$field_options['grid_options'] = $grid_info['Fields'][$field_name];
$field_options = $this->getCustomFilterSearchClause($object, $field_name, $filter_type, $field_options);
if ($field_options['value']) {
@@ -515,7 +517,8 @@
$custom_filter = $custom_filters[$grid_name];
foreach ($custom_filter as $field_name => $field_options) {
- list ($filter_type, $field_options) = each($field_options);
+ $filter_type = key($field_options);
+ $field_options = $field_options[$filter_type];
if (strpos($filter_type, 'range') === false) {
continue;
Index: branches/5.2.x/core/units/languages/languages_event_handler.php
===================================================================
--- branches/5.2.x/core/units/languages/languages_event_handler.php
+++ branches/5.2.x/core/units/languages/languages_event_handler.php
@@ -565,7 +565,8 @@
$items_info = $this->Application->GetVar('phrases_import');
if ($items_info) {
- list ($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
/** @var kDBItem $object */
$object = $this->Application->recallObject('phrases.import', 'phrases', Array('skip_autoload' => true));
@@ -638,7 +639,8 @@
{
$items_info = $this->Application->GetVar('phrases_export');
if ( $items_info ) {
- list($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
/** @var kDBItem $object */
$object = $this->Application->recallObject('phrases.export', null, Array ('skip_autoload' => true));
Index: branches/5.2.x/core/units/reviews/reviews_event_handler.php
===================================================================
--- branches/5.2.x/core/units/reviews/reviews_event_handler.php
+++ branches/5.2.x/core/units/reviews/reviews_event_handler.php
@@ -121,7 +121,7 @@
if ($items_info) {
// rev:PresetFormFields is used to initialize new review creation
- list ($review_id, ) = each($items_info);
+ $review_id = key($items_info);
}
else {
// when adding new review in admin
@@ -633,4 +633,4 @@
$parent_prefix = $event->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$event->SetRedirectParam('pass', 'm,' . $event->getPrefixSpecial() . ',' . $parent_prefix);
}
- }
\ No newline at end of file
+ }
Index: branches/5.2.x/core/units/selectors/selectors_event_handler.php
===================================================================
--- branches/5.2.x/core/units/selectors/selectors_event_handler.php
+++ branches/5.2.x/core/units/selectors/selectors_event_handler.php
@@ -210,7 +210,8 @@
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( $items_info ) {
- list($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
if ( $id == 0 ) {
$parent_id = getArrayValue($field_values, 'ParentId');
Index: branches/5.2.x/core/units/theme_files/theme_file_eh.php
===================================================================
--- branches/5.2.x/core/units/theme_files/theme_file_eh.php
+++ branches/5.2.x/core/units/theme_files/theme_file_eh.php
@@ -184,7 +184,8 @@
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if ($items_info) {
- list ($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
$object->setID($id);
$object->SetFieldsFromHash($field_values);
$event->setEventParam('form_data', $field_values);
Index: branches/5.2.x/core/units/user_profile/user_profile_eh.php
===================================================================
--- branches/5.2.x/core/units/user_profile/user_profile_eh.php
+++ branches/5.2.x/core/units/user_profile/user_profile_eh.php
@@ -45,7 +45,8 @@
protected function OnUpdate(kEvent $event)
{
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
- list ($user_id, $field_values) = each($items_info);
+ $user_id = key($items_info);
+ $field_values = $items_info[$user_id];
if ($user_id != $this->Application->RecallVar('user_id')) {
// we are not updating own profile
Index: branches/5.2.x/core/units/users/users_event_handler.php
===================================================================
--- branches/5.2.x/core/units/users/users_event_handler.php
+++ branches/5.2.x/core/units/users/users_event_handler.php
@@ -664,7 +664,8 @@
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( $items_info ) {
- list ($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
if ( $id > 0 ) {
$object->Load($id);
@@ -1072,7 +1073,8 @@
{
$event->redirect = false;
$item_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
- list($id, $field_values) = each($item_info);
+ $id = key($item_info);
+ $field_values = $item_info[$id];
/** @var kDBItem $object */
$object = $event->getObject( Array ('skip_autoload' => true) );
@@ -1169,7 +1171,8 @@
return;
}
- list ($id, $field_values) = each($items_info);
+ $id = key($items_info);
+ $field_values = $items_info[$id];
$user_id = $this->Application->RecallVar('user_id');
if ( $id == $user_id && ($user_id > 0 || $user_id == USER_ROOT) ) {
Event Timeline
Log In to Comment