Commit b1190c11 authored by Dries's avatar Dries

- Patch #924686 by mikey_p, munzirtaha: space required after foreach construct.

parent b0957836
......@@ -41,7 +41,7 @@
* @code
* $result = db_query_range('SELECT n.nid, n.title, n.created
* FROM {node} n WHERE n.uid = :uid', 0, 10, array(':uid' => $uid));
* foreach($result as $record) {
* foreach ($result as $record) {
* // Perform operations on $node->title, etc. here.
* }
* @endcode
......@@ -50,7 +50,8 @@
* out into an argument passed to db_query() so that SQL injection attacks
* from user input can be caught and nullified. The LIMIT syntax varies between
* database servers, so that is abstracted into db_query_range() arguments.
* Finally, note the PDO-based ability to foreach() over the result set.
* Finally, note the PDO-based ability to iterate over the result set using
* foreach ().
*
* All queries are passed as a prepared statement string. A
* prepared statement is a "template" of a query that omits literal or variable
......
......@@ -1616,7 +1616,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$settings = field_info_formatter_settings('field_test_default');
$setting = $settings['test_formatter_setting'];
$this->assertText($this->label, t('Label was displayed.'));
foreach($this->values as $delta => $value) {
foreach ($this->values as $delta => $value) {
$this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
......@@ -1633,7 +1633,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$setting = $display['settings']['test_formatter_setting_multiple'];
$this->assertNoText($this->label, t('Label was not displayed.'));
$array = array();
foreach($this->values as $delta => $value) {
foreach ($this->values as $delta => $value) {
$array[] = $delta . ':' . $value['value'];
}
$this->assertText($setting . '|' . implode('|', $array), t('Values were displayed with expected setting.'));
......@@ -1661,7 +1661,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$this->drupalSetContent(drupal_render($output));
$setting = $this->instance['display']['teaser']['settings']['test_formatter_setting'];
$this->assertText($this->label, t('Label was displayed.'));
foreach($this->values as $delta => $value) {
foreach ($this->values as $delta => $value) {
$this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
......@@ -1671,7 +1671,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$this->drupalSetContent(drupal_render($output));
$setting = $this->instance['display']['default']['settings']['test_formatter_setting'];
$this->assertText($this->label, t('Label was displayed.'));
foreach($this->values as $delta => $value) {
foreach ($this->values as $delta => $value) {
$this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
}
......
......@@ -184,7 +184,7 @@ function field_test_field_widget_form(&$form, &$form_state, $field, $instance, $
function field_test_widget_multiple_validate($element, &$form_state) {
$values = array_map('trim', explode(',', $element['#value']));
$items = array();
foreach($values as $value) {
foreach ($values as $value) {
$items[] = array('value' => $value);
}
form_set_value($element, $items, $form_state);
......
......@@ -1013,11 +1013,11 @@ function filter_dom_serialize($dom_document) {
$body_node = $dom_document->getElementsByTagName('body')->item(0);
$body_content = '';
foreach($body_node->getElementsByTagName('script') as $node) {
foreach ($body_node->getElementsByTagName('script') as $node) {
filter_dom_serialize_escape_cdata_element($dom_document, $node);
}
foreach($body_node->getElementsByTagName('style') as $node) {
foreach ($body_node->getElementsByTagName('style') as $node) {
filter_dom_serialize_escape_cdata_element($dom_document, $node, '/*', '*/');
}
......@@ -1173,7 +1173,7 @@ function _filter_html($text, $filter) {
if ($filter->settings['filter_html_nofollow']) {
$html_dom = filter_dom_load($text);
$links = $html_dom->getElementsByTagName('a');
foreach($links as $link) {
foreach ($links as $link) {
$link->setAttribute('rel', 'nofollow');
}
$text = filter_dom_serialize($html_dom);
......
......@@ -145,7 +145,7 @@ class ForumTestCase extends DrupalWebTestCase {
// Must remove forum topics to test creating orphan topics.
$vid = variable_get('forum_nav_vocabulary');
$tree = taxonomy_get_tree($vid);
foreach($tree as $term) {
foreach ($tree as $term) {
taxonomy_term_delete($term->tid);
}
......
......@@ -497,7 +497,7 @@ function node_update_7004() {
* Add status/comment/promote and sticky columns to the {node_revision} table.
*/
function node_update_7005() {
foreach(array('status', 'comment', 'promote', 'sticky') as $column) {
foreach (array('status', 'comment', 'promote', 'sticky') as $column) {
db_add_field('node_revision', $column, array(
'type' => 'int',
'not null' => TRUE,
......
......@@ -60,7 +60,7 @@ function search_admin_settings($form) {
// Collect some stats
$remaining = 0;
$total = 0;
foreach(variable_get('search_active_modules', array('node', 'user')) as $module) {
foreach (variable_get('search_active_modules', array('node', 'user')) as $module) {
if ($status = module_invoke($module, 'search_status')) {
$remaining += $status['remaining'];
$total += $status['total'];
......@@ -132,7 +132,7 @@ function search_admin_settings($form) {
$form['#submit'][] = 'search_admin_settings_submit';
// Per module settings
foreach(variable_get('search_active_modules', array('node', 'user')) as $module) {
foreach (variable_get('search_active_modules', array('node', 'user')) as $module) {
$added_form = module_invoke($module, 'search_admin');
if (is_array($added_form)) {
$form = array_merge($form, $added_form);
......
......@@ -353,7 +353,7 @@ function search_cron() {
// to date.
drupal_register_shutdown_function('search_update_totals');
foreach(variable_get('search_active_modules', array('node', 'user')) as $module) {
foreach (variable_get('search_active_modules', array('node', 'user')) as $module) {
// Update word index
module_invoke($module, 'update_index');
}
......
......@@ -385,7 +385,7 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
// Assert that the e-mail was sent by iterating over the message properties
// and ensuring that they are captured intact.
foreach($message as $field => $value) {
foreach ($message as $field => $value) {
$this->assertMail($field, $value, t('The e-mail was sent and the value for property @field is intact.', array('@field' => $field)), t('E-mail'));
}
......
......@@ -192,7 +192,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
*/
function testSimpleAJAXFormValue() {
// Verify form values of a select element.
foreach(array('red', 'green', 'blue') as $item) {
foreach (array('red', 'green', 'blue') as $item) {
$edit = array(
'select' => $item,
);
......@@ -202,7 +202,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
}
// Verify form values of a checkbox element.
foreach(array(FALSE, TRUE) as $item) {
foreach (array(FALSE, TRUE) as $item) {
$edit = array(
'checkbox' => $item,
);
......
......@@ -885,7 +885,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
array(),
array('query' => array('cache' => 1)),
);
foreach($run_options as $options) {
foreach ($run_options as $options) {
$this->drupalPost('form-test/state-persist', array(), t('Submit'), $options);
// The submit handler outputs the value in $form_state, assert it's there.
$this->assertText('State persisted.');
......
......@@ -169,7 +169,7 @@ class SchemaTestCase extends DrupalWebTestCase {
}
// Finally, check each column and try to insert invalid values into them.
foreach($table_spec['fields'] as $column_name => $column_spec) {
foreach ($table_spec['fields'] as $column_name => $column_spec) {
$this->assertTrue(db_field_exists($table_name, $column_name), t('Unsigned @type column was created.', array('@type' => $column_spec['type'])));
$this->assertFalse($this->tryUnsignedInsert($table_name, $column_name), t('Unsigned @type column rejected a negative value.', array('@type' => $column_spec['type'])));
}
......
......@@ -1839,7 +1839,7 @@ function system_file_system_settings() {
);
// Any visible, writeable wrapper can potentially be used for the files
// directory, including a remote file system that integrates with a CDN.
foreach(file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $info) {
foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $info) {
$options[$scheme] = check_plain($info['description']);
}
......@@ -2719,7 +2719,7 @@ function theme_system_themes_page($variables) {
// Start new theme group.
$output .= '<div class="system-themes-list system-themes-list-'. $state .' clearfix"><h2>'. $title .'</h2>';
foreach($theme_groups[$state] as $theme) {
foreach ($theme_groups[$state] as $theme) {
// Theme the screenshot.
$screenshot = $theme->screenshot ? theme('image', $theme->screenshot) : '<div class="no-screenshot">' . t('no screenshot') . '</div>';
......
......@@ -3294,7 +3294,7 @@ function hook_drupal_goto_alter(&$path, &$options, &$http_response_code) {
* array will be the most likely target for changes.
*/
function hook_html_head_alter(&$head_elements) {
foreach($head_elements as $key => $element) {
foreach ($head_elements as $key => $element) {
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') {
// I want a custom canonical url.
$head_elements[$key]['#attributes']['href'] = mymodule_canonical_url();
......@@ -3662,7 +3662,7 @@ function hook_page_delivery_callback_alter(&$callback) {
*/
function hook_system_themes_page_alter(&$theme_groups) {
foreach ($theme_groups as $state => &$group) {
foreach($theme_groups[$state] as &$theme) {
foreach ($theme_groups[$state] as &$theme) {
// Add a foo link to each list of theme operations.
$theme->operations[] = l(t('Foo'), 'admin/appearance/foo', array('query' => array('theme' => $theme->name)));
}
......
......@@ -2209,7 +2209,7 @@ function system_update_files_database(&$files, $type) {
// All remaining files are not in the system table, so we need to add them.
$query = db_insert('system')->fields(array('filename', 'name', 'type', 'owner', 'info'));
foreach($files as &$file) {
foreach ($files as &$file) {
if (isset($file->exists)) {
unset($file->exists);
}
......
......@@ -41,7 +41,7 @@
// Get the status messages and print them.
$messages = array_pop(drupal_get_messages('status'));
foreach($messages as $text) {
foreach ($messages as $text) {
echo " - " . $text . "\n";
}
exit;
......@@ -431,7 +431,7 @@ function simpletest_script_get_test_list() {
// Check for valid group names and get all valid classes in group.
foreach ($args['test_names'] as $group_name) {
if (isset($groups[$group_name])) {
foreach($groups[$group_name] as $class_name => $info) {
foreach ($groups[$group_name] as $class_name => $info) {
$test_list[] = $class_name;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment