@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | return array( |
| 30 | 30 | 'add_columns' => array( |
| 31 | - $this->table_prefix . 'directory_cats' => array( |
|
| 31 | + $this->table_prefix.'directory_cats' => array( |
|
| 32 | 32 | 'cat_route' => array('VCHAR', '', 'after' => 'cat_name'), |
| 33 | 33 | ) |
| 34 | 34 | ), |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | return array( |
| 54 | 54 | 'drop_columns' => array( |
| 55 | - $this->table_prefix . 'directory_cats' => array( |
|
| 55 | + $this->table_prefix.'directory_cats' => array( |
|
| 56 | 56 | 'cat_route', |
| 57 | 57 | ), |
| 58 | 58 | ), |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $slug = new \E1379\SpeakingUrl\SpeakingUrl(); |
| 65 | 65 | |
| 66 | - $sql = 'SELECT cat_id, cat_name FROM ' . $this->table_prefix . 'directory_cats'; |
|
| 66 | + $sql = 'SELECT cat_id, cat_name FROM '.$this->table_prefix.'directory_cats'; |
|
| 67 | 67 | $result = $this->db->sql_query($sql); |
| 68 | 68 | |
| 69 | 69 | while ($row = $this->db->sql_fetchrow($result)) |
| 70 | 70 | { |
| 71 | - $sql = 'UPDATE ' . $this->table_prefix . 'directory_cats' . ' |
|
| 72 | - SET cat_route = "' . (string) $slug->getSlug($row['cat_name'], array('lang' => $this->config['default_lang'], 'symbols' => true)). '" |
|
| 71 | + $sql = 'UPDATE '.$this->table_prefix.'directory_cats'.' |
|
| 72 | + SET cat_route = "' . (string) $slug->getSlug($row['cat_name'], array('lang' => $this->config['default_lang'], 'symbols' => true)).'" |
|
| 73 | 73 | WHERE cat_id = ' . (int) $row['cat_id']; |
| 74 | 74 | $this->db->sql_query($sql); |
| 75 | 75 | } |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * @inheritDoc |
|
| 24 | - */ |
|
| 23 | + * @inheritDoc |
|
| 24 | + */ |
|
| 25 | 25 | public function update_schema() |
| 26 | 26 | { |
| 27 | 27 | return array( |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * @inheritDoc |
|
| 38 | - */ |
|
| 37 | + * @inheritDoc |
|
| 38 | + */ |
|
| 39 | 39 | public function update_data() |
| 40 | 40 | { |
| 41 | 41 | return array( |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * @inheritDoc |
|
| 48 | - */ |
|
| 47 | + * @inheritDoc |
|
| 48 | + */ |
|
| 49 | 49 | public function revert_schema() |
| 50 | 50 | { |
| 51 | 51 | return array( |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | return array( |
| 39 | 39 | 'drop_columns' => array( |
| 40 | - $this->table_prefix . 'directory_links' => array( |
|
| 40 | + $this->table_prefix.'directory_links' => array( |
|
| 41 | 41 | 'link_pagerank', |
| 42 | 42 | ), |
| 43 | 43 | ), |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | return array( |
| 50 | 50 | 'add_columns' => array( |
| 51 | - $this->table_prefix . 'directory_links' => array( |
|
| 51 | + $this->table_prefix.'directory_links' => array( |
|
| 52 | 52 | 'link_pagerank' => array('CHAR:2', ''), |
| 53 | 53 | ), |
| 54 | 54 | ), |
@@ -57,23 +57,23 @@ discard block |
||
| 57 | 57 | protected $php_ext; |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Constructor |
|
| 61 | - * |
|
| 62 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 63 | - * @param \phpbb\config\config $config Config object |
|
| 64 | - * @param \phpbb\language\language $language Language object |
|
| 65 | - * @param \phpbb\template\template $template Template object |
|
| 66 | - * @param \phpbb\user $user User object |
|
| 67 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
| 68 | - * @param \phpbb\request\request $request Request object |
|
| 69 | - * @param \phpbb\auth\auth $auth Auth object |
|
| 70 | - * @param \phpbb\notification\manager $notification Notification object |
|
| 71 | - * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper |
|
| 72 | - * @param \FastImageSize\FastImageSize $imagesize FastImageSize class |
|
| 73 | - * @param \phpbb\files\factory $files_factory File classes factory |
|
| 74 | - * @param string $root_path phpBB root path |
|
| 75 | - * @param string $php_ext phpEx |
|
| 76 | - */ |
|
| 60 | + * Constructor |
|
| 61 | + * |
|
| 62 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 63 | + * @param \phpbb\config\config $config Config object |
|
| 64 | + * @param \phpbb\language\language $language Language object |
|
| 65 | + * @param \phpbb\template\template $template Template object |
|
| 66 | + * @param \phpbb\user $user User object |
|
| 67 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
| 68 | + * @param \phpbb\request\request $request Request object |
|
| 69 | + * @param \phpbb\auth\auth $auth Auth object |
|
| 70 | + * @param \phpbb\notification\manager $notification Notification object |
|
| 71 | + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper |
|
| 72 | + * @param \FastImageSize\FastImageSize $imagesize FastImageSize class |
|
| 73 | + * @param \phpbb\files\factory $files_factory File classes factory |
|
| 74 | + * @param string $root_path phpBB root path |
|
| 75 | + * @param string $php_ext phpEx |
|
| 76 | + */ |
|
| 77 | 77 | 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\notification\manager $notification, \phpbb\filesystem\filesystem_interface $filesystem, \FastImageSize\FastImageSize $imagesize, \phpbb\files\factory $files_factory, $root_path, $php_ext) |
| 78 | 78 | { |
| 79 | 79 | $this->db = $db; |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * Add a link into db |
|
| 97 | - * |
|
| 98 | - * @param array $data Contains all data to insert in db |
|
| 99 | - * @param bool $need_approval Links needs to be approved? |
|
| 100 | - * @return null |
|
| 101 | - */ |
|
| 96 | + * Add a link into db |
|
| 97 | + * |
|
| 98 | + * @param array $data Contains all data to insert in db |
|
| 99 | + * @param bool $need_approval Links needs to be approved? |
|
| 100 | + * @return null |
|
| 101 | + */ |
|
| 102 | 102 | public function add($data, $need_approval) |
| 103 | 103 | { |
| 104 | 104 | $notification_data = array(); |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * Edit a link of the db |
|
| 147 | - * |
|
| 148 | - * @param array $data Contains all data to edit in db |
|
| 149 | - * @param int $link_id is link's id, for WHERE clause |
|
| 150 | - * @param bool $need_approval Links needs to be approved? |
|
| 151 | - * @return null |
|
| 152 | - */ |
|
| 146 | + * Edit a link of the db |
|
| 147 | + * |
|
| 148 | + * @param array $data Contains all data to edit in db |
|
| 149 | + * @param int $link_id is link's id, for WHERE clause |
|
| 150 | + * @param bool $need_approval Links needs to be approved? |
|
| 151 | + * @return null |
|
| 152 | + */ |
|
| 153 | 153 | public function edit($data, $link_id, $need_approval) |
| 154 | 154 | { |
| 155 | 155 | $notification_data = array( |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | - * Delete a link of the db |
|
| 205 | - * |
|
| 206 | - * @param int $cat_id The category ID |
|
| 207 | - * @param mixed $link_id Link's id, for WHERE clause |
|
| 208 | - * @return null |
|
| 209 | - */ |
|
| 204 | + * Delete a link of the db |
|
| 205 | + * |
|
| 206 | + * @param int $cat_id The category ID |
|
| 207 | + * @param mixed $link_id Link's id, for WHERE clause |
|
| 208 | + * @return null |
|
| 209 | + */ |
|
| 210 | 210 | public function del($cat_id, $link_id) |
| 211 | 211 | { |
| 212 | 212 | $this->db->sql_transaction('begin'); |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | - * Increments link view counter |
|
| 283 | - * |
|
| 284 | - * @param int $link_id Link's id, for WHERE clause |
|
| 285 | - * @return null |
|
| 286 | - * @throws \phpbb\exception\http_exception |
|
| 287 | - */ |
|
| 282 | + * Increments link view counter |
|
| 283 | + * |
|
| 284 | + * @param int $link_id Link's id, for WHERE clause |
|
| 285 | + * @return null |
|
| 286 | + * @throws \phpbb\exception\http_exception |
|
| 287 | + */ |
|
| 288 | 288 | public function view($link_id) |
| 289 | 289 | { |
| 290 | 290 | $sql = 'SELECT link_id, link_url |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | - * Verify that an URL exist before add into db |
|
| 312 | - * |
|
| 313 | - * @param string $url The URL to check |
|
| 314 | - * @return bool True if url is reachable, else false. |
|
| 315 | - */ |
|
| 311 | + * Verify that an URL exist before add into db |
|
| 312 | + * |
|
| 313 | + * @param string $url The URL to check |
|
| 314 | + * @return bool True if url is reachable, else false. |
|
| 315 | + */ |
|
| 316 | 316 | public function checkurl($url) |
| 317 | 317 | { |
| 318 | 318 | $details = parse_url($url); |
@@ -351,11 +351,11 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | - * Delete the final '/', if no path |
|
| 355 | - * |
|
| 356 | - * @param string $url URL to clean |
|
| 357 | - * @return string $url The correct string. |
|
| 358 | - */ |
|
| 354 | + * Delete the final '/', if no path |
|
| 355 | + * |
|
| 356 | + * @param string $url URL to clean |
|
| 357 | + * @return string $url The correct string. |
|
| 358 | + */ |
|
| 359 | 359 | public function clean_url($url) |
| 360 | 360 | { |
| 361 | 361 | $details = parse_url($url); |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
| 371 | - * Display a flag |
|
| 372 | - * |
|
| 373 | - * @param array $data Link's data from db |
|
| 374 | - * @return string Flag path. |
|
| 375 | - */ |
|
| 371 | + * Display a flag |
|
| 372 | + * |
|
| 373 | + * @param array $data Link's data from db |
|
| 374 | + * @return string Flag path. |
|
| 375 | + */ |
|
| 376 | 376 | public function display_flag($data) |
| 377 | 377 | { |
| 378 | 378 | global $phpbb_extension_manager; |
@@ -390,13 +390,13 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
| 393 | - * Calculate the link's note |
|
| 394 | - * |
|
| 395 | - * @param int $total_note Sum of all link's notes |
|
| 396 | - * @param int $nb_vote Number of votes |
|
| 397 | - * @param bool $votes_status Votes are enable in this category? |
|
| 398 | - * @return string $note The calculated note. |
|
| 399 | - */ |
|
| 393 | + * Calculate the link's note |
|
| 394 | + * |
|
| 395 | + * @param int $total_note Sum of all link's notes |
|
| 396 | + * @param int $nb_vote Number of votes |
|
| 397 | + * @param bool $votes_status Votes are enable in this category? |
|
| 398 | + * @return string $note The calculated note. |
|
| 399 | + */ |
|
| 400 | 400 | public function display_note($total_note, $nb_vote, $votes_status) |
| 401 | 401 | { |
| 402 | 402 | if (!$votes_status) |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | - * Display the vote form for auth users |
|
| 415 | - * |
|
| 416 | - * @param array $data Link's data from db |
|
| 417 | - * @return null|string Html combo list or nothing if votes are not available. |
|
| 418 | - */ |
|
| 414 | + * Display the vote form for auth users |
|
| 415 | + * |
|
| 416 | + * @param array $data Link's data from db |
|
| 417 | + * @return null|string Html combo list or nothing if votes are not available. |
|
| 418 | + */ |
|
| 419 | 419 | public function display_vote($data) |
| 420 | 420 | { |
| 421 | 421 | if ($this->user->data['is_registered'] && $this->auth->acl_get('u_vote_dir') && empty($data['vote_user_id'])) |
@@ -432,11 +432,11 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
| 435 | - * Display the RSS icon |
|
| 436 | - * |
|
| 437 | - * @param array $data Link's data from db |
|
| 438 | - * @return null|string RSS feed URL or nothing. |
|
| 439 | - */ |
|
| 435 | + * Display the RSS icon |
|
| 436 | + * |
|
| 437 | + * @param array $data Link's data from db |
|
| 438 | + * @return null|string RSS feed URL or nothing. |
|
| 439 | + */ |
|
| 440 | 440 | public function display_rss($data) |
| 441 | 441 | { |
| 442 | 442 | if ($this->config['dir_activ_rss'] && !empty($data['link_rss'])) |
@@ -446,13 +446,13 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | - * Display link's thumb if thumb service enabled. |
|
| 450 | - * if thumb don't exists in db or if a new service was choosen in acp |
|
| 451 | - * thumb is research |
|
| 452 | - * |
|
| 453 | - * @param array $data Link's data from db |
|
| 454 | - * @return string|null Thumb or null. |
|
| 455 | - */ |
|
| 449 | + * Display link's thumb if thumb service enabled. |
|
| 450 | + * if thumb don't exists in db or if a new service was choosen in acp |
|
| 451 | + * thumb is research |
|
| 452 | + * |
|
| 453 | + * @param array $data Link's data from db |
|
| 454 | + * @return string|null Thumb or null. |
|
| 455 | + */ |
|
| 456 | 456 | public function display_thumb($data) |
| 457 | 457 | { |
| 458 | 458 | if ($this->config['dir_activ_thumb']) |
@@ -473,11 +473,11 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
| 476 | - * Display and resize a banner |
|
| 477 | - * |
|
| 478 | - * @param array $data link's data from db |
|
| 479 | - * @return string $s_banner html code. |
|
| 480 | - */ |
|
| 476 | + * Display and resize a banner |
|
| 477 | + * |
|
| 478 | + * @param array $data link's data from db |
|
| 479 | + * @return string $s_banner html code. |
|
| 480 | + */ |
|
| 481 | 481 | public function display_bann($data) |
| 482 | 482 | { |
| 483 | 483 | if (!empty($data['link_banner'])) |
@@ -515,11 +515,11 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
| 518 | - * Add a vote in db, for a specifi link |
|
| 519 | - * |
|
| 520 | - * @param int $link_id Link_id from db |
|
| 521 | - * @return null |
|
| 522 | - */ |
|
| 518 | + * Add a vote in db, for a specifi link |
|
| 519 | + * |
|
| 520 | + * @param int $link_id Link_id from db |
|
| 521 | + * @return null |
|
| 522 | + */ |
|
| 523 | 523 | public function add_vote($link_id) |
| 524 | 524 | { |
| 525 | 525 | $data = array( |
@@ -563,11 +563,11 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
| 566 | - * Search an appropriate thumb for url |
|
| 567 | - * |
|
| 568 | - * @param string $url Link's url |
|
| 569 | - * @return string The thumb url |
|
| 570 | - */ |
|
| 566 | + * Search an appropriate thumb for url |
|
| 567 | + * |
|
| 568 | + * @param string $url Link's url |
|
| 569 | + * @return string The thumb url |
|
| 570 | + */ |
|
| 571 | 571 | public function thumb_process($url) |
| 572 | 572 | { |
| 573 | 573 | if (!$this->config['dir_activ_thumb']) |
@@ -588,12 +588,12 @@ discard block |
||
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /** |
| 591 | - * Check if ascreen thumb exists |
|
| 592 | - * |
|
| 593 | - * @param string $protocol The protocol |
|
| 594 | - * @param string $host The hostname |
|
| 595 | - * @return bool True if ascreen file exixts, else false |
|
| 596 | - */ |
|
| 591 | + * Check if ascreen thumb exists |
|
| 592 | + * |
|
| 593 | + * @param string $protocol The protocol |
|
| 594 | + * @param string $host The hostname |
|
| 595 | + * @return bool True if ascreen file exixts, else false |
|
| 596 | + */ |
|
| 597 | 597 | private function _ascreen_exist($protocol, $host) |
| 598 | 598 | { |
| 599 | 599 | if (($thumb_info = $this->imagesize->getImageSize($protocol.'://'.$host.'/ascreen.jpg')) !== false) |
@@ -608,12 +608,12 @@ discard block |
||
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | /** |
| 611 | - * Primary work on banner, can edit, copy or check a banner |
|
| 612 | - * |
|
| 613 | - * @param string $banner The banner's remote url |
|
| 614 | - * @param array $error The array error, passed by reference |
|
| 615 | - * @return null |
|
| 616 | - */ |
|
| 611 | + * Primary work on banner, can edit, copy or check a banner |
|
| 612 | + * |
|
| 613 | + * @param string $banner The banner's remote url |
|
| 614 | + * @param array $error The array error, passed by reference |
|
| 615 | + * @return null |
|
| 616 | + */ |
|
| 617 | 617 | public function banner_process(&$banner, &$error) |
| 618 | 618 | { |
| 619 | 619 | $old_banner = $this->request->variable('old_banner', ''); |
@@ -649,13 +649,13 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
| 652 | - * Copy a remonte banner to server. |
|
| 653 | - * called by banner_process() |
|
| 654 | - * |
|
| 655 | - * @param string $banner The banner's remote url |
|
| 656 | - * @param array $error The array error, passed by reference |
|
| 657 | - * @return false|string String if no errors, else false |
|
| 658 | - */ |
|
| 652 | + * Copy a remonte banner to server. |
|
| 653 | + * called by banner_process() |
|
| 654 | + * |
|
| 655 | + * @param string $banner The banner's remote url |
|
| 656 | + * @param array $error The array error, passed by reference |
|
| 657 | + * @return false|string String if no errors, else false |
|
| 658 | + */ |
|
| 659 | 659 | private function _banner_upload($banner, &$error) |
| 660 | 660 | { |
| 661 | 661 | /** @var \phpbb\files\upload $upload */ |
@@ -687,13 +687,13 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /** |
| 690 | - * Check than remote banner exists |
|
| 691 | - * called by banner_process() |
|
| 692 | - * |
|
| 693 | - * @param string $banner The banner's remote url |
|
| 694 | - * @param array $error The array error, passed by reference |
|
| 695 | - * @return false|string String if no errors, else false |
|
| 696 | - */ |
|
| 690 | + * Check than remote banner exists |
|
| 691 | + * called by banner_process() |
|
| 692 | + * |
|
| 693 | + * @param string $banner The banner's remote url |
|
| 694 | + * @param array $error The array error, passed by reference |
|
| 695 | + * @return false|string String if no errors, else false |
|
| 696 | + */ |
|
| 697 | 697 | private function _banner_remote($banner, &$error) |
| 698 | 698 | { |
| 699 | 699 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
@@ -801,11 +801,11 @@ discard block |
||
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | - * Delete a banner from server |
|
| 805 | - * |
|
| 806 | - * @param string $file The file's name |
|
| 807 | - * @return bool True if delete success, else false |
|
| 808 | - */ |
|
| 804 | + * Delete a banner from server |
|
| 805 | + * |
|
| 806 | + * @param string $file The file's name |
|
| 807 | + * @return bool True if delete success, else false |
|
| 808 | + */ |
|
| 809 | 809 | private function _banner_delete($file) |
| 810 | 810 | { |
| 811 | 811 | if (file_exists($this->get_banner_path($file))) |
@@ -818,12 +818,12 @@ discard block |
||
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
| 821 | - * List flags |
|
| 822 | - * |
|
| 823 | - * @param string $flag_path The flag directory path |
|
| 824 | - * @param string $value Selected flag |
|
| 825 | - * @return string $list Html code |
|
| 826 | - */ |
|
| 821 | + * List flags |
|
| 822 | + * |
|
| 823 | + * @param string $flag_path The flag directory path |
|
| 824 | + * @param string $value Selected flag |
|
| 825 | + * @return string $list Html code |
|
| 826 | + */ |
|
| 827 | 827 | public function get_dir_flag_list($flag_path, $value) |
| 828 | 828 | { |
| 829 | 829 | $list = ''; |
@@ -858,10 +858,10 @@ discard block |
||
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
| 861 | - * Display recents links added |
|
| 862 | - * |
|
| 863 | - * @return null |
|
| 864 | - */ |
|
| 861 | + * Display recents links added |
|
| 862 | + * |
|
| 863 | + * @return null |
|
| 864 | + */ |
|
| 865 | 865 | public function recents() |
| 866 | 866 | { |
| 867 | 867 | if ($this->config['dir_recent_block']) |
@@ -938,13 +938,13 @@ discard block |
||
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | - * Validate back link |
|
| 942 | - * |
|
| 943 | - * @param string $remote_url Page URL contains the backlink |
|
| 944 | - * @param bool $optional Link back is optional in this category? |
|
| 945 | - * @param bool $cron This methos is called by con process? |
|
| 946 | - * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) |
|
| 947 | - */ |
|
| 941 | + * Validate back link |
|
| 942 | + * |
|
| 943 | + * @param string $remote_url Page URL contains the backlink |
|
| 944 | + * @param bool $optional Link back is optional in this category? |
|
| 945 | + * @param bool $cron This methos is called by con process? |
|
| 946 | + * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) |
|
| 947 | + */ |
|
| 948 | 948 | public function validate_link_back($remote_url, $optional, $cron = false) |
| 949 | 949 | { |
| 950 | 950 | if (!$cron) |
@@ -76,20 +76,20 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | 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\notification\manager $notification, \phpbb\filesystem\filesystem_interface $filesystem, \FastImageSize\FastImageSize $imagesize, \phpbb\files\factory $files_factory, $root_path, $php_ext) |
| 78 | 78 | { |
| 79 | - $this->db = $db; |
|
| 80 | - $this->config = $config; |
|
| 79 | + $this->db = $db; |
|
| 80 | + $this->config = $config; |
|
| 81 | 81 | $this->language = $language; |
| 82 | 82 | $this->template = $template; |
| 83 | 83 | $this->user = $user; |
| 84 | - $this->helper = $helper; |
|
| 85 | - $this->request = $request; |
|
| 84 | + $this->helper = $helper; |
|
| 85 | + $this->request = $request; |
|
| 86 | 86 | $this->auth = $auth; |
| 87 | - $this->notification = $notification; |
|
| 88 | - $this->filesystem = $filesystem; |
|
| 87 | + $this->notification = $notification; |
|
| 88 | + $this->filesystem = $filesystem; |
|
| 89 | 89 | $this->imagesize = $imagesize; |
| 90 | - $this->files_factory = $files_factory; |
|
| 90 | + $this->files_factory = $files_factory; |
|
| 91 | 91 | $this->root_path = $root_path; |
| 92 | - $this->php_ext = $php_ext; |
|
| 92 | + $this->php_ext = $php_ext; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $this->db->sql_transaction('begin'); |
| 107 | 107 | |
| 108 | - $sql = 'INSERT INTO ' . $this->links_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 108 | + $sql = 'INSERT INTO '.$this->links_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
| 109 | 109 | $this->db->sql_query($sql); |
| 110 | 110 | $notification_data['link_id'] = $this->db->sql_nextid(); |
| 111 | 111 | |
| 112 | 112 | if (!$need_approval || $this->auth->acl_get('a_') || $this->auth->acl_get('m_')) |
| 113 | 113 | { |
| 114 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 114 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 115 | 115 | SET cat_links = cat_links + 1 |
| 116 | 116 | WHERE cat_id = ' . (int) $data['link_cat']; |
| 117 | 117 | $this->db->sql_query($sql); |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $this->db->sql_transaction('begin'); |
| 171 | 171 | |
| 172 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 172 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 173 | 173 | SET cat_links = cat_links - 1 |
| 174 | 174 | WHERE cat_id = ' . (int) $old_cat; |
| 175 | 175 | $this->db->sql_query($sql); |
| 176 | 176 | |
| 177 | 177 | if (!$need_approval) |
| 178 | 178 | { |
| 179 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 179 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 180 | 180 | SET cat_links = cat_links + 1 |
| 181 | 181 | WHERE cat_id = ' . (int) $data['link_cat']; |
| 182 | 182 | $this->db->sql_query($sql); |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $this->notification->add_notifications($notification_type, $notification_data); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 198 | - SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
| 197 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 198 | + SET ' . $this->db->sql_build_array('UPDATE', $data).' |
|
| 199 | 199 | WHERE link_id = ' . (int) $link_id; |
| 200 | 200 | $this->db->sql_query($sql); |
| 201 | 201 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | 223 | $sql = 'SELECT link_banner |
| 224 | - FROM ' . $this->links_table . ' |
|
| 224 | + FROM ' . $this->links_table.' |
|
| 225 | 225 | WHERE '. $this->db->sql_in_set('link_id', $url_array); |
| 226 | 226 | $result = $this->db->sql_query($sql); |
| 227 | 227 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $this->db->sql_query("DELETE FROM $table WHERE ".$this->db->sql_in_set($field, $url_array)); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
| 246 | + $sql = 'UPDATE '.$this->categories_table.' |
|
| 247 | 247 | SET cat_links = cat_links - '.sizeof($url_array).' |
| 248 | 248 | WHERE cat_id = ' . (int) $cat_id; |
| 249 | 249 | $this->db->sql_query($sql); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | if ($this->request->is_ajax()) |
| 262 | 262 | { |
| 263 | 263 | $sql = 'SELECT cat_links |
| 264 | - FROM ' . $this->categories_table . ' |
|
| 264 | + FROM ' . $this->categories_table.' |
|
| 265 | 265 | WHERE cat_id = ' . (int) $cat_id; |
| 266 | 266 | $result = $this->db->sql_query($sql); |
| 267 | 267 | $data = $this->db->sql_fetchrow($result); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | public function view($link_id) |
| 289 | 289 | { |
| 290 | 290 | $sql = 'SELECT link_id, link_url |
| 291 | - FROM ' . $this->links_table . ' |
|
| 291 | + FROM ' . $this->links_table.' |
|
| 292 | 292 | WHERE link_id = ' . (int) $link_id; |
| 293 | 293 | $result = $this->db->sql_query($sql); |
| 294 | 294 | $data = $this->db->sql_fetchrow($result); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_LINKS'); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 301 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 302 | 302 | SET link_view = link_view + 1 |
| 303 | 303 | WHERE link_id = ' . (int) $link_id; |
| 304 | 304 | $this->db->sql_query($sql); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | if ($details['scheme'] == 'https') |
| 324 | 324 | { |
| 325 | 325 | $default_port = 443; |
| 326 | - $hostname = 'tls://' . $details['host']; |
|
| 326 | + $hostname = 'tls://'.$details['host']; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | if (!isset($details['path'])) |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $flag_path = $ext_path.'images/flags/'; |
| 382 | 382 | $img_flag = 'no_flag.png'; |
| 383 | 383 | |
| 384 | - if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path . $data['link_flag'])) |
|
| 384 | + if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path.$data['link_flag'])) |
|
| 385 | 385 | { |
| 386 | 386 | $img_flag = $data['link_flag']; |
| 387 | 387 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $list = '<select name="vote">'; |
| 424 | 424 | for ($i = 0; $i <= 10; $i++) |
| 425 | 425 | { |
| 426 | - $list .= '<option value="' . $i . '"' . (($i == 5) ? ' selected="selected"' : '') . '>' . $i . '</option>'; |
|
| 426 | + $list .= '<option value="'.$i.'"'.(($i == 5) ? ' selected="selected"' : '').'>'.$i.'</option>'; |
|
| 427 | 427 | } |
| 428 | 428 | $list .= '</select>'; |
| 429 | 429 | |
@@ -461,8 +461,8 @@ discard block |
||
| 461 | 461 | { |
| 462 | 462 | $thumb = $this->thumb_process($data['link_url']); |
| 463 | 463 | |
| 464 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 465 | - SET link_thumb = "' . $this->db->sql_escape($thumb) . '" |
|
| 464 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 465 | + SET link_thumb = "' . $this->db->sql_escape($thumb).'" |
|
| 466 | 466 | WHERE link_id = ' . (int) $data['link_id']; |
| 467 | 467 | $this->db->sql_query($sql); |
| 468 | 468 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | $height /= $coef_max; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - return '<img src="' . $img_src . '" width="' . $width . '" height="' . $height . '" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
| 512 | + return '<img src="'.$img_src.'" width="'.$width.'" height="'.$height.'" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
| 513 | 513 | } |
| 514 | 514 | return ''; |
| 515 | 515 | } |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | $this->db->sql_transaction('begin'); |
| 532 | 532 | |
| 533 | - $sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 533 | + $sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
| 534 | 534 | $this->db->sql_query($sql); |
| 535 | 535 | |
| 536 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 536 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 537 | 537 | SET link_vote = link_vote + 1, |
| 538 | - link_note = link_note + ' . (int) $data['vote_note'] . ' |
|
| 538 | + link_note = link_note + ' . (int) $data['vote_note'].' |
|
| 539 | 539 | WHERE link_id = ' . (int) $link_id; |
| 540 | 540 | $this->db->sql_query($sql); |
| 541 | 541 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | if ($this->request->is_ajax()) |
| 545 | 545 | { |
| 546 | - $sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id; |
|
| 546 | + $sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id; |
|
| 547 | 547 | $result = $this->db->sql_query($sql); |
| 548 | 548 | $data = $this->db->sql_fetchrow($result); |
| 549 | 549 | |
@@ -577,8 +577,8 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | $details = parse_url($url); |
| 579 | 579 | |
| 580 | - $root_url = $details['scheme'].'://'.$details['host']; |
|
| 581 | - $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
| 580 | + $root_url = $details['scheme'].'://'.$details['host']; |
|
| 581 | + $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
| 582 | 582 | |
| 583 | 583 | if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host'])) |
| 584 | 584 | { |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $destination = $this->get_banner_path(); |
| 622 | 622 | |
| 623 | 623 | // Can we upload? |
| 624 | - $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($this->root_path . $destination) && $this->filesystem->is_writable($this->root_path . $destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
|
| 624 | + $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($this->root_path.$destination) && $this->filesystem->is_writable($this->root_path.$destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
|
| 625 | 625 | |
| 626 | 626 | if ($banner && $can_upload) |
| 627 | 627 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $file = $upload->handle_upload('files.types.remote', $banner); |
| 669 | 669 | |
| 670 | - $prefix = unique_id() . '_'; |
|
| 670 | + $prefix = unique_id().'_'; |
|
| 671 | 671 | $file->clean_filename('real', $prefix); |
| 672 | 672 | |
| 673 | 673 | if (sizeof($file->error)) |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | { |
| 699 | 699 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
| 700 | 700 | { |
| 701 | - $banner = 'http://' . $banner; |
|
| 701 | + $banner = 'http://'.$banner; |
|
| 702 | 702 | } |
| 703 | 703 | if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $banner)) |
| 704 | 704 | { |
@@ -729,8 +729,8 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | // Check image type |
| 732 | - $types = \phpbb\files\upload::image_types(); |
|
| 733 | - $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
| 732 | + $types = \phpbb\files\upload::image_types(); |
|
| 733 | + $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
| 734 | 734 | |
| 735 | 735 | // Check if this is actually an image |
| 736 | 736 | if ($file_stream = @fopen($banner, 'r')) |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | if (file_exists($flag_path.$img_file)) |
| 852 | 852 | { |
| 853 | - $list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>'; |
|
| 853 | + $list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>'; |
|
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | |
@@ -866,8 +866,8 @@ discard block |
||
| 866 | 866 | { |
| 867 | 867 | if ($this->config['dir_recent_block']) |
| 868 | 868 | { |
| 869 | - $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
| 870 | - $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); |
|
| 869 | + $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
| 870 | + $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); |
|
| 871 | 871 | |
| 872 | 872 | $sql_array = array( |
| 873 | 873 | 'SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_thumb, u.user_id, u.username, u.user_colour, c.cat_name', |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | if (sizeof($rowset)) |
| 901 | 901 | { |
| 902 | 902 | $this->template->assign_block_vars('block', array( |
| 903 | - 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']) . '%', |
|
| 903 | + 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']).'%', |
|
| 904 | 904 | )); |
| 905 | 905 | |
| 906 | 906 | foreach ($rowset as $row) |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | 'COUNT' => $row['link_view'], |
| 920 | 920 | 'COMMENT' => $row['link_comment'], |
| 921 | 921 | |
| 922 | - 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['link_cat']), |
|
| 922 | + 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['link_cat']), |
|
| 923 | 923 | 'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), |
| 924 | 924 | |
| 925 | 925 | 'L_DIR_SEARCH_NB_CLICKS' => $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | protected $categories_table; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Constructor |
|
| 30 | - * |
|
| 31 | - * @param \phpbb\db\driver\driver_interface $db Database connection |
|
| 32 | - * @param string $categories_table Table name |
|
| 33 | - * @access public |
|
| 34 | - */ |
|
| 29 | + * Constructor |
|
| 30 | + * |
|
| 31 | + * @param \phpbb\db\driver\driver_interface $db Database connection |
|
| 32 | + * @param string $categories_table Table name |
|
| 33 | + * @access public |
|
| 34 | + */ |
|
| 35 | 35 | public function __construct(\phpbb\db\driver\driver_interface $db, $categories_table) |
| 36 | 36 | { |
| 37 | 37 | $this->db = $db; |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * {@inheritdoc} |
|
| 43 | - * |
|
| 44 | - * @api |
|
| 45 | - */ |
|
| 42 | + * {@inheritdoc} |
|
| 43 | + * |
|
| 44 | + * @api |
|
| 45 | + */ |
|
| 46 | 46 | public function load($resource, $type = null) |
| 47 | 47 | { |
| 48 | 48 | $routes = new RouteCollection(); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * {@inheritdoc} |
|
| 82 | - * |
|
| 83 | - * @api |
|
| 84 | - */ |
|
| 81 | + * {@inheritdoc} |
|
| 82 | + * |
|
| 83 | + * @api |
|
| 84 | + */ |
|
| 85 | 85 | public function supports($resource, $type = null) |
| 86 | 86 | { |
| 87 | 87 | return $type === 'ernadoo_phpbbdirectory_route'; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct(\phpbb\db\driver\driver_interface $db, $categories_table) |
| 36 | 36 | { |
| 37 | - $this->db = $db; |
|
| 37 | + $this->db = $db; |
|
| 38 | 38 | $this->categories_table = $categories_table; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | while ($row = $this->db->sql_fetchrow($result)) |
| 68 | 68 | { |
| 69 | 69 | $defaults['cat_id'] = $row['cat_id']; |
| 70 | - $path = 'directory/' . $row['cat_route'] . '/{page}/{sort_days}/{sort_key}/{sort_dir}'; |
|
| 70 | + $path = 'directory/'.$row['cat_route'].'/{page}/{sort_days}/{sort_key}/{sort_dir}'; |
|
| 71 | 71 | |
| 72 | 72 | $route = new Route($path, $defaults, $requirements); |
| 73 | - $routes->add('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id'], $route); |
|
| 73 | + $routes->add('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id'], $route); |
|
| 74 | 74 | } |
| 75 | 75 | $this->db->sql_freeresult(); |
| 76 | 76 | |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | protected $link; |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Constructor |
|
| 54 | - * |
|
| 55 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 56 | - * @param \phpbb\config\config $config Config object |
|
| 57 | - * @param \phpbb\language\language $language Language object |
|
| 58 | - * @param \phpbb\template\template $template Template object |
|
| 59 | - * @param \phpbb\user $user User object |
|
| 60 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
| 61 | - * @param \phpbb\request\request $request Request object |
|
| 62 | - * @param \phpbb\auth\auth $auth Auth object |
|
| 63 | - * @param \phpbb\pagination $pagination Pagination object |
|
| 64 | - * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 65 | - * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
| 66 | - */ |
|
| 53 | + * Constructor |
|
| 54 | + * |
|
| 55 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 56 | + * @param \phpbb\config\config $config Config object |
|
| 57 | + * @param \phpbb\language\language $language Language object |
|
| 58 | + * @param \phpbb\template\template $template Template object |
|
| 59 | + * @param \phpbb\user $user User object |
|
| 60 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
| 61 | + * @param \phpbb\request\request $request Request object |
|
| 62 | + * @param \phpbb\auth\auth $auth Auth object |
|
| 63 | + * @param \phpbb\pagination $pagination Pagination object |
|
| 64 | + * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 65 | + * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
| 66 | + */ |
|
| 67 | 67 | 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\pagination $pagination, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link) |
| 68 | 68 | { |
| 69 | 69 | $this->db = $db; |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Base controller to be accessed with the URL /directory |
|
| 90 | - * |
|
| 91 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 92 | - */ |
|
| 89 | + * Base controller to be accessed with the URL /directory |
|
| 90 | + * |
|
| 91 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 92 | + */ |
|
| 93 | 93 | public function base() |
| 94 | 94 | { |
| 95 | 95 | $this->categorie->display(); |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * Legacy view controller for display a category |
|
| 103 | - * Used with /directory/categorie/{cat_id} |
|
| 104 | - * @deprecated 2.0.0 No longer used since dynamic routing. |
|
| 105 | - * |
|
| 106 | - * @param int $cat_id The category ID |
|
| 107 | - * @param int $page Page number taken from the URL |
|
| 108 | - * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 109 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v |
|
| 110 | - * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 111 | - * @param string $mode watch|unwatch |
|
| 112 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 113 | - * @throws \phpbb\exception\http_exception |
|
| 114 | - */ |
|
| 102 | + * Legacy view controller for display a category |
|
| 103 | + * Used with /directory/categorie/{cat_id} |
|
| 104 | + * @deprecated 2.0.0 No longer used since dynamic routing. |
|
| 105 | + * |
|
| 106 | + * @param int $cat_id The category ID |
|
| 107 | + * @param int $page Page number taken from the URL |
|
| 108 | + * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 109 | + * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v |
|
| 110 | + * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 111 | + * @param string $mode watch|unwatch |
|
| 112 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 113 | + * @throws \phpbb\exception\http_exception |
|
| 114 | + */ |
|
| 115 | 115 | public function view($cat_id, $page, $sort_days, $sort_key, $sort_dir, $mode = '') |
| 116 | 116 | { |
| 117 | 117 | $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page, 'sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir)); |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * View controller for display a category |
|
| 124 | - * |
|
| 125 | - * @param int $cat_id The category ID |
|
| 126 | - * @param int $page Page number taken from the URL |
|
| 127 | - * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 128 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
| 129 | - * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 130 | - * @param string $mode watch|unwatch |
|
| 131 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 132 | - * @throws \phpbb\exception\http_exception |
|
| 133 | - */ |
|
| 123 | + * View controller for display a category |
|
| 124 | + * |
|
| 125 | + * @param int $cat_id The category ID |
|
| 126 | + * @param int $page Page number taken from the URL |
|
| 127 | + * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
| 128 | + * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
| 129 | + * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
| 130 | + * @param string $mode watch|unwatch |
|
| 131 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
| 132 | + * @throws \phpbb\exception\http_exception |
|
| 133 | + */ |
|
| 134 | 134 | public function view_route($cat_id, $page = 1, $sort_days = 0, $sort_key = '', $sort_dir = '', $mode = '') |
| 135 | 135 | { |
| 136 | 136 | if (false === $this->categorie->get($cat_id)) |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
| 388 | - * date controller for return a date |
|
| 389 | - * |
|
| 390 | - * @return \phpbb\json_response A Json Response |
|
| 391 | - * @throws \phpbb\exception\http_exception |
|
| 392 | - */ |
|
| 388 | + * date controller for return a date |
|
| 389 | + * |
|
| 390 | + * @return \phpbb\json_response A Json Response |
|
| 391 | + * @throws \phpbb\exception\http_exception |
|
| 392 | + */ |
|
| 393 | 393 | public function return_date() |
| 394 | 394 | { |
| 395 | 395 | if (!$this->request->is_ajax()) |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | - * slug controller for return a slugify category name |
|
| 410 | - * |
|
| 411 | - * @return \phpbb\json_response A Json Response |
|
| 412 | - * @throws \phpbb\exception\http_exception |
|
| 413 | - */ |
|
| 409 | + * slug controller for return a slugify category name |
|
| 410 | + * |
|
| 411 | + * @return \phpbb\json_response A Json Response |
|
| 412 | + * @throws \phpbb\exception\http_exception |
|
| 413 | + */ |
|
| 414 | 414 | public function return_slug() |
| 415 | 415 | { |
| 416 | 416 | if (!$this->request->is_ajax()) |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | 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\pagination $pagination, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link) |
| 68 | 68 | { |
| 69 | - $this->db = $db; |
|
| 70 | - $this->config = $config; |
|
| 69 | + $this->db = $db; |
|
| 70 | + $this->config = $config; |
|
| 71 | 71 | $this->language = $language; |
| 72 | 72 | $this->template = $template; |
| 73 | 73 | $this->user = $user; |
| 74 | - $this->helper = $helper; |
|
| 75 | - $this->request = $request; |
|
| 74 | + $this->helper = $helper; |
|
| 75 | + $this->request = $request; |
|
| 76 | 76 | $this->auth = $auth; |
| 77 | - $this->pagination = $pagination; |
|
| 78 | - $this->categorie = $categorie; |
|
| 77 | + $this->pagination = $pagination; |
|
| 78 | + $this->categorie = $categorie; |
|
| 79 | 79 | $this->link = $link; |
| 80 | 80 | |
| 81 | 81 | $language->add_lang('directory', 'ernadoo/phpbbdirectory'); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function view($cat_id, $page, $sort_days, $sort_key, $sort_dir, $mode = '') |
| 116 | 116 | { |
| 117 | - $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page, 'sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir)); |
|
| 117 | + $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page, 'sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir)); |
|
| 118 | 118 | |
| 119 | 119 | return new RedirectResponse($url, 301); |
| 120 | 120 | } |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $start = ($page - 1) * $this->config['dir_show']; |
| 142 | 142 | |
| 143 | - $default_sort_days = 0; |
|
| 143 | + $default_sort_days = 0; |
|
| 144 | 144 | $default_sort_key = (string) substr($this->config['dir_default_order'], 0, 1); |
| 145 | 145 | $default_sort_dir = (string) substr($this->config['dir_default_order'], 2); |
| 146 | 146 | |
| 147 | 147 | $sort_days = (!$sort_days) ? $this->request->variable('st', $default_sort_days) : $sort_days; |
| 148 | 148 | $sort_key = (!$sort_key) ? $this->request->variable('sk', $default_sort_key) : $sort_key; |
| 149 | - $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
| 149 | + $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
| 150 | 150 | $link_list = $rowset = array(); |
| 151 | 151 | |
| 152 | 152 | // Categorie ordering options |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | $min_post_time = time() - ($sort_days * 86400); |
| 185 | 185 | |
| 186 | 186 | $sql = 'SELECT COUNT(link_id) AS nb_links |
| 187 | - FROM ' . $this->links_table . ' |
|
| 188 | - WHERE link_cat = ' . (int) $cat_id . ' |
|
| 187 | + FROM ' . $this->links_table.' |
|
| 188 | + WHERE link_cat = ' . (int) $cat_id.' |
|
| 189 | 189 | AND link_time >= ' . $min_post_time; |
| 190 | 190 | $result = $this->db->sql_query($sql); |
| 191 | 191 | $nb_links = (int) $this->db->sql_fetchfield('nb_links'); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | else |
| 201 | 201 | { |
| 202 | 202 | $sql_limit_time = ''; |
| 203 | - $nb_links = (int) $this->categorie->data['cat_links']; |
|
| 203 | + $nb_links = (int) $this->categorie->data['cat_links']; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // Make sure $start is set to the last page if it exceeds the amount |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $this->categorie->make_cat_jumpbox(); |
| 214 | 214 | |
| 215 | 215 | $base_url = array( |
| 216 | - 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, |
|
| 216 | + 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, |
|
| 217 | 217 | 'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param), |
| 218 | 218 | ); |
| 219 | 219 | |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | 'S_SELECT_SORT_KEY' => $s_sort_key, |
| 227 | 227 | 'S_SELECT_SORT_DAYS' => $s_limit_days, |
| 228 | 228 | 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), |
| 229 | - 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)), |
|
| 229 | + 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)), |
|
| 230 | 230 | 'S_CAT_ID' => $cat_id, |
| 231 | 231 | |
| 232 | 232 | 'TOTAL_LINKS' => $this->language->lang('DIR_NB_LINKS', (int) $nb_links), |
| 233 | 233 | |
| 234 | 234 | 'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), |
| 235 | 235 | |
| 236 | - 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id), |
|
| 236 | + 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id), |
|
| 237 | 237 | 'U_WATCH_CAT' => $s_watching_categorie['link'], |
| 238 | 238 | 'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], |
| 239 | 239 | 'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], |
@@ -263,11 +263,11 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | if (is_array($sort_by_sql[$sort_key])) |
| 265 | 265 | { |
| 266 | - $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; |
|
| 266 | + $sql_sort_order = implode(' '.$direction.', ', $sort_by_sql[$sort_key]).' '.$direction; |
|
| 267 | 267 | } |
| 268 | 268 | else |
| 269 | 269 | { |
| 270 | - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; |
|
| 270 | + $sql_sort_order = $sort_by_sql[$sort_key].' '.$direction; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Grab just the sorted link ids |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | ), |
| 311 | 311 | array( |
| 312 | 312 | 'FROM' => array($this->votes_table => 'v'), |
| 313 | - 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'] |
|
| 313 | + 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = '.$this->user->data['user_id'] |
|
| 314 | 314 | ) |
| 315 | 315 | ), |
| 316 | 316 | 'WHERE' => $this->db->sql_in_set('l.link_id', $link_list) |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | $link_list = ($store_reverse) ? array_reverse($link_list) : $link_list; |
| 329 | 329 | |
| 330 | - $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
| 331 | - $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
| 330 | + $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
| 331 | + $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
| 332 | 332 | |
| 333 | 333 | foreach ($link_list as $link_id) |
| 334 | 334 | { |
@@ -338,10 +338,10 @@ discard block |
||
| 338 | 338 | $s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status); |
| 339 | 339 | $s_thumb = $this->link->display_thumb($site); |
| 340 | 340 | $s_vote = $this->link->display_vote($site); |
| 341 | - $s_banner = $this->link->display_bann($site); |
|
| 342 | - $s_rss = $this->link->display_rss($site); |
|
| 341 | + $s_banner = $this->link->display_bann($site); |
|
| 342 | + $s_rss = $this->link->display_rss($site); |
|
| 343 | 343 | |
| 344 | - $edit_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir')))); |
|
| 344 | + $edit_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir')))); |
|
| 345 | 345 | $delete_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_delete_dir')))); |
| 346 | 346 | |
| 347 | 347 | $this->template->assign_block_vars('site', array( |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $this->template->assign_block_vars('no_draw_link', array()); |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - $page_title = $this->language->lang('DIRECTORY') . ' - ' . $this->categorie->data['cat_name']; |
|
| 380 | + $page_title = $this->language->lang('DIRECTORY').' - '.$this->categorie->data['cat_name']; |
|
| 381 | 381 | |
| 382 | 382 | $this->categorie->display(); |
| 383 | 383 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * Define the extensions to be tested |
| 38 | 38 | * |
| 39 | - * @return array vendor/name of extension(s) to test |
|
| 39 | + * @return string[] vendor/name of extension(s) to test |
|
| 40 | 40 | */ |
| 41 | 41 | static protected function setup_extensions() |
| 42 | 42 | { |
@@ -221,6 +221,9 @@ discard block |
||
| 221 | 221 | $this->core_categorie->set_extension_manager($phpbb_extension_manager); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | + /** |
|
| 225 | + * @param \ernadoo\phpbbdirectory\cron\task\core\prune_categorie[] $tasks |
|
| 226 | + */ |
|
| 224 | 227 | private function create_cron_manager($tasks) |
| 225 | 228 | { |
| 226 | 229 | global $phpbb_root_path, $phpEx; |
@@ -34,10 +34,10 @@ |
||
| 34 | 34 | protected $user; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * Define the extensions to be tested |
|
| 38 | - * |
|
| 39 | - * @return array vendor/name of extension(s) to test |
|
| 40 | - */ |
|
| 37 | + * Define the extensions to be tested |
|
| 38 | + * |
|
| 39 | + * @return array vendor/name of extension(s) to test |
|
| 40 | + */ |
|
| 41 | 41 | static protected function setup_extensions() |
| 42 | 42 | { |
| 43 | 43 | return array('ernadoo/phpbbdirectory'); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | parent::setUp(); |
| 53 | 53 | |
| 54 | - $table_categories = 'phpbb_directory_cats'; |
|
| 55 | - $tables_comments = 'phpbb_directory_comments'; |
|
| 54 | + $table_categories = 'phpbb_directory_cats'; |
|
| 55 | + $tables_comments = 'phpbb_directory_comments'; |
|
| 56 | 56 | $tables_links = 'phpbb_directory_links'; |
| 57 | 57 | $tables_votes = 'phpbb_directory_votes'; |
| 58 | 58 | $tables_watch = 'phpbb_directory_watch'; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $this->helper->expects($this->any()) |
| 102 | 102 | ->method('render') |
| 103 | - ->willReturnCallback(function ($template_file, $page_title = '', $status_code = 200, $display_online_list = false) { |
|
| 103 | + ->willReturnCallback(function($template_file, $page_title = '', $status_code = 200, $display_online_list = false) { |
|
| 104 | 104 | return new \Symfony\Component\HttpFoundation\Response($template_file, $status_code); |
| 105 | 105 | }); |
| 106 | 106 | $this->helper |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $phpbb_container->set('path_helper', $phpbb_path_helper); |
| 132 | 132 | $phpbb_container->set('ext.manager', $phpbb_extension_manager); |
| 133 | 133 | $phpbb_container->set('user', $this->user); |
| 134 | - $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/'); |
|
| 134 | + $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path.'cache/'.PHPBB_ENVIRONMENT.'/'); |
|
| 135 | 135 | |
| 136 | 136 | $context = new \phpbb\template\context(); |
| 137 | 137 | $twig_extension = new \phpbb\template\twig\extension($context, $this->lang); |
@@ -100,7 +100,8 @@ |
||
| 100 | 100 | |
| 101 | 101 | $this->helper->expects($this->any()) |
| 102 | 102 | ->method('render') |
| 103 | - ->willReturnCallback(function ($template_file, $page_title = '', $status_code = 200, $display_online_list = false) { |
|
| 103 | + ->willReturnCallback(function ($template_file, $page_title = '', $status_code = 200, $display_online_list = false) |
|
| 104 | + { |
|
| 104 | 105 | return new \Symfony\Component\HttpFoundation\Response($template_file, $status_code); |
| 105 | 106 | }); |
| 106 | 107 | $this->helper |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Setup test environment |
|
| 26 | - */ |
|
| 25 | + * Setup test environment |
|
| 26 | + */ |
|
| 27 | 27 | public function setUp() |
| 28 | 28 | { |
| 29 | 29 | parent::setUp(); |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Test data for the test_display_base() function |
|
| 65 | - * |
|
| 66 | - * @return array Array of test data |
|
| 67 | - */ |
|
| 64 | + * Test data for the test_display_base() function |
|
| 65 | + * |
|
| 66 | + * @return array Array of test data |
|
| 67 | + */ |
|
| 68 | 68 | public function display_base_data() |
| 69 | 69 | { |
| 70 | 70 | return array( |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Test controller display |
|
| 77 | - * |
|
| 78 | - * @dataProvider display_base_data |
|
| 79 | - */ |
|
| 76 | + * Test controller display |
|
| 77 | + * |
|
| 78 | + * @dataProvider display_base_data |
|
| 79 | + */ |
|
| 80 | 80 | public function test_display_base($status_code, $page_content) |
| 81 | 81 | { |
| 82 | 82 | $controller = $this->get_controller(); |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * Test base case scenario |
|
| 91 | - * |
|
| 92 | - */ |
|
| 90 | + * Test base case scenario |
|
| 91 | + * |
|
| 92 | + */ |
|
| 93 | 93 | public function test_for_root_categories() |
| 94 | 94 | { |
| 95 | 95 | $this->template->expects($this->exactly(2)) |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | public function getDataSet() |
| 20 | 20 | { |
| 21 | - return $this->createMySQLXMLDataSet(__DIR__ . '/fixtures/fixture_base.xml'); |
|
| 21 | + return $this->createMySQLXMLDataSet(__DIR__.'/fixtures/fixture_base.xml'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Setup test environment |
|
| 26 | - */ |
|
| 25 | + * Setup test environment |
|
| 26 | + */ |
|
| 27 | 27 | public function setUp() |
| 28 | 28 | { |
| 29 | 29 | parent::setUp(); |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Test data for the test_display_cat_by_id() function |
|
| 69 | - * |
|
| 70 | - * @return array Array of test data |
|
| 71 | - */ |
|
| 68 | + * Test data for the test_display_cat_by_id() function |
|
| 69 | + * |
|
| 70 | + * @return array Array of test data |
|
| 71 | + */ |
|
| 72 | 72 | public function display_cat_by_id_data() |
| 73 | 73 | { |
| 74 | 74 | return array( |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * Test controller display |
|
| 81 | - * |
|
| 82 | - * @dataProvider display_cat_by_id_data |
|
| 83 | - */ |
|
| 80 | + * Test controller display |
|
| 81 | + * |
|
| 82 | + * @dataProvider display_cat_by_id_data |
|
| 83 | + */ |
|
| 84 | 84 | public function test_display_cat_by_id($cat_id, $page, $status_code) |
| 85 | 85 | { |
| 86 | 86 | $controller = $this->get_controller(); |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * Test data for the test_display_cat_fails() function |
|
| 125 | - * |
|
| 126 | - * @return array Array of test data |
|
| 127 | - */ |
|
| 124 | + * Test data for the test_display_cat_fails() function |
|
| 125 | + * |
|
| 126 | + * @return array Array of test data |
|
| 127 | + */ |
|
| 128 | 128 | public function display_cat_fails_data() |
| 129 | 129 | { |
| 130 | 130 | return array( |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * Test controller display throws 404 exceptions |
|
| 137 | - * |
|
| 138 | - * @dataProvider display_cat_fails_data |
|
| 139 | - */ |
|
| 136 | + * Test controller display throws 404 exceptions |
|
| 137 | + * |
|
| 138 | + * @dataProvider display_cat_fails_data |
|
| 139 | + */ |
|
| 140 | 140 | public function test_display_cat_fails($cat_id, $page, $status_code, $page_content) |
| 141 | 141 | { |
| 142 | 142 | $controller = $this->get_controller(); |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * Test data for the test_category_one_page() function |
|
| 157 | - * |
|
| 158 | - * @return array Array of test data |
|
| 159 | - */ |
|
| 156 | + * Test data for the test_category_one_page() function |
|
| 157 | + * |
|
| 158 | + * @return array Array of test data |
|
| 159 | + */ |
|
| 160 | 160 | public function category_one_page_data() |
| 161 | 161 | { |
| 162 | 162 | return array( |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | - * Test base case scenario |
|
| 169 | - * |
|
| 170 | - * @dataProvider category_one_page_data |
|
| 171 | - */ |
|
| 168 | + * Test base case scenario |
|
| 169 | + * |
|
| 170 | + * @dataProvider category_one_page_data |
|
| 171 | + */ |
|
| 172 | 172 | function test_category_one_page($cat_id, $cat_name, $parent_cat_id, $nb_links) |
| 173 | 173 | { |
| 174 | 174 | $controller = $this->get_controller(); |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | - * Test data for the test_category_no_links() function |
|
| 182 | - * |
|
| 183 | - * @return array Array of test data |
|
| 184 | - */ |
|
| 181 | + * Test data for the test_category_no_links() function |
|
| 182 | + * |
|
| 183 | + * @return array Array of test data |
|
| 184 | + */ |
|
| 185 | 185 | public function category_no_links_data() |
| 186 | 186 | { |
| 187 | 187 | return array( |
@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | - * Test base case scenario |
|
| 194 | - * |
|
| 195 | - * @dataProvider category_no_links_data |
|
| 196 | - */ |
|
| 193 | + * Test base case scenario |
|
| 194 | + * |
|
| 195 | + * @dataProvider category_no_links_data |
|
| 196 | + */ |
|
| 197 | 197 | function test_category_no_links($cat_id, $cat_name, $nb_links) |
| 198 | 198 | { |
| 199 | 199 | $this->template->expects($this->at(3)) |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | - * Test data for the test_category_with_pages() function |
|
| 213 | - * |
|
| 214 | - * @return array Array of test data |
|
| 215 | - */ |
|
| 212 | + * Test data for the test_category_with_pages() function |
|
| 213 | + * |
|
| 214 | + * @return array Array of test data |
|
| 215 | + */ |
|
| 216 | 216 | public function category_with_pages_data() |
| 217 | 217 | { |
| 218 | 218 | return array( |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | - * Test base case scenario |
|
| 226 | - * |
|
| 227 | - * @dataProvider category_with_pages_data |
|
| 228 | - */ |
|
| 225 | + * Test base case scenario |
|
| 226 | + * |
|
| 227 | + * @dataProvider category_with_pages_data |
|
| 228 | + */ |
|
| 229 | 229 | public function test_category_with_pages($cat_id, $cat_name, $parent_cat_id, $parent_cat_name, $nb_links, $page = 1, $sort_days = 0) |
| 230 | 230 | { |
| 231 | 231 | $controller = $this->get_controller(); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | public function getDataSet() |
| 20 | 20 | { |
| 21 | - return $this->createMySQLXMLDataSet(__DIR__ . '/fixtures/fixture_categories.xml'); |
|
| 21 | + return $this->createMySQLXMLDataSet(__DIR__.'/fixtures/fixture_categories.xml'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | class categories_routing_loader_test extends \phpbb_database_test_case |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * Define the extensions to be tested |
|
| 17 | - * |
|
| 18 | - * @return array vendor/name of extension(s) to test |
|
| 19 | - */ |
|
| 16 | + * Define the extensions to be tested |
|
| 17 | + * |
|
| 18 | + * @return array vendor/name of extension(s) to test |
|
| 19 | + */ |
|
| 20 | 20 | static protected function setup_extensions() |
| 21 | 21 | { |
| 22 | 22 | return array('ernadoo/phpbbdirectory'); |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Get the route collection from the categories_loader |
|
| 54 | - * |
|
| 55 | - * @return \Symfony\Component\Routing\RouteCollection |
|
| 56 | - */ |
|
| 53 | + * Get the route collection from the categories_loader |
|
| 54 | + * |
|
| 55 | + * @return \Symfony\Component\Routing\RouteCollection |
|
| 56 | + */ |
|
| 57 | 57 | public function get_categories_route_collection() |
| 58 | 58 | { |
| 59 | 59 | $collection = $this->loader->load('ernadoo_phpbbdirectory_route_controller', 'pages_extension'); |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Data set for test_page_loader |
|
| 69 | - * |
|
| 70 | - * @return array |
|
| 71 | - */ |
|
| 68 | + * Data set for test_page_loader |
|
| 69 | + * |
|
| 70 | + * @return array |
|
| 71 | + */ |
|
| 72 | 72 | public function page_loader_data() |
| 73 | 73 | { |
| 74 | 74 | return array( |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | - * @dataProvider page_loader_data |
|
| 83 | - * |
|
| 84 | - * @param int $id Id of a categorie |
|
| 85 | - * @param string $expected Expected route of a categorie |
|
| 86 | - */ |
|
| 82 | + * @dataProvider page_loader_data |
|
| 83 | + * |
|
| 84 | + * @param int $id Id of a categorie |
|
| 85 | + * @param string $expected Expected route of a categorie |
|
| 86 | + */ |
|
| 87 | 87 | public function test_page_loader($id, $expected) |
| 88 | 88 | { |
| 89 | 89 | // Get a route instance |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function getDataSet() |
| 35 | 35 | { |
| 36 | - return $this->createMySQLXMLDataSet(__DIR__ . '/fixtures/categories.xml'); |
|
| 36 | + return $this->createMySQLXMLDataSet(__DIR__.'/fixtures/categories.xml'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function setUp() |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function test_page_loader($id, $expected) |
| 88 | 88 | { |
| 89 | 89 | // Get a route instance |
| 90 | - $route = $this->collection->get('ernadoo_phpbbdirectory_dynamic_route_' . $id); |
|
| 90 | + $route = $this->collection->get('ernadoo_phpbbdirectory_dynamic_route_'.$id); |
|
| 91 | 91 | |
| 92 | 92 | // Assert the roue is an instance of Route |
| 93 | 93 | $this->assertInstanceOf('Symfony\Component\Routing\Route', $route, 'A route instance could not be made.'); |