aggregator_menu

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/aggregator/aggregator.module, строка 30

Версии
5
aggregator_menu($may_cache)
6
aggregator_menu()

Реализация hook_menu().

Код

<?php
function aggregator_menu($may_cache) {
  $items = array();
  $edit = user_access('administer news feeds');
  $view = user_access('access news feeds');

  if ($may_cache) {
    $items[] = array('path' => 'admin/content/aggregator',
      'title' => t('News aggregator'),
      'description' => t("Configure which content your site aggregates from other sites, how often it polls them, and how they're categorized."),
      'callback' => 'aggregator_admin_overview',
      'access' => $edit);
    $items[] = array('path' => 'admin/content/aggregator/add/feed',
      'title' => t('Add feed'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('aggregator_form_feed'),
      'access' => $edit,
      'type' => MENU_LOCAL_TASK);
    $items[] = array('path' => 'admin/content/aggregator/add/category',
      'title' => t('Add category'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('aggregator_form_category'),
      'access' => $edit,
      'type' => MENU_LOCAL_TASK);
    $items[] = array(
      'path' => 'admin/content/aggregator/remove',
      'title' => t('Remove items'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('aggregator_admin_remove_feed'),
      'access' => $edit,
      'type' => MENU_CALLBACK,
    );
    $items[] = array('path' => 'admin/content/aggregator/update',
      'title' => t('Update items'),
      'callback' => 'aggregator_admin_refresh_feed',
      'access' => $edit,
      'type' => MENU_CALLBACK);
    $items[] = array('path' => 'admin/content/aggregator/list',
      'title' => t('List'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10);
    $items[] = array('path' => 'admin/content/aggregator/settings',
      'title' => t('Settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('aggregator_admin_settings'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
      'access' => $edit);

    $items[] = array('path' => 'aggregator',
      'title' => t('News aggregator'),
      'callback' => 'aggregator_page_last',
      'access' => $view,
      'weight' => 5);
    $items[] = array('path' => 'aggregator/sources',
      'title' => t('Sources'),
      'callback' => 'aggregator_page_sources',
      'access' => $view);
    $items[] = array('path' => 'aggregator/categories',
      'title' => t('Categories'),
      'callback' => 'aggregator_page_categories',
      'access' => $view,
      'type' => MENU_ITEM_GROUPING);
    $items[] = array('path' => 'aggregator/rss',
      'title' => t('RSS feed'),
      'callback' => 'aggregator_page_rss',
      'access' => $view,
      'type' => MENU_CALLBACK);
    $items[] = array('path' => 'aggregator/opml',
      'title' => t('OPML feed'),
      'callback' => 'aggregator_page_opml',
      'access' => $view,
      'type' => MENU_CALLBACK);

    $result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
    while ($category = db_fetch_array($result)) {
      $items[] = array('path' => 'aggregator/categories/'. $category['cid'],
        'title' => $category['title'],
        'callback' => 'aggregator_page_category',
        'access' => $view);
    }
  }
  else {
    // Add the CSS for this module
    // We put this in !$may_cache so it's only added once per request
    drupal_add_css(drupal_get_path('module', 'aggregator') .'/aggregator.css');

    if (arg(0) == 'aggregator' && is_numeric(arg(2))) {
      if (arg(1) == 'sources') {
        $feed = aggregator_get_feed(arg(2));
        if ($feed) {
          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'],
            'title' => $feed['title'],
            'callback' => 'aggregator_page_source',
            'access' => $view,
            'type' => MENU_CALLBACK);
          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'] .'/view',
            'title' => t('View'),
            'type' => MENU_DEFAULT_LOCAL_TASK,
            'weight' => -10);
          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'] .'/categorize',
            'title' => t('Categorize'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array('aggregator_page_source'),
            'access' => $edit,
            'type' => MENU_LOCAL_TASK);
          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'] .'/configure',
            'title' => t('Configure'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array('aggregator_form_feed', $feed),
            'access' => $edit,
            'type' => MENU_LOCAL_TASK,
            'weight' => 1);
        }
      }
      else if (arg(1) == 'categories') {
        $category = aggregator_get_category(arg(2));
        if ($category) {
          $items[] = array('path' => 'aggregator/categories/'. $category['cid'] .'/view',
            'title' => t('View'),
            'type' => MENU_DEFAULT_LOCAL_TASK,
            'weight' => -10);
          $items[] = array('path' => 'aggregator/categories/'. $category['cid'] .'/categorize',
            'title' => t('Categorize'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array('aggregator_page_category'),
            'access' => $edit,
            'type' => MENU_LOCAL_TASK);
          $items[] = array('path' => 'aggregator/categories/'. $category['cid'] .'/configure',
            'title' => t('Configure'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array('aggregator_form_category', $category),
            'access' => $edit,
            'type' => MENU_LOCAL_TASK,
            'weight' => 1);
        }
      }
    }
    else if (arg(2) == 'aggregator' && is_numeric(arg(5))) {
      if (arg(4) == 'feed') {
        $feed = aggregator_get_feed(arg(5));
        if ($feed) {
          $items[] = array('path' => 'admin/content/aggregator/edit/feed/'. $feed['fid'],
            'title' => t('Edit feed'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array('aggregator_form_feed', $feed),
            'access' => $edit,
            'type' => MENU_CALLBACK);
        }
      }
      else {
        $category = aggregator_get_category(arg(5));
        if ($category) {
          $items[] = array('path' => 'admin/content/aggregator/edit/category/'. $category['cid'],
            'title' => t('Edit category'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array('aggregator_form_category', $category),
            'access' => $edit,
            'type' => MENU_CALLBACK);
        }
      }
    }
  }

  return $items;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему