Projet

Général

Profil

Révision 00c2605a

Ajouté par Assos Assos il y a environ 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/advanced_help/advanced_help.module
205 205

  
206 206
  $output = array();
207 207
  // Print a search widget.
208
  $output['advanced_help_search'] = module_exists('search') ? drupal_get_form('advanced_help_search_form') : t('Enable the search module to search help.');
208
  $output['advanced_help_search'] = module_exists('search') ? drupal_get_form('advanced_help_search_form') : array('#markup' => t('Enable the search module to search help.'));
209 209

  
210 210
  $breadcrumb = array();
211 211
  if ($module) {
......
230 230
    $result = db_query('SELECT * FROM {system}');
231 231
    foreach ($result as $info) {
232 232
      $module_info = unserialize($info->info);
233
      $modules[$info->name] = $module_info['name'];
233
      $modules[$info->name] = isset($module_info['name']) ? $module_info['name'] : $info->name;
234 234
    }
235 235

  
236 236
    asort($modules);
......
563 563
      'html' => TRUE)
564 564
    );
565 565
  }
566
  else {
566
  elseif (user_access('view advanced help topic')) {
567 567
    return l($text, "help/$module/$topic", array(
568 568
      'attributes' => array(
569 569
        'class' => $class,
......
632 632

  
633 633
    $output = file_get_contents($file);
634 634
    if (isset($info['readme file']) && $info['readme file']) {
635
      // Readme files are treated as plain text: filter accordingly.
636
      $output = check_plain($output);
635
      $ext = pathinfo($file, PATHINFO_EXTENSION);
636
      if ('md' == $ext && module_exists('markdown')) {
637
        $filters = module_invoke('markdown', 'filter_info');
638
        $md_info = $filters['filter_markdown'];
639
	
640
        if (function_exists($md_info['process callback'])) {
641
          $function = $md_info['process callback'];
642
          $output = '<div class="advanced-help-topic">' . filter_xss_admin($function($output, NULL)) . '</div>';
643
        }
644
        else {
645
          $output = '<div class="advanced-help-topic"><pre class="readme">' . check_plain($output) . '</pre></div>';
646
        }
647
      }
648
      else {
649
        $output = '<div class="advanced-help-topic"><pre class="readme">' . check_plain($output) . '</pre></div>';
650
      }
651
      return $output;
637 652
    }
638 653

  
639 654
    // Make some exchanges. The strtr is because url() translates $ into %24
......
714 729
        $navigation = '<div class="help-navigation clear-block">';
715 730

  
716 731
        if ($prev) {
717
          $navigation .= advanced_help_l('<< ' . $topics[$prev[0]][$prev[1]]['title'], "help/$prev[0]/$prev[1]", array('attributes' => array('class' => 'help-left')));
732
          $navigation .= advanced_help_l('«« ' . $topics[$prev[0]][$prev[1]]['title'], "help/$prev[0]/$prev[1]", array('attributes' => array('class' => 'help-left')));
718 733
        }
719 734
        if ($up) {
720 735
          $navigation .= advanced_help_l(t('Up'), $up, array('attributes' => array('class' => $prev ? 'help-up' : 'help-up-noleft')));
721 736
        }
722 737
        if ($next) {
723
          $navigation .= advanced_help_l($topics[$next[0]][$next[1]]['title'] . ' >>', "help/$next[0]/$next[1]", array('attributes' => array('class' => 'help-right')));
738
          $navigation .= advanced_help_l($topics[$next[0]][$next[1]]['title'] . ' »»', "help/$next[0]/$next[1]", array('attributes' => array('class' => 'help-right')));
724 739
        }
725 740

  
726 741
        $navigation .= '</div>';
......
735 750

  
736 751
    $output = '<div class="advanced-help-topic">' . $output . '</div>';
737 752
    drupal_alter('advanced_help_topic', $output, $popup);
753
    
738 754
    return $output;
739 755
  }
740 756
}
......
783 799
    $ini = array('topics' => array(), 'settings' => array());
784 800

  
785 801
    $help_path = drupal_get_path('module', 'advanced_help') . '/modules';
786
    foreach (module_list() as $module) {
787
      $module_path = drupal_get_path('module', $module);
802
    foreach (array_merge(module_list(), list_themes()) as $plugin) {
803
      $module = is_string($plugin) ? $plugin : $plugin->name;
804
      $module_path = drupal_get_path(is_string($plugin) ? 'module' : 'theme', $module);
788 805
      $info = array();
789 806
      if (file_exists("$module_path/help/$module.help.ini")) {
790 807
        $path = "$module_path/help";
......
797 814
      elseif (!file_exists("$module_path/help")) {
798 815
        // Look for one or more README files.
799 816
        $files = file_scan_directory("./$module_path",
800
          '/^(README|readme).*\.(txt|TXT)$/', array('recurse' => FALSE));
817
          '/^(readme).*\.(txt|md)$/i', array('recurse' => FALSE));
801 818
        $path = "./$module_path";
802 819
        foreach ($files as $name => $fileinfo) {
803 820
          $info[$fileinfo->filename] = array(
......
1075 1092
  $css = drupal_add_css();
1076 1093

  
1077 1094
  // Remove theme css.
1078
  foreach ($css as $media => $types) {
1079
    if (isset($css[$media]['theme'])) {
1080
      $css[$media]['theme'] = array();
1095
  foreach ($css as $key => $value) {
1096
    if ($value['group'] == CSS_THEME) {
1097
      $exclude[$key] = FALSE;
1081 1098
    }
1082 1099
  }
1100
  $css = array_diff_key($css, $exclude);
1083 1101

  
1084 1102
  $variables['styles']            = drupal_get_css($css);
1085 1103
  $variables['scripts']           = drupal_get_js();

Formats disponibles : Unified diff