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

iohandler_base.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 4.12 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\install\helper\iohandler;
 015   
 016  /**
 017   * Base class for installer input-output handlers
 018   */
 019  abstract class iohandler_base implements iohandler_interface
 020  {
 021      /**
 022       * Array of errors
 023       *
 024       * Errors should be added, when the installation cannot continue without
 025       * user interaction. If the aim is to notify the user about something, please
 026       * use a warning instead.
 027       *
 028       * @var array
 029       */
 030      protected $errors;
 031   
 032      /**
 033       * Array of warnings
 034       *
 035       * @var array
 036       */
 037      protected $warnings;
 038   
 039      /**
 040       * Array of logs
 041       *
 042       * @var array
 043       */
 044      protected $logs;
 045   
 046      /**
 047       * Array of success messages
 048       *
 049       * @var array
 050       */
 051      protected $success;
 052   
 053      /**
 054       * @var \phpbb\language\language
 055       */
 056      protected $language;
 057   
 058      /**
 059       * @var int
 060       */
 061      protected $task_progress_count;
 062   
 063      /**
 064       * @var int
 065       */
 066      protected $current_task_progress;
 067   
 068      /**
 069       * @var string
 070       */
 071      protected $current_task_name;
 072   
 073      /**
 074       * @var bool
 075       */
 076      protected $restart_progress_bar;
 077   
 078      /**
 079       * Constructor
 080       */
 081      public function __construct()
 082      {
 083          $this->errors    = array();
 084          $this->warnings    = array();
 085          $this->logs        = array();
 086          $this->success    = array();
 087   
 088          $this->restart_progress_bar        = false;
 089          $this->task_progress_count        = 0;
 090          $this->current_task_progress    = 0;
 091          $this->current_task_name        = '';
 092      }
 093   
 094      /**
 095       * Set language service
 096       *
 097       * @param \phpbb\language\language $language
 098       */
 099      public function set_language(\phpbb\language\language $language)
 100      {
 101          $this->language = $language;
 102      }
 103   
 104      /**
 105       * {@inheritdoc}
 106       */
 107      public function add_error_message($error_title, $error_description = false)
 108      {
 109          if (!is_array($error_title) && strpos($error_title, '<br />') !== false)
 110          {
 111              $error_title = strip_tags(htmlspecialchars_decode($error_title));
 112          }
 113          $this->errors[] = $this->translate_message($error_title, $error_description);
 114      }
 115   
 116      /**
 117       * {@inheritdoc}
 118       */
 119      public function add_warning_message($warning_title, $warning_description = false)
 120      {
 121          $this->warnings[] = $this->translate_message($warning_title, $warning_description);
 122      }
 123   
 124      /**
 125       * {@inheritdoc}
 126       */
 127      public function add_log_message($log_title, $log_description = false)
 128      {
 129          $this->logs[] = $this->translate_message($log_title, $log_description);
 130      }
 131   
 132      /**
 133       * {@inheritdoc}
 134       */
 135      public function add_success_message($success_title, $success_description = false)
 136      {
 137          $this->success[] = $this->translate_message($success_title, $success_description);
 138      }
 139   
 140      /**
 141       * {@inheritdoc}
 142       */
 143      public function set_task_count($task_count, $restart = false)
 144      {
 145          $this->task_progress_count = $task_count;
 146          $this->restart_progress_bar = $restart;
 147      }
 148   
 149      /**
 150       * {@inheritdoc}
 151       */
 152      public function set_progress($task_lang_key, $task_number)
 153      {
 154          $this->current_task_name = '';
 155   
 156          if (!empty($task_lang_key))
 157          {
 158              $this->current_task_name = $this->language->lang($task_lang_key);
 159          }
 160   
 161          $this->current_task_progress = $task_number;
 162      }
 163   
 164      /**
 165       * {@inheritdoc}
 166       */
 167      public function finish_progress($message_lang_key)
 168      {
 169          if (!empty($message_lang_key))
 170          {
 171              $this->current_task_name = $this->language->lang($message_lang_key);
 172          }
 173   
 174          $this->current_task_progress = $this->task_progress_count;
 175      }
 176   
 177      /**
 178       * {@inheritdoc}
 179       */
 180      public function generate_form_render_data($title, $form)
 181      {
 182          return '';
 183      }
 184   
 185      /**
 186       * Localize message.
 187       *
 188       * Note: When an array is passed into the parameters below, it will be
 189       * resolved as printf($param[0], $param[1], ...).
 190       *
 191       * @param array|string        $title            Title of the message
 192       * @param array|string|bool    $description    Description of the message
 193       *
 194       * @return array    Localized message in an array
 195       */
 196      protected function translate_message($title, $description)
 197      {
 198          $message_array = array();
 199   
 200          $message_array['title'] = call_user_func_array(array($this->language, 'lang'), (array) $title);
 201   
 202          if ($description !== false)
 203          {
 204              $message_array['description'] = call_user_func_array(array($this->language, 'lang'), (array) $description);
 205          }
 206   
 207          return $message_array;
 208      }
 209  }
 210