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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
quote_helper.php
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 profile link, uses {USER_ID} as placeholder
25 */
26 protected $profile_url;
27
28 /**
29 * @var \phpbb\user
30 */
31 protected $user;
32
33 /**
34 * Constructor
35 *
36 * @param \phpbb\user $user
37 * @param string $root_path
38 * @param string $php_ext
39 */
40 public function __construct(\phpbb\user $user, $root_path, $php_ext)
41 {
42 $this->post_url = append_sid($root_path . 'viewtopic.' . $php_ext, 'p={POST_ID}#p{POST_ID}');
43 $this->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}');
44 $this->user = $user;
45 }
46
47 /**
48 * Inject dynamic metadata into QUOTE tags in given XML
49 *
50 * @param string $xml Original XML
51 * @return string Modified XML
52 */
53 public function inject_metadata($xml)
54 {
55 $post_url = $this->post_url;
56 $profile_url = $this->profile_url;
57 $user = $this->user;
58
59 return \s9e\TextFormatter\Utils::replaceAttributes(
60 $xml,
61 'QUOTE',
62 function ($attributes) use ($post_url, $profile_url, $user)
63 {
64 if (isset($attributes['post_id']))
65 {
66 $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $post_url);
67 }
68 if (isset($attributes['time']))
69 {
70 $attributes['date'] = $user->format_date($attributes['time']);
71 }
72 if (isset($attributes['user_id']))
73 {
74 $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $profile_url);
75 }
76
77 return $attributes;
78 }
79 );
80 }
81 }
82