@@ -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( |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | $this->db->sql_freeresult($result); |
| 90 | 90 | |
| 91 | 91 | $current_location_id = ''; |
| 92 | - $data = array_filter($data, function($row) use (&$current_location_id) { |
|
| 92 | + $data = 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; |
@@ -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)' : ''; |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * Increment views for specified ads |
|
| 124 | - * |
|
| 125 | - * Note, that views are incremented only by one even when |
|
| 126 | - * an ad is displayed multiple times on the same page. |
|
| 127 | - * |
|
| 128 | - * @param array $ad_ids IDs of ads to increment views |
|
| 129 | - * @return void |
|
| 130 | - */ |
|
| 123 | + * Increment views for specified ads |
|
| 124 | + * |
|
| 125 | + * Note, that views are incremented only by one even when |
|
| 126 | + * an ad is displayed multiple times on the same page. |
|
| 127 | + * |
|
| 128 | + * @param array $ad_ids IDs of ads to increment views |
|
| 129 | + * @return void |
|
| 130 | + */ |
|
| 131 | 131 | public function increment_ads_views($ad_ids) |
| 132 | 132 | { |
| 133 | 133 | if (!empty($ad_ids)) |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * Increment clicks for specified ad |
|
| 144 | - * |
|
| 145 | - * @param int $ad_id ID of an ad to increment clicks |
|
| 146 | - * @return void |
|
| 147 | - */ |
|
| 143 | + * Increment clicks for specified ad |
|
| 144 | + * |
|
| 145 | + * @param int $ad_id ID of an ad to increment clicks |
|
| 146 | + * @return void |
|
| 147 | + */ |
|
| 148 | 148 | public function increment_ad_clicks($ad_id) |
| 149 | 149 | { |
| 150 | 150 | $sql = 'UPDATE ' . $this->ads_table . ' |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * Insert new advertisement to the database |
|
| 158 | - * |
|
| 159 | - * @param array $data New ad data |
|
| 160 | - * @return int New advertisement ID |
|
| 161 | - */ |
|
| 157 | + * Insert new advertisement to the database |
|
| 158 | + * |
|
| 159 | + * @param array $data New ad data |
|
| 160 | + * @return int New advertisement ID |
|
| 161 | + */ |
|
| 162 | 162 | public function insert_ad($data) |
| 163 | 163 | { |
| 164 | 164 | $data = $this->intersect_ad_data($data); |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | - * Update advertisement |
|
| 174 | - * |
|
| 175 | - * @param int $ad_id Advertisement ID |
|
| 176 | - * @param array $data List of data to update in the database |
|
| 177 | - * @return int Number of affected rows. Can be used to determine if any ad has been updated. |
|
| 178 | - */ |
|
| 173 | + * Update advertisement |
|
| 174 | + * |
|
| 175 | + * @param int $ad_id Advertisement ID |
|
| 176 | + * @param array $data List of data to update in the database |
|
| 177 | + * @return int Number of affected rows. Can be used to determine if any ad has been updated. |
|
| 178 | + */ |
|
| 179 | 179 | public function update_ad($ad_id, $data) |
| 180 | 180 | { |
| 181 | 181 | $data = $this->intersect_ad_data($data); |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Delete advertisement |
|
| 193 | - * |
|
| 194 | - * @param int $ad_id Advertisement ID |
|
| 195 | - * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
| 196 | - */ |
|
| 192 | + * Delete advertisement |
|
| 193 | + * |
|
| 194 | + * @param int $ad_id Advertisement ID |
|
| 195 | + * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
| 196 | + */ |
|
| 197 | 197 | public function delete_ad($ad_id) |
| 198 | 198 | { |
| 199 | 199 | $sql = 'DELETE FROM ' . $this->ads_table . ' |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | - * Get all locations for specified advertisement |
|
| 208 | - * |
|
| 209 | - * @param int $ad_id Advertisement ID |
|
| 210 | - * @return array List of template locations for specified ad |
|
| 211 | - */ |
|
| 207 | + * Get all locations for specified advertisement |
|
| 208 | + * |
|
| 209 | + * @param int $ad_id Advertisement ID |
|
| 210 | + * @return array List of template locations for specified ad |
|
| 211 | + */ |
|
| 212 | 212 | public function get_ad_locations($ad_id) |
| 213 | 213 | { |
| 214 | 214 | $ad_locations = array(); |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * Insert advertisement locations |
|
| 231 | - * |
|
| 232 | - * @param int $ad_id Advertisement ID |
|
| 233 | - * @param array $ad_locations List of template locations for this ad |
|
| 234 | - * @return void |
|
| 235 | - */ |
|
| 230 | + * Insert advertisement locations |
|
| 231 | + * |
|
| 232 | + * @param int $ad_id Advertisement ID |
|
| 233 | + * @param array $ad_locations List of template locations for this ad |
|
| 234 | + * @return void |
|
| 235 | + */ |
|
| 236 | 236 | public function insert_ad_locations($ad_id, $ad_locations) |
| 237 | 237 | { |
| 238 | 238 | $sql_ary = array(); |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | - * Delete advertisement locations |
|
| 251 | - * |
|
| 252 | - * @param int $ad_id Advertisement ID |
|
| 253 | - * @return void |
|
| 254 | - */ |
|
| 250 | + * Delete advertisement locations |
|
| 251 | + * |
|
| 252 | + * @param int $ad_id Advertisement ID |
|
| 253 | + * @return void |
|
| 254 | + */ |
|
| 255 | 255 | public function delete_ad_locations($ad_id) |
| 256 | 256 | { |
| 257 | 257 | $sql = 'DELETE FROM ' . $this->ad_locations_table . ' |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
| 263 | - * Load memberships of the user |
|
| 264 | - * |
|
| 265 | - * @param int $user_id User ID to load memberships |
|
| 266 | - * @return array List of group IDs user is member of |
|
| 267 | - */ |
|
| 263 | + * Load memberships of the user |
|
| 264 | + * |
|
| 265 | + * @param int $user_id User ID to load memberships |
|
| 266 | + * @return array List of group IDs user is member of |
|
| 267 | + */ |
|
| 268 | 268 | public function load_memberships($user_id) |
| 269 | 269 | { |
| 270 | 270 | $memberships = array(); |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * Load all board groups |
|
| 286 | - * |
|
| 287 | - * @return array List of groups |
|
| 288 | - */ |
|
| 285 | + * Load all board groups |
|
| 286 | + * |
|
| 287 | + * @return array List of groups |
|
| 288 | + */ |
|
| 289 | 289 | public function load_groups() |
| 290 | 290 | { |
| 291 | 291 | $sql = 'SELECT group_id, group_name, group_type |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | - * Make sure only necessary data make their way to SQL query |
|
| 339 | - * |
|
| 340 | - * @param array $data List of data to query the database |
|
| 341 | - * @return array Cleaned data that contain only valid keys |
|
| 342 | - */ |
|
| 338 | + * Make sure only necessary data make their way to SQL query |
|
| 339 | + * |
|
| 340 | + * @param array $data List of data to query the database |
|
| 341 | + * @return array Cleaned data that contain only valid keys |
|
| 342 | + */ |
|
| 343 | 343 | protected function intersect_ad_data($data) |
| 344 | 344 | { |
| 345 | 345 | return array_intersect_key($data, array( |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | - * Get the random statement for this database layer |
|
| 360 | - * Random function should generate a float value between 0 and 1 |
|
| 361 | - * |
|
| 362 | - * @return string Random statement for current database layer |
|
| 363 | - */ |
|
| 359 | + * Get the random statement for this database layer |
|
| 360 | + * Random function should generate a float value between 0 and 1 |
|
| 361 | + * |
|
| 362 | + * @return string Random statement for current database layer |
|
| 363 | + */ |
|
| 364 | 364 | protected function sql_random() |
| 365 | 365 | { |
| 366 | 366 | switch ($this->db->get_sql_layer()) |
@@ -34,11 +34,11 @@ |
||
| 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\JsonResponse A Symfony JsonResponse object |
|
| 41 | - */ |
|
| 37 | + * Increment clicks for an ad |
|
| 38 | + * |
|
| 39 | + * @param int $ad_id Advertisement ID |
|
| 40 | + * @return \Symfony\Component\HttpFoundation\JsonResponse A Symfony JsonResponse object |
|
| 41 | + */ |
|
| 42 | 42 | public function increment_clicks($ad_id) |
| 43 | 43 | { |
| 44 | 44 | if ($this->request->is_ajax() && !empty($ad_id)) |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * Upload image and return updated ad code or <img> of new banner when using ajax. |
| 114 | 114 | * |
| 115 | 115 | * @param string $ad_code Current ad code |
| 116 | - * @return mixed \phpbb\json_response when request is ajax or updated ad code otherwise. |
|
| 116 | + * @return string \phpbb\json_response when request is ajax or updated ad code otherwise. |
|
| 117 | 117 | */ |
| 118 | 118 | public function banner_upload($ad_code) |
| 119 | 119 | { |
@@ -54,20 +54,20 @@ |
||
| 54 | 54 | protected $u_action; |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Constructor |
|
| 58 | - * |
|
| 59 | - * @param \phpbb\template\template $template Template object |
|
| 60 | - * @param \phpbb\language\language $language Language object |
|
| 61 | - * @param \phpbb\request\request $request Request object |
|
| 62 | - * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
|
| 63 | - * @param \phpbb\config\db_text $config_text Config text object |
|
| 64 | - * @param \phpbb\config\config $config Config object |
|
| 65 | - * @param \phpbb\group\helper $group_helper Group helper object |
|
| 66 | - * @param \phpbb\ads\controller\admin_input $input Admin input object |
|
| 67 | - * @param \phpbb\ads\controller\admin_helper $helper Admin helper object |
|
| 68 | - * @param string $root_path phpBB root path |
|
| 69 | - * @param string $php_ext PHP extension |
|
| 70 | - */ |
|
| 57 | + * Constructor |
|
| 58 | + * |
|
| 59 | + * @param \phpbb\template\template $template Template object |
|
| 60 | + * @param \phpbb\language\language $language Language object |
|
| 61 | + * @param \phpbb\request\request $request Request object |
|
| 62 | + * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
|
| 63 | + * @param \phpbb\config\db_text $config_text Config text object |
|
| 64 | + * @param \phpbb\config\config $config Config object |
|
| 65 | + * @param \phpbb\group\helper $group_helper Group helper object |
|
| 66 | + * @param \phpbb\ads\controller\admin_input $input Admin input object |
|
| 67 | + * @param \phpbb\ads\controller\admin_helper $helper Admin helper object |
|
| 68 | + * @param string $root_path phpBB root path |
|
| 69 | + * @param string $php_ext PHP extension |
|
| 70 | + */ |
|
| 71 | 71 | public function __construct(\phpbb\template\template $template, \phpbb\language\language $language, \phpbb\request\request $request, \phpbb\ads\ad\manager $manager, \phpbb\config\db_text $config_text, \phpbb\config\config $config, \phpbb\group\helper $group_helper, \phpbb\ads\controller\admin_input $input, \phpbb\ads\controller\admin_helper $helper, $root_path, $php_ext) |
| 72 | 72 | { |
| 73 | 73 | $this->template = $template; |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | abstract class base implements \phpbb\ads\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 | /** |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | protected $language; |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * Construct a template location object |
|
| 32 | - * |
|
| 33 | - * @param \phpbb\user $user User object |
|
| 34 | - * @param \phpbb\language\language $language Language object |
|
| 35 | - */ |
|
| 31 | + * Construct a template location object |
|
| 32 | + * |
|
| 33 | + * @param \phpbb\user $user User object |
|
| 34 | + * @param \phpbb\language\language $language Language object |
|
| 35 | + */ |
|
| 36 | 36 | public function __construct(\phpbb\user $user, \phpbb\language\language $language) |
| 37 | 37 | { |
| 38 | 38 | $this->user = $user; |
@@ -40,24 +40,24 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * {@inheritDoc} |
|
| 44 | - */ |
|
| 43 | + * {@inheritDoc} |
|
| 44 | + */ |
|
| 45 | 45 | public function get_name() |
| 46 | 46 | { |
| 47 | 47 | return $this->language->lang('AD_' . strtoupper($this->get_id())); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * {@inheritDoc} |
|
| 52 | - */ |
|
| 51 | + * {@inheritDoc} |
|
| 52 | + */ |
|
| 53 | 53 | public function get_desc() |
| 54 | 54 | { |
| 55 | 55 | return $this->language->lang('AD_' . strtoupper($this->get_id()) . '_DESC'); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * {@inheritDoc} |
|
| 60 | - */ |
|
| 59 | + * {@inheritDoc} |
|
| 60 | + */ |
|
| 61 | 61 | public function will_display() |
| 62 | 62 | { |
| 63 | 63 | return true; |