Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

type_base.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 4.21 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\profilefields\type;
 015   
 016  abstract class type_base implements type_interface
 017  {
 018      /**
 019      * Request object
 020      * @var \phpbb\request\request
 021      */
 022      protected $request;
 023   
 024      /**
 025      * Template object
 026      * @var \phpbb\template\template
 027      */
 028      protected $template;
 029   
 030      /**
 031      * User object
 032      * @var \phpbb\user
 033      */
 034      protected $user;
 035   
 036      /**
 037      * Construct
 038      *
 039      * @param    \phpbb\request\request        $request    Request object
 040      * @param    \phpbb\template\template    $template    Template object
 041      * @param    \phpbb\user                    $user        User object
 042      */
 043      public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
 044      {
 045          $this->request = $request;
 046          $this->template = $template;
 047          $this->user = $user;
 048      }
 049   
 050      /**
 051      * {@inheritDoc}
 052      */
 053      public function get_name()
 054      {
 055          return $this->user->lang('FIELD_' . strtoupper($this->get_name_short()));
 056      }
 057   
 058      /**
 059      * {@inheritDoc}
 060      */
 061      public function get_service_name()
 062      {
 063          return 'profilefields.type.' . $this->get_name_short();
 064      }
 065   
 066      /**
 067      * {@inheritDoc}
 068      */
 069      public function get_template_filename()
 070      {
 071          return 'profilefields/' . $this->get_name_short() . '.html';
 072      }
 073   
 074      /**
 075      * {@inheritDoc}
 076      */
 077      public function get_field_ident($field_data)
 078      {
 079          return 'pf_' . $field_data['field_ident'];
 080      }
 081   
 082      /**
 083      * {@inheritDoc}
 084      */
 085      public function get_field_name($field_name)
 086      {
 087          return isset($this->user->lang[$field_name]) ? $this->user->lang[$field_name] : $field_name;
 088      }
 089   
 090      /**
 091      * {@inheritDoc}
 092      */
 093      public function get_profile_contact_value($field_value, $field_data)
 094      {
 095          return $this->get_profile_value($field_value, $field_data);
 096      }
 097   
 098      /**
 099      * {@inheritDoc}
 100      */
 101      public function get_language_options_input($field_data)
 102      {
 103          $field_data['l_lang_name']            = $this->request->variable('l_lang_name', array(0 => ''), true);
 104          $field_data['l_lang_explain']            = $this->request->variable('l_lang_explain', array(0 => ''), true);
 105          $field_data['l_lang_default_value']    = $this->request->variable('l_lang_default_value', array(0 => ''), true);
 106          $field_data['l_lang_options']            = $this->request->variable('l_lang_options', array(0 => ''), true);
 107   
 108          return $field_data;
 109      }
 110   
 111      /**
 112      * {@inheritDoc}
 113      */
 114      public function prepare_options_form(&$exclude_options, &$visibility_options)
 115      {
 116          return $this->request->variable('lang_options', '', true);
 117      }
 118   
 119      /**
 120      * {@inheritDoc}
 121      */
 122      public function validate_options_on_submit($error, $field_data)
 123      {
 124          return $error;
 125      }
 126   
 127      /**
 128      * {@inheritDoc}
 129      */
 130      public function get_excluded_options($key, $action, $current_value, &$field_data, $step)
 131      {
 132          if ($step == 3 && ($field_data[$key] || $action != 'edit') && $key == 'l_lang_options' && is_array($field_data[$key]))
 133          {
 134              foreach ($field_data[$key] as $lang_id => $options)
 135              {
 136                  $field_data[$key][$lang_id] = is_array($options) ? $options : explode("\n", $options);
 137              }
 138   
 139              return $current_value;
 140          }
 141   
 142          return $current_value;
 143      }
 144   
 145      /**
 146      * {@inheritDoc}
 147      */
 148      public function prepare_hidden_fields($step, $key, $action, &$field_data)
 149      {
 150          if (!$this->request->is_set($key))
 151          {
 152              // Do not set this variable, we will use the default value
 153              return null;
 154          }
 155          else if ($key == 'field_ident' && isset($field_data[$key]))
 156          {
 157              return $field_data[$key];
 158          }
 159          else
 160          {
 161              return $this->request->variable($key, '', true);
 162          }
 163      }
 164   
 165      /**
 166      * {@inheritDoc}
 167      */
 168      public function display_options(&$template_vars, &$field_data)
 169      {
 170          return;
 171      }
 172   
 173      /**
 174      * Return templated value/field. Possible values for $mode are:
 175      * change == user is able to set/enter profile values; preview == just show the value
 176      */
 177      public function process_field_row($mode, $profile_row)
 178      {
 179          $preview_options = ($mode == 'preview') ? $profile_row['lang_options'] : false;
 180   
 181          // set template filename
 182          $this->template->set_filenames(array(
 183              'cp_body'        => $this->get_template_filename(),
 184          ));
 185   
 186          // empty previously filled blockvars
 187          $this->template->destroy_block_vars($this->get_name_short());
 188   
 189          // Assign template variables
 190          $this->generate_field($profile_row, $preview_options);
 191   
 192          return $this->template->assign_display('cp_body');
 193      }
 194  }
 195