@@ -37,37 +37,37 @@ discard block |
||
37 | 37 | private $ext_name = 'ernadoo/phpbbdirectory'; |
38 | 38 | |
39 | 39 | /** |
40 | - * Set the extension manager |
|
41 | - * |
|
42 | - * @param \phpbb\extension\manager $phpbb_extension_manager |
|
43 | - * @return null |
|
44 | - */ |
|
40 | + * Set the extension manager |
|
41 | + * |
|
42 | + * @param \phpbb\extension\manager $phpbb_extension_manager |
|
43 | + * @return null |
|
44 | + */ |
|
45 | 45 | public function set_extension_manager(\phpbb\extension\manager $phpbb_extension_manager) |
46 | 46 | { |
47 | 47 | $this->extension_manager = $phpbb_extension_manager; |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * Set the path helper |
|
52 | - * |
|
53 | - * @param \phpbb\path_helper $path_helper |
|
54 | - * @return null |
|
55 | - */ |
|
51 | + * Set the path helper |
|
52 | + * |
|
53 | + * @param \phpbb\path_helper $path_helper |
|
54 | + * @return null |
|
55 | + */ |
|
56 | 56 | public function set_path_helper(\phpbb\path_helper $path_helper) |
57 | 57 | { |
58 | 58 | $this->path_helper = $path_helper; |
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * Set the tables names |
|
63 | - * |
|
64 | - * @param string $categories_table |
|
65 | - * @param string $comments_table |
|
66 | - * @param string $links_table |
|
67 | - * @param string $votes_table |
|
68 | - * @param string $watch_table |
|
69 | - * @return null |
|
70 | - */ |
|
62 | + * Set the tables names |
|
63 | + * |
|
64 | + * @param string $categories_table |
|
65 | + * @param string $comments_table |
|
66 | + * @param string $links_table |
|
67 | + * @param string $votes_table |
|
68 | + * @param string $watch_table |
|
69 | + * @return null |
|
70 | + */ |
|
71 | 71 | public function set_tables($categories_table, $comments_table, $links_table, $votes_table, $watch_table) |
72 | 72 | { |
73 | 73 | $this->comments_table = $comments_table; |
@@ -77,48 +77,48 @@ discard block |
||
77 | 77 | $this->categories_table = $categories_table; |
78 | 78 | } |
79 | 79 | /** |
80 | - * Return ext name |
|
81 | - * |
|
82 | - * @param bool $web_root_path Whether the path should be relative to web root |
|
83 | - * @return string Path to an extension |
|
84 | - */ |
|
80 | + * Return ext name |
|
81 | + * |
|
82 | + * @param bool $web_root_path Whether the path should be relative to web root |
|
83 | + * @return string Path to an extension |
|
84 | + */ |
|
85 | 85 | public function get_ext_name($web_root_path = false) |
86 | 86 | { |
87 | 87 | return (($web_root_path) ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name); |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * Return path to resource image |
|
92 | - * |
|
93 | - * @param string $type is ressource type (flags|icons) |
|
94 | - * @param string $image is the resource to display |
|
95 | - * @return string The relative path to ressource |
|
96 | - */ |
|
91 | + * Return path to resource image |
|
92 | + * |
|
93 | + * @param string $type is ressource type (flags|icons) |
|
94 | + * @param string $image is the resource to display |
|
95 | + * @return string The relative path to ressource |
|
96 | + */ |
|
97 | 97 | public function get_img_path($type, $image = '') |
98 | 98 | { |
99 | 99 | return $this->get_ext_name(true) . 'images/' . $type . '/' . $image; |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Return path to banner |
|
104 | - * |
|
105 | - * @param string $banner is the physical name |
|
106 | - * @return string The relative path to banner |
|
107 | - */ |
|
103 | + * Return path to banner |
|
104 | + * |
|
105 | + * @param string $banner is the physical name |
|
106 | + * @return string The relative path to banner |
|
107 | + */ |
|
108 | 108 | public function get_banner_path($banner = '') |
109 | 109 | { |
110 | 110 | return $this->path_helper->get_phpbb_root_path() . 'files/' . $this->get_ext_name() . 'banners/' . $banner; |
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * Return array entries that match the pattern |
|
115 | - * |
|
116 | - * @link http://php.net/manual/fr/function.preg-grep.php#95787 |
|
117 | - * |
|
118 | - * @param string $pattern The pattern to search for |
|
119 | - * @param array $input The input array |
|
120 | - * @return array $vals Returns an array indexed using the keys from the input array |
|
121 | - */ |
|
114 | + * Return array entries that match the pattern |
|
115 | + * |
|
116 | + * @link http://php.net/manual/fr/function.preg-grep.php#95787 |
|
117 | + * |
|
118 | + * @param string $pattern The pattern to search for |
|
119 | + * @param array $input The input array |
|
120 | + * @return array $vals Returns an array indexed using the keys from the input array |
|
121 | + */ |
|
122 | 122 | public function preg_grep_keys($pattern, $input) |
123 | 123 | { |
124 | 124 | $keys = preg_grep($pattern, array_keys($input)); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function set_extension_manager(\phpbb\extension\manager $phpbb_extension_manager) |
46 | 46 | { |
47 | - $this->extension_manager = $phpbb_extension_manager; |
|
47 | + $this->extension_manager = $phpbb_extension_manager; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function set_tables($categories_table, $comments_table, $links_table, $votes_table, $watch_table) |
72 | 72 | { |
73 | - $this->comments_table = $comments_table; |
|
73 | + $this->comments_table = $comments_table; |
|
74 | 74 | $this->links_table = $links_table; |
75 | 75 | $this->votes_table = $votes_table; |
76 | 76 | $this->watch_table = $watch_table; |
77 | - $this->categories_table = $categories_table; |
|
77 | + $this->categories_table = $categories_table; |
|
78 | 78 | } |
79 | 79 | /** |
80 | 80 | * Return ext name |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function get_ext_name($web_root_path = false) |
86 | 86 | { |
87 | - return (($web_root_path) ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name); |
|
87 | + return (($web_root_path) ? $this->path_helper->get_web_root_path() : '').$this->extension_manager->get_extension_path($this->ext_name); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function get_img_path($type, $image = '') |
98 | 98 | { |
99 | - return $this->get_ext_name(true) . 'images/' . $type . '/' . $image; |
|
99 | + return $this->get_ext_name(true).'images/'.$type.'/'.$image; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function get_banner_path($banner = '') |
109 | 109 | { |
110 | - return $this->path_helper->get_phpbb_root_path() . 'files/' . $this->get_ext_name() . 'banners/' . $banner; |
|
110 | + return $this->path_helper->get_phpbb_root_path().'files/'.$this->get_ext_name().'banners/'.$banner; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\language\language $language, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\cron\manager $cron) |
62 | 62 | { |
63 | - $this->db = $db; |
|
64 | - $this->config = $config; |
|
63 | + $this->db = $db; |
|
64 | + $this->config = $config; |
|
65 | 65 | $this->language = $language; |
66 | 66 | $this->template = $template; |
67 | 67 | $this->user = $user; |
68 | - $this->helper = $helper; |
|
69 | - $this->request = $request; |
|
68 | + $this->helper = $helper; |
|
69 | + $this->request = $request; |
|
70 | 70 | $this->auth = $auth; |
71 | 71 | $this->cron = $cron; |
72 | 72 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function make_cat_jumpbox() |
91 | 91 | { |
92 | 92 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
93 | - FROM ' . $this->categories_table . ' |
|
93 | + FROM ' . $this->categories_table.' |
|
94 | 94 | ORDER BY left_id ASC'; |
95 | 95 | $result = $this->db->sql_query($sql, 600); |
96 | 96 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | 'FORUM_ID' => $row['cat_id'], |
120 | 120 | 'FORUM_NAME' => $row['cat_name'], |
121 | 121 | 'S_FORUM_COUNT' => $iteration, |
122 | - 'LINK' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id']), |
|
122 | + 'LINK' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id']), |
|
123 | 123 | )); |
124 | 124 | |
125 | 125 | for ($i = 0; $i < $padding; $i++) |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | // This query is identical to the jumpbox one |
153 | 153 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
154 | - FROM ' . $this->categories_table . ' |
|
154 | + FROM ' . $this->categories_table.' |
|
155 | 155 | ORDER BY left_id ASC'; |
156 | 156 | $result = $this->db->sql_query($sql); |
157 | 157 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | $selected = (($row['cat_id'] == $select_id) ? ' selected="selected"' : ''); |
184 | - $cat_list .= '<option value="' . $row['cat_id'] . '"' . (($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected) . '>' . $padding . $row['cat_name'] . '</option>'; |
|
184 | + $cat_list .= '<option value="'.$row['cat_id'].'"'.(($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected).'>'.$padding.$row['cat_name'].'</option>'; |
|
185 | 185 | } |
186 | 186 | $this->db->sql_freeresult($result); |
187 | 187 | unset($padding_store); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function display() |
198 | 198 | { |
199 | - $cat_rows = $subcats = array(); |
|
199 | + $cat_rows = $subcats = array(); |
|
200 | 200 | $parent_id = $visible_cats = 0; |
201 | 201 | |
202 | 202 | $sql_array = array( |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | else |
215 | 215 | { |
216 | 216 | $root_data = $this->data; |
217 | - $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id']; |
|
217 | + $sql_where = 'left_id > '.$root_data['left_id'].' AND left_id < '.$root_data['right_id']; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | $sql = $this->db->sql_build_query('SELECT', array( |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | { |
262 | 262 | foreach ($subcats[$dir_cat_id] as $subcat_id => $subcat_row) |
263 | 263 | { |
264 | - $row['cat_links'] = ($row['cat_count_all']) ? ($row['cat_links']+$subcat_row['links']) : $row['cat_links']; |
|
264 | + $row['cat_links'] = ($row['cat_count_all']) ? ($row['cat_links'] + $subcat_row['links']) : $row['cat_links']; |
|
265 | 265 | |
266 | 266 | if ($subcat_row['display'] && $subcat_row['parent_id'] == $dir_cat_id) |
267 | 267 | { |
268 | 268 | $subcats_list[] = array( |
269 | - 'link' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $subcat_id), |
|
269 | + 'link' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$subcat_id), |
|
270 | 270 | 'name' => $subcat_row['name'], |
271 | 271 | 'links' => $subcat_row['links'] |
272 | 272 | ); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | 'CAT_LINKS' => $row['cat_links'], |
285 | 285 | 'CAT_IMG' => $this->get_img_path('icons', $row['cat_icon']), |
286 | 286 | |
287 | - 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id']), |
|
287 | + 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id']), |
|
288 | 288 | )); |
289 | 289 | |
290 | 290 | // Assign subcats loop for style authors |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | if ($task->is_ready()) |
317 | 317 | { |
318 | 318 | $url = $task->get_url(); |
319 | - $this->template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="" />'); |
|
319 | + $this->template->assign_var('RUN_CRON_TASK', '<img src="'.$url.'" width="1" height="1" alt="" />'); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | 'LEFT_JOIN' => array( |
339 | 339 | array( |
340 | 340 | 'FROM' => array($this->watch_table => 'w'), |
341 | - 'ON' => 'c.cat_id = w.cat_id AND w.user_id = ' . (int) $this->user->data['user_id'] |
|
341 | + 'ON' => 'c.cat_id = w.cat_id AND w.user_id = '.(int) $this->user->data['user_id'] |
|
342 | 342 | ), |
343 | 343 | ), |
344 | - 'WHERE' => 'c.cat_id = ' . (int) $cat_id |
|
344 | + 'WHERE' => 'c.cat_id = '.(int) $cat_id |
|
345 | 345 | ); |
346 | 346 | $sql = $this->db->sql_build_query('SELECT', $sql_array); |
347 | 347 | $result = $this->db->sql_query($sql); |
@@ -378,8 +378,8 @@ discard block |
||
378 | 378 | $this->template->assign_block_vars('dir_navlinks', array( |
379 | 379 | 'FORUM_NAME' => $parent_data['cat_name'], |
380 | 380 | 'FORUM_ID' => $parent_cat_id, |
381 | - 'MICRODATA' => $microdata_attr . '="' . $parent_cat_id . '"', |
|
382 | - 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $parent_cat_id), |
|
381 | + 'MICRODATA' => $microdata_attr.'="'.$parent_cat_id.'"', |
|
382 | + 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$parent_cat_id), |
|
383 | 383 | )); |
384 | 384 | } |
385 | 385 | } |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | $this->template->assign_block_vars('dir_navlinks', array( |
388 | 388 | 'FORUM_NAME' => $dir_cat_data['cat_name'], |
389 | 389 | 'FORUM_ID' => $dir_cat_data['cat_id'], |
390 | - 'MICRODATA' => $microdata_attr . '="' . $dir_cat_data['cat_id'] . '"', |
|
391 | - 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $dir_cat_data['cat_id']), |
|
390 | + 'MICRODATA' => $microdata_attr.'="'.$dir_cat_data['cat_id'].'"', |
|
391 | + 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$dir_cat_data['cat_id']), |
|
392 | 392 | )); |
393 | 393 | |
394 | 394 | return; |
@@ -444,17 +444,17 @@ discard block |
||
444 | 444 | { |
445 | 445 | if ($mode == 'unwatch') |
446 | 446 | { |
447 | - $sql = 'DELETE FROM ' . $this->watch_table . " |
|
447 | + $sql = 'DELETE FROM '.$this->watch_table." |
|
448 | 448 | WHERE cat_id = $cat_id |
449 | 449 | AND user_id = $user_id"; |
450 | 450 | $this->db->sql_query($sql); |
451 | 451 | |
452 | - $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
452 | + $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
453 | 453 | $message = $this->language->lang('DIR_NOT_WATCHING_CAT'); |
454 | 454 | |
455 | 455 | if (!$this->request->is_ajax()) |
456 | 456 | { |
457 | - $message .= '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $redirect_url . '">', '</a>'); |
|
457 | + $message .= '<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$redirect_url.'">', '</a>'); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | meta_refresh(3, $redirect_url); |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | |
467 | 467 | if ($notify_status != NOTIFY_YES) |
468 | 468 | { |
469 | - $sql = 'UPDATE ' . $this->watch_table . ' |
|
470 | - SET notify_status = ' . NOTIFY_YES . " |
|
469 | + $sql = 'UPDATE '.$this->watch_table.' |
|
470 | + SET notify_status = ' . NOTIFY_YES." |
|
471 | 471 | WHERE cat_id = $cat_id |
472 | 472 | AND user_id = $user_id"; |
473 | 473 | $this->db->sql_query($sql); |
@@ -478,16 +478,16 @@ discard block |
||
478 | 478 | { |
479 | 479 | if ($mode == 'watch') |
480 | 480 | { |
481 | - $sql = 'INSERT INTO ' . $this->watch_table . " (user_id, cat_id, notify_status) |
|
482 | - VALUES ($user_id, $cat_id, " . NOTIFY_YES . ')'; |
|
481 | + $sql = 'INSERT INTO '.$this->watch_table." (user_id, cat_id, notify_status) |
|
482 | + VALUES ($user_id, $cat_id, ".NOTIFY_YES.')'; |
|
483 | 483 | $this->db->sql_query($sql); |
484 | 484 | |
485 | - $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
485 | + $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
486 | 486 | $message = $this->language->lang('DIR_ARE_WATCHING_CAT'); |
487 | 487 | |
488 | 488 | if (!$this->request->is_ajax()) |
489 | 489 | { |
490 | - $message .= '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $redirect_url . '">', '</a>'); |
|
490 | + $message .= '<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$redirect_url.'">', '</a>'); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | meta_refresh(3, $redirect_url); |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | |
508 | 508 | if ($can_watch) |
509 | 509 | { |
510 | - $s_watching['link'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => (($is_watching) ? 'unwatch' : 'watch'))); |
|
510 | + $s_watching['link'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => (($is_watching) ? 'unwatch' : 'watch'))); |
|
511 | 511 | $s_watching['link_toggle'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => ((!$is_watching) ? 'unwatch' : 'watch'))); |
512 | - $s_watching['title'] = $this->language->lang((($is_watching) ? 'DIR_STOP' : 'DIR_START') . '_WATCHING_CAT'); |
|
513 | - $s_watching['title_toggle'] = $this->language->lang(((!$is_watching) ? 'DIR_STOP' : 'DIR_START') . '_WATCHING_CAT'); |
|
512 | + $s_watching['title'] = $this->language->lang((($is_watching) ? 'DIR_STOP' : 'DIR_START').'_WATCHING_CAT'); |
|
513 | + $s_watching['title_toggle'] = $this->language->lang(((!$is_watching) ? 'DIR_STOP' : 'DIR_START').'_WATCHING_CAT'); |
|
514 | 514 | $s_watching['is_watching'] = $is_watching; |
515 | 515 | } |
516 | 516 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $categories_table = $phpbb_container->getParameter('tables.dir.categories'); |
531 | 531 | |
532 | 532 | $sql = 'SELECT cat_name |
533 | - FROM ' . $categories_table . ' |
|
533 | + FROM ' . $categories_table.' |
|
534 | 534 | WHERE cat_id = ' . (int) $cat_id; |
535 | 535 | $result = $db->sql_query($sql); |
536 | 536 | $row = $db->sql_fetchrow($result); |