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 |
assets_bag.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\template;
15
16 class assets_bag
17 {
18 /** @var asset[] */
19 protected $stylesheets = [];
20
21 /** @var asset[] */
22 protected $scripts = [];
23
24 /**
25 * Add a css asset to the bag
26 *
27 * @param asset $asset
28 */
29 public function add_stylesheet(asset $asset)
30 {
31 $this->stylesheets[] = $asset;
32 }
33
34 /**
35 * Add a js script asset to the bag
36 *
37 * @param asset $asset
38 */
39 public function add_script(asset $asset)
40 {
41 $this->scripts[] = $asset;
42 }
43
44 /**
45 * Returns all css assets
46 *
47 * @return asset[]
48 */
49 public function get_stylesheets()
50 {
51 return $this->stylesheets;
52 }
53
54 /**
55 * Returns all js assets
56 *
57 * @return asset[]
58 */
59 public function get_scripts()
60 {
61 return $this->scripts;
62 }
63
64 /**
65 * Returns the HTML code to includes all css assets
66 *
67 * @return string
68 */
69 public function get_stylesheets_content()
70 {
71 $output = '';
72 foreach ($this->stylesheets as $stylesheet)
73 {
74 $output .= "<link href=\"{$stylesheet->get_url()}\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n";
75 }
76
77 return $output;
78 }
79
80 /**
81 * Returns the HTML code to includes all js assets
82 *
83 * @return string
84 */
85 public function get_scripts_content()
86 {
87 $output = '';
88 foreach ($this->scripts as $script)
89 {
90 $output .= "<script type=\"text/javascript\" src=\"{$script->get_url()}\"></script>\n";
91 }
92
93 return $output;
94 }
95 }
96