diff --git a/feeds.info b/feeds.info index b568755d2ad5f6bcbbfbb23e5acd60e173c23170..98983c1d99e4612e2faa1b9d5356e048c900ca53 100644 --- a/feeds.info +++ b/feeds.info @@ -2,7 +2,6 @@ name = Feeds description = Aggregates RSS/Atom/RDF feeds, imports CSV files and more. package = Feeds core = 7.x - dependencies[] = ctools dependencies[] = job_scheduler diff --git a/feeds.module b/feeds.module index 7875e60f3f293d7e17a969c18522725620232d33..4dde598f3f70ff8f55cbb89ca1ef610c5ea83266 100644 --- a/feeds.module +++ b/feeds.module @@ -89,7 +89,9 @@ function feeds_source_import($job) { try { $source->existing()->import(); } - catch (FeedsNotExistingException $e) {} + catch (FeedsNotExistingException $e) { + // Do nothing. + } catch (Exception $e) { $source->log('import', $e->getMessage(), array(), WATCHDOG_ERROR); } @@ -104,7 +106,9 @@ function feeds_source_clear($job) { try { $source->existing()->clear(); } - catch (FeedsNotExistingException $e) {} + catch (FeedsNotExistingException $e) { + // Do nothing. + } catch (Exception $e) { $source->log('clear', $e->getMessage(), array(), WATCHDOG_ERROR); } @@ -119,7 +123,9 @@ function feeds_importer_expire($job) { try { $importer->existing()->expire(); } - catch (FeedsNotExistingException $e) {} + catch (FeedsNotExistingException $e) { + // Do nothing. + } catch (Exception $e) { $importer->log('expire', $e->getMessage(), array(), WATCHDOG_ERROR); } @@ -212,7 +218,7 @@ function feeds_forms() { $forms['FeedsImporter_feeds_form']['callback'] = 'feeds_form'; $plugins = FeedsPlugin::all(); foreach ($plugins as $plugin) { - $forms[$plugin['handler']['class'] .'_feeds_form']['callback'] = 'feeds_form'; + $forms[$plugin['handler']['class'] . '_feeds_form']['callback'] = 'feeds_form'; } return $forms; } @@ -327,11 +333,18 @@ function feeds_theme() { * Menu access callback. * * @param $action - * One of 'import' or 'clear'. + * The action to be performed. Possible values are: + * - import + * - clear * @param $param * Node object or FeedsImporter id. */ function feeds_access($action, $param) { + if (!in_array($action, array('import', 'clear'))) { + // If $action is not one of the supported actions, we return access denied. + return FALSE; + } + if (is_string($param)) { $importer_id = $param; } @@ -341,7 +354,7 @@ function feeds_access($action, $param) { // Check for permissions if feed id is present, otherwise return FALSE. if ($importer_id) { - if (user_access('administer feeds') || user_access($action .' '. $importer_id .' feeds')) { + if (user_access('administer feeds') || user_access("{$action} {$importer_id} feeds")) { return TRUE; } } @@ -377,8 +390,8 @@ function feeds_exit() { */ function feeds_views_api() { return array( - 'api' => '2.0', - 'path' => drupal_get_path('module', 'feeds') .'/views', + 'api' => 3, + 'path' => drupal_get_path('module', 'feeds') . '/views', ); } @@ -699,16 +712,16 @@ function feeds_export($importer_id, $indent = '') { } /** - * Logs to a file like /mytmp/feeds_my_domain_org.log in temporary directory. + * Logs to a file like /tmp/feeds_my_domain_org.log in temporary directory. */ function feeds_dbg($msg) { - if (variable_get('feeds_debug', false)) { + if (variable_get('feeds_debug', FALSE)) { if (!is_string($msg)) { - $msg = var_export($msg, true); + $msg = var_export($msg, TRUE); } $filename = trim(str_replace('/', '_', $_SERVER['HTTP_HOST'] . base_path()), '_'); - $handle = fopen(file_directory_temp() ."/feeds_$filename.log", 'a'); - fwrite($handle, date('c') ."\t$msg\n"); + $handle = fopen("temporary://feeds_$filename.log", 'a'); + fwrite($handle, gmdate('c') . "\t$msg\n"); fclose($handle); } } @@ -835,10 +848,10 @@ function feeds_plugin($plugin, $id) { if ($class = ctools_plugin_load_class('feeds', 'plugins', $plugin, 'handler')) { return FeedsConfigurable::instance($class, $id); } - $args = array( '%plugin' => $plugin); + $args = array('%plugin' => $plugin, '@id' => $id); if (user_access('administer feeds')) { - $args['!link'] = l($id, 'admin/structure/feeds/edit/' . $id); - drupal_set_message(t('Missing Feeds plugin %plugin. See !link. Check whether all required libraries and modules are installed properly.', $args), 'warning'); + $args['@link'] = url('admin/structure/feeds/edit/' . $id); + drupal_set_message(t('Missing Feeds plugin %plugin. See <a href="@link">@id</a>. Check whether all required libraries and modules are installed properly.', $args), 'warning'); } else { drupal_set_message(t('Missing Feeds plugin %plugin. Please contact your site administrator.', $args), 'warning'); @@ -872,7 +885,7 @@ function feeds_include_library($file, $library) { // Try first whether libraries module is present and load the file from // there. If this fails, require the library from the local path. if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/$file")) { - require libraries_get_path($library) ."/$file"; + require libraries_get_path($library) . "/$file"; } else { // @todo: Throws "Deprecated function: Assigning the return value of new @@ -918,7 +931,7 @@ function feeds_alter($type, &$data) { $args = array_merge($args, $additional_args); foreach (module_list() as $module) { - $function = $module .'_'. $type .'_alter'; + $function = "{$module}_{$type}_alter"; if (function_exists($function)) { call_user_func_array($function, $args); } diff --git a/feeds.pages.inc b/feeds.pages.inc index 258a7569f3cccaae1ffd60961e10bdbd843cbf03..547737c15d2dfbf83d3ee117d3025d5f4a63c2f2 100644 --- a/feeds.pages.inc +++ b/feeds.pages.inc @@ -15,15 +15,15 @@ function feeds_page() { if ($importer->disabled) { continue; } - if (!(user_access('import '. $importer->id .' feeds') || user_access('administer feeds'))) { + if (!(user_access('import ' . $importer->id . ' feeds') || user_access('administer feeds'))) { continue; } if (empty($importer->config['content_type'])) { - $link = 'import/'. $importer->id; + $link = 'import/' . $importer->id; $title = $importer->config['name']; } - elseif (user_access('create '. $importer->config['content_type'] .' content')) { - $link = 'node/add/'. str_replace('_', '-', $importer->config['content_type']); + elseif (user_access('create ' . $importer->config['content_type'] . ' content')) { + $link = 'node/add/' . str_replace('_', '-', $importer->config['content_type']); $title = node_type_get_name($importer->config['content_type']); } $rows[] = array( @@ -115,14 +115,14 @@ function feeds_import_tab_form($form, &$form_state, $node) { $form = array(); $form['#feed_nid'] = $node->nid; $form['#importer_id'] = $importer_id; - $form['#redirect'] = 'node/'. $node->nid; + $form['#redirect'] = 'node/' . $node->nid; $form['source_status'] = array( '#type' => 'fieldset', '#title' => t('Status'), '#tree' => TRUE, '#value' => feeds_source_status($source), ); - $form = confirm_form($form, t('Import all content from source?'), 'node/'. $node->nid, '', t('Import'), t('Cancel'), 'confirm feeds update'); + $form = confirm_form($form, t('Import all content from source?'), 'node/' . $node->nid, '', t('Import'), t('Cancel'), 'confirm feeds update'); $progress = $source->progressImporting(); if ($progress !== FEEDS_BATCH_COMPLETE) { $form['actions']['submit']['#disabled'] = TRUE; @@ -192,7 +192,9 @@ function feeds_fetcher_callback($importer, $feed_nid = 0) { try { return $importer->fetcher->request($feed_nid); } - catch(Exception $e) {} + catch (Exception $e) { + // Do nothing. + } } drupal_access_denied(); } @@ -263,7 +265,7 @@ function theme_feeds_source_status($v) { */ function theme_feeds_upload($variables) { $element = $variables['element']; - drupal_add_css(drupal_get_path('module', 'feeds') .'/feeds.css'); + drupal_add_css(drupal_get_path('module', 'feeds') . '/feeds.css'); _form_set_class($element, array('form-file')); $description = ''; if (!empty($element['#file_info'])) { @@ -282,7 +284,7 @@ function theme_feeds_upload($variables) { $description .= '</div>'; } $description .= '<div class="file-upload">'; - $description .= '<input type="file" name="'. $element['#name'] .'"'. ($element['#attributes'] ? ' '. drupal_attributes($element['#attributes']) : '') .' id="'. $element['#id'] .'" size="'. $element['#size'] ."\" />\n"; + $description .= '<input type="file" name="' . $element['#name'] . '"' . ($element['#attributes'] ? ' ' . drupal_attributes($element['#attributes']) : '') . ' id="' . $element['#id'] . '" size="' . $element['#size'] . "\" />\n"; $description .= '</div>'; $element['#description'] = $description; diff --git a/feeds.plugins.inc b/feeds.plugins.inc index 51b557a9a2fc760128e15d01ec11d124aeb28947..26d9bff1cb594b3f90c2ce85780c88fadb9ad9e6 100644 --- a/feeds.plugins.inc +++ b/feeds.plugins.inc @@ -9,7 +9,7 @@ * Break out for feeds_feed_plugins(). */ function _feeds_feeds_plugins() { - $path = drupal_get_path('module', 'feeds') .'/plugins'; + $path = drupal_get_path('module', 'feeds') . '/plugins'; $info = array(); $info['FeedsPlugin'] = array( diff --git a/feeds_import/feeds_import.test b/feeds_import/feeds_import.test index 3991d89579b2bf07a6e373bae5ed0f6d3104632b..94172fa8ff3493613f66cdfbdd0bfa068acb3c97 100644 --- a/feeds_import/feeds_import.test +++ b/feeds_import/feeds_import.test @@ -30,7 +30,7 @@ class FeedsExamplesNodeTestCase extends FeedsWebTestCase { */ public function test() { // Import file. - $this->importFile('node', $this->absolutePath() .'/tests/feeds/nodes.csv'); + $this->importFile('node', $this->absolutePath() . '/tests/feeds/nodes.csv'); // Assert returning page. $this->assertText('Created 8 nodes'); @@ -83,11 +83,11 @@ class FeedsExamplesNodeTestCase extends FeedsWebTestCase { // Import a similar file with changes in 4 records. Feeds should report 6 // Updated Article nodes (4 changed records, 2 records sharing a GUID // subsequently being updated). - $this->importFile('node', $this->absolutePath() .'/tests/feeds/nodes_changes.csv'); + $this->importFile('node', $this->absolutePath() . '/tests/feeds/nodes_changes.csv'); $this->assertText('Updated 6 nodes'); // Import a larger file with more records. - $this->importFile('node', $this->absolutePath() .'/tests/feeds/many_nodes.csv'); + $this->importFile('node', $this->absolutePath() . '/tests/feeds/many_nodes.csv'); $this->assertText('Created 71 nodes'); // Remove all nodes. @@ -102,7 +102,7 @@ class FeedsExamplesNodeTestCase extends FeedsWebTestCase { // Import a tab separated file. $this->drupalPost('import/node/delete-items', array(), 'Delete'); $edit = array( - 'files[feeds]' => $this->absolutePath() .'/tests/feeds/nodes.tsv', + 'files[feeds]' => $this->absolutePath() . '/tests/feeds/nodes.tsv', 'feeds[FeedsCSVParser][delimiter]' => "TAB", ); $this->drupalPost('import/node', $edit, 'Import'); @@ -131,7 +131,7 @@ class FeedsExamplesUserTestCase extends FeedsWebTestCase { */ public function test() { // Import CSV file. - $this->importFile('user', $this->absolutePath() .'/tests/feeds/users.csv'); + $this->importFile('user', $this->absolutePath() . '/tests/feeds/users.csv'); // Assert result. $this->assertText('Created 4 users'); diff --git a/feeds_news/feeds_news.feeds_importer_default.inc b/feeds_news/feeds_news.feeds_importer_default.inc index 0eef0585aac3d29d9f128fe04c15e0665e556798..f42ad0ca5e57b556dfe0dc12d7424719b0a11033 100644 --- a/feeds_news/feeds_news.feeds_importer_default.inc +++ b/feeds_news/feeds_news.feeds_importer_default.inc @@ -33,7 +33,7 @@ function feeds_news_feeds_importer_default() { 'plugin_key' => 'FeedsNodeProcessor', 'config' => array( 'content_type' => 'feed_item', - 'update_existing' => 0, + 'update_existing' => '0', 'expire' => '-1', 'mappings' => array( 0 => array( @@ -62,7 +62,7 @@ function feeds_news_feeds_importer_default() { 'unique' => FALSE, ), ), - 'input_format' => 0, + 'input_format' => 'filtered_html', 'author' => 0, ), ), diff --git a/feeds_news/feeds_news.test b/feeds_news/feeds_news.test index db9916c94d5c6e7499a576d0f2cdb87c96b9fac9..8a2a5071b34643103ed783f275ecdf9f6791ffae 100644 --- a/feeds_news/feeds_news.test +++ b/feeds_news/feeds_news.test @@ -61,15 +61,15 @@ class FeedsExamplesFeedTestCase extends FeedsWebTestCase { $this->assertEqual($count, 1, 'Found feed_node_item record.'); // Remove all items - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); $this->assertText('Deleted 10 nodes'); // Import again. - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('Created 10 nodes'); // Delete and assert all items gone. - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); $count = db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'")->fetchField(); $this->assertEqual($count, 0, 'Found the correct number of feed item nodes in database.'); diff --git a/feeds_news/feeds_news.views_default.inc b/feeds_news/feeds_news.views_default.inc index 7442b72832a78c13d1d1f17856eee75b0ad63ee4..8736f5768473452a6a94f6408e34b5d3c39b1f3e 100644 --- a/feeds_news/feeds_news.views_default.inc +++ b/feeds_news/feeds_news.views_default.inc @@ -29,7 +29,9 @@ function feeds_news_views_default_views() { $handler->display->display_options['exposed_form']['type'] = 'basic'; $handler->display->display_options['pager']['type'] = 'full'; $handler->display->display_options['style_plugin'] = 'default'; - $handler->display->display_options['row_plugin'] = 'fields'; + $handler->display->display_options['row_plugin'] = 'node'; + $handler->display->display_options['row_options']['links'] = 1; + $handler->display->display_options['row_options']['comments'] = 0; /* No results behavior: Global: Text area */ $handler->display->display_options['empty']['text']['id'] = 'area'; $handler->display->display_options['empty']['text']['table'] = 'views'; @@ -42,90 +44,11 @@ function feeds_news_views_default_views() { $handler->display->display_options['relationships']['feed_nid_1']['table'] = 'feeds_item'; $handler->display->display_options['relationships']['feed_nid_1']['field'] = 'feed_nid'; $handler->display->display_options['relationships']['feed_nid_1']['required'] = 1; - /* Field: Content: Title */ - $handler->display->display_options['fields']['title_1']['id'] = 'title_1'; - $handler->display->display_options['fields']['title_1']['table'] = 'node'; - $handler->display->display_options['fields']['title_1']['field'] = 'title'; - $handler->display->display_options['fields']['title_1']['relationship'] = 'feed_nid_1'; - $handler->display->display_options['fields']['title_1']['label'] = 'From'; - $handler->display->display_options['fields']['title_1']['alter']['alter_text'] = 0; - $handler->display->display_options['fields']['title_1']['alter']['make_link'] = 0; - $handler->display->display_options['fields']['title_1']['alter']['absolute'] = 0; - $handler->display->display_options['fields']['title_1']['alter']['word_boundary'] = 1; - $handler->display->display_options['fields']['title_1']['alter']['ellipsis'] = 1; - $handler->display->display_options['fields']['title_1']['alter']['strip_tags'] = 0; - $handler->display->display_options['fields']['title_1']['alter']['trim'] = 0; - $handler->display->display_options['fields']['title_1']['alter']['html'] = 0; - $handler->display->display_options['fields']['title_1']['hide_empty'] = 0; - $handler->display->display_options['fields']['title_1']['empty_zero'] = 0; - $handler->display->display_options['fields']['title_1']['link_to_node'] = 1; - /* Field: Feeds item: Item URL */ - $handler->display->display_options['fields']['url']['id'] = 'url'; - $handler->display->display_options['fields']['url']['table'] = 'feeds_item'; - $handler->display->display_options['fields']['url']['field'] = 'url'; - $handler->display->display_options['fields']['url']['label'] = ''; - $handler->display->display_options['fields']['url']['exclude'] = TRUE; - $handler->display->display_options['fields']['url']['alter']['alter_text'] = 0; - $handler->display->display_options['fields']['url']['alter']['make_link'] = 0; - $handler->display->display_options['fields']['url']['alter']['absolute'] = 0; - $handler->display->display_options['fields']['url']['alter']['word_boundary'] = 1; - $handler->display->display_options['fields']['url']['alter']['ellipsis'] = 1; - $handler->display->display_options['fields']['url']['alter']['strip_tags'] = 0; - $handler->display->display_options['fields']['url']['alter']['trim'] = 0; - $handler->display->display_options['fields']['url']['alter']['html'] = 0; - $handler->display->display_options['fields']['url']['hide_empty'] = 0; - $handler->display->display_options['fields']['url']['empty_zero'] = 0; - $handler->display->display_options['fields']['url']['display_as_link'] = 0; - /* Field: Content: Title */ - $handler->display->display_options['fields']['title']['id'] = 'title'; - $handler->display->display_options['fields']['title']['table'] = 'node'; - $handler->display->display_options['fields']['title']['field'] = 'title'; - $handler->display->display_options['fields']['title']['label'] = ''; - $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0; - $handler->display->display_options['fields']['title']['alter']['make_link'] = 1; - $handler->display->display_options['fields']['title']['alter']['path'] = '[url]'; - $handler->display->display_options['fields']['title']['alter']['absolute'] = 0; - $handler->display->display_options['fields']['title']['alter']['prefix'] = '<h2>'; - $handler->display->display_options['fields']['title']['alter']['suffix'] = '</h2>'; - $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1; - $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1; - $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0; - $handler->display->display_options['fields']['title']['alter']['trim'] = 0; - $handler->display->display_options['fields']['title']['alter']['html'] = 0; - $handler->display->display_options['fields']['title']['hide_empty'] = 0; - $handler->display->display_options['fields']['title']['empty_zero'] = 0; - $handler->display->display_options['fields']['title']['link_to_node'] = 0; - /* Field: Content: Description */ - $handler->display->display_options['fields']['entity_id']['id'] = 'entity_id'; - $handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_feed_item_description'; - $handler->display->display_options['fields']['entity_id']['field'] = 'field_feed_item_description'; - $handler->display->display_options['fields']['entity_id']['label'] = ''; - $handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0; - $handler->display->display_options['fields']['entity_id']['alter']['make_link'] = 0; - $handler->display->display_options['fields']['entity_id']['alter']['absolute'] = 0; - $handler->display->display_options['fields']['entity_id']['alter']['word_boundary'] = 1; - $handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 1; - $handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0; - $handler->display->display_options['fields']['entity_id']['alter']['trim'] = 0; - $handler->display->display_options['fields']['entity_id']['alter']['html'] = 0; - $handler->display->display_options['fields']['entity_id']['hide_empty'] = 0; - $handler->display->display_options['fields']['entity_id']['empty_zero'] = 0; - /* Field: Content: Edit link */ - $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node'; - $handler->display->display_options['fields']['edit_node']['table'] = 'node'; - $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node'; - $handler->display->display_options['fields']['edit_node']['label'] = ''; - $handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = 0; - $handler->display->display_options['fields']['edit_node']['alter']['make_link'] = 0; - $handler->display->display_options['fields']['edit_node']['alter']['absolute'] = 0; - $handler->display->display_options['fields']['edit_node']['alter']['word_boundary'] = 1; - $handler->display->display_options['fields']['edit_node']['alter']['ellipsis'] = 1; - $handler->display->display_options['fields']['edit_node']['alter']['strip_tags'] = 0; - $handler->display->display_options['fields']['edit_node']['alter']['trim'] = 0; - $handler->display->display_options['fields']['edit_node']['alter']['html'] = 0; - $handler->display->display_options['fields']['edit_node']['hide_empty'] = 0; - $handler->display->display_options['fields']['edit_node']['empty_zero'] = 0; - $handler->display->display_options['fields']['edit_node']['text'] = 'Edit'; + /* Sort criterion: Content: Post date */ + $handler->display->display_options['sorts']['created']['id'] = 'created'; + $handler->display->display_options['sorts']['created']['table'] = 'node'; + $handler->display->display_options['sorts']['created']['field'] = 'created'; + $handler->display->display_options['sorts']['created']['order'] = 'DESC'; /* Contextual filter: Content: Nid */ $handler->display->display_options['arguments']['nid']['id'] = 'nid'; $handler->display->display_options['arguments']['nid']['table'] = 'node'; @@ -157,7 +80,7 @@ function feeds_news_views_default_views() { $handler->display->display_options['path'] = 'node/%/feed-items'; $handler->display->display_options['menu']['type'] = 'tab'; $handler->display->display_options['menu']['title'] = 'View items'; - $handler->display->display_options['menu']['weight'] = '0'; + $handler->display->display_options['menu']['weight'] = '-9'; $translatables['feeds_defaults_feed_items'] = array( t('Defaults'), t('more'), @@ -171,11 +94,6 @@ function feeds_news_views_default_views() { t('Offset'), t('There are no items for this feed at the moment.'), t('Owner feed'), - t('From'), - t('[url]'), - t('<h2>'), - t('</h2>'), - t('Edit'), t('All'), t('Articles from %1'), t('Page'), diff --git a/feeds_ui/feeds_ui.admin.inc b/feeds_ui/feeds_ui.admin.inc index a8e1bfbdef912dc6f876d3c5b1c771680636a7d6..e906b65cc697126d5ca5f4629ee02c3e5bc273e6 100644 --- a/feeds_ui/feeds_ui.admin.inc +++ b/feeds_ui/feeds_ui.admin.inc @@ -68,7 +68,7 @@ function feeds_ui_overview_form($form, &$form_status) { } else { if (!$importer->disabled) { - $importer_form['attached']['#markup'] = l(node_type_get_name($importer->config['content_type']), 'node/add/'. str_replace('_', '-', $importer->config['content_type'])); + $importer_form['attached']['#markup'] = l(node_type_get_name($importer->config['content_type']), 'node/add/' . str_replace('_', '-', $importer->config['content_type'])); } else { $importer_form['attached']['#markup'] = node_type_get_name($importer->config['content_type']); @@ -80,12 +80,12 @@ function feeds_ui_overview_form($form, &$form_status) { $edit = t('Override'); $delete = ''; } - else if ($importer->export_type == EXPORT_IN_DATABASE) { + elseif ($importer->export_type == EXPORT_IN_DATABASE) { $status = t('Normal'); $edit = t('Edit'); $delete = t('Delete'); } - else if ($importer->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) { + elseif ($importer->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) { $status = t('Overridden'); $edit = t('Edit'); $delete = t('Revert'); @@ -96,10 +96,10 @@ function feeds_ui_overview_form($form, &$form_status) { if (!$importer->disabled) { $importer_form['operations'] = array( '#markup' => - l($edit, 'admin/structure/feeds/edit/'. $importer->id) .' | '. - l(t('Export'), 'admin/structure/feeds/export/'. $importer->id) .' | '. - l(t('Clone'), 'admin/structure/feeds/clone/'. $importer->id) . - (empty($delete) ? '' : ' | '. l($delete, 'admin/structure/feeds/delete/'. $importer->id)), + l($edit, 'admin/structure/feeds/edit/' . $importer->id) . ' | ' . + l(t('Export'), 'admin/structure/feeds/export/' . $importer->id) . ' | ' . + l(t('Clone'), 'admin/structure/feeds/clone/' . $importer->id) . + (empty($delete) ? '' : ' | ' . l($delete, 'admin/structure/feeds/delete/' . $importer->id)), ); } else { @@ -150,7 +150,7 @@ function feeds_ui_overview_form_submit($form, &$form_state) { * of $from_importer. */ function feeds_ui_create_form($form, &$form_state, $from_importer = NULL) { - drupal_add_js(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.js'); + drupal_add_js(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.js'); $form = array(); $form['#from_importer'] = $from_importer; $form['name'] = array( @@ -212,9 +212,9 @@ function feeds_ui_create_form_submit($form, &$form_state) { drupal_set_message(t('Your configuration has been created with default settings. If they do not fit your use case you can adjust them here.')); } else { - drupal_set_message(t('A clone of the !name configuration has been created.', array('!name' => $form['#from_importer']->config['name']))); + drupal_set_message(t('A clone of the @name configuration has been created.', array('@name' => $form['#from_importer']->config['name']))); } - $form_state['redirect'] = 'admin/structure/feeds/edit/'. $importer->id; + $form_state['redirect'] = 'admin/structure/feeds/edit/' . $importer->id; feeds_cache_clear(); } @@ -272,7 +272,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $plugins = FeedsPlugin::all(); $config = $importer->config; // Base path for changing the active container. - $path = 'admin/structure/feeds/edit/'. $importer->id; + $path = 'admin/structure/feeds/edit/' . $importer->id; $active_container = array( 'class' => array('active-container'), @@ -281,7 +281,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { switch ($active) { case 'help': $active_container['title'] = t('Getting started'); - $active_container['body'] = '<div class="help feeds-admin-ui">'. feeds_ui_edit_help() .'</div>'; + $active_container['body'] = '<div class="help feeds-admin-ui">' . feeds_ui_edit_help() . '</div>'; unset($active_container['actions']); break; case 'fetcher': @@ -291,7 +291,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $active_container['body'] = drupal_get_form('feeds_ui_plugin_form', $importer, $active); break; case 'settings': - drupal_add_js(drupal_get_path('module', 'ctools') .'/js/dependent.js'); + drupal_add_js(drupal_get_path('module', 'ctools') . '/js/dependent.js'); ctools_include('dependent'); if (empty($plugin_key)) { $active_container['title'] = t('Basic settings'); @@ -333,7 +333,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $info['body'] = array( array( 'body' => theme('item_list', array('items' => $items)), - 'actions' => array(l(t('Settings'), $path .'/settings')), + 'actions' => array(l(t('Settings'), $path . '/settings')), ), ); $config_info[] = $info; @@ -342,7 +342,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $fetcher = $plugins[$config['fetcher']['plugin_key']]; $actions = array(); if (feeds_get_form($importer->fetcher, 'configForm')) { - $actions = array(l(t('Settings'), $path .'/settings/'. $config['fetcher']['plugin_key'])); + $actions = array(l(t('Settings'), $path . '/settings/' . $config['fetcher']['plugin_key'])); } $info['title'] = t('Fetcher'); $info['body'] = array( @@ -352,14 +352,14 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { 'actions' => $actions, ), ); - $info['actions'] = array(l(t('Change'), $path .'/fetcher')); + $info['actions'] = array(l(t('Change'), $path . '/fetcher')); $config_info[] = $info; // Parser. $parser = $plugins[$config['parser']['plugin_key']]; $actions = array(); if (feeds_get_form($importer->parser, 'configForm')) { - $actions = array(l(t('Settings'), $path .'/settings/'. $config['parser']['plugin_key'])); + $actions = array(l(t('Settings'), $path . '/settings/' . $config['parser']['plugin_key'])); } $info['title'] = t('Parser'); $info['body'] = array( @@ -369,16 +369,16 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { 'actions' => $actions, ) ); - $info['actions'] = array(l(t('Change'), $path .'/parser')); + $info['actions'] = array(l(t('Change'), $path . '/parser')); $config_info[] = $info; // Processor. $processor = $plugins[$config['processor']['plugin_key']]; $actions = array(); if (feeds_get_form($importer->processor, 'configForm')) { - $actions[] = l(t('Settings'), $path .'/settings/'. $config['processor']['plugin_key']); + $actions[] = l(t('Settings'), $path . '/settings/' . $config['processor']['plugin_key']); } - $actions[] = l(t('Mapping'), $path .'/mapping'); + $actions[] = l(t('Mapping'), $path . '/mapping'); $info['title'] = t('Processor'); $info['body'] = array( array( @@ -387,7 +387,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { 'actions' => $actions, ) ); - $info['actions'] = array(l(t('Change'), $path .'/processor')); + $info['actions'] = array(l(t('Change'), $path . '/processor')); $config_info[] = $info; return theme('feeds_ui_edit_page', array( @@ -420,8 +420,8 @@ function feeds_ui_plugin_form($form, &$form_state, $importer, $type) { $form['plugin_key'][$key] = array( '#type' => 'radio', '#parents' => array('plugin_key'), - '#title' => $plugin['name'], - '#description' => isset($plugin['help']) ? $plugin['help'] : $plugin['description'], + '#title' => check_plain($plugin['name']), + '#description' => filter_xss(isset($plugin['help']) ? $plugin['help'] : $plugin['description']), '#return_value' => $key, '#default_value' => ($plugin['handler']['class'] == get_class($importer->$type)) ? $key : '', ); @@ -441,7 +441,7 @@ function feeds_ui_plugin_form_submit($form, &$form_state) { // Set the plugin and save feed. $form['#importer']->setPlugin($form_state['values']['plugin_key']); $form['#importer']->save(); - drupal_set_message(t('Changed !type plugin.', array('!type' => $form['#plugin_type']))); + drupal_set_message(t('Changed @type plugin.', array('!type' => $form['#plugin_type']))); } /** @@ -449,7 +449,7 @@ function feeds_ui_plugin_form_submit($form, &$form_state) { */ function theme_feeds_ui_plugin_form($variables) { $form = $variables['form']; - drupal_add_js(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.js'); + drupal_add_js(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.js'); $output = ''; foreach (element_children($form['plugin_key']) as $key) { @@ -479,7 +479,7 @@ function theme_feeds_ui_plugin_form($variables) { * FeedsProcessor, a flag can tell whether mapping is supported or not. */ function feeds_ui_mapping_form($form, &$form_state, $importer) { - drupal_add_js(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.js'); + drupal_add_js(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.js'); $form = array(); $form['#importer'] = $importer; @@ -648,8 +648,8 @@ function _feeds_ui_format_options($options) { */ function theme_feeds_ui_overview_form($variables) { $form = $variables['form']; - drupal_add_js(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.js'); - drupal_add_css(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.css'); + drupal_add_js(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.js'); + drupal_add_css(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.css'); // Iterate through all importers and build a table. $rows = array(); @@ -684,7 +684,7 @@ function theme_feeds_ui_overview_form($variables) { function theme_feeds_ui_edit_page($variables) { $config_info = $variables['info']; $active_container = $variables['active']; - drupal_add_css(drupal_get_path('module', 'feeds_ui') .'/feeds_ui.css'); + drupal_add_css(drupal_get_path('module', 'feeds_ui') . '/feeds_ui.css'); // Outer wrapper. $output = '<div class="feeds-settings clear-block">'; @@ -729,13 +729,13 @@ function theme_feeds_ui_container($variables) { $container = $variables['container']; $class = array_merge(array('feeds-container'), empty($container['class']) ? array('plain') : $container['class']); - $id = empty($container['id']) ? '': ' id="'. $container['id'] .'"'; - $output = '<div class="'. implode(' ', $class) .'"'. $id .'>'; + $id = empty($container['id']) ? '': ' id="' . $container['id'] . '"'; + $output = '<div class="' . implode(' ', $class) . '"' . $id . '>'; if (isset($container['actions']) && count($container['actions'])) { $output .= '<ul class="container-actions">'; foreach ($container['actions'] as $action) { - $output .= '<li>'. $action .'</li>'; + $output .= '<li>' . $action . '</li>'; } $output .= '</ul>'; } @@ -809,7 +809,7 @@ function theme_feeds_ui_mapping_form($variables) { '', drupal_render($form['add']), ); - $output = '<div class="help feeds-admin-ui""'. drupal_render($form['help']) .'</div>'; + $output = '<div class="help feeds-admin-ui""' . drupal_render($form['help']) . '</div>'; $output .= theme('table', array('header' => $header, 'rows' => $rows)); // Build the help table that explains available sources. @@ -822,7 +822,7 @@ function theme_feeds_ui_mapping_form($variables) { ); } if (count($rows)) { - $legend .= '<h4>'. t('Sources') .'</h4>'; + $legend .= '<h4>' . t('Sources') . '</h4>'; $legend .= theme('table', array('header' => array(t('Name'), t('Description')), 'rows' => $rows)); } @@ -834,12 +834,12 @@ function theme_feeds_ui_mapping_form($variables) { check_plain(drupal_render($form['legendset']['legend']['targets'][$k]['description'])), ); } - $legend .= '<h4>'. t('Targets') .'</h4>'; + $legend .= '<h4>' . t('Targets') . '</h4>'; $legend .= theme('table', array('header' => array(t('Name'), t('Description')), 'rows' => $rows)); // Stick tables into collapsible fieldset. $form['legendset']['legend'] = array( - '#markup' => '<div>'. $legend .'</div>', + '#markup' => '<div>' . $legend . '</div>', ); $output .= drupal_render($form['legendset']); diff --git a/feeds_ui/feeds_ui.info b/feeds_ui/feeds_ui.info index 931f842a620f632565f47fc30d55b88a578cde6b..1ef5b469280bcf1fb70bc0ed2d00d076563f021d 100644 --- a/feeds_ui/feeds_ui.info +++ b/feeds_ui/feeds_ui.info @@ -1,8 +1,8 @@ name = Feeds Admin UI description = Administrative UI for Feeds module. package = Feeds +core = 7.x dependencies[] = feeds -files[] = feeds_ui.module configure = admin/structure/feeds -core = 7.x -php = 5.2 \ No newline at end of file + +files[] = feeds_ui.test diff --git a/feeds_ui/feeds_ui.module b/feeds_ui/feeds_ui.module index 248be340e6051b1b56bb11b55f722a56c4498234..592d80c20922fb20a25b817492f77aa11e01a604 100644 --- a/feeds_ui/feeds_ui.module +++ b/feeds_ui/feeds_ui.module @@ -9,7 +9,7 @@ function feeds_ui_help($path, $arg) { switch ($path) { case 'admin/structure/feeds': - $output = '<p>'. t('Create one or more Feed importers for pulling content into Drupal. You can use these importers from the !import page or - if you attach them to a content type - simply by creating a node from that content type.', array('!import' => l(t('Import'), 'import'))) .'</p>'; + $output = '<p>' . t('Create one or more Feed importers for pulling content into Drupal. You can use these importers from the <a href="@import">Import</a> page or - if you attach them to a content type - simply by creating a node from that content type.', array('@import' => url('import'))) . '</p>'; return $output; } } @@ -28,11 +28,11 @@ function feeds_ui_menu() { 'file' => 'feeds_ui.admin.inc', ); $items['admin/structure/feeds/list'] = array( - 'title' => t('List'), + 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/structure/feeds/create'] = array( - 'title' => t('New importer'), + 'title' => 'New importer', 'page callback' => 'drupal_get_form', 'page arguments' => array('feeds_ui_create_form'), 'access arguments' => array('administer feeds'), @@ -68,7 +68,7 @@ function feeds_ui_menu() { 'type' => MENU_CALLBACK, ); $items['admin/structure/feeds/delete/%feeds_importer'] = array( - 'title' => t('Delete configuration'), + 'title' => 'Delete configuration', 'page callback' => 'drupal_get_form', 'page arguments' => array('feeds_ui_delete_form', 4), 'access arguments' => array('administer feeds'), diff --git a/feeds_ui/tests/feeds_ui.test b/feeds_ui/feeds_ui.test similarity index 97% rename from feeds_ui/tests/feeds_ui.test rename to feeds_ui/feeds_ui.test index fd1c907cb82b9ddf53e0297cb71293b5ec94037d..66ed8e33ae3bb678ba7dac33c6bdd691faa78388 100644 --- a/feeds_ui/tests/feeds_ui.test +++ b/feeds_ui/feeds_ui.test @@ -107,7 +107,7 @@ class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase { // Create a feed node. $edit = array( 'title' => 'Development Seed', - 'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/developmentseed.rss2', + 'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2', ); $this->drupalPost('node/add/page', $edit, 'Save'); $this->assertText('Page Development Seed has been created.'); diff --git a/includes/FeedsConfigurable.inc b/includes/FeedsConfigurable.inc index 70a5cecd76668ca28b589852f6fb84b93e36573f..0b9b620bfca0c3b89bd9a6917a758d465daeb719 100644 --- a/includes/FeedsConfigurable.inc +++ b/includes/FeedsConfigurable.inc @@ -211,7 +211,7 @@ abstract class FeedsConfigurable { */ function feeds_get_form($configurable, $form_method) { if (method_exists($configurable, $form_method)) { - return drupal_get_form(get_class($configurable) .'_feeds_form', $configurable, $form_method); + return drupal_get_form(get_class($configurable) . '_feeds_form', $configurable, $form_method); } } @@ -246,7 +246,7 @@ function feeds_form($form, &$form_state, $configurable, $form_method) { * Validation handler for feeds_form(). */ function feeds_form_validate($form, &$form_state) { - $validate_method = $form['#feeds_form_method'] .'Validate'; + $validate_method = $form['#feeds_form_method'] . 'Validate'; if (method_exists($form['#configurable'], $validate_method)) { $form['#configurable']->$validate_method($form_state['values']); } @@ -256,7 +256,7 @@ function feeds_form_validate($form, &$form_state) { * Submit handler for feeds_config_form(). */ function feeds_form_submit($form, &$form_state) { - $submit_method = $form['#feeds_form_method'] .'Submit'; + $submit_method = $form['#feeds_form_method'] . 'Submit'; if (method_exists($form['#configurable'], $submit_method)) { $form['#configurable']->$submit_method($form_state['values']); } diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index f0295b222f6f89a8f4ce2aa24c1f89a584f43120..6ed170201ba5f24030d3ce3d7481bbe2071f3904 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -348,7 +348,9 @@ class FeedsSource extends FeedsConfigurable { // Process. $this->importer->processor->process($this, $parser_result); } - catch (Exception $e) {} + catch (Exception $e) { + // Do nothing. + } $this->releaseLock(); // Clean up. @@ -387,7 +389,9 @@ class FeedsSource extends FeedsConfigurable { $this->importer->parser->clear($this); $this->importer->processor->clear($this); } - catch (Exception $e) {} + catch (Exception $e) { + // Do nothing. + } $this->releaseLock(); // Clean up. diff --git a/libraries/PuSHSubscriber.inc b/libraries/PuSHSubscriber.inc index da257cb052ac15d733e16520176b603e75f412de..5f7cbc9c50ee3cbe48a3d93c4b004c3ef09a88f3 100644 --- a/libraries/PuSHSubscriber.inc +++ b/libraries/PuSHSubscriber.inc @@ -85,7 +85,9 @@ class PuSHSubscriber { $self = (string) $self->attributes()->href; } } - catch (Exception $e) {} + catch (Exception $e) { + // Do nothing. + } } curl_close($request); // Fall back to $url if $self is not given. @@ -215,12 +217,12 @@ class PuSHSubscriber { $verify = TRUE; } if ($verify) { - header('HTTP/1.1 200 "Found"', null, 200); + header('HTTP/1.1 200 "Found"', NULL, 200); print $_GET['hub_challenge']; exit(); } } - header('HTTP/1.1 404 "Not Found"', null, 404); + header('HTTP/1.1 404 "Not Found"', NULL, 404); $this->log('Could not verify subscription.', 'error'); exit(); } @@ -242,7 +244,7 @@ class PuSHSubscriber { * @todo Make concurrency safe. */ protected function request($hub, $topic, $mode, $callback_url) { - $secret = hash('sha1', uniqid(rand(), true)); + $secret = hash('sha1', uniqid(rand(), TRUE)); $post_fields = array( 'hub.callback' => $callback_url, 'hub.mode' => $mode, @@ -265,7 +267,7 @@ class PuSHSubscriber { $this->log("Positive response to \"$mode\" request ($code)."); } else { - $sub->status = $mode .' failed'; + $sub->status = $mode . ' failed'; $sub->save(); $this->log("Error issuing \"$mode\" request to $hub ($code).", 'error'); } diff --git a/libraries/common_syndication_parser.inc b/libraries/common_syndication_parser.inc index 65616b1b6d7326bd2caf37641cf7745f07d3cb35..77797ffa8e9eaac97b9f9e4cb8e3dc106f9b251d 100644 --- a/libraries/common_syndication_parser.inc +++ b/libraries/common_syndication_parser.inc @@ -47,7 +47,7 @@ function common_syndication_parser_parse($string) { * Get the cached version of the <var>$url</var> */ function _parser_common_syndication_cache_get($url) { - $cache_file = _parser_common_syndication_sanitize_cache() .'/'. md5($url); + $cache_file = _parser_common_syndication_sanitize_cache() . '/' . md5($url); if (file_exists($cache_file)) { $file_content = file_get_contents($cache_file); return unserialize($file_content); @@ -167,7 +167,7 @@ function _parser_common_syndication_atom10_parse($feed_XML) { } $body .= "{$news->content}"; } - else if (!empty($news->summary)) { + elseif (!empty($news->summary)) { foreach ($news->summary->children() as $child) { $body .= $child->asXML(); } @@ -186,7 +186,7 @@ function _parser_common_syndication_atom10_parse($feed_XML) { $original_author = "{$news->source->author->name}"; $author_found = TRUE; } - else if (!empty($news->author->name)) { + elseif (!empty($news->author->name)) { $original_author = "{$news->author->name}"; $author_found = TRUE; } @@ -256,9 +256,9 @@ function _parser_common_syndication_RDF10_parse($feed_XML) { // Process the <rss:channel> resource containing feed metadata: foreach ($feed_XML->children($canonical_namespaces['rss'])->channel as $rss_channel) { $parsed_source = array( - 'title' => _parser_common_syndication_title((string)$rss_channel->title), - 'description' => (string)$rss_channel->description, - 'link' => (string)$rss_channel->link, + 'title' => _parser_common_syndication_title((string) $rss_channel->title), + 'description' => (string) $rss_channel->description, + 'link' => (string) $rss_channel->link, 'items' => array(), ); break; @@ -278,11 +278,11 @@ function _parser_common_syndication_RDF10_parse($feed_XML) { // still be able to correctly handle it. foreach ($rss_item->attributes($ns_uri) as $attr_name => $attr_value) { $ns_prefix = ($ns_prefix = array_search($ns_uri, $canonical_namespaces)) ? $ns_prefix : $ns; - $rdf_data[$ns_prefix .':'. $attr_name][] = (string)$attr_value; + $rdf_data[$ns_prefix . ':' . $attr_name][] = (string) $attr_value; } foreach ($rss_item->children($ns_uri) as $rss_property) { $ns_prefix = ($ns_prefix = array_search($ns_uri, $canonical_namespaces)) ? $ns_prefix : $ns; - $rdf_data[$ns_prefix .':'. $rss_property->getName()][] = (string)$rss_property; + $rdf_data[$ns_prefix . ':' . $rss_property->getName()][] = (string) $rss_property; } } @@ -291,7 +291,7 @@ function _parser_common_syndication_RDF10_parse($feed_XML) { 'title' => array('rss:title', 'dc:title'), 'description' => array('rss:description', 'dc:description', 'content:encoded'), 'url' => array('rss:link', 'rdf:about'), - 'author_name' => array('dc:creator', 'dc:publisher'), + 'author_name' => array('dc:creator', 'dc:publisher'), 'guid' => 'rdf:about', 'timestamp' => 'dc:date', 'tags' => 'dc:subject' @@ -346,7 +346,7 @@ function _parser_common_syndication_RDF10_item($rdf_data, $mappings) { */ function _parser_common_syndication_RSS20_parse($feed_XML) { - $ns = array ( + $ns = array( "content" => "http://purl.org/rss/1.0/modules/content/", "dc" => "http://purl.org/dc/elements/1.1/", "georss" => "http://www.georss.org/georss", @@ -571,7 +571,7 @@ function _parser_common_syndication_title($title, $body = FALSE) { if (empty($title) && !empty($body)) { // Explode to words and use the first 3 words. $words = preg_split("/[\s,]+/", strip_tags($body)); - $title = $words[0] .' '. $words[1] .' '. $words[2]; + $title = $words[0] . ' ' . $words[1] . ' ' . $words[2]; } return $title; } diff --git a/libraries/http_request.inc b/libraries/http_request.inc index 1cf85807b0deab228d0f7f6597e262786ac50f5b..4a3182511f644921ad13bcdc7e59a160b514de6f 100644 --- a/libraries/http_request.inc +++ b/libraries/http_request.inc @@ -95,14 +95,14 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva // Only download and parse data if really needs refresh. // Based on "Last-Modified" and "If-Modified-Since". $headers = array(); - if ($cache = cache_get('feeds_http_download_'. md5($url))) { + if ($cache = cache_get('feeds_http_download_' . md5($url))) { $last_result = $cache->data; $last_headers = $last_result->headers; $has_etag = TRUE; if (!empty($last_headers['ETag'])) { if ($curl) { - $headers[] = 'If-None-Match: '. $last_headers['ETag']; + $headers[] = 'If-None-Match: ' . $last_headers['ETag']; } else { $headers['If-None-Match'] = $last_headers['ETag']; @@ -110,14 +110,14 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva } if (!empty($last_headers['Last-Modified'])) { if ($curl) { - $headers[] = 'If-Modified-Since: '. $last_headers['Last-Modified']; + $headers[] = 'If-Modified-Since: ' . $last_headers['Last-Modified']; } else { $headers['If-Modified-Since'] = $last_headers['Last-Modified']; } } if (!empty($username) && !$curl) { - $headers['Authorization'] = 'Basic '. base64_encode("$username:$password"); + $headers['Authorization'] = 'Basic ' . base64_encode("$username:$password"); } } @@ -181,7 +181,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva if (isset($result->headers[$header]) && $header == 'Set-Cookie') { // RFC 2109: the Set-Cookie response header comprises the token Set- // Cookie:, followed by a comma-separated list of one or more cookies. - $result->headers[$header] .= ','. trim($value); + $result->headers[$header] .= ',' . trim($value); } else { $result->headers[$header] = trim($value); @@ -208,7 +208,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva else { // It's a tragedy, this file must exist and contain good data. // In this case, clear cache and repeat. - cache_clear_all('feeds_http_download_'. md5($url), 'cache'); + cache_clear_all('feeds_http_download_' . md5($url), 'cache'); return http_request_get($url, $username, $password); } } @@ -220,7 +220,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva } // Set caches. - cache_set('feeds_http_download_'. md5($url), $result); + cache_set('feeds_http_download_' . md5($url), $result); $download_cache[$url] = $result; return $result; @@ -247,7 +247,7 @@ function http_request_use_curl() { * Clear cache for a specific URL. */ function http_request_clear_cache($url) { - cache_clear_all('feeds_http_download_'. md5($url), 'cache'); + cache_clear_all('feeds_http_download_' . md5($url), 'cache'); } /** @@ -302,7 +302,7 @@ function http_request_find_feeds($html) { foreach ($attributes as $attribute) { // Find the key value pairs, attribute[1] is key and attribute[2] is the // value. - if(!empty($attribute[1]) && !empty($attribute[2])) { + if (!empty($attribute[1]) && !empty($attribute[2])) { $candidate[drupal_strtolower($attribute[1])] = drupal_strtolower(decode_entities($attribute[2])); } } @@ -353,13 +353,13 @@ function http_request_create_absolute_url($url, $base_url) { else { // Backtracking from the existing path. $cparts = array_merge(array_filter(explode("/", $path)), array_filter(explode("/", $url))); - foreach($cparts as $i => $part) { - if($part == '.') { - $cparts[$i] = null; + foreach ($cparts as $i => $part) { + if ($part == '.') { + $cparts[$i] = NULL; } - if($part == '..') { - $cparts[$i - 1] = null; - $cparts[$i] = null; + if ($part == '..') { + $cparts[$i - 1] = NULL; + $cparts[$i] = NULL; } } $cparts = array_filter($cparts); diff --git a/libraries/opml_parser.inc b/libraries/opml_parser.inc index 529bfa2027fc27f07a2067ccaac5f60a88701c13..d1faefcc127925b46827c5b79d677b11ba723db7 100644 --- a/libraries/opml_parser.inc +++ b/libraries/opml_parser.inc @@ -34,7 +34,7 @@ function opml_parser_parse($raw) { $item['title'] = $item['text']; } else { - $item['title'] = trim(substr($item['text'], 0, 30)) .' ...'; + $item['title'] = trim(substr($item['text'], 0, 30)) . ' ...'; } } if (isset($item['title']) && isset($item['xmlurl'])) { diff --git a/mappers/link.inc b/mappers/link.inc index 5629da840b1fad8b01395865f2dcaf6db65262fa..c38f904eb0e432894958ac7b40981eb95072fc4a 100644 --- a/mappers/link.inc +++ b/mappers/link.inc @@ -56,13 +56,13 @@ function link_feeds_set_target($source, $entity, $target, $value) { foreach ($value as $v) { if (!is_array($v) && !is_object($v)) { if (strstr($target, 'url')) { - if(isset($entity->{$field_name}['und'][$i]['title'])) { + if (isset($entity->{$field_name}['und'][$i]['title'])) { $field['und'][$i]['title'] = $entity->{$field_name}['und'][$i]['title']; } $field['und'][$i]['url'] = $v; } elseif (strstr($target, 'title')) { - if(isset($entity->{$field_name}['und'][$i]['url'])) { + if (isset($entity->{$field_name}['und'][$i]['url'])) { $field['und'][$i]['url'] = $entity->{$field_name}['und'][$i]['url']; } $field['und'][$i]['title'] = $v; diff --git a/mappers/taxonomy.inc b/mappers/taxonomy.inc index 01d92f3f4057a1a912104a75d95d8192588273d3..a4186645447a13068f629bbd27aeb84556bc79ee 100644 --- a/mappers/taxonomy.inc +++ b/mappers/taxonomy.inc @@ -13,7 +13,7 @@ function taxonomy_feeds_parser_sources_alter(&$sources, $content_type) { if (!empty($content_type)) { foreach (taxonomy_get_vocabularies($content_type) as $vocabulary) { - $sources['parent:taxonomy:'. $vocabulary->machine_name] = array( + $sources['parent:taxonomy:' . $vocabulary->machine_name] = array( 'name' => t('Feed node: Taxonomy: @vocabulary', array('@vocabulary' => $vocabulary->name)), 'description' => t('Taxonomy terms from feed node in given vocabulary.'), 'callback' => 'taxonomy_feeds_get_source', diff --git a/plugins/FeedsCSVParser.inc b/plugins/FeedsCSVParser.inc index f71810c7a4fc30f5782cfdb45ac98997f9e2655c..8f4f67fd197eac9decfe5cf7f58525ce03e49559 100644 --- a/plugins/FeedsCSVParser.inc +++ b/plugins/FeedsCSVParser.inc @@ -123,7 +123,7 @@ class FeedsCSVParser extends FeedsParser { } } - $output = t('Import !csv_files with one or more of these columns: !columns.',array('!csv_files' => l(t('CSV files'), 'http://en.wikipedia.org/wiki/Comma-separated_values'), '!columns' => implode(', ', $sources))); + $output = t('Import !csv_files with one or more of these columns: !columns.', array('!csv_files' => l(t('CSV files'), 'http://en.wikipedia.org/wiki/Comma-separated_values'), '!columns' => implode(', ', $sources))); $items = array(); $items[] = format_plural(count($uniques), t('Column <strong>!column</strong> is mandatory and considered unique: only one item per !column value will be created.', array('!column' => implode(', ', $uniques))), t('Columns <strong>!columns</strong> are mandatory and values in these columns are considered unique: only one entry per value in one of these column will be created.', array('!columns' => implode(', ', $uniques)))); $items[] = l(t('Download a template'), 'import/' . $this->id . '/template'); @@ -203,7 +203,7 @@ class FeedsCSVParser extends FeedsParser { $columns[] = $col; } drupal_add_http_header('Cache-Control', 'max-age=60, must-revalidate'); - drupal_add_http_header('Content-Disposition', 'attachment; filename="'. $this->id . '_template.csv"'); + drupal_add_http_header('Content-Disposition', 'attachment; filename="' . $this->id . '_template.csv"'); drupal_add_http_header('Content-type', 'text/csv; charset=utf-8'); print implode($sep, $columns); return; diff --git a/plugins/FeedsFetcher.inc b/plugins/FeedsFetcher.inc index f16e939e62379766db100c596f80f6908a901805..9cafd20f3d91c6994decc090b9da3a9a952b3d20 100644 --- a/plugins/FeedsFetcher.inc +++ b/plugins/FeedsFetcher.inc @@ -44,7 +44,7 @@ class FeedsFetcherResult extends FeedsResult { throw new Exception(t('Feeds directory either cannot be created or is not writable.')); } $this->file_path = FALSE; - if ($file = file_save_data($this->getRaw(), $destination . '/'. get_class($this) . REQUEST_TIME)) { + if ($file = file_save_data($this->getRaw(), $destination . '/' . get_class($this) . REQUEST_TIME)) { $file->status = 0; file_save($file); $this->file_path = $file->uri; @@ -67,7 +67,7 @@ class FeedsFetcherResult extends FeedsResult { * The sanitized content as a string. */ public function sanitizeRaw($raw) { - if (substr($raw, 0,3) == pack('CCC',0xef,0xbb,0xbf)) { + if (substr($raw, 0, 3) == pack('CCC', 0xef, 0xbb, 0xbf)) { $raw = substr($raw, 3); } return $raw; @@ -89,7 +89,7 @@ class FeedsFetcherResult extends FeedsResult { fclose($handle); // If BOM header is present, read entire contents of file and overwrite // the file with corrected contents. - if (substr($line, 0,3) == pack('CCC',0xef,0xbb,0xbf)) { + if (substr($line, 0, 3) == pack('CCC', 0xef, 0xbb, 0xbf)) { $contents = file_get_contents($filepath); $contents = substr($contents, 3); $status = file_put_contents($filepath, $contents); diff --git a/plugins/FeedsFileFetcher.inc b/plugins/FeedsFileFetcher.inc index e99c6c3d89dbe6a784a5dc43e762351b03dc248b..5d11129e50fc3192c4e6a22bdcb30aaee915fa2e 100644 --- a/plugins/FeedsFileFetcher.inc +++ b/plugins/FeedsFileFetcher.inc @@ -199,13 +199,13 @@ class FeedsFileFetcher extends FeedsFetcher { public function configForm(&$form_state) { $form = array(); $form['allowed_extensions'] = array( - '#type' =>'textfield', + '#type' => 'textfield', '#title' => t('Allowed file extensions'), '#description' => t('Allowed file extensions for upload.'), '#default_value' => $this->config['allowed_extensions'], ); $form['direct'] = array( - '#type' =>'checkbox', + '#type' => 'checkbox', '#title' => t('Supply path to file or directory directly'), '#description' => t('For experts. Lets users specify a path to a file <em>or a directory of files</em> directly, instead of a file upload through the browser. This is useful when the files that need to be imported diff --git a/plugins/FeedsHTTPFetcher.inc b/plugins/FeedsHTTPFetcher.inc index b48d8a1ef4bff4bf343ae3ef248b263619110e78..27dd013b3235ff56da2bf2815c24d1c2623c2ca3 100644 --- a/plugins/FeedsHTTPFetcher.inc +++ b/plugins/FeedsHTTPFetcher.inc @@ -78,12 +78,12 @@ class FeedsHTTPFetcher extends FeedsFetcher { } catch (Exception $e) { // In case of an error, respond with a 503 Service (temporary) unavailable. - header('HTTP/1.1 503 "Not Found"', null, 503); + header('HTTP/1.1 503 "Not Found"', NULL, 503); exit(); } } // Will generate the default 200 response. - header('HTTP/1.1 200 "OK"', null, 200); + header('HTTP/1.1 200 "OK"', NULL, 200); exit(); } @@ -120,7 +120,6 @@ class FeedsHTTPFetcher extends FeedsFetcher { '#title' => t('Designated hub'), '#description' => t('Enter the URL of a designated PubSubHubbub hub (e. g. superfeedr.com). If given, this hub will be used instead of the hub specified in the actual feed.'), '#default_value' => $this->config['designated_hub'], -// '#process' => array('ctools_dependent_process'), '#dependency' => array( 'edit-use-pubsubhubbub' => array(1), ), diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 20277052ca1451888644388058cb9aabb35a1f57..aa1dfff92e818707dd80641124ca382a9a79b6e7 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -320,7 +320,7 @@ class FeedsEnclosure extends FeedsElement { else { $filename = basename($this->getValue()); if (module_exists('transliteration')) { - require_once (drupal_get_path('module', 'transliteration') . '/transliteration.inc'); + require_once drupal_get_path('module', 'transliteration') . '/transliteration.inc'; $filename = transliteration_clean_filename($filename); } $file = file_save_data($this->getContent(), "$destination/$filename"); @@ -509,7 +509,7 @@ class FeedsDateTime extends DateTime { * * Ref: http://bugs.php.net/41334, http://bugs.php.net/39821 */ - public function __sleep(){ + public function __sleep() { $this->_serialized_time = $this->format('c'); $this->_serialized_timezone = $this->getTimezone()->getName(); return array('_serialized_time', '_serialized_timezone'); @@ -534,7 +534,7 @@ class FeedsDateTime extends DateTime { public function __construct($time = '', $tz = NULL) { // Assume UNIX timestamp if numeric. if (is_numeric($time)) { - $time = "@". $time; + $time = "@" . $time; } // PHP < 5.3 doesn't like the GMT- notation for parsing timezones. diff --git a/plugins/FeedsPlugin.inc b/plugins/FeedsPlugin.inc index c13c0f9b216a64f712d0f8d767bfa92e4d94836a..fa1746bcfec505ad080bf5d86047d114eefd018c 100644 --- a/plugins/FeedsPlugin.inc +++ b/plugins/FeedsPlugin.inc @@ -93,7 +93,7 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter protected static function loadMappers() { static $loaded = FALSE; if (!$loaded) { - $path = drupal_get_path('module', 'feeds') .'/mappers'; + $path = drupal_get_path('module', 'feeds') . '/mappers'; $files = drupal_system_listing('/.*\.inc$/', $path, 'name', 0); foreach ($files as $file) { if (strstr($file->uri, '/mappers/')) { diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index b1925458f1cb997eda1360ff3526df2b032e6686..08ae85fa43ca56323c2053fcb9d56898ef1e3810 100644 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -141,9 +141,9 @@ abstract class FeedsProcessor extends FeedsPlugin { drupal_set_message($e->getMessage(), 'warning'); $message = $e->getMessage(); $message .= '<h3>Original item</h3>'; - $message .= '<pre>' . var_export($item, true) . '</pre>'; + $message .= '<pre>' . var_export($item, TRUE) . '</pre>'; $message .= '<h3>Entity</h3>'; - $message .= '<pre>' . var_export($entity, true) . '</pre>'; + $message .= '<pre>' . var_export($entity, TRUE) . '</pre>'; $source->log('import', $message, array(), WATCHDOG_ERROR); } } diff --git a/plugins/FeedsTermProcessor.inc b/plugins/FeedsTermProcessor.inc index 67fffd443da4439988d13742d8698c10a7d7c7c2..0d44e845baac488a5fa2fbbaea21415ea77cae89 100644 --- a/plugins/FeedsTermProcessor.inc +++ b/plugins/FeedsTermProcessor.inc @@ -126,7 +126,9 @@ class FeedsTermProcessor extends FeedsProcessor { self::loadMappers(); feeds_alter('feeds_processor_targets', $targets, 'taxonomy_term', $this->vocabulary()->machine_name); } - catch (Exception $e) {} + catch (Exception $e) { + // Do nothing. + } return $targets; } diff --git a/tests/common_syndication_parser.test b/tests/common_syndication_parser.test index bb01b6a3596ec415738d14ffa086daec10bb12ab..a08e3fe9c28bbf9b9ca836bb84a2c157a2fbc738 100644 --- a/tests/common_syndication_parser.test +++ b/tests/common_syndication_parser.test @@ -81,7 +81,7 @@ class CommonSyndicationParserTestCase extends DrupalWebTestCase { * Helper to read a feed. */ protected function readFeed($filename) { - $feed = dirname(__FILE__) .'/feeds/'. $filename; + $feed = dirname(__FILE__) . '/feeds/' . $filename; $handle = fopen($feed, 'r'); $string = fread($handle, filesize($feed)); fclose($handle); diff --git a/tests/feeds.test b/tests/feeds.test index 215d62bb670dda688d5e72d43231a7f6963fa3ae..40c6214adac4512ef8af5731e7ef22ffca0671e0 100644 --- a/tests/feeds.test +++ b/tests/feeds.test @@ -125,7 +125,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { * Get the absolute directory path of the feeds module. */ public function absolutePath() { - return $this->absolute() .'/'. drupal_get_path('module', 'feeds'); + return $this->absolute() . '/' . drupal_get_path('module', 'feeds'); } /** @@ -135,7 +135,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { * to feeds included in this test. */ public function generateOPML() { - $path = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/'; + $path = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/'; $output = '<?xml version="1.0" encoding="utf-8"?> @@ -147,16 +147,16 @@ class FeedsWebTestCase extends DrupalWebTestCase { </head> <body> <outline text="Feeds test group" > - <outline title="Development Seed - Technological Solutions for Progressive Organizations" text="" xmlUrl="'. $path .'developmentseed.rss2" type="rss" /> - <outline title="Magyar Nemzet Online - H’rek" text="" xmlUrl="'. $path .'feed_without_guid.rss2" type="rss" /> - <outline title="Drupal planet" text="" type="rss" xmlUrl="'. $path .'drupalplanet.rss2" /> + <outline title="Development Seed - Technological Solutions for Progressive Organizations" text="" xmlUrl="' . $path . 'developmentseed.rss2" type="rss" /> + <outline title="Magyar Nemzet Online - H’rek" text="" xmlUrl="' . $path . 'feed_without_guid.rss2" type="rss" /> + <outline title="Drupal planet" text="" type="rss" xmlUrl="' . $path . 'drupalplanet.rss2" /> </outline> </body> </opml>'; // UTF 8 encode output string and write it to disk $output = utf8_encode($output); - $filename = file_default_scheme() . '://test-opml-'. $this->randomName() . '.opml'; + $filename = file_default_scheme() . '://test-opml-' . $this->randomName() . '.opml'; $filename = file_unmanaged_save_data($output, $filename); return $filename; @@ -208,7 +208,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { // Assert actual configuration. $config = unserialize(db_query("SELECT config FROM {feeds_importer} WHERE id = :id", array(':id' => $id))->fetchField()); - $this->assertEqual($config[$type]['plugin_key'], $plugin_key, 'Verified correct '. $type .' ('. $plugin_key .').'); + $this->assertEqual($config[$type]['plugin_key'], $plugin_key, 'Verified correct ' . $type . ' (' . $plugin_key . ').'); } } @@ -223,7 +223,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { * The settings to set. */ public function setSettings($id, $plugin, $settings) { - $this->drupalPost('admin/structure/feeds/edit/'. $id .'/settings/'. $plugin, $settings, 'Save'); + $this->drupalPost('admin/structure/feeds/edit/' . $id . '/settings/' . $plugin, $settings, 'Save'); $this->assertText('Your changes have been saved.'); } @@ -241,7 +241,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { */ public function createFeedNode($id = 'syndication', $feed_url = NULL, $title = '', $content_type = NULL) { if (empty($feed_url)) { - $feed_url = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/developmentseed.rss2'; + $feed_url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2'; } // If content type not given, retrieve it. @@ -252,7 +252,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { ->execute(); $config = unserialize($result->fetchField()); $content_type = $config['content_type']; - $this->assertFalse(empty($content_type), 'Valid content type found: '. $content_type); + $this->assertFalse(empty($content_type), 'Valid content type found: ' . $content_type); } // Create a feed node. @@ -260,7 +260,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { 'title' => $title, 'feeds[FeedsHTTPFetcher][source]' => $feed_url, ); - $this->drupalPost('node/add/'. str_replace('_', '-', $content_type), $edit, 'Save'); + $this->drupalPost('node/add/' . str_replace('_', '-', $content_type), $edit, 'Save'); $this->assertText('has been created.'); // Get the node id from URL. @@ -329,12 +329,12 @@ class FeedsWebTestCase extends DrupalWebTestCase { */ public function importURL($id, $feed_url = NULL) { if (empty($feed_url)) { - $feed_url = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/developmentseed.rss2'; + $feed_url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2'; } $edit = array( 'feeds[FeedsHTTPFetcher][source]' => $feed_url, ); - $nid = $this->drupalPost('import/'. $id, $edit, 'Import'); + $nid = $this->drupalPost('import/' . $id, $edit, 'Import'); // Check whether feed got recorded in feeds_source table. $this->assertEqual(1, db_query("SELECT COUNT(*) FROM {feeds_source} WHERE id = :id AND feed_nid = 0", array(':id' => $id))->fetchField()); @@ -357,7 +357,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { $edit = array( 'files[feeds]' => $file, ); - $this->drupalPost('import/'. $id, $edit, 'Import'); + $this->drupalPost('import/' . $id, $edit, 'Import'); } /** @@ -388,7 +388,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { */ public function addMappings($id, $mappings) { - $path = 'admin/structure/feeds/edit/'. $id .'/mapping'; + $path = 'admin/structure/feeds/edit/' . $id . '/mapping'; // Iterate through all mappings and add the via the form. foreach ($mappings as $i => $mapping) { @@ -402,7 +402,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { // If unique was set, set the last mapping's unique flag. if ($unique) { $edit = array( - 'unique_flags['. $i .']' => 1, + 'unique_flags[' . $i . ']' => 1, ); $this->drupalPost($path, $edit, t('Save')); } diff --git a/tests/feeds_mapper.test b/tests/feeds_mapper.test index 1bd5b332d7a63104f897f41d142884fe49c82cd9..78da63779166bad30c28aed3ec1a97c865ca1c19 100644 --- a/tests/feeds_mapper.test +++ b/tests/feeds_mapper.test @@ -46,7 +46,7 @@ class FeedsMapperTestCase extends FeedsWebTestCase { protected function assertNodeFieldValue($field_name, $value, $index = 0) { $names = $this->getFormFieldsNames($field_name, $index); $values = $this->getFormFieldsValues($field_name, $value); - foreach($names as $k => $name){ + foreach ($names as $k => $name) { $value = $values[$k]; $this->assertFieldByName($name, $value, t('Found form field %name for %field_name with the expected value.', array('%name' => $name, '%field_name' => $field_name))); } @@ -103,11 +103,11 @@ class FeedsMapperTestCase extends FeedsWebTestCase { $type = $this->drupalCreateContentType($settings); $typename = $type->type; - $admin_type_url = 'admin/structure/types/manage/'. str_replace('_', '-', $typename); + $admin_type_url = 'admin/structure/types/manage/' . str_replace('_', '-', $typename); // Create the fields foreach ($fields as $field_name => $options) { - if(is_string($options)) { + if (is_string($options)) { $options = array('type' => $options); } $field_type = isset($options['type']) ? $options['type'] : 'text'; diff --git a/tests/feeds_mapper_date.test b/tests/feeds_mapper_date.test index 66c8790be1cd5952aaf9c3d0915e8d0f899df014..63d371bdc45829da12e0be735c6bbf98461b18d2 100644 --- a/tests/feeds_mapper_date.test +++ b/tests/feeds_mapper_date.test @@ -41,7 +41,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase { // Create and configure importer. $this->createImporterConfiguration('Date RSS', 'daterss'); - $this->setSettings('daterss', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER,)); + $this->setSettings('daterss', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER)); $this->setPlugin('daterss', 'FeedsFileFetcher'); $this->setPlugin('daterss', 'FeedsSyndicationParser'); $this->setSettings('daterss', 'FeedsNodeProcessor', array('content_type' => $typename)); @@ -70,7 +70,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase { $this->drupalPost('admin/structure/feeds/edit/daterss/settings/FeedsFileFetcher', $edit, 'Save'); // Import CSV file. - $this->importFile('daterss', $this->absolutePath() .'/tests/feeds/googlenewstz.rss2'); + $this->importFile('daterss', $this->absolutePath() . '/tests/feeds/googlenewstz.rss2'); $this->assertText('Created 6 nodes'); // Check the imported nodes. diff --git a/tests/feeds_mapper_field.test b/tests/feeds_mapper_field.test index 404f37e0b1afe0efb65dc75511446e8c7f7b69ab..f0684da79b06cad7a844ebbb4a81b2dc38b25c49 100644 --- a/tests/feeds_mapper_field.test +++ b/tests/feeds_mapper_field.test @@ -35,7 +35,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase { // Create and configure importer. $this->createImporterConfiguration('Content CSV', 'csv'); - $this->setSettings('csv', NULL, array('content_type' => '','import_period' => FEEDS_SCHEDULE_NEVER,)); + $this->setSettings('csv', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER)); $this->setPlugin('csv', 'FeedsFileFetcher'); $this->setPlugin('csv', 'FeedsCSVParser'); $this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename)); @@ -71,7 +71,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase { )); // Import CSV file. - $this->importFile('csv', $this->absolutePath() .'/tests/feeds/content.csv'); + $this->importFile('csv', $this->absolutePath() . '/tests/feeds/content.csv'); $this->assertText('Created 2 nodes'); // Check the two imported files. diff --git a/tests/feeds_mapper_link.test b/tests/feeds_mapper_link.test index 3e0fb50ca1ca267b83c3b019eee769eee32b7ef7..91926ac80078555808f733dc6ab4f9d7d126aa10 100644 --- a/tests/feeds_mapper_link.test +++ b/tests/feeds_mapper_link.test @@ -124,7 +124,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase { * Override parent::getFormFieldsNames(). */ protected function getFormFieldsNames($field_name, $index) { - if(in_array($field_name, array('alpha', 'beta', 'gamma', 'omega'))) { + if (in_array($field_name, array('alpha', 'beta', 'gamma', 'omega'))) { $fields = array("field_{$field_name}[und][{$index}][url]"); if (in_array($field_name, array('alpha', 'gamma'))) { $fields[] = "field_{$field_name}[und][{$index}][title]"; diff --git a/tests/feeds_mapper_taxonomy.test b/tests/feeds_mapper_taxonomy.test index a3e21bd0519f85a4829a422e00226ca97944a8a6..f83d2aa55992ba73f4f8b09b82d87c7fca0b5e00 100644 --- a/tests/feeds_mapper_taxonomy.test +++ b/tests/feeds_mapper_taxonomy.test @@ -86,7 +86,7 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { 'taxonomy[tags][1]' => implode(',', $terms), ); $this->drupalPost("node/$nid/edit", $edit, t('Save')); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $count = db_query("SELECT COUNT(*) FROM {term_node}")->fetchField(); $this->assertEqual(33, $count, 'Found correct number of tags for all feed nodes and feed items.'); foreach ($terms as $term) { @@ -155,7 +155,7 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { } // Delete all items, all associations are gone. - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); $this->assertText('Deleted 10 nodes'); $this->assertEqual(30, db_query("SELECT count(*) FROM {term_data}")->fetchField(), "Found correct number of terms."); $this->assertEqual(0, db_query("SELECT count(*) FROM {term_node}")->fetchField(), "Found correct number of term-node relations."); @@ -165,7 +165,7 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { 'tags' => FALSE, ); $this->drupalPost('admin/content/taxonomy/edit/vocabulary/1', $edit, 'Save'); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('Created 10 nodes'); // We should only get one term-node association per node. @@ -173,14 +173,14 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { $this->assertEqual(10, db_query("SELECT count(*) FROM {term_node}")->fetchField(), "Found correct number of term-node relations."); // Delete all items. - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); // Set vocabulary to multiple terms, import again. $edit = array( 'multiple' => TRUE, ); $this->drupalPost('admin/content/taxonomy/edit/vocabulary/1', $edit, 'Save'); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('Created 10 nodes'); // We should get all term-node associations again. @@ -188,13 +188,13 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { $this->assertEqual(44, db_query("SELECT count(*) FROM {term_node}")->fetchField(), "Found correct number of term-node relations."); // Delete all items. - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); // Remove a term, import again. $this->drupalPost('admin/content/taxonomy/edit/term/1', array(), 'Delete'); $this->drupalPost(NULL, array(), 'Delete'); $this->assertText('Deleted term'); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('Created 10 nodes'); // This term should now be missing from term-node associations. @@ -207,6 +207,6 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase { */ public function assertTaxonomyTerm($term) { $term = check_plain($term); - $this->assertPattern('/<a href="(.*?)\/taxonomy\/term\/([0-9]*?)"(.*)>'. $term .'<\/a>/', 'Found '. $term); + $this->assertPattern('/<a href="(.*?)\/taxonomy\/term\/([0-9]*?)"(.*)>' . $term . '<\/a>/', 'Found ' . $term); } } diff --git a/tests/feeds_parser_sitemap.test b/tests/feeds_parser_sitemap.test index 3be92213a503f5a36311b7b4093637d684fde05a..6b79804f1a3d7d3258bdba2943bac34051e47bf2 100644 --- a/tests/feeds_parser_sitemap.test +++ b/tests/feeds_parser_sitemap.test @@ -55,8 +55,8 @@ class FeedsSitemapParserTestCase extends FeedsWebTestCase { ); - $path = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/'; - $nid = $this->createFeedNode('sitemap', $path .'sitemap-example.xml', 'Testing Sitemap Parser'); + $path = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/'; + $nid = $this->createFeedNode('sitemap', $path . 'sitemap-example.xml', 'Testing Sitemap Parser'); $this->assertText('Created 5 nodes'); // Assert DB status. diff --git a/tests/feeds_parser_syndication.test b/tests/feeds_parser_syndication.test index 6831c5e2bec546a129d74b055f21f17a4379bcb2..c4ea234fc0a2bf2dd7dd6a69ebc5761140f55e2c 100644 --- a/tests/feeds_parser_syndication.test +++ b/tests/feeds_parser_syndication.test @@ -35,7 +35,7 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase { $this->setPlugin('syndication', $parser); foreach ($this->feedUrls() as $url => $assertions) { $this->createFeedNode('syndication', $url); - $this->assertText('Created '. $assertions['item_count'] .' nodes'); + $this->assertText('Created ' . $assertions['item_count'] . ' nodes'); } } } @@ -44,7 +44,7 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase { * Return an array of test feeds. */ protected function feedUrls() { - $path = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/'; + $path = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/'; return array( "{$path}developmentseed.rss2" => array( 'item_count' => 10, diff --git a/tests/feeds_processor_node.test b/tests/feeds_processor_node.test index c16983f529634829bd3689d56706d1dec964f1e4..c58611ab11b6cd72cde86336dbed718c78fbffe6 100644 --- a/tests/feeds_processor_node.test +++ b/tests/feeds_processor_node.test @@ -77,9 +77,9 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { $this->assertEqual("Created by FeedsNodeProcessor", db_query("SELECT nr.log FROM {node} n JOIN {node_revision} nr ON n.vid = nr.vid WHERE n.nid = :nid", array(':nid' => $article_nid))->fetchField()); // Navigate to feed node, there should be Feeds tabs visible. - $this->drupalGet('node/'. $nid); - $this->assertRaw('node/'. $nid .'/import'); - $this->assertRaw('node/'. $nid .'/delete-items'); + $this->drupalGet("node/$nid"); + $this->assertRaw("node/$nid/import"); + $this->assertRaw("node/$nid/delete-items"); // Assert accuracy of aggregated information. $this->drupalGet('node'); @@ -98,7 +98,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { */ // Import again. - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('There are no new nodes'); // Assert DB status, there still shouldn't be more than 10 items. @@ -113,22 +113,22 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { 'node_options[status]' => FALSE, ); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $count = db_query("SELECT COUNT(*) FROM {node} n INNER JOIN {feeds_item} fi ON fi.entity_type = 'node' AND n.nid = fi.entity_id WHERE n.status = 0")->fetchField(); $this->assertEqual($count, 10, 'No items are published.'); $edit = array( 'node_options[status]' => TRUE, ); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); // Enable replace existing and import updated feed file. - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->setSettings('syndication', 'FeedsNodeProcessor', array('update_existing' => 1)); - $feed_url = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') .'/tests/feeds/developmentseed_changes.rss2'; + $feed_url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed_changes.rss2'; $this->editFeedNode($nid, $feed_url); - $this->drupalPost('node/' . $nid . '/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('Updated 2 nodes'); // Assert accuracy of aggregated content (check 2 updates, one original). @@ -138,12 +138,12 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { $this->assertText('Scaling the Open Atrium UI'); // Import again. - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('There are no new nodes'); $this->assertFeedItemCount(10); // Now delete all items. - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); $this->assertText('Deleted 10 nodes'); $this->assertFeedItemCount(0); @@ -155,7 +155,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { $this->setSettings('syndication', 'FeedsNodeProcessor', array('input_format' => 'plain_text')); // Import again. - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->assertText('Created 10 nodes'); // Assert author. @@ -174,7 +174,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { // Set to update existing, remove authorship of above nodes and import again. $this->setSettings('syndication', 'FeedsNodeProcessor', array('update_existing' => 2)); db_query("UPDATE {node} n JOIN {feeds_item} fi ON fi.entity_type = 'node' AND n.nid = fi.entity_id SET n.uid = 0, fi.hash=''"); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->drupalGet('node'); $this->assertNoPattern('/<span class="username">' . check_plain($this->auth_user->name) . '<\/span>/'); $count = db_query("SELECT COUNT(*) FROM {feeds_item} fi JOIN {node} n ON fi.entity_type = 'node' AND fi.entity_id = n.nid WHERE n.uid = :uid", array(':uid' => $this->auth_user->uid))->fetchField(); @@ -190,20 +190,20 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { ), ) ); - $this->drupalPost('node/'. $nid .'/import', array(), 'Import'); + $this->drupalPost("node/$nid/import", array(), 'Import'); $this->drupalGet('node'); $this->assertNoPattern('/<span class="username">' . check_plain($this->auth_user->name) . '<\/span>/'); $uid = db_query("SELECT uid FROM {node} WHERE nid = :nid", array(':nid' => $nid))->fetchField(); - $count = db_query("SELECT COUNT(*) FROM {node} WHERE uid = :uid", array(':uid' =>$uid))->fetchField(); + $count = db_query("SELECT COUNT(*) FROM {node} WHERE uid = :uid", array(':uid' => $uid))->fetchField(); $this->assertEqual($count, 11, 'All feed item nodes are assigned to feed node author.'); // Login with new user with only access content permissions. $this->drupalLogin($this->auth_user); // Navigate to feed node, there should be no Feeds tabs visible. - $this->drupalGet('node/'. $nid); - $this->assertNoRaw('node/'. $nid .'/import'); - $this->assertNoRaw('node/'. $nid .'/delete-items'); + $this->drupalGet("node/$nid"); + $this->assertNoRaw("node/$nid/import"); + $this->assertNoRaw("node/$nid/delete-items"); // Now create a second feed configuration that is not attached to a content // type and run tests on importing/purging. @@ -211,7 +211,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { // Login with sufficient permissions. $this->drupalLogin($this->admin_user); // Remove all items again so that next test can check for them. - $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete'); + $this->drupalPost("node/$nid/delete-items", array(), 'Delete'); // Create an importer, not attached to content type. $this->createImporterConfiguration('Syndication standalone', 'syndication_standalone'); @@ -265,7 +265,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { // Enable replace existing and import updated feed file. $this->setSettings('syndication_standalone', 'FeedsNodeProcessor', array('update_existing' => 1)); - $feed_url = $GLOBALS['base_url'] .'/'. drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed_changes.rss2'; + $feed_url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed_changes.rss2'; $this->importURL('syndication_standalone', $feed_url); $this->assertText('Updated 2 nodes'); @@ -310,7 +310,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { // Create a feed node. $edit = array( - 'files[feeds]' => $this->absolutePath() .'/tests/feeds/drupalplanet.rss2', + 'files[feeds]' => $this->absolutePath() . '/tests/feeds/drupalplanet.rss2', ); $this->drupalPost('import/syndication_standalone', $edit, 'Import'); $this->assertText('Created 25 nodes'); @@ -373,7 +373,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { * Test using non-normal URLs like feed:// and webcal://. */ function testOddFeedSchemes() { - $url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') .'/tests/feeds/developmentseed.rss2'; + $url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2'; $schemes = array('feed', 'webcal'); $item_count = 0; @@ -395,7 +395,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { function testNonFeedNodeUI() { // There should not be feed links on an article node. $non_feed_node = $this->drupalCreateNode(array('type' => 'article')); - $this->drupalGet('node/'. $non_feed_node->nid); + $this->drupalGet('node/' . $non_feed_node->nid); $this->assertNoLink('Import'); $this->assertNoLink('Delete items'); diff --git a/tests/feeds_processor_term.test b/tests/feeds_processor_term.test index 3c25fa5d710fde4aae67577e10047a430c1eae0d..99422e18ee522e1c5895dfb63a1ed3a55f0210b1 100644 --- a/tests/feeds_processor_term.test +++ b/tests/feeds_processor_term.test @@ -56,7 +56,7 @@ class FeedsCSVtoTermsTest extends FeedsWebTestCase { $this->drupalPost('admin/structure/feeds/edit/term_import/settings/FeedsTermProcessor', $edit, t('Save')); // Import and assert. - $this->importFile('term_import', $this->absolutePath() .'/tests/feeds/users.csv'); + $this->importFile('term_import', $this->absolutePath() . '/tests/feeds/users.csv'); $this->assertText('Created 5 terms'); $this->drupalGet('admin/structure/taxonomy/addams'); $this->assertText('Morticia'); @@ -65,7 +65,7 @@ class FeedsCSVtoTermsTest extends FeedsWebTestCase { $this->assertText('Pugsley'); // Import again. - $this->importFile('term_import', $this->absolutePath() .'/tests/feeds/users.csv'); + $this->importFile('term_import', $this->absolutePath() . '/tests/feeds/users.csv'); $this->assertText('There are no new terms.'); // Add a term manually, delete all terms, this term should still stand. diff --git a/tests/feeds_processor_user.test b/tests/feeds_processor_user.test index 324625be4457bdf0534ba373c8d8ce5b464ebfbe..296bf40839c26175f36303ee5d22e6238a880f3b 100644 --- a/tests/feeds_processor_user.test +++ b/tests/feeds_processor_user.test @@ -70,7 +70,7 @@ class FeedsCSVtoUsersTest extends FeedsWebTestCase { $this->setSettings('user_import', 'FeedsUserProcessor', $edit); // Import CSV file. - $this->importFile('user_import', $this->absolutePath() .'/tests/feeds/users.csv'); + $this->importFile('user_import', $this->absolutePath() . '/tests/feeds/users.csv'); // Assert result. $this->assertText('Created 4 users'); diff --git a/tests/feeds_scheduler.test b/tests/feeds_scheduler.test index 532744acb05672ed3090c6469b853ff71b5baccb..f1615b730ed2f16e19e1bbc648597520befab7b6 100644 --- a/tests/feeds_scheduler.test +++ b/tests/feeds_scheduler.test @@ -92,16 +92,16 @@ class FeedsSchedulerTestCase extends FeedsWebTestCase { foreach ($rows as $row) { $schedule[$row->id] = $row; } - $this->assertEqual(count($schedule), 20, '20 feeds refreshed on cron.'. $count); + $this->assertEqual(count($schedule), 20, '20 feeds refreshed on cron.' . $count); // There should be 200 article nodes in the database. $count = db_query("SELECT COUNT(*) FROM {node} WHERE type = 'article' AND status = 1")->fetchField(); - $this->assertEqual($count, 200, 'There are 200 article nodes aggregated.'. $count); + $this->assertEqual($count, 200, 'There are 200 article nodes aggregated.' . $count); // There shouldn't be any items with scheduled = 1 now, if so, this would // mean they are stuck. $count = db_query("SELECT COUNT(*) FROM {job_schedule} WHERE scheduled = 1")->fetchField(); - $this->assertEqual($count, 0, 'All items are unscheduled (schedule flag = 0).'. $count); + $this->assertEqual($count, 0, 'All items are unscheduled (schedule flag = 0).' . $count); // Hit cron again twice. $this->cronRun(); @@ -218,7 +218,7 @@ class FeedsSchedulerTestCase extends FeedsWebTestCase { $this->addMappings('node', $mappings); // Verify that there are 86 nodes total. - $this->importFile('node', $this->absolutePath() .'/tests/feeds/many_nodes.csv'); + $this->importFile('node', $this->absolutePath() . '/tests/feeds/many_nodes.csv'); $this->assertText('Created 86 nodes'); // Run batch twice with two different process limits. diff --git a/tests/parser_csv.test b/tests/parser_csv.test index d908b07a89e3c0022dcaf38d3cf3b6a5cc86e7c5..6c8adfbf37492bf881efd229238b990049d17c28 100644 --- a/tests/parser_csv.test +++ b/tests/parser_csv.test @@ -38,8 +38,8 @@ class ParserCSVTest extends DrupalWebTestCase { * Simple test of parsing functionality. */ protected function _testSimple() { - $file = $this->absolutePath() .'/tests/feeds/nodes.csv'; - include $this->absolutePath() .'/tests/feeds/nodes.csv.php'; + $file = $this->absolutePath() . '/tests/feeds/nodes.csv'; + include $this->absolutePath() . '/tests/feeds/nodes.csv.php'; $iterator = new ParserCSVIterator($file); $parser = new ParserCSV(); @@ -53,8 +53,8 @@ class ParserCSVTest extends DrupalWebTestCase { * Test batching. */ protected function _testBatching() { - $file = $this->absolutePath() .'/tests/feeds/nodes.csv'; - include $this->absolutePath() .'/tests/feeds/nodes.csv.php'; + $file = $this->absolutePath() . '/tests/feeds/nodes.csv'; + include $this->absolutePath() . '/tests/feeds/nodes.csv.php'; // Set up parser with 2 lines to parse per call. $iterator = new ParserCSVIterator($file); @@ -80,6 +80,6 @@ class ParserCSVTest extends DrupalWebTestCase { * Absolute path to feeds. */ public function absolutePath() { - return DRUPAL_ROOT .'/'. drupal_get_path('module', 'feeds'); + return DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds'); } } diff --git a/views/feeds_views_handler_field_source.inc b/views/feeds_views_handler_field_source.inc index 098545a1455547d5bb9c14b560f3f7077a76a0c1..8e137ac79ec71f418c2da40dc395847a50286ab4 100644 --- a/views/feeds_views_handler_field_source.inc +++ b/views/feeds_views_handler_field_source.inc @@ -17,7 +17,7 @@ class feeds_views_handler_field_source extends views_handler_field { } elseif (isset($value['FeedsFileFetcher']['feeds_source'])) { // @todo This is untested. - return $GLOBALS['base_url'] .'/'. check_plain($value['FeedsFileFetcher']['feeds_source']); + return $GLOBALS['base_url'] . '/' . check_plain($value['FeedsFileFetcher']['feeds_source']); } return ''; }