Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

help.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 3.84 KiB


001  <?php
002  /**
003   *
004   * This file is part of the phpBB Forum Software package.
005   *
006   * @copyright (c) phpBB Limited <https://www.phpbb.com>
007   * @license GNU General Public License, version 2 (GPL-2.0)
008   *
009   * For full copyright and license information, please see
010   * the docs/CREDITS.txt file.
011   *
012   */
013   
014  namespace phpbb\help\controller;
015   
016  use phpbb\exception\http_exception;
017   
018  class help
019  {
020      /** @var \phpbb\controller\helper */
021      protected $helper;
022   
023      /** @var \phpbb\event\dispatcher_interface  */
024      protected $dispatcher;
025   
026      /** @var \phpbb\template\template */
027      protected $template;
028   
029      /** @var \phpbb\user */
030      protected $user;
031   
032      /** @var string */
033      protected $root_path;
034   
035      /** @var string */
036      protected $php_ext;
037   
038      /**
039       * Constructor
040       *
041       * @param \phpbb\controller\helper    $helper
042       * @param \phpbb\event\dispatcher_interface    $dispatcher
043       * @param \phpbb\template\template    $template
044       * @param \phpbb\user                $user
045       * @param string                    $root_path
046       * @param string                    $php_ext
047       */
048      public function __construct(\phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\template\template $template, \phpbb\user $user, $root_path, $php_ext)
049      {
050          $this->helper = $helper;
051          $this->dispatcher = $dispatcher;
052          $this->template = $template;
053          $this->user = $user;
054          $this->root_path = $root_path;
055          $this->php_ext = $php_ext;
056      }
057   
058      /**
059       * Controller for /help/{mode} routes
060       *
061       * @param string        $mode
062       * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
063       * @throws http_exception when the $mode is not known by any extension
064       */
065      public function handle($mode)
066      {
067          switch ($mode)
068          {
069              case 'faq':
070              case 'bbcode':
071                  $page_title = ($mode === 'faq') ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE'];
072                  $this->user->add_lang($mode, false, true);
073              break;
074   
075              default:
076                  $page_title = $this->user->lang['FAQ_EXPLAIN'];
077                  $ext_name = $lang_file = '';
078   
079                  /**
080                   * You can use this event display a custom help page
081                   *
082                   * @event core.faq_mode_validation
083                   * @var    string    page_title        Title of the page
084                   * @var    string    mode            FAQ that is going to be displayed
085                   * @var    string    lang_file        Language file containing the help data
086                   * @var    string    ext_name        Vendor and extension name where the help
087                   *                                language file can be loaded from
088                   * @since 3.1.4-RC1
089                   */
090                  $vars = array(
091                      'page_title',
092                      'mode',
093                      'lang_file',
094                      'ext_name',
095                  );
096                  extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
097   
098                  if ($ext_name === '' || $lang_file === '')
099                  {
100                      throw new http_exception(404, 'Not Found');
101                  }
102   
103                  $this->user->add_lang($lang_file, false, true, $ext_name);
104              break;
105   
106          }
107   
108          $this->template->assign_vars(array(
109              'L_FAQ_TITLE'                => $page_title,
110              'S_IN_FAQ'                    => true,
111          ));
112   
113          $this->assign_to_template($this->user->help);
114   
115          make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
116          return $this->helper->render('faq_body.html', $page_title);
117      }
118   
119      /**
120       * Assigns the help data to the template blocks
121       *
122       * @param array $help_data
123       * @return null
124       */
125      protected function assign_to_template(array $help_data)
126      {
127          // Pull the array data from the lang pack
128          $switch_column = $found_switch = false;
129          foreach ($help_data as $help_ary)
130          {
131              if ($help_ary[0] == '--')
132              {
133                  if ($help_ary[1] == '--')
134                  {
135                      $switch_column = true;
136                      $found_switch = true;
137                      continue;
138                  }
139   
140                  $this->template->assign_block_vars('faq_block', array(
141                      'BLOCK_TITLE'        => $help_ary[1],
142                      'SWITCH_COLUMN'        => $switch_column,
143                  ));
144   
145                  if ($switch_column)
146                  {
147                      $switch_column = false;
148                  }
149                  continue;
150              }
151   
152              $this->template->assign_block_vars('faq_block.faq_row', array(
153                  'FAQ_QUESTION'        => $help_ary[0],
154                  'FAQ_ANSWER'        => $help_ary[1],
155              ));
156          }
157   
158          $this->template->assign_var('SWITCH_COLUMN_MANUALLY', !$found_switch);
159      }
160  }
161