list_themes

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

includes/theme.inc, строка 435

Версии
5 – 6
list_themes($refresh = FALSE)

Возвращает список доступных для использования на данный момент тем.

Если база данных активна, тогда функция получает этот список из неё. Иначе генерируется новый список.

Параметры

$refresh Нужно ли загрузить список тем из базы данных.

Возвращаемое значение

Массив доступных для использования на данный момент тем.

▾ 12 функции вызывают list_themes()

block_add_block_form_submit in modules/block/block.admin.inc
Сохраняет новый блок, созданный пользователем.
block_menu in modules/block/block.module
Реализация hook_menu().
color_form_alter in modules/color/color.module
Реализация hook_form_alter().
drupal_find_theme_templates in includes/theme.inc
Find overridden theme templates. Called by themes and/or theme engines to easily discover templates.
init_theme in includes/theme.inc
Инициализирует систему темизации и загружает тему.
system_menu in modules/system/system.module
Реализация hook_menu().
system_themes_form_submit in modules/system/system.admin.inc
Process system_themes_form form submissions.
system_theme_select_form in modules/system/system.module
Returns a fieldset containing the theme select form.
system_update_6042 in modules/system/system.install
Upgrade recolored theme stylesheets to new array structure.
theme_get_setting in includes/theme.inc
Получает значение указанной настройки темы.
_color_rewrite_stylesheet in modules/color/color.module
Rewrite the stylesheet to match the colors in the palette.
_drupal_maintenance_theme in includes/theme.maintenance.inc
Sets up the theming system for site installs, updates and when the site is in off-line mode. It also applies when the database is unavailable.

Код

<?php
function list_themes($refresh = FALSE) {
  static $list = array();

  if ($refresh) {
    $list = array();
  }

  if (empty($list)) {
    $list = array();
    $themes = array();
    // Extract from the database only when it is available.
    // Also check that the site is not in the middle of an install or update.
    if (db_is_active() && !defined('MAINTENANCE_MODE')) {
      $result = db_query("SELECT * FROM {system} WHERE type = '%s'", 'theme');
      while ($theme = db_fetch_object($result)) {
        if (file_exists($theme->filename)) {
          $theme->info = unserialize($theme->info);
          $themes[] = $theme;
        }
      }
    }
    else {
      // Scan the installation when the database should not be read.
      $themes = _system_theme_data();
    }

    foreach ($themes as $theme) {
      foreach ($theme->info['stylesheets'] as $media => $stylesheets) {
        foreach ($stylesheets as $stylesheet => $path) {
          $theme->stylesheets[$media][$stylesheet] = $path;
        }
      }
      foreach ($theme->info['scripts'] as $script => $path) {
        if (file_exists($path)) {
          $theme->scripts[$script] = $path;
        }
      }
      if (isset($theme->info['engine'])) {
        $theme->engine = $theme->info['engine'];
      }
      if (isset($theme->info['base theme'])) {
        $theme->base_theme = $theme->info['base theme'];
      }
      // Status is normally retrieved from the database. Add zero values when
      // read from the installation directory to prevent notices.
      if (!isset($theme->status)) {
        $theme->status = 0;
      }
      $list[$theme->name] = $theme;
    }
  }

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

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