diff --git a/feeds.module b/feeds.module index 88bbb24..7a91e7e 100644 --- a/feeds.module +++ b/feeds.module @@ -999,11 +999,11 @@ function feeds_menu_local_tasks_alter(&$data, $router_item, $root_path) { /** * Loads all importers. * - * @param bool $load_disabled + * @param $load_disabled * Pass TRUE to load all importers, enabled or disabled, pass FALSE to only * retrieve enabled importers. * - * @return array + * @return * An array of all feed configurations available. */ function feeds_importer_load_all($load_disabled = FALSE) { @@ -1053,10 +1053,10 @@ function feeds_enabled_importers() { /** * Gets an enabled importer configuration by content type. * - * @param string $content_type + * @param $content_type * A node type string. * - * @return array + * @return * A FeedsImporter id if there is an importer for the given content type, * FALSE otherwise. */ @@ -1383,9 +1383,6 @@ function feeds_include_library($file, $library) { * The name of the library. If libraries module is installed, * feeds_library_exists() will look for libraries with this name managed by * libraries module. - * - * @return bool - * If library exists or not. */ function feeds_library_exists($file, $library) { $path = module_exists('libraries') ? libraries_get_path($library) : FALSE; @@ -1407,7 +1404,7 @@ function feeds_library_exists($file, $library) { return FALSE; } -/** + /** * Checks whether simplepie exists. */ function feeds_simplepie_exists() { @@ -1472,7 +1469,7 @@ function feeds_alter($type, &$data) { /** * Copy of valid_url() that supports the webcal scheme. * - * @see valid_url() + * @see valid_url(). * * @todo Replace with valid_url() when http://drupal.org/node/295021 is fixed. */ @@ -1507,7 +1504,7 @@ function feeds_valid_url($url, $absolute = FALSE) { * Information about a new job to queue; or if set to NULL (default), leaves * the current queued jobs unchanged. * - * @return array + * @return * An array of subscribe jobs to process. * * @see feeds_exit() @@ -1524,7 +1521,7 @@ function feeds_set_subscription_job(array $job = NULL) { /** * Returns the list of queued jobs to be run. * - * @return array + * @return * An array of subscribe jobs to process. * * @see feeds_set_subscription_job() @@ -1558,7 +1555,7 @@ function feeds_entity_property_info_alter(&$info) { * Gets the feed_nid for an entity for use in entity metadata. */ function feeds_get_feed_nid_entity_callback($entity, array $options, $name, $entity_type) { - list($entity_id, ,) = entity_extract_ids($entity_type, $entity); + list($entity_id, , ) = entity_extract_ids($entity_type, $entity); $feed_nid = NULL; if ($entity_id) { @@ -1586,7 +1583,7 @@ function feeds_file_download($uri) { return; } - // Get the file record based on the URI. If not in the database just return. + // Get the file record based on the URI. If not in the database just return. $files = file_load_multiple(array(), array('uri' => $uri)); foreach ($files as $item) { // Since some database servers sometimes use a case-insensitive comparison diff --git a/feeds.pages.inc b/feeds.pages.inc index cb4e6d3..e886d91 100644 --- a/feeds.pages.inc +++ b/feeds.pages.inc @@ -330,8 +330,7 @@ function feeds_unlock_tab_form($form, &$form_state, FeedsImporter $importer = NU '#tree' => TRUE, '#value' => feeds_source_status($source), ); - $form = confirm_form($form, t('Unlock this importer?'), - $form['#redirect'], '', t('Delete'), t('Cancel'), 'confirm feeds update'); + $form = confirm_form($form, t('Unlock this importer?'), $form['#redirect'], '', t('Delete'), t('Cancel'), 'confirm feeds update'); if ($source->progressImporting() == FEEDS_BATCH_COMPLETE && $source->progressClearing() == FEEDS_BATCH_COMPLETE) { $form['source_locked'] = array( '#type' => 'markup', @@ -357,7 +356,7 @@ function feeds_unlock_tab_form_submit($form, &$form_state) { $feed_nid = empty($form['#feed_nid']) ? 0 : $form['#feed_nid']; $importer_id = $form['#importer_id']; - // Is there a more API-friendly way to set the state? + //Is there a more API-friendly way to set the state? db_update('feeds_source') ->condition('id', $importer_id) ->condition('feed_nid', $feed_nid) @@ -381,7 +380,7 @@ function feeds_fetcher_callback($importer, $feed_nid = 0) { } /** - * Template generation. + * Template generation */ function feeds_importer_template(FeedsImporter $importer) { if ($importer->parser instanceof FeedsCSVParser) { @@ -418,26 +417,18 @@ function theme_feeds_source_status($v) { $items = array(); if ($v['progress_importing']) { $progress = number_format(100.0 * $v['progress_importing'], 0); - $items[] = t('Importing - @progress % complete.', array( - '@progress' => $progress, - )); + $items[] = t('Importing - @progress % complete.', array('@progress' => $progress)); } if ($v['progress_clearing']) { $progress = number_format(100.0 * $v['progress_clearing'], 0); - $items[] = t('Deleting items - @progress % complete.', array( - '@progress' => $progress, - )); + $items[] = t('Deleting items - @progress % complete.', array('@progress' => $progress)); } if (!count($items)) { if ($v['count']) { if ($v['imported']) { - $items[] = t('Last import: @ago ago.', array( - '@ago' => format_interval(REQUEST_TIME - $v['imported'], 1), - )); + $items[] = t('Last import: @ago ago.', array('@ago' => format_interval(REQUEST_TIME - $v['imported'], 1))); } - $items[] = t('@count imported items total.', array( - '@count' => $v['count'], - )); + $items[] = t('@count imported items total.', array('@count' => $v['count'])); } else { $items[] = t('No imported items.'); @@ -465,9 +456,7 @@ function theme_feeds_upload($variables) { $summary .= l($file->filename, $wrapper->getExternalUrl()); } else { - $summary .= t('URI scheme %scheme not available.', array( - '%scheme' => file_uri_scheme($uri), - )); + $summary .= t('URI scheme %scheme not available.', array('%scheme' => file_uri_scheme($uri))); } $summary .= ''; $summary .= '
'; @@ -479,8 +468,7 @@ function theme_feeds_upload($variables) { $summary .= '
'; } // Prepend the summary to the form field. - $element['#children'] = '
' . $summary . - '
' . $element['#children']; + $element['#children'] = '
' . $summary . '
' . $element['#children']; // Render file upload field using theme_form_element(). $output = theme('form_element', $element); // Close "feeds-file" and "feeds-file-upload" divs. diff --git a/feeds_import/feeds_import.test b/feeds_import/feeds_import.test index e5a1f7a..ee62de0 100644 --- a/feeds_import/feeds_import.test +++ b/feeds_import/feeds_import.test @@ -100,10 +100,9 @@ class FeedsExamplesNodeTestCase extends FeedsWebTestCase { $this->assertText('Updated 7 nodes'); // Import a tab separated file. - $this->drupalGet('import/node/delete-items'); $this->drupalPost('import/node/delete-items', array(), 'Delete'); $edit = array( - 'files[node]' => $this->absolutePath() . '/tests/feeds/nodes.tsv', + 'files[feeds]' => $this->absolutePath() . '/tests/feeds/nodes.tsv', 'feeds[FeedsCSVParser][delimiter]' => "TAB", ); $this->drupalPost('import/node', $edit, 'Import'); diff --git a/feeds_ui/feeds_ui.test b/feeds_ui/feeds_ui.test index 58ac0cd..296d2ed 100644 --- a/feeds_ui/feeds_ui.test +++ b/feeds_ui/feeds_ui.test @@ -108,10 +108,8 @@ class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase { // Create a feed node. $edit = array( 'title' => 'Development Seed', - 'feeds[test_feed][FeedsHTTPFetcher][source]' => - $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . - '/tests/feeds/developmentseed.rss2', - ); + 'feeds[test_feed][FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2', + ); $this->drupalPost('node/add/page', $edit, 'Save'); $this->assertText('Basic page Development Seed has been created.'); diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index 6dded29..172ee8f 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -33,7 +33,7 @@ interface FeedsSourceInterface { * * @see FeedsPlugin class. * - * @return bool + * @return * TRUE if a plugin handles source specific configuration, FALSE otherwise. */ public function hasSourceConfig(); @@ -124,9 +124,9 @@ class FeedsState { * - $progress is larger than $total * - $progress approximates $total so that $finished rounds to 1.0 * - * @param int $total + * @param $total * A natural number that is the total to be worked off. - * @param int $progress + * @param $progress * A natural number that is the progress made on $total. */ public function progress($total, $progress) { @@ -217,8 +217,7 @@ class FeedsSource extends FeedsConfigurable { } /** - * Returns the FeedsImporter object that this source is expected - * to be used with. + * Returns the FeedsImporter object that this source is expected to be used with. */ public function importer() { return $this->importer; @@ -227,7 +226,7 @@ class FeedsSource extends FeedsConfigurable { /** * Preview = fetch and parse a feed. * - * @return object + * @return * FeedsParserResult object. * * @throws @@ -369,7 +368,7 @@ class FeedsSource extends FeedsConfigurable { * This method only executes the current batch chunk, then returns. If you are * looking to import an entire source, use FeedsSource::startImport() instead. * - * @return float + * @return * FEEDS_BATCH_COMPLETE if the import process finished. A decimal between * 0.0 and 0.9 periodic if import is still in progress. * @@ -497,7 +496,7 @@ class FeedsSource extends FeedsConfigurable { * looking to delete all items of a source, use FeedsSource::startClear() * instead. * - * @return float + * @return * FEEDS_BATCH_COMPLETE if the clearing process finished. A decimal between * 0.0 and 0.9 periodic if clearing is still in progress. * @@ -595,10 +594,10 @@ class FeedsSource extends FeedsConfigurable { * * @todo Rename getConfigFor() accordingly to config(). * - * @param string $stage + * @param $stage * One of FEEDS_FETCH, FEEDS_PARSE, FEEDS_PROCESS or FEEDS_PROCESS_CLEAR. * - * @return object + * @return * The FeedsState object for the given stage. */ public function state($stage) { @@ -664,12 +663,7 @@ class FeedsSource extends FeedsConfigurable { * @todo Patch CTools to move constants from export.inc to ctools.module. */ public function load() { - if ($record = db_query("SELECT imported, config, state, fetcher_result FROM {feeds_source} WHERE id = :id AND feed_nid = :nid", - array( - ':id' => $this->id, - ':nid' => $this->feed_nid, - ) - )->fetchObject()) { + if ($record = db_query("SELECT imported, config, state, fetcher_result FROM {feeds_source} WHERE id = :id AND feed_nid = :nid", array(':id' => $this->id, ':nid' => $this->feed_nid))->fetchObject()) { // While FeedsSource cannot be exported, we still use CTool's export.inc // export definitions. ctools_include('export'); @@ -714,7 +708,7 @@ class FeedsSource extends FeedsConfigurable { /** * Only return source if configuration is persistent and valid. * - * @see FeedsConfigurable::existing() + * @see FeedsConfigurable::existing(). */ public function existing() { // If there is no feed nid given, there must be no content type specified. @@ -751,7 +745,7 @@ class FeedsSource extends FeedsConfigurable { * @param $config * The configuration for $client. * - * @return array + * @return * An array stored for $client. */ public function setConfigFor(FeedsSourceInterface $client, $config) { @@ -818,10 +812,10 @@ class FeedsSource extends FeedsConfigurable { * submits a source for import or clearing, we will leave her without any * visual indicators of an ongoing job. * - * @see FeedsSource::startImport() - * @see FeedsSource::startClear() + * @see FeedsSource::startImport(). + * @see FeedsSource::startClear(). * - * @param string $method + * @param $method * Method to execute on importer; one of 'import' or 'clear'. * * @throws Exception $e @@ -841,13 +835,13 @@ class FeedsSource extends FeedsConfigurable { /** * Batch API helper. Starts a Batch API job. * - * @see FeedsSource::startImport() - * @see FeedsSource::startClear() + * @see FeedsSource::startImport(). + * @see FeedsSource::startClear(). * @see feeds_batch() * - * @param string $title + * @param $title * Title to show to user when executing batch. - * @param string $method + * @param $method * Method to execute on importer; one of 'import' or 'clear'. */ protected function startBatchAPIJob($title, $method) { diff --git a/plugins/FeedsFileFetcher.inc b/plugins/FeedsFileFetcher.inc index 6ed8ac3..cf84480 100644 --- a/plugins/FeedsFileFetcher.inc +++ b/plugins/FeedsFileFetcher.inc @@ -30,11 +30,7 @@ class FeedsFileFetcherResult extends FeedsFetcherResult { */ public function getFilePath() { if (!is_readable($this->file_path)) { - throw new Exception(t('File @filepath is not accessible.', - array( - '@filepath' => $this->file_path, - ) - )); + throw new Exception(t('File @filepath is not accessible.', array('@filepath' => $this->file_path))); } return $this->sanitizeFile($this->file_path); } @@ -69,15 +65,14 @@ class FeedsFileFetcher extends FeedsFetcher { return new FeedsFileFetcherResult($file); } - throw new Exception(t('Resource is not a file or it is an empty directory: %source', - array('%source' => $source_config['source']))); + throw new Exception(t('Resource is not a file or it is an empty directory: %source', array('%source' => $source_config['source']))); } /** * Returns an array of files in a directory. * * @param string $dir - * A stream wrapper URI that is a directory. + * A stream wreapper URI that is a directory. * * @return array * An array of stream wrapper URIs pointing to files. The array is empty if @@ -114,12 +109,9 @@ class FeedsFileFetcher extends FeedsFetcher { '#type' => 'file', '#name' => 'files[' . $this->id . ']', '#title' => empty($this->config['direct']) ? t('File') : NULL, - '#description' => empty($source_config['source']) ? - t('Select a file from your local system.') : - t('Select a different file from your local system.'), + '#description' => empty($source_config['source']) ? t('Select a file from your local system.') : t('Select a different file from your local system.'), '#theme_wrappers' => array('feeds_upload'), - '#file_info' => empty($source_config['fid']) ? - NULL : file_load($source_config['fid']), + '#file_info' => empty($source_config['fid']) ? NULL : file_load($source_config['fid']), '#size' => 10, ); } @@ -127,10 +119,8 @@ class FeedsFileFetcher extends FeedsFetcher { $form['source'] = array( '#type' => 'textfield', '#title' => t('File'), - '#description' => t('Specify a path to a file or a directory. Prefix the path with a scheme. Available schemes: @schemes.', - array('@schemes' => implode(', ', $this->config['allowed_schemes']))), - '#default_value' => empty($source_config['source']) ? - '' : $source_config['source'], + '#description' => t('Specify a path to a file or a directory. Prefix the path with a scheme. Available schemes: @schemes.', array('@schemes' => implode(', ', $this->config['allowed_schemes']))), + '#default_value' => empty($source_config['source']) ? '' : $source_config['source'], ); } return $form; @@ -150,27 +140,15 @@ class FeedsFileFetcher extends FeedsFetcher { if (user_access('administer feeds')) { $plugin_key = feeds_importer($this->id)->config[$this->pluginType()]['plugin_key']; $link = url('admin/structure/feeds/' . $this->id . '/settings/' . $plugin_key); - form_set_error('feeds][FeedsFileFetcher][source', - t('Upload failed. Please check the upload settings.', - array('@link' => $link)) - ); + form_set_error('feeds][FeedsFileFetcher][source', t('Upload failed. Please check the upload settings.', array('@link' => $link))); } else { - form_set_error('feeds][FeedsFileFetcher][source', - t('Upload failed. Please contact your site administrator.') - ); + form_set_error('feeds][FeedsFileFetcher][source', t('Upload failed. Please contact your site administrator.')); } - watchdog('feeds', 'The upload directory %directory required by a feed could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', - array('%directory' => $feed_dir) - ); + watchdog('feeds', 'The upload directory %directory required by a feed could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', array('%directory' => $feed_dir)); } // Validate and save uploaded file. - elseif ($file = file_save_upload($this->id, - array( - 'file_validate_extensions' => array( - 0 => $this->config['allowed_extensions'], - ), - ), $feed_dir)) { + elseif ($file = file_save_upload($this->id, array('file_validate_extensions' => array(0 => $this->config['allowed_extensions'])), $feed_dir)) { $values['source'] = $file->uri; $values['file'] = $file; } @@ -185,12 +163,7 @@ class FeedsFileFetcher extends FeedsFetcher { // Check if chosen url scheme is allowed. $scheme = file_uri_scheme($values['source']); if (!$scheme || !in_array($scheme, $this->config['allowed_schemes'])) { - form_set_error('feeds][FeedsFileFetcher][source', - t("The file needs to reside within the site's files directory, its path needs to start with scheme://. Available schemes: @schemes.", - array( - '@schemes' => implode(', ', $this->config['allowed_schemes']), - )) - ); + form_set_error('feeds][FeedsFileFetcher][source', t("The file needs to reside within the site's files directory, its path needs to start with scheme://. Available schemes: @schemes.", array('@schemes' => implode(', ', $this->config['allowed_schemes'])))); } // Check whether the given path is readable. elseif (!is_readable($values['source'])) { @@ -284,9 +257,7 @@ class FeedsFileFetcher extends FeedsFetcher { $form['directory'] = array( '#type' => 'textfield', '#title' => t('Upload directory'), - '#description' => t('Directory where uploaded files get stored. Prefix the path with a scheme. Available schemes: @schemes.', - array('@schemes' => implode(', ', $this->getSchemes())) - ), + '#description' => t('Directory where uploaded files get stored. Prefix the path with a scheme. Available schemes: @schemes.', array('@schemes' => implode(', ', $this->getSchemes()))), '#default_value' => $this->config['directory'], '#states' => array( 'visible' => array( @@ -337,8 +308,7 @@ class FeedsFileFetcher extends FeedsFetcher { // Validate the URI scheme of the upload directory. $scheme = file_uri_scheme($values['directory']); if (!$scheme || !in_array($scheme, $this->getSchemes())) { - form_set_error('directory', - t('Please enter a valid scheme into the directory location.')); + form_set_error('directory', t('Please enter a valid scheme into the directory location.')); // Return here so that attempts to create the directory below don't // throw warnings. @@ -347,8 +317,7 @@ class FeedsFileFetcher extends FeedsFetcher { // Ensure that the upload directory exists. if (!file_prepare_directory($values['directory'], FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { - form_set_error('directory', - t('The chosen directory does not exist and attempts to create it failed.')); + form_set_error('directory', t('The chosen directory does not exist and attempts to create it failed.')); } } } diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc index d3912fe..129dfdf 100644 --- a/plugins/FeedsNodeProcessor.inc +++ b/plugins/FeedsNodeProcessor.inc @@ -96,9 +96,7 @@ class FeedsNodeProcessor extends FeedsProcessor { // could be invalid. if (!$author) { $message = 'User %uid is not a valid user.'; - throw new FeedsAccessException(t($message, - array('%uid' => $entity->uid)) - ); + throw new FeedsAccessException(t($message, array('%uid' => $entity->uid))); } if (empty($entity->nid) || !empty($entity->is_new)) { @@ -131,7 +129,7 @@ class FeedsNodeProcessor extends FeedsProcessor { parent::entityValidate($entity); if (!isset($entity->uid) || !is_numeric($entity->uid)) { - $entity->uid = $this->config['author']; + $entity->uid = $this->config['author']; } } @@ -188,7 +186,7 @@ class FeedsNodeProcessor extends FeedsProcessor { '#title' => t('Author'), '#description' => t('Select the author of the nodes to be created - leave empty to assign "anonymous".'), '#autocomplete_path' => 'user/autocomplete', - '#default_value' => empty($author->name) ? 'anonymous' : check_plain($author->name), + '#default_value' => empty($author->name) ? 'anonymous' : check_plain($author->name), ); $form['authorize'] = array( '#type' => 'checkbox', @@ -196,10 +194,7 @@ class FeedsNodeProcessor extends FeedsProcessor { '#description' => t('Check that the author has permission to create the node.'), '#default_value' => $this->config['authorize'], ); - $period = drupal_map_assoc(array( - FEEDS_EXPIRE_NEVER, 3600, 10800, 21600, 43200, 86400, 259200, 604800, - 2592000, 2592000 * 3, 2592000 * 6, 31536000, - ), 'feeds_format_expire'); + $period = drupal_map_assoc(array(FEEDS_EXPIRE_NEVER, 3600, 10800, 21600, 43200, 86400, 259200, 604800, 2592000, 2592000 * 3, 2592000 * 6, 31536000), 'feeds_format_expire'); $form['expire'] = array( '#type' => 'select', '#title' => t('Expire nodes'), @@ -382,14 +377,11 @@ class FeedsNodeProcessor extends FeedsProcessor { foreach ($this->uniqueTargets($source, $result) as $target => $value) { switch ($target) { case 'nid': - $nid = db_query("SELECT nid FROM {node} WHERE nid = :nid", - array(':nid' => $value))->fetchField(); + $nid = db_query("SELECT nid FROM {node} WHERE nid = :nid", array(':nid' => $value))->fetchField(); break; case 'title': - $nid = db_query("SELECT nid FROM {node} WHERE title = :title AND type = :type", - array(':title' => $value, ':type' => $this->bundle())) - ->fetchField(); + $nid = db_query("SELECT nid FROM {node} WHERE title = :title AND type = :type", array(':title' => $value, ':type' => $this->bundle()))->fetchField(); break; } if (isset($this->config['content_type']) && diff --git a/tests/feeds_processor_node.test b/tests/feeds_processor_node.test index 171a960..196d41d 100644 --- a/tests/feeds_processor_node.test +++ b/tests/feeds_processor_node.test @@ -24,8 +24,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { public function setUp() { parent::setUp(); - // Set the front page to show 20 nodes so we can easily see what - // is aggregated. + // Set the front page to show 20 nodes so we can easily see what is aggregated. variable_set('default_nodes_main', 20); // Set the teaser length display to unlimited otherwise tests looking for