diff options
Diffstat (limited to 'modules/aggregator/aggregator.module')
-rw-r--r-- | modules/aggregator/aggregator.module | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index a95c64bed..89664ceec 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -91,6 +91,7 @@ function aggregator_menu() { 'description' => "Configure which content your site aggregates from other sites, how often it polls them, and how they're categorized.", 'page callback' => 'aggregator_admin_overview', 'access arguments' => array('administer news feeds'), + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/add/feed'] = array( 'title' => 'Add feed', @@ -99,6 +100,7 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_ACTION, 'parent' => 'admin/settings/aggregator', + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/add/category'] = array( 'title' => 'Add category', @@ -107,6 +109,7 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_ACTION, 'parent' => 'admin/settings/aggregator', + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/add/opml'] = array( 'title' => 'Import OPML', @@ -115,6 +118,7 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_ACTION, 'parent' => 'admin/settings/aggregator', + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/remove/%aggregator_feed'] = array( 'title' => 'Remove items', @@ -122,6 +126,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_admin_remove_feed', 4), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/update/%aggregator_feed'] = array( 'title' => 'Update items', @@ -129,6 +134,7 @@ function aggregator_menu() { 'page arguments' => array(4), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/list'] = array( 'title' => 'List', @@ -141,34 +147,40 @@ function aggregator_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('aggregator_admin_form'), 'access arguments' => array('administer news feeds'), + 'file' => 'aggregator.admin.inc', ); $items['aggregator'] = array( 'title' => 'Feed aggregator', 'page callback' => 'aggregator_page_last', 'access arguments' => array('access news feeds'), 'weight' => 5, + 'file' => 'aggregator.pages.inc', ); $items['aggregator/sources'] = array( 'title' => 'Sources', 'page callback' => 'aggregator_page_sources', 'access arguments' => array('access news feeds'), + 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories'] = array( 'title' => 'Categories', 'page callback' => 'aggregator_page_categories', 'access callback' => '_aggregator_has_categories', + 'file' => 'aggregator.pages.inc', ); $items['aggregator/rss'] = array( 'title' => 'RSS feed', 'page callback' => 'aggregator_page_rss', 'access arguments' => array('access news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.pages.inc', ); $items['aggregator/opml'] = array( 'title' => 'OPML feed', 'page callback' => 'aggregator_page_opml', 'access arguments' => array('access news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories/%aggregator_category'] = array( 'title callback' => '_aggregator_category_title', @@ -177,6 +189,7 @@ function aggregator_menu() { 'page arguments' => array(2), 'access callback' => 'user_access', 'access arguments' => array('access news feeds'), + 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories/%aggregator_category/view'] = array( 'title' => 'View', @@ -189,6 +202,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_page_category', 2), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, + 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories/%aggregator_category/configure'] = array( 'title' => 'Configure', @@ -197,12 +211,14 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, + 'file' => 'aggregator.admin.inc', ); $items['aggregator/sources/%aggregator_feed'] = array( 'page callback' => 'aggregator_page_source', 'page arguments' => array(2), 'access arguments' => array('access news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.pages.inc', ); $items['aggregator/sources/%aggregator_feed/view'] = array( 'title' => 'View', @@ -215,6 +231,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_page_source', 2), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, + 'file' => 'aggregator.pages.inc', ); $items['aggregator/sources/%aggregator_feed/configure'] = array( 'title' => 'Configure', @@ -223,6 +240,7 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/edit/feed/%aggregator_feed'] = array( 'title' => 'Edit feed', @@ -230,6 +248,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_feed', 5), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.admin.inc', ); $items['admin/settings/aggregator/edit/category/%aggregator_category'] = array( 'title' => 'Edit category', @@ -237,6 +256,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_category', 5), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, + 'file' => 'aggregator.admin.inc', ); return $items; @@ -514,6 +534,7 @@ function aggregator_save_feed($edit) { * An object describing the feed to be cleared. */ function aggregator_remove($feed) { + _aggregator_get_variables(); // Call hook_aggregator_remove() on all modules. module_invoke_all('aggregator_remove', $feed); // Reset feed. @@ -530,6 +551,23 @@ function aggregator_remove($feed) { ->execute(); } +function _aggregator_get_variables() { + // Fetch the feed. + $fetcher = variable_get('aggregator_fetcher', 'aggregator'); + if ($fetcher == 'aggregator') { + include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'aggregator') . '/aggregator.fetcher.inc'; + } + $parser = variable_get('aggregator_parser', 'aggregator'); + if ($parser == 'aggregator') { + include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'aggregator') . '/aggregator.parser.inc'; + } + $processors = variable_get('aggregator_processors', array('aggregator')); + if (in_array('aggregator', $processors)) { + include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'aggregator') . '/aggregator.processor.inc'; + } + return array($fetcher, $parser, $processors); +} + /** * Checks a news feed for new items. * @@ -537,25 +575,22 @@ function aggregator_remove($feed) { * An object describing the feed to be refreshed. */ function aggregator_refresh($feed) { - // Fetch the feed. - $fetcher = variable_get('aggregator_fetcher', 'aggregator'); + list($fetcher, $parser, $processors) = _aggregator_get_variables(); module_invoke($fetcher, 'aggregator_fetch', $feed); if ($feed->source_string !== FALSE) { // Parse the feed. - $parser = variable_get('aggregator_parser', 'aggregator'); module_invoke($parser, 'aggregator_parse', $feed); // If there are items on the feed, let all enabled processors do their work on it. if (@count($feed->items)) { - $processors = variable_get('aggregator_processors', array('aggregator')); foreach ($processors as $processor) { module_invoke($processor, 'aggregator_process', $feed); } } } // Expire old feed items. - if (drupal_function_exists('aggregator_expire')) { + if (function_exists('aggregator_expire')) { aggregator_expire($feed); } } @@ -635,15 +670,13 @@ function aggregator_filter_xss($value) { */ function aggregator_sanitize_configuration() { $reset = FALSE; - $fetcher = variable_get('aggregator_fetcher', 'aggregator'); + list($fetcher, $parser, $processors) = _aggregator_get_variables(); if (!module_exists($fetcher)) { $reset = TRUE; } - $parser = variable_get('aggregator_parser', 'aggregator'); if (!module_exists($parser)) { $reset = TRUE; } - $processors = variable_get('aggregator_processors', array('aggregator')); foreach ($processors as $processor) { if (!module_exists($processor)) { $reset = TRUE; |