Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

quote_helper.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 2.08 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * For full copyright and license information, please see
10  * the docs/CREDITS.txt file.
11  *
12  */
13   
14  namespace phpbb\textformatter\s9e;
15   
16  class quote_helper
17  {
18      /**
19      * @var string Base URL for a post link, uses {POST_ID} as placeholder
20      */
21      protected $post_url;
22   
23      /**
24      * @var string Base URL for a private message link, uses {MSG_ID} as placeholder
25      */
26      protected $msg_url;
27   
28      /**
29      * @var string Base URL for a profile link, uses {USER_ID} as placeholder
30      */
31      protected $profile_url;
32   
33      /**
34      * @var \phpbb\user
35      */
36      protected $user;
37   
38      /**
39      * Constructor
40      *
41      * @param \phpbb\user $user
42      * @param string $root_path
43      * @param string $php_ext
44      */
45      public function __construct(\phpbb\user $user, $root_path, $php_ext)
46      {
47          $this->post_url = append_sid($root_path . 'viewtopic.' . $php_ext, 'p={POST_ID}#p{POST_ID}', false);
48          $this->msg_url = append_sid($root_path . 'ucp.' . $php_ext, 'i=pm&mode=view&p={MSG_ID}', false);
49          $this->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}', false);
50          $this->user = $user;
51      }
52   
53      /**
54      * Inject dynamic metadata into QUOTE tags in given XML
55      *
56      * @param  string $xml Original XML
57      * @return string      Modified XML
58      */
59      public function inject_metadata($xml)
60      {
61          return \s9e\TextFormatter\Utils::replaceAttributes(
62              $xml,
63              'QUOTE',
64              function ($attributes)
65              {
66                  if (isset($attributes['post_id']))
67                  {
68                      $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $this->post_url);
69                  }
70                  if (isset($attributes['msg_id']))
71                  {
72                      $attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $this->msg_url);
73                  }
74                  if (isset($attributes['time']))
75                  {
76                      $attributes['date'] = $this->user->format_date($attributes['time']);
77                  }
78                  if (isset($attributes['user_id']))
79                  {
80                      $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $this->profile_url);
81                  }
82   
83                  return $attributes;
84              }
85          );
86      }
87  }
88