You are here

function views_get_all_urls in Views (for Drupal 7) 5

Load all of the URLs we use; this is cached in a special manner in an attempt to make the menu system both flexible and yet not overly intensive.

1 call to views_get_all_urls()
views_menu_inline_items in ./views.module

File

./views.module, line 180

Code

function views_get_all_urls() {
  $cache = cache_get("views_urls", 'cache_views');
  if ($cache == 0) {
    $views = array();
    $used = array();

    // avoid creating empty path items by requiring an URL to be set
    $result = db_query("SELECT name, url FROM {view_view} WHERE page = 1 AND LENGTH(url) > 0");
    while ($view = db_fetch_object($result)) {
      $used[$view->name] = TRUE;
      $views[$view->name] = $view->url;
    }
    views_load_cache();
    $default_views = _views_get_default_views();
    $views_status = variable_get('views_defaults', array());
    foreach ($default_views as $name => $view) {
      if ($view->page && !$used[$name] && ($views_status[$name] == 'enabled' || !$view->disabled && $views_status[$name] != 'disabled')) {
        $views[$view->name] = $view->url;
      }
    }
    cache_set("views_urls", 'cache_views', serialize($views));
  }
  else {
    $views = unserialize($cache->data);
  }
  return $views;
}