@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | protected $controller_helper; |
43 | 43 | |
44 | 44 | /** |
45 | - * {@inheritdoc} |
|
46 | - */ |
|
45 | + * {@inheritdoc} |
|
46 | + */ |
|
47 | 47 | static public function getSubscribedEvents() |
48 | 48 | { |
49 | 49 | return array( |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Constructor |
|
57 | - * |
|
58 | - * @param \phpbb\template\template $template Template object |
|
59 | - * @param \phpbb\user $user User object |
|
60 | - * @param \phpbb\config\db_text $config_text Config text object |
|
61 | - * @param \phpbb\config\config $config Config object |
|
62 | - * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
|
63 | - * @param \phpbb\ads\location\manager $location_manager Template location manager object |
|
64 | - * @param \phpbb\controller\helper $controller_helper Controller helper object |
|
65 | - */ |
|
56 | + * Constructor |
|
57 | + * |
|
58 | + * @param \phpbb\template\template $template Template object |
|
59 | + * @param \phpbb\user $user User object |
|
60 | + * @param \phpbb\config\db_text $config_text Config text object |
|
61 | + * @param \phpbb\config\config $config Config object |
|
62 | + * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
|
63 | + * @param \phpbb\ads\location\manager $location_manager Template location manager object |
|
64 | + * @param \phpbb\controller\helper $controller_helper Controller helper object |
|
65 | + */ |
|
66 | 66 | public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\db_text $config_text, \phpbb\config\config $config, \phpbb\ads\ad\manager $manager, \phpbb\ads\location\manager $location_manager, \phpbb\controller\helper $controller_helper) |
67 | 67 | { |
68 | 68 | $this->template = $template; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * Load common language file during user setup |
|
79 | - * |
|
80 | - * @param \phpbb\event\data $event The event object |
|
81 | - * @return void |
|
82 | - */ |
|
78 | + * Load common language file during user setup |
|
79 | + * |
|
80 | + * @param \phpbb\event\data $event The event object |
|
81 | + * @return void |
|
82 | + */ |
|
83 | 83 | public function load_language_on_setup($event) |
84 | 84 | { |
85 | 85 | $lang_set_ext = $event['lang_set_ext']; |
@@ -13,27 +13,27 @@ discard block |
||
13 | 13 | class m9_views_clicks 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_column_exists($this->table_prefix . 'ads', 'ad_views'); |
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\ads\migrations\v10x\m1_initial_schema'); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Add the views and clicks to ads table |
|
33 | - * |
|
34 | - * @return array Array of table schema |
|
35 | - * @access public |
|
36 | - */ |
|
32 | + * Add the views and clicks to ads table |
|
33 | + * |
|
34 | + * @return array Array of table schema |
|
35 | + * @access public |
|
36 | + */ |
|
37 | 37 | public function update_schema() |
38 | 38 | { |
39 | 39 | return array( |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Drop the views and clicks from ads table |
|
61 | - * |
|
62 | - * @return array Array of table schema |
|
63 | - * @access public |
|
64 | - */ |
|
60 | + * Drop the views and clicks from ads table |
|
61 | + * |
|
62 | + * @return array Array of table schema |
|
63 | + * @access public |
|
64 | + */ |
|
65 | 65 | public function revert_schema() |
66 | 66 | { |
67 | 67 | return array( |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | - * Get specific ad |
|
45 | - * |
|
46 | - * @param int $ad_id Advertisement ID |
|
47 | - * @return mixed Array with advertisement data, false if ad doesn't exist |
|
48 | - */ |
|
44 | + * Get specific ad |
|
45 | + * |
|
46 | + * @param int $ad_id Advertisement ID |
|
47 | + * @return mixed Array with advertisement data, false if ad doesn't exist |
|
48 | + */ |
|
49 | 49 | public function get_ad($ad_id) |
50 | 50 | { |
51 | 51 | $sql = 'SELECT * |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * Get one ad per every location |
|
63 | - * |
|
64 | - * @param array $ad_locations List of ad locations to fetch ads for |
|
65 | - * @return array List of ad codes for each location |
|
66 | - */ |
|
62 | + * Get one ad per every location |
|
63 | + * |
|
64 | + * @param array $ad_locations List of ad locations to fetch ads for |
|
65 | + * @return array List of ad codes for each location |
|
66 | + */ |
|
67 | 67 | public function get_ads($ad_locations) |
68 | 68 | { |
69 | 69 | $sql_where_views = $this->config['phpbb_ads_enable_views'] ? 'AND (a.ad_views_limit = 0 OR a.ad_views_limit > a.ad_views)' : ''; |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * Get all advertisements |
|
103 | - * |
|
104 | - * @return array List of all ads |
|
105 | - */ |
|
102 | + * Get all advertisements |
|
103 | + * |
|
104 | + * @return array List of all ads |
|
105 | + */ |
|
106 | 106 | public function get_all_ads() |
107 | 107 | { |
108 | 108 | $sql = 'SELECT ad_id, ad_name, ad_enabled, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Increment views for specified ads |
|
119 | - * |
|
120 | - * Note, that views are incremented only by one even when |
|
121 | - * an ad is displayed multiple times on the same page. |
|
122 | - * |
|
123 | - * @param array $ad_ids IDs of ads to increment views |
|
124 | - * @return void |
|
125 | - */ |
|
118 | + * Increment views for specified ads |
|
119 | + * |
|
120 | + * Note, that views are incremented only by one even when |
|
121 | + * an ad is displayed multiple times on the same page. |
|
122 | + * |
|
123 | + * @param array $ad_ids IDs of ads to increment views |
|
124 | + * @return void |
|
125 | + */ |
|
126 | 126 | public function increment_ads_views($ad_ids) |
127 | 127 | { |
128 | 128 | if (!empty($ad_ids)) |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | - * Increment clicks for specified ad |
|
139 | - * |
|
140 | - * @param array $ad_id ID of an ad to increment clicks |
|
141 | - * @return void |
|
142 | - */ |
|
138 | + * Increment clicks for specified ad |
|
139 | + * |
|
140 | + * @param array $ad_id ID of an ad to increment clicks |
|
141 | + * @return void |
|
142 | + */ |
|
143 | 143 | public function increment_ad_clicks($ad_id) |
144 | 144 | { |
145 | 145 | $sql = 'UPDATE ' . $this->ads_table . ' |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
152 | - * Insert new advertisement to the database |
|
153 | - * |
|
154 | - * @param array $data New ad data |
|
155 | - * @return int New advertisement ID |
|
156 | - */ |
|
152 | + * Insert new advertisement to the database |
|
153 | + * |
|
154 | + * @param array $data New ad data |
|
155 | + * @return int New advertisement ID |
|
156 | + */ |
|
157 | 157 | public function insert_ad($data) |
158 | 158 | { |
159 | 159 | $data = $this->intersect_ad_data($data); |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
168 | - * Update advertisement |
|
169 | - * |
|
170 | - * @param int $ad_id Advertisement ID |
|
171 | - * @param array $data List of data to update in the database |
|
172 | - * @return int Number of affected rows. Can be used to determine if any ad has been updated. |
|
173 | - */ |
|
168 | + * Update advertisement |
|
169 | + * |
|
170 | + * @param int $ad_id Advertisement ID |
|
171 | + * @param array $data List of data to update in the database |
|
172 | + * @return int Number of affected rows. Can be used to determine if any ad has been updated. |
|
173 | + */ |
|
174 | 174 | public function update_ad($ad_id, $data) |
175 | 175 | { |
176 | 176 | $data = $this->intersect_ad_data($data); |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
187 | - * Delete advertisement |
|
188 | - * |
|
189 | - * @param int $ad_id Advertisement ID |
|
190 | - * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
191 | - */ |
|
187 | + * Delete advertisement |
|
188 | + * |
|
189 | + * @param int $ad_id Advertisement ID |
|
190 | + * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
191 | + */ |
|
192 | 192 | public function delete_ad($ad_id) |
193 | 193 | { |
194 | 194 | $sql = 'DELETE FROM ' . $this->ads_table . ' |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | - * Get all locations for specified advertisement |
|
203 | - * |
|
204 | - * @param int $ad_id Advertisement ID |
|
205 | - * @return array List of template locations for specified ad |
|
206 | - */ |
|
202 | + * Get all locations for specified advertisement |
|
203 | + * |
|
204 | + * @param int $ad_id Advertisement ID |
|
205 | + * @return array List of template locations for specified ad |
|
206 | + */ |
|
207 | 207 | public function get_ad_locations($ad_id) |
208 | 208 | { |
209 | 209 | $ad_locations = array(); |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
225 | - * Insert advertisement locations |
|
226 | - * |
|
227 | - * @param int $ad_id Advertisement ID |
|
228 | - * @param array $ad_locations List of template locations for this ad |
|
229 | - * @return void |
|
230 | - */ |
|
225 | + * Insert advertisement locations |
|
226 | + * |
|
227 | + * @param int $ad_id Advertisement ID |
|
228 | + * @param array $ad_locations List of template locations for this ad |
|
229 | + * @return void |
|
230 | + */ |
|
231 | 231 | public function insert_ad_locations($ad_id, $ad_locations) |
232 | 232 | { |
233 | 233 | $sql_ary = array(); |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
245 | - * Delete advertisement locations |
|
246 | - * |
|
247 | - * @param int $ad_id Advertisement ID |
|
248 | - * @return void |
|
249 | - */ |
|
245 | + * Delete advertisement locations |
|
246 | + * |
|
247 | + * @param int $ad_id Advertisement ID |
|
248 | + * @return void |
|
249 | + */ |
|
250 | 250 | public function delete_ad_locations($ad_id) |
251 | 251 | { |
252 | 252 | $sql = 'DELETE FROM ' . $this->ad_locations_table . ' |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
258 | - * Load memberships of the user |
|
259 | - * |
|
260 | - * @param int $user_id User ID to load memberships |
|
261 | - * @return array List of group IDs user is member of |
|
262 | - */ |
|
258 | + * Load memberships of the user |
|
259 | + * |
|
260 | + * @param int $user_id User ID to load memberships |
|
261 | + * @return array List of group IDs user is member of |
|
262 | + */ |
|
263 | 263 | public function load_memberships($user_id) |
264 | 264 | { |
265 | 265 | $memberships = array(); |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * Load all board groups |
|
281 | - * |
|
282 | - * @return array List of groups |
|
283 | - */ |
|
280 | + * Load all board groups |
|
281 | + * |
|
282 | + * @return array List of groups |
|
283 | + */ |
|
284 | 284 | public function load_groups() |
285 | 285 | { |
286 | 286 | $sql = 'SELECT group_id, group_name, group_type |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
297 | - * Make sure only necessary data make their way to SQL query |
|
298 | - * |
|
299 | - * @param array $data List of data to query the database |
|
300 | - * @return array Cleaned data that contain only valid keys |
|
301 | - */ |
|
297 | + * Make sure only necessary data make their way to SQL query |
|
298 | + * |
|
299 | + * @param array $data List of data to query the database |
|
300 | + * @return array Cleaned data that contain only valid keys |
|
301 | + */ |
|
302 | 302 | protected function intersect_ad_data($data) |
303 | 303 | { |
304 | 304 | return array_intersect_key($data, array( |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | - * Get the random statement for this database layer |
|
318 | - * Random function should generate a float value between 0 and 1 |
|
319 | - * |
|
320 | - * @return string Random statement for current database layer |
|
321 | - */ |
|
317 | + * Get the random statement for this database layer |
|
318 | + * Random function should generate a float value between 0 and 1 |
|
319 | + * |
|
320 | + * @return string Random statement for current database layer |
|
321 | + */ |
|
322 | 322 | protected function sql_random() |
323 | 323 | { |
324 | 324 | switch ($this->db->get_sql_layer()) |
@@ -89,7 +89,7 @@ |
||
89 | 89 | $this->db->sql_freeresult($result); |
90 | 90 | |
91 | 91 | $current_location_id = ''; |
92 | - $filtered = array_filter($data, function($row) use (&$current_location_id) { |
|
92 | + $filtered = array_filter($data, function ($row) use (&$current_location_id) { |
|
93 | 93 | $return = $current_location_id != $row['location_id']; |
94 | 94 | $current_location_id = $row['location_id']; |
95 | 95 | return $return; |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | protected $helper; |
23 | 23 | |
24 | 24 | /** |
25 | - * Constructor |
|
26 | - * |
|
27 | - * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
|
28 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
29 | - */ |
|
25 | + * Constructor |
|
26 | + * |
|
27 | + * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
|
28 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
29 | + */ |
|
30 | 30 | public function __construct(\phpbb\ads\ad\manager $manager, \phpbb\controller\helper $helper) |
31 | 31 | { |
32 | 32 | $this->manager = $manager; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | - * Increment clicks for an ad |
|
38 | - * |
|
39 | - * @param int $ad_id Advertisement ID |
|
40 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
41 | - */ |
|
37 | + * Increment clicks for an ad |
|
38 | + * |
|
39 | + * @param int $ad_id Advertisement ID |
|
40 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
41 | + */ |
|
42 | 42 | public function increment_clicks($ad_id) |
43 | 43 | { |
44 | 44 | if (!$ad_id) |