@@ -16,33 +16,33 @@ discard block |
||
16 | 16 | class m1_initial_schema extends \phpbb\db\migration\migration |
17 | 17 | { |
18 | 18 | /** |
19 | - * {@inheritDoc} |
|
20 | - */ |
|
19 | + * {@inheritDoc} |
|
20 | + */ |
|
21 | 21 | public function effectively_installed() |
22 | 22 | { |
23 | 23 | return $this->db_tools->sql_table_exists($this->table_prefix . 'ads'); |
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | - * {@inheritDoc} |
|
28 | - */ |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | 29 | static public function depends_on() |
30 | 30 | { |
31 | 31 | return array('\phpbb\db\migration\data\v310\gold'); |
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * Add the ads table schema to the database: |
|
36 | - * ads: |
|
37 | - * ad_id |
|
38 | - * ad_name |
|
39 | - * ad_note |
|
40 | - * ad_code |
|
41 | - * ad_enabled |
|
42 | - * |
|
43 | - * @return array Array of table schema |
|
44 | - * @access public |
|
45 | - */ |
|
35 | + * Add the ads table schema to the database: |
|
36 | + * ads: |
|
37 | + * ad_id |
|
38 | + * ad_name |
|
39 | + * ad_note |
|
40 | + * ad_code |
|
41 | + * ad_enabled |
|
42 | + * |
|
43 | + * @return array Array of table schema |
|
44 | + * @access public |
|
45 | + */ |
|
46 | 46 | public function update_schema() |
47 | 47 | { |
48 | 48 | return array( |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | - * Drop the ads table schema from the database |
|
66 | - * |
|
67 | - * @return array Array of table schema |
|
68 | - * @access public |
|
69 | - */ |
|
65 | + * Drop the ads table schema from the database |
|
66 | + * |
|
67 | + * @return array Array of table schema |
|
68 | + * @access public |
|
69 | + */ |
|
70 | 70 | public function revert_schema() |
71 | 71 | { |
72 | 72 | return array( |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | class m2_acp_module extends \phpbb\db\migration\migration |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function effectively_installed() |
19 | 19 | { |
20 | 20 | $sql = 'SELECT module_id |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * {@inheritDoc} |
|
33 | - */ |
|
32 | + * {@inheritDoc} |
|
33 | + */ |
|
34 | 34 | static public function depends_on() |
35 | 35 | { |
36 | 36 | return array('\phpbb\admanagement\migrations\v10x\m1_initial_schema'); |
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | - * Add the ACP module |
|
41 | - * |
|
42 | - * @return array Array of data update instructions |
|
43 | - */ |
|
40 | + * Add the ACP module |
|
41 | + * |
|
42 | + * @return array Array of data update instructions |
|
43 | + */ |
|
44 | 44 | public function update_data() |
45 | 45 | { |
46 | 46 | return array( |
@@ -16,34 +16,34 @@ |
||
16 | 16 | interface type_interface |
17 | 17 | { |
18 | 18 | /** |
19 | - * Returns the unique ID of the location. |
|
20 | - * |
|
21 | - * @return string ID of location. |
|
22 | - */ |
|
19 | + * Returns the unique ID of the location. |
|
20 | + * |
|
21 | + * @return string ID of location. |
|
22 | + */ |
|
23 | 23 | public function get_id(); |
24 | 24 | |
25 | 25 | /** |
26 | - * Returns the name of the location. |
|
27 | - * |
|
28 | - * @return string Name of location. |
|
29 | - */ |
|
26 | + * Returns the name of the location. |
|
27 | + * |
|
28 | + * @return string Name of location. |
|
29 | + */ |
|
30 | 30 | public function get_name(); |
31 | 31 | |
32 | 32 | /** |
33 | - * Returns the description of the location. |
|
34 | - * |
|
35 | - * @return string Description of location. |
|
36 | - */ |
|
33 | + * Returns the description of the location. |
|
34 | + * |
|
35 | + * @return string Description of location. |
|
36 | + */ |
|
37 | 37 | public function get_desc(); |
38 | 38 | |
39 | 39 | /** |
40 | - * Returns whether or not this location type will be displayed on a current page. |
|
41 | - * |
|
42 | - * Generally, you can always return true, but if you can narrow down the usage |
|
43 | - * without adding extra load to server, this will further enhance the extension's |
|
44 | - * performance. |
|
45 | - * |
|
46 | - * @return bool True when location type will be displayed on a current page and false if not. |
|
47 | - */ |
|
40 | + * Returns whether or not this location type will be displayed on a current page. |
|
41 | + * |
|
42 | + * Generally, you can always return true, but if you can narrow down the usage |
|
43 | + * without adding extra load to server, this will further enhance the extension's |
|
44 | + * performance. |
|
45 | + * |
|
46 | + * @return bool True when location type will be displayed on a current page and false if not. |
|
47 | + */ |
|
48 | 48 | public function will_display(); |
49 | 49 | } |
@@ -13,31 +13,31 @@ discard block |
||
13 | 13 | class m3_template_locations_schema extends \phpbb\db\migration\migration |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function effectively_installed() |
19 | 19 | { |
20 | 20 | return $this->db_tools->sql_table_exists($this->table_prefix . 'ad_locations'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | static public function depends_on() |
27 | 27 | { |
28 | 28 | return array('\phpbb\admanagement\migrations\v10x\m2_acp_module'); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Add the ad_locations table schema to the database: |
|
33 | - * ad_locations: |
|
34 | - * ad_location_id |
|
35 | - * ad_id |
|
36 | - * location_id |
|
37 | - * |
|
38 | - * @return array Array of table schema |
|
39 | - * @access public |
|
40 | - */ |
|
32 | + * Add the ad_locations table schema to the database: |
|
33 | + * ad_locations: |
|
34 | + * ad_location_id |
|
35 | + * ad_id |
|
36 | + * location_id |
|
37 | + * |
|
38 | + * @return array Array of table schema |
|
39 | + * @access public |
|
40 | + */ |
|
41 | 41 | public function update_schema() |
42 | 42 | { |
43 | 43 | return array( |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | - * Drop the ad_locations table schema from the database |
|
58 | - * |
|
59 | - * @return array Array of table schema |
|
60 | - * @access public |
|
61 | - */ |
|
57 | + * Drop the ad_locations table schema from the database |
|
58 | + * |
|
59 | + * @return array Array of table schema |
|
60 | + * @access public |
|
61 | + */ |
|
62 | 62 | public function revert_schema() |
63 | 63 | { |
64 | 64 | return array( |
@@ -13,30 +13,30 @@ discard block |
||
13 | 13 | class manager |
14 | 14 | { |
15 | 15 | /** |
16 | - * Array that contains all available template location types which are passed |
|
17 | - * via the service container |
|
18 | - * @var array |
|
19 | - */ |
|
16 | + * Array that contains all available template location types which are passed |
|
17 | + * via the service container |
|
18 | + * @var array |
|
19 | + */ |
|
20 | 20 | protected $template_locations; |
21 | 21 | |
22 | 22 | /** |
23 | - * Construct an template locations manager object |
|
24 | - * |
|
25 | - * @param array $template_locations Template location types passed via the service container |
|
26 | - */ |
|
23 | + * Construct an template locations manager object |
|
24 | + * |
|
25 | + * @param array $template_locations Template location types passed via the service container |
|
26 | + */ |
|
27 | 27 | public function __construct($template_locations) |
28 | 28 | { |
29 | 29 | $this->register_template_locations($template_locations); |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
33 | - * Get a list of all template location types |
|
34 | - * |
|
35 | - * Returns an associated array where key is the location id |
|
36 | - * and value is array of location name and location description. |
|
37 | - * |
|
38 | - * @return array Array containing a list of all template locations |
|
39 | - */ |
|
33 | + * Get a list of all template location types |
|
34 | + * |
|
35 | + * Returns an associated array where key is the location id |
|
36 | + * and value is array of location name and location description. |
|
37 | + * |
|
38 | + * @return array Array containing a list of all template locations |
|
39 | + */ |
|
40 | 40 | public function get_all_locations() |
41 | 41 | { |
42 | 42 | $location_types = array(); |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Get a list of all template location IDs for display |
|
57 | - * |
|
58 | - * @return array Array containing a list of all template location IDs |
|
59 | - */ |
|
56 | + * Get a list of all template location IDs for display |
|
57 | + * |
|
58 | + * @return array Array containing a list of all template location IDs |
|
59 | + */ |
|
60 | 60 | public function get_all_location_ids() |
61 | 61 | { |
62 | 62 | $template_locations = array(); |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | - * Register template locations |
|
77 | - * |
|
78 | - * @param array $template_locations Template location types passed via the service container |
|
79 | - */ |
|
76 | + * Register template locations |
|
77 | + * |
|
78 | + * @param array $template_locations Template location types passed via the service container |
|
79 | + */ |
|
80 | 80 | protected function register_template_locations($template_locations) |
81 | 81 | { |
82 | 82 | if (!empty($template_locations)) |
@@ -21,7 +21,6 @@ |
||
21 | 21 | /** |
22 | 22 | * Construct an after_profile template location object |
23 | 23 | * |
24 | - * @param \phpbb\user $config User object |
|
25 | 24 | */ |
26 | 25 | public function __construct(\phpbb\user $user) |
27 | 26 | { |
@@ -16,40 +16,40 @@ |
||
16 | 16 | abstract class base implements \phpbb\admanagement\location\type\type_interface |
17 | 17 | { |
18 | 18 | /** |
19 | - * User object |
|
20 | - * @var \phpbb\user |
|
21 | - */ |
|
19 | + * User object |
|
20 | + * @var \phpbb\user |
|
21 | + */ |
|
22 | 22 | protected $user; |
23 | 23 | |
24 | 24 | /** |
25 | - * Construct an after_profile template location object |
|
26 | - * |
|
27 | - * @param \phpbb\user $config User object |
|
28 | - */ |
|
25 | + * Construct an after_profile template location object |
|
26 | + * |
|
27 | + * @param \phpbb\user $config User object |
|
28 | + */ |
|
29 | 29 | public function __construct(\phpbb\user $user) |
30 | 30 | { |
31 | 31 | $this->user = $user; |
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * {@inheritDoc} |
|
36 | - */ |
|
35 | + * {@inheritDoc} |
|
36 | + */ |
|
37 | 37 | public function get_name() |
38 | 38 | { |
39 | 39 | return $this->user->lang('AD_' . strtoupper($this->get_id())); |
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * {@inheritDoc} |
|
44 | - */ |
|
43 | + * {@inheritDoc} |
|
44 | + */ |
|
45 | 45 | public function get_desc() |
46 | 46 | { |
47 | 47 | return $this->user->lang('AD_' . strtoupper($this->get_id()) . '_DESC'); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * {@inheritDoc} |
|
52 | - */ |
|
51 | + * {@inheritDoc} |
|
52 | + */ |
|
53 | 53 | public function will_display() |
54 | 54 | { |
55 | 55 | return true; |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | protected $location_manager; |
34 | 34 | |
35 | 35 | /** |
36 | - * {@inheritdoc} |
|
37 | - */ |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | 38 | static public function getSubscribedEvents() |
39 | 39 | { |
40 | 40 | return array( |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * Constructor |
|
47 | - * |
|
48 | - * @param \phpbb\request\request $request Request object |
|
49 | - * @param \phpbb\template\template $template Template object |
|
50 | - * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
51 | - * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
52 | - */ |
|
46 | + * Constructor |
|
47 | + * |
|
48 | + * @param \phpbb\request\request $request Request object |
|
49 | + * @param \phpbb\template\template $template Template object |
|
50 | + * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
51 | + * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
52 | + */ |
|
53 | 53 | public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\admanagement\ad\manager $manager, \phpbb\admanagement\location\manager $location_manager) |
54 | 54 | { |
55 | 55 | $this->request = $request; |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | protected $errors = array(); |
46 | 46 | |
47 | 47 | /** |
48 | - * Constructor |
|
49 | - * |
|
50 | - * @param \phpbb\template\template $template Template object |
|
51 | - * @param \phpbb\user $user User object |
|
52 | - * @param \phpbb\request\request $request Request object |
|
53 | - * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
54 | - * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
55 | - * @param string $php_ext PHP extension |
|
56 | - * @param string $ext_path Path to this extension |
|
57 | - */ |
|
48 | + * Constructor |
|
49 | + * |
|
50 | + * @param \phpbb\template\template $template Template object |
|
51 | + * @param \phpbb\user $user User object |
|
52 | + * @param \phpbb\request\request $request Request object |
|
53 | + * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
54 | + * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
55 | + * @param string $php_ext PHP extension |
|
56 | + * @param string $ext_path Path to this extension |
|
57 | + */ |
|
58 | 58 | public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, \phpbb\admanagement\ad\manager $manager, \phpbb\admanagement\location\manager $location_manager, $php_ext, $ext_path) |
59 | 59 | { |
60 | 60 | $this->template = $template; |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | - * Process user request |
|
71 | - * |
|
72 | - * @return void |
|
73 | - */ |
|
70 | + * Process user request |
|
71 | + * |
|
72 | + * @return void |
|
73 | + */ |
|
74 | 74 | public function main() |
75 | 75 | { |
76 | 76 | $this->user->add_lang_ext('phpbb/admanagement', 'acp'); |
@@ -87,31 +87,31 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * Set page url |
|
91 | - * |
|
92 | - * @param string $u_action Custom form action |
|
93 | - * @return void |
|
94 | - */ |
|
90 | + * Set page url |
|
91 | + * |
|
92 | + * @param string $u_action Custom form action |
|
93 | + * @return void |
|
94 | + */ |
|
95 | 95 | public function set_page_url($u_action) |
96 | 96 | { |
97 | 97 | $this->u_action = $u_action; |
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | - * Get ACP page title for Ads module |
|
102 | - * |
|
103 | - * @return string Language string for Ads ACP module |
|
104 | - */ |
|
101 | + * Get ACP page title for Ads module |
|
102 | + * |
|
103 | + * @return string Language string for Ads ACP module |
|
104 | + */ |
|
105 | 105 | public function get_page_title() |
106 | 106 | { |
107 | 107 | return $this->user->lang('ACP_ADMANAGEMENT_TITLE'); |
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | - * Add an advertisement |
|
112 | - * |
|
113 | - * @return void |
|
114 | - */ |
|
111 | + * Add an advertisement |
|
112 | + * |
|
113 | + * @return void |
|
114 | + */ |
|
115 | 115 | public function action_add() |
116 | 116 | { |
117 | 117 | add_form_key('phpbb/admanagement/add'); |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Edit an advertisement |
|
146 | - * |
|
147 | - * @return void |
|
148 | - */ |
|
145 | + * Edit an advertisement |
|
146 | + * |
|
147 | + * @return void |
|
148 | + */ |
|
149 | 149 | public function action_edit() |
150 | 150 | { |
151 | 151 | $ad_id = $this->request->variable('id', 0); |
@@ -196,30 +196,30 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
199 | - * Enable an advertisement |
|
200 | - * |
|
201 | - * @return void |
|
202 | - */ |
|
199 | + * Enable an advertisement |
|
200 | + * |
|
201 | + * @return void |
|
202 | + */ |
|
203 | 203 | public function action_enable() |
204 | 204 | { |
205 | 205 | $this->ad_enable(true); |
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
209 | - * Disable an advertisement |
|
210 | - * |
|
211 | - * @return void |
|
212 | - */ |
|
209 | + * Disable an advertisement |
|
210 | + * |
|
211 | + * @return void |
|
212 | + */ |
|
213 | 213 | public function action_disable() |
214 | 214 | { |
215 | 215 | $this->ad_enable(false); |
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | - * Delete an advertisement |
|
220 | - * |
|
221 | - * @return void |
|
222 | - */ |
|
219 | + * Delete an advertisement |
|
220 | + * |
|
221 | + * @return void |
|
222 | + */ |
|
223 | 223 | public function action_delete() |
224 | 224 | { |
225 | 225 | $ad_id = $this->request->variable('id', 0); |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
256 | - * Display the ads |
|
257 | - * |
|
258 | - * @return void |
|
259 | - */ |
|
256 | + * Display the ads |
|
257 | + * |
|
258 | + * @return void |
|
259 | + */ |
|
260 | 260 | public function list_ads() |
261 | 261 | { |
262 | 262 | foreach ($this->manager->get_all_ads() as $row) |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
284 | - * Enable/disable an advertisement |
|
285 | - * |
|
286 | - * @param bool $enable Enable or disable the advertisement? |
|
287 | - * @return void |
|
288 | - */ |
|
284 | + * Enable/disable an advertisement |
|
285 | + * |
|
286 | + * @param bool $enable Enable or disable the advertisement? |
|
287 | + * @return void |
|
288 | + */ |
|
289 | 289 | protected function ad_enable($enable) |
290 | 290 | { |
291 | 291 | $ad_id = $this->request->variable('id', 0); |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
319 | - * Get admin form data. |
|
320 | - * |
|
321 | - * @return array Form data |
|
322 | - */ |
|
319 | + * Get admin form data. |
|
320 | + * |
|
321 | + * @return array Form data |
|
322 | + */ |
|
323 | 323 | protected function get_form_data() |
324 | 324 | { |
325 | 325 | return array( |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
335 | - * Validate form data. |
|
336 | - * |
|
337 | - * @param array $data The form data. |
|
338 | - * @param string $form_name The form name. |
|
339 | - * @return void |
|
340 | - */ |
|
335 | + * Validate form data. |
|
336 | + * |
|
337 | + * @param array $data The form data. |
|
338 | + * @param string $form_name The form name. |
|
339 | + * @return void |
|
340 | + */ |
|
341 | 341 | protected function validate($data, $form_name) |
342 | 342 | { |
343 | 343 | if (!check_form_key($form_name)) |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
359 | - * Assign form data to the template. |
|
360 | - * |
|
361 | - * @param array $data The form data. |
|
362 | - * @return void |
|
363 | - */ |
|
359 | + * Assign form data to the template. |
|
360 | + * |
|
361 | + * @param array $data The form data. |
|
362 | + * @return void |
|
363 | + */ |
|
364 | 364 | protected function assign_form_data($data) |
365 | 365 | { |
366 | 366 | $this->template->assign_vars(array( |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
378 | - * Assign template locations data to the template. |
|
379 | - * |
|
380 | - * @param mixed $data The form data or nothing. |
|
381 | - * @return void |
|
382 | - */ |
|
378 | + * Assign template locations data to the template. |
|
379 | + * |
|
380 | + * @param mixed $data The form data or nothing. |
|
381 | + * @return void |
|
382 | + */ |
|
383 | 383 | protected function assign_locations($data = false) |
384 | 384 | { |
385 | 385 | foreach ($this->location_manager->get_all_locations() as $location_id => $location_data) |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
397 | - * Print success message. |
|
398 | - * |
|
399 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
400 | - */ |
|
397 | + * Print success message. |
|
398 | + * |
|
399 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
400 | + */ |
|
401 | 401 | protected function success() |
402 | 402 | { |
403 | 403 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action)); |
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
407 | - * Print error message. |
|
408 | - * |
|
409 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
410 | - */ |
|
407 | + * Print error message. |
|
408 | + * |
|
409 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
410 | + */ |
|
411 | 411 | protected function error() |
412 | 412 | { |
413 | 413 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING); |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | protected $ad_locations_table; |
23 | 23 | |
24 | 24 | /** |
25 | - * Constructor |
|
26 | - * |
|
27 | - * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
28 | - * @param string $ads_table Ads table |
|
29 | - * @param string $ad_locations_table Ad locations table |
|
30 | - */ |
|
25 | + * Constructor |
|
26 | + * |
|
27 | + * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
28 | + * @param string $ads_table Ads table |
|
29 | + * @param string $ad_locations_table Ad locations table |
|
30 | + */ |
|
31 | 31 | public function __construct(\phpbb\db\driver\driver_interface $db, $ads_table, $ad_locations_table) |
32 | 32 | { |
33 | 33 | $this->db = $db; |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * Get specific ad |
|
40 | - * |
|
41 | - * @param int $ad_id Advertisement ID |
|
42 | - * @return array Advertisement data |
|
43 | - */ |
|
39 | + * Get specific ad |
|
40 | + * |
|
41 | + * @param int $ad_id Advertisement ID |
|
42 | + * @return array Advertisement data |
|
43 | + */ |
|
44 | 44 | public function get_ad($ad_id) |
45 | 45 | { |
46 | 46 | $sql = 'SELECT * |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | - * Get one ad per every location |
|
58 | - * |
|
59 | - * @param array $ad_locations List of ad locations to fetch ads for |
|
60 | - * @return array List of ad codes for each location |
|
61 | - */ |
|
57 | + * Get one ad per every location |
|
58 | + * |
|
59 | + * @param array $ad_locations List of ad locations to fetch ads for |
|
60 | + * @return array List of ad codes for each location |
|
61 | + */ |
|
62 | 62 | public function get_ads($ad_locations) |
63 | 63 | { |
64 | 64 | $sql = 'SELECT location_id, ad_code |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | - * Get all advertisements |
|
84 | - * |
|
85 | - * @return array List of all ads |
|
86 | - */ |
|
83 | + * Get all advertisements |
|
84 | + * |
|
85 | + * @return array List of all ads |
|
86 | + */ |
|
87 | 87 | public function get_all_ads() |
88 | 88 | { |
89 | 89 | $sql = 'SELECT ad_id, ad_name, ad_enabled |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | - * Insert new advertisement to the database |
|
100 | - * |
|
101 | - * @param array $data New ad data |
|
102 | - * @return int New advertisement ID |
|
103 | - */ |
|
99 | + * Insert new advertisement to the database |
|
100 | + * |
|
101 | + * @param array $data New ad data |
|
102 | + * @return int New advertisement ID |
|
103 | + */ |
|
104 | 104 | public function insert_ad($data) |
105 | 105 | { |
106 | 106 | $data = $this->intersect_ad_data($data); |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | - * Update advertisement |
|
116 | - * |
|
117 | - * @param int $ad_id Advertisement ID |
|
118 | - * @param array $data List of data to update in the database |
|
119 | - * @return int Number of affected rows. Can be used to determine if any ad has been udated. |
|
120 | - */ |
|
115 | + * Update advertisement |
|
116 | + * |
|
117 | + * @param int $ad_id Advertisement ID |
|
118 | + * @param array $data List of data to update in the database |
|
119 | + * @return int Number of affected rows. Can be used to determine if any ad has been udated. |
|
120 | + */ |
|
121 | 121 | public function update_ad($ad_id, $data) |
122 | 122 | { |
123 | 123 | $data = $this->intersect_ad_data($data); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * Delete advertisement |
|
135 | - * |
|
136 | - * @param int $ad_id Advertisement ID |
|
137 | - * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
138 | - */ |
|
134 | + * Delete advertisement |
|
135 | + * |
|
136 | + * @param int $ad_id Advertisement ID |
|
137 | + * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
138 | + */ |
|
139 | 139 | public function delete_ad($ad_id) |
140 | 140 | { |
141 | 141 | $sql = 'DELETE FROM ' . $this->ads_table . ' |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
149 | - * Get all locations for specified advertisement |
|
150 | - * |
|
151 | - * @param int $ad_id Advertisement ID |
|
152 | - * @return array List of template locations for specified ad |
|
153 | - */ |
|
149 | + * Get all locations for specified advertisement |
|
150 | + * |
|
151 | + * @param int $ad_id Advertisement ID |
|
152 | + * @return array List of template locations for specified ad |
|
153 | + */ |
|
154 | 154 | public function get_ad_locations($ad_id) |
155 | 155 | { |
156 | 156 | $ad_locations = array(); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | - * Insert advertisement locations |
|
173 | - * |
|
174 | - * @param int $ad_id Advertisement ID |
|
175 | - * @param array $ad_locations List of template locations for this ad |
|
176 | - * @return void |
|
177 | - */ |
|
172 | + * Insert advertisement locations |
|
173 | + * |
|
174 | + * @param int $ad_id Advertisement ID |
|
175 | + * @param array $ad_locations List of template locations for this ad |
|
176 | + * @return void |
|
177 | + */ |
|
178 | 178 | public function insert_ad_locations($ad_id, $ad_locations) |
179 | 179 | { |
180 | 180 | $sql_ary = array(); |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | - * Delete advertisement locations |
|
193 | - * |
|
194 | - * @param int $ad_id Advertisement ID |
|
195 | - * @return void |
|
196 | - */ |
|
192 | + * Delete advertisement locations |
|
193 | + * |
|
194 | + * @param int $ad_id Advertisement ID |
|
195 | + * @return void |
|
196 | + */ |
|
197 | 197 | public function delete_ad_locations($ad_id) |
198 | 198 | { |
199 | 199 | $sql = 'DELETE FROM ' . $this->ad_locations_table . ' |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * Make sure only necessary data make their way to SQL query |
|
206 | - * |
|
207 | - * @param array $data List of data to query the database |
|
208 | - * @return array Cleaned data that contain only valid keys |
|
209 | - */ |
|
205 | + * Make sure only necessary data make their way to SQL query |
|
206 | + * |
|
207 | + * @param array $data List of data to query the database |
|
208 | + * @return array Cleaned data that contain only valid keys |
|
209 | + */ |
|
210 | 210 | protected function intersect_ad_data($data) |
211 | 211 | { |
212 | 212 | return array_intersect_key($data, array( |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
221 | - * Get the random statement for this database layer |
|
222 | - * |
|
223 | - * @return string Random statement for current database layer |
|
224 | - */ |
|
221 | + * Get the random statement for this database layer |
|
222 | + * |
|
223 | + * @return string Random statement for current database layer |
|
224 | + */ |
|
225 | 225 | protected function sql_random() |
226 | 226 | { |
227 | 227 | switch ($this->db->get_sql_layer()) |