@@ -416,7 +416,7 @@ |
||
| 416 | 416 | * Return a variable if it is set, otherwise default |
| 417 | 417 | * |
| 418 | 418 | * @param mixed $var The variable to test |
| 419 | - * @param mixed $default The default value to use |
|
| 419 | + * @param false|string $default The default value to use |
|
| 420 | 420 | * @return mixed The value of the variable if set, otherwise default value |
| 421 | 421 | * @access protected |
| 422 | 422 | */ |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | public $u_action; |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * ACP module constructor |
|
| 60 | - * |
|
| 61 | - * @access public |
|
| 62 | - */ |
|
| 59 | + * ACP module constructor |
|
| 60 | + * |
|
| 61 | + * @access public |
|
| 62 | + */ |
|
| 63 | 63 | public function __construct() |
| 64 | 64 | { |
| 65 | 65 | global $config, $db, $request, $template, $user, $phpbb_log, $phpbb_root_path, $phpEx; |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * Main ACP module |
|
| 86 | - * |
|
| 87 | - * @param int $id |
|
| 88 | - * @param string $mode |
|
| 89 | - * @access public |
|
| 90 | - */ |
|
| 85 | + * Main ACP module |
|
| 86 | + * |
|
| 87 | + * @param int $id |
|
| 88 | + * @param string $mode |
|
| 89 | + * @access public |
|
| 90 | + */ |
|
| 91 | 91 | public function main($id, $mode) |
| 92 | 92 | { |
| 93 | 93 | $form_key = 'acp_similar_topics'; |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | - * Check if config field values exceed 255 chars |
|
| 255 | - * |
|
| 256 | - * @return null |
|
| 257 | - * @access protected |
|
| 258 | - */ |
|
| 254 | + * Check if config field values exceed 255 chars |
|
| 255 | + * |
|
| 256 | + * @return null |
|
| 257 | + * @access protected |
|
| 258 | + */ |
|
| 259 | 259 | protected function validate_config_length() |
| 260 | 260 | { |
| 261 | 261 | $arg_list = func_get_args(); |
@@ -269,12 +269,12 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | - * Check form key, trigger error if invalid |
|
| 273 | - * |
|
| 274 | - * @param string $form_key The form key value |
|
| 275 | - * @return null |
|
| 276 | - * @access protected |
|
| 277 | - */ |
|
| 272 | + * Check form key, trigger error if invalid |
|
| 273 | + * |
|
| 274 | + * @param string $form_key The form key value |
|
| 275 | + * @return null |
|
| 276 | + * @access protected |
|
| 277 | + */ |
|
| 278 | 278 | protected function check_form_key($form_key) |
| 279 | 279 | { |
| 280 | 280 | if (!check_form_key($form_key)) |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | - * Get forums list |
|
| 288 | - * |
|
| 289 | - * @return array forum data rows |
|
| 290 | - * @access protected |
|
| 291 | - */ |
|
| 287 | + * Get forums list |
|
| 288 | + * |
|
| 289 | + * @return array forum data rows |
|
| 290 | + * @access protected |
|
| 291 | + */ |
|
| 292 | 292 | protected function get_forum_list() |
| 293 | 293 | { |
| 294 | 294 | $sql = 'SELECT forum_id, forum_name, similar_topic_forums |
@@ -303,13 +303,13 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | - * Calculate the $pst_time based on user input |
|
| 307 | - * |
|
| 308 | - * @param int $length user entered value |
|
| 309 | - * @param string $type years, months, weeks, days |
|
| 310 | - * @return int time in seconds |
|
| 311 | - * @access protected |
|
| 312 | - */ |
|
| 306 | + * Calculate the $pst_time based on user input |
|
| 307 | + * |
|
| 308 | + * @param int $length user entered value |
|
| 309 | + * @param string $type years, months, weeks, days |
|
| 310 | + * @return int time in seconds |
|
| 311 | + * @access protected |
|
| 312 | + */ |
|
| 313 | 313 | protected function set_pst_time($length, $type) |
| 314 | 314 | { |
| 315 | 315 | switch ($type) |
@@ -335,13 +335,13 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | - * Get the correct time $length value for the form |
|
| 339 | - * |
|
| 340 | - * @param int $time as a timestamp |
|
| 341 | - * @param string $type years, months, weeks, days |
|
| 342 | - * @return int time converted to the given $type |
|
| 343 | - * @access protected |
|
| 344 | - */ |
|
| 338 | + * Get the correct time $length value for the form |
|
| 339 | + * |
|
| 340 | + * @param int $time as a timestamp |
|
| 341 | + * @param string $type years, months, weeks, days |
|
| 342 | + * @return int time converted to the given $type |
|
| 343 | + * @access protected |
|
| 344 | + */ |
|
| 345 | 345 | protected function get_pst_time($time, $type) |
| 346 | 346 | { |
| 347 | 347 | switch ($type) |
@@ -370,11 +370,11 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
| 373 | - * Check for FULLTEXT index support |
|
| 374 | - * |
|
| 375 | - * @return bool True if FULLTEXT is fully supported, false otherwise |
|
| 376 | - * @access protected |
|
| 377 | - */ |
|
| 373 | + * Check for FULLTEXT index support |
|
| 374 | + * |
|
| 375 | + * @return bool True if FULLTEXT is fully supported, false otherwise |
|
| 376 | + * @access protected |
|
| 377 | + */ |
|
| 378 | 378 | protected function fulltext_support_enabled() |
| 379 | 379 | { |
| 380 | 380 | if ($this->fulltext->is_supported()) |
@@ -386,11 +386,11 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
| 389 | - * Enable FULLTEXT support for the topic_title |
|
| 390 | - * |
|
| 391 | - * @return null |
|
| 392 | - * @access protected |
|
| 393 | - */ |
|
| 389 | + * Enable FULLTEXT support for the topic_title |
|
| 390 | + * |
|
| 391 | + * @return null |
|
| 392 | + * @access protected |
|
| 393 | + */ |
|
| 394 | 394 | protected function enable_fulltext_support() |
| 395 | 395 | { |
| 396 | 396 | if (!$this->fulltext->is_mysql()) |
@@ -413,13 +413,13 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /** |
| 416 | - * Return a variable if it is set, otherwise default |
|
| 417 | - * |
|
| 418 | - * @param mixed $var The variable to test |
|
| 419 | - * @param mixed $default The default value to use |
|
| 420 | - * @return mixed The value of the variable if set, otherwise default value |
|
| 421 | - * @access protected |
|
| 422 | - */ |
|
| 416 | + * Return a variable if it is set, otherwise default |
|
| 417 | + * |
|
| 418 | + * @param mixed $var The variable to test |
|
| 419 | + * @param mixed $default The default value to use |
|
| 420 | + * @return mixed The value of the variable if set, otherwise default value |
|
| 421 | + * @access protected |
|
| 422 | + */ |
|
| 423 | 423 | protected function isset_or_default($var, $default) |
| 424 | 424 | { |
| 425 | 425 | return (isset($var)) ? $var : $default; |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | protected $user; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * Constructor |
|
| 37 | - * |
|
| 38 | - * @param \phpbb\auth\auth $auth |
|
| 39 | - * @param \phpbb\config\config $config |
|
| 40 | - * @param \phpbb\request\request $request |
|
| 41 | - * @param \phpbb\template\template $template |
|
| 42 | - * @param \phpbb\user $user |
|
| 43 | - * @access public |
|
| 44 | - */ |
|
| 36 | + * Constructor |
|
| 37 | + * |
|
| 38 | + * @param \phpbb\auth\auth $auth |
|
| 39 | + * @param \phpbb\config\config $config |
|
| 40 | + * @param \phpbb\request\request $request |
|
| 41 | + * @param \phpbb\template\template $template |
|
| 42 | + * @param \phpbb\user $user |
|
| 43 | + * @access public |
|
| 44 | + */ |
|
| 45 | 45 | public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) |
| 46 | 46 | { |
| 47 | 47 | $this->auth = $auth; |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Assign functions defined in this class to event listeners in the core |
|
| 56 | - * |
|
| 57 | - * @return array |
|
| 58 | - * @static |
|
| 59 | - * @access public |
|
| 60 | - */ |
|
| 55 | + * Assign functions defined in this class to event listeners in the core |
|
| 56 | + * |
|
| 57 | + * @return array |
|
| 58 | + * @static |
|
| 59 | + * @access public |
|
| 60 | + */ |
|
| 61 | 61 | static public function getSubscribedEvents() |
| 62 | 62 | { |
| 63 | 63 | return array( |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * Get user's Similar Topics option and display it in UCP Prefs View page |
|
| 71 | - * |
|
| 72 | - * @param object $event The event object |
|
| 73 | - * @return null |
|
| 74 | - * @access public |
|
| 75 | - */ |
|
| 70 | + * Get user's Similar Topics option and display it in UCP Prefs View page |
|
| 71 | + * |
|
| 72 | + * @param object $event The event object |
|
| 73 | + * @return null |
|
| 74 | + * @access public |
|
| 75 | + */ |
|
| 76 | 76 | public function ucp_prefs_get_data($event) |
| 77 | 77 | { |
| 78 | 78 | // Request the user option vars and add them to the data array |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Add user's Similar Topics option state into the sql_array |
|
| 96 | - * |
|
| 97 | - * @param object $event The event object |
|
| 98 | - * @return null |
|
| 99 | - * @access public |
|
| 100 | - */ |
|
| 95 | + * Add user's Similar Topics option state into the sql_array |
|
| 96 | + * |
|
| 97 | + * @param object $event The event object |
|
| 98 | + * @return null |
|
| 99 | + * @access public |
|
| 100 | + */ |
|
| 101 | 101 | public function ucp_prefs_set_data($event) |
| 102 | 102 | { |
| 103 | 103 | $event['sql_ary'] = array_merge($event['sql_ary'], array( |
@@ -21,23 +21,23 @@ discard block |
||
| 21 | 21 | protected $similar_topics; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * Constructor |
|
| 25 | - * |
|
| 26 | - * @param \vse\similartopics\core\similar_topics $similar_topics |
|
| 27 | - * @access public |
|
| 28 | - */ |
|
| 24 | + * Constructor |
|
| 25 | + * |
|
| 26 | + * @param \vse\similartopics\core\similar_topics $similar_topics |
|
| 27 | + * @access public |
|
| 28 | + */ |
|
| 29 | 29 | public function __construct(\vse\similartopics\core\similar_topics $similar_topics) |
| 30 | 30 | { |
| 31 | 31 | $this->similar_topics = $similar_topics; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * Assign functions defined in this class to event listeners in the core |
|
| 36 | - * |
|
| 37 | - * @return array |
|
| 38 | - * @static |
|
| 39 | - * @access public |
|
| 40 | - */ |
|
| 35 | + * Assign functions defined in this class to event listeners in the core |
|
| 36 | + * |
|
| 37 | + * @return array |
|
| 38 | + * @static |
|
| 39 | + * @access public |
|
| 40 | + */ |
|
| 41 | 41 | static public function getSubscribedEvents() |
| 42 | 42 | { |
| 43 | 43 | return array( |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Display similar topics |
|
| 51 | - * |
|
| 52 | - * @param object $event The event object |
|
| 53 | - * @return null |
|
| 54 | - * @access public |
|
| 55 | - */ |
|
| 50 | + * Display similar topics |
|
| 51 | + * |
|
| 52 | + * @param object $event The event object |
|
| 53 | + * @return null |
|
| 54 | + * @access public |
|
| 55 | + */ |
|
| 56 | 56 | public function display_similar_topics($event) |
| 57 | 57 | { |
| 58 | 58 | // Return early if no reason to display similar topics |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Add custom permissions language variables |
|
| 69 | - * |
|
| 70 | - * @param object $event The event object |
|
| 71 | - * @return null |
|
| 72 | - * @access public |
|
| 73 | - */ |
|
| 68 | + * Add custom permissions language variables |
|
| 69 | + * |
|
| 70 | + * @param object $event The event object |
|
| 71 | + * @return null |
|
| 72 | + * @access public |
|
| 73 | + */ |
|
| 74 | 74 | public function add_permissions($event) |
| 75 | 75 | { |
| 76 | 76 | $permissions = $event['permissions']; |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * Add a FULLTEXT index to phpbb_topics.topic_title |
|
| 67 | - */ |
|
| 66 | + * Add a FULLTEXT index to phpbb_topics.topic_title |
|
| 67 | + */ |
|
| 68 | 68 | public function add_topic_title_fulltext() |
| 69 | 69 | { |
| 70 | 70 | $fulltext = $this->get_fulltext(); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Drop the FULLTEXT index on phpbb_topics.topic_title |
|
| 82 | - */ |
|
| 81 | + * Drop the FULLTEXT index on phpbb_topics.topic_title |
|
| 82 | + */ |
|
| 83 | 83 | public function drop_topic_title_fulltext() |
| 84 | 84 | { |
| 85 | 85 | $fulltext = $this->get_fulltext(); |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * Get an instance of the fulltext class |
|
| 97 | - * |
|
| 98 | - * @return \vse\similartopics\core\fulltext_support |
|
| 99 | - */ |
|
| 96 | + * Get an instance of the fulltext class |
|
| 97 | + * |
|
| 98 | + * @return \vse\similartopics\core\fulltext_support |
|
| 99 | + */ |
|
| 100 | 100 | public function get_fulltext() |
| 101 | 101 | { |
| 102 | 102 | return new \vse\similartopics\core\fulltext_support($this->db); |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Drop the FULLTEXT index on phpbb_topics.topic_title |
|
| 44 | - * Convert phpbb_topics back to the original storage engine |
|
| 45 | - */ |
|
| 43 | + * Drop the FULLTEXT index on phpbb_topics.topic_title |
|
| 44 | + * Convert phpbb_topics back to the original storage engine |
|
| 45 | + */ |
|
| 46 | 46 | public function revert_fulltext_changes() |
| 47 | 47 | { |
| 48 | 48 | $fulltext = new \vse\similartopics\core\fulltext_support($this->db); |
@@ -19,31 +19,31 @@ discard block |
||
| 19 | 19 | protected $engine; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Constructor |
|
| 23 | - * |
|
| 24 | - * @param \phpbb\db\driver\driver_interface |
|
| 25 | - * @access public |
|
| 26 | - */ |
|
| 22 | + * Constructor |
|
| 23 | + * |
|
| 24 | + * @param \phpbb\db\driver\driver_interface |
|
| 25 | + * @access public |
|
| 26 | + */ |
|
| 27 | 27 | public function __construct(\phpbb\db\driver\driver_interface $db) |
| 28 | 28 | { |
| 29 | 29 | $this->db = $db; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Check if the database is using MySQL |
|
| 34 | - * |
|
| 35 | - * @return bool True if is mysql, false otherwise |
|
| 36 | - */ |
|
| 33 | + * Check if the database is using MySQL |
|
| 34 | + * |
|
| 35 | + * @return bool True if is mysql, false otherwise |
|
| 36 | + */ |
|
| 37 | 37 | public function is_mysql() |
| 38 | 38 | { |
| 39 | 39 | return ($this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Check for FULLTEXT index support |
|
| 44 | - * |
|
| 45 | - * @return bool True if FULLTEXT is supported, false otherwise |
|
| 46 | - */ |
|
| 43 | + * Check for FULLTEXT index support |
|
| 44 | + * |
|
| 45 | + * @return bool True if FULLTEXT is supported, false otherwise |
|
| 46 | + */ |
|
| 47 | 47 | public function is_supported() |
| 48 | 48 | { |
| 49 | 49 | // FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to |
@@ -52,20 +52,20 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Get the database storage engine name |
|
| 56 | - * |
|
| 57 | - * @return string The storage engine name |
|
| 58 | - */ |
|
| 55 | + * Get the database storage engine name |
|
| 56 | + * |
|
| 57 | + * @return string The storage engine name |
|
| 58 | + */ |
|
| 59 | 59 | public function get_engine() |
| 60 | 60 | { |
| 61 | 61 | return (isset($this->engine)) ? $this->engine : $this->set_engine(); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * Set the database storage engine name |
|
| 66 | - * |
|
| 67 | - * @return string The storage engine name |
|
| 68 | - */ |
|
| 65 | + * Set the database storage engine name |
|
| 66 | + * |
|
| 67 | + * @return string The storage engine name |
|
| 68 | + */ |
|
| 69 | 69 | public function set_engine() |
| 70 | 70 | { |
| 71 | 71 | $this->engine = ''; |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * Check if a field is a FULLTEXT index |
|
| 94 | - * |
|
| 95 | - * @param string $field name of a field |
|
| 96 | - * @return bool True if field is a FULLTEXT index, false otherwise |
|
| 97 | - */ |
|
| 93 | + * Check if a field is a FULLTEXT index |
|
| 94 | + * |
|
| 95 | + * @param string $field name of a field |
|
| 96 | + * @return bool True if field is a FULLTEXT index, false otherwise |
|
| 97 | + */ |
|
| 98 | 98 | public function index($field = 'topic_title') |
| 99 | 99 | { |
| 100 | 100 | $sql = 'SHOW INDEX |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | protected $php_ext; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Constructor |
|
| 53 | - * |
|
| 54 | - * @param \phpbb\auth\auth $auth |
|
| 55 | - * @param \phpbb\cache\service $cache |
|
| 56 | - * @param \phpbb\config\config $config |
|
| 57 | - * @param \phpbb\db\driver\driver_interface $db |
|
| 58 | - * @param \phpbb\event\dispatcher_interface $dispatcher |
|
| 59 | - * @param \phpbb\pagination $pagination |
|
| 60 | - * @param \phpbb\request\request $request |
|
| 61 | - * @param \phpbb\template\template $template |
|
| 62 | - * @param \phpbb\user $user |
|
| 63 | - * @param \phpbb\content_visibility $content_visibility |
|
| 64 | - * @param string $root_path |
|
| 65 | - * @param string $php_ext |
|
| 66 | - * @access public |
|
| 67 | - */ |
|
| 52 | + * Constructor |
|
| 53 | + * |
|
| 54 | + * @param \phpbb\auth\auth $auth |
|
| 55 | + * @param \phpbb\cache\service $cache |
|
| 56 | + * @param \phpbb\config\config $config |
|
| 57 | + * @param \phpbb\db\driver\driver_interface $db |
|
| 58 | + * @param \phpbb\event\dispatcher_interface $dispatcher |
|
| 59 | + * @param \phpbb\pagination $pagination |
|
| 60 | + * @param \phpbb\request\request $request |
|
| 61 | + * @param \phpbb\template\template $template |
|
| 62 | + * @param \phpbb\user $user |
|
| 63 | + * @param \phpbb\content_visibility $content_visibility |
|
| 64 | + * @param string $root_path |
|
| 65 | + * @param string $php_ext |
|
| 66 | + * @access public |
|
| 67 | + */ |
|
| 68 | 68 | public function __construct(\phpbb\auth\auth $auth, \phpbb\cache\service $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \phpbb\content_visibility $content_visibility, $root_path, $php_ext) |
| 69 | 69 | { |
| 70 | 70 | $this->auth = $auth; |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * Is similar topics available? |
|
| 86 | - * |
|
| 87 | - * @return bool True if available, false otherwise |
|
| 88 | - * @access public |
|
| 89 | - */ |
|
| 85 | + * Is similar topics available? |
|
| 86 | + * |
|
| 87 | + * @return bool True if available, false otherwise |
|
| 88 | + * @access public |
|
| 89 | + */ |
|
| 90 | 90 | public function is_available() |
| 91 | 91 | { |
| 92 | 92 | return !empty($this->config['similar_topics']) && // is enabled |
@@ -98,29 +98,29 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * Is the forum available for displaying similar topics |
|
| 102 | - * |
|
| 103 | - * @param int $forum_id A forum identifier |
|
| 104 | - * @return bool True if available, false otherwise |
|
| 105 | - * @access public |
|
| 106 | - */ |
|
| 101 | + * Is the forum available for displaying similar topics |
|
| 102 | + * |
|
| 103 | + * @param int $forum_id A forum identifier |
|
| 104 | + * @return bool True if available, false otherwise |
|
| 105 | + * @access public |
|
| 106 | + */ |
|
| 107 | 107 | public function forum_available($forum_id) |
| 108 | 108 | { |
| 109 | 109 | return !in_array($forum_id, explode(',', $this->config['similar_topics_hide'])); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | - * Get similar topics by matching topic titles |
|
| 114 | - * |
|
| 115 | - * NOTE: Currently requires MySQL due to the use of FULLTEXT indexes |
|
| 116 | - * and MATCH and AGAINST and UNIX_TIMESTAMP. MySQL FULLTEXT has built-in |
|
| 117 | - * English ignore words. We use phpBB's ignore words for non-English |
|
| 118 | - * languages. We also remove any admin-defined special ignore words. |
|
| 119 | - * |
|
| 120 | - * @param array $topic_data Array with topic data |
|
| 121 | - * @return null |
|
| 122 | - * @access public |
|
| 123 | - */ |
|
| 113 | + * Get similar topics by matching topic titles |
|
| 114 | + * |
|
| 115 | + * NOTE: Currently requires MySQL due to the use of FULLTEXT indexes |
|
| 116 | + * and MATCH and AGAINST and UNIX_TIMESTAMP. MySQL FULLTEXT has built-in |
|
| 117 | + * English ignore words. We use phpBB's ignore words for non-English |
|
| 118 | + * languages. We also remove any admin-defined special ignore words. |
|
| 119 | + * |
|
| 120 | + * @param array $topic_data Array with topic data |
|
| 121 | + * @return null |
|
| 122 | + * @access public |
|
| 123 | + */ |
|
| 124 | 124 | public function display_similar_topics($topic_data) |
| 125 | 125 | { |
| 126 | 126 | $topic_title = $this->clean_topic_title($topic_data['topic_title']); |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | - * Event to modify the sql_array for similar topics |
|
| 202 | - * |
|
| 203 | - * @event vse.similartopics.get_topic_data |
|
| 204 | - * @var array sql_array SQL array to get similar topics data |
|
| 205 | - * @since 1.3.0 |
|
| 206 | - */ |
|
| 201 | + * Event to modify the sql_array for similar topics |
|
| 202 | + * |
|
| 203 | + * @event vse.similartopics.get_topic_data |
|
| 204 | + * @var array sql_array SQL array to get similar topics data |
|
| 205 | + * @since 1.3.0 |
|
| 206 | + */ |
|
| 207 | 207 | $vars = array('sql_array'); |
| 208 | 208 | extract($this->dispatcher->trigger_event('vse.similartopics.get_topic_data', compact($vars))); |
| 209 | 209 | |
@@ -291,13 +291,13 @@ discard block |
||
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | - * Event to modify the similar topics template block |
|
| 295 | - * |
|
| 296 | - * @event vse.similartopics.modify_topicrow |
|
| 297 | - * @var array row Array with similar topic data |
|
| 298 | - * @var array topic_row Template block array |
|
| 299 | - * @since 1.3.0 |
|
| 300 | - */ |
|
| 294 | + * Event to modify the similar topics template block |
|
| 295 | + * |
|
| 296 | + * @event vse.similartopics.modify_topicrow |
|
| 297 | + * @var array row Array with similar topic data |
|
| 298 | + * @var array topic_row Template block array |
|
| 299 | + * @since 1.3.0 |
|
| 300 | + */ |
|
| 301 | 301 | $vars = array('row', 'topic_row'); |
| 302 | 302 | extract($this->dispatcher->trigger_event('vse.similartopics.modify_topicrow', compact($vars))); |
| 303 | 303 | |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
| 325 | - * Clean topic title (and if needed, ignore-words) |
|
| 326 | - * |
|
| 327 | - * @param string $text The topic title |
|
| 328 | - * @return string The topic title |
|
| 329 | - * @access public |
|
| 330 | - */ |
|
| 325 | + * Clean topic title (and if needed, ignore-words) |
|
| 326 | + * |
|
| 327 | + * @param string $text The topic title |
|
| 328 | + * @return string The topic title |
|
| 329 | + * @access public |
|
| 330 | + */ |
|
| 331 | 331 | public function clean_topic_title($text) |
| 332 | 332 | { |
| 333 | 333 | // Strip quotes, ampersands |
@@ -342,12 +342,12 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | - * Remove any non-english and/or custom defined ignore-words |
|
| 346 | - * |
|
| 347 | - * @param string $text The topic title |
|
| 348 | - * @return string The topic title |
|
| 349 | - * @access protected |
|
| 350 | - */ |
|
| 345 | + * Remove any non-english and/or custom defined ignore-words |
|
| 346 | + * |
|
| 347 | + * @param string $text The topic title |
|
| 348 | + * @return string The topic title |
|
| 349 | + * @access protected |
|
| 350 | + */ |
|
| 351 | 351 | protected function strip_stop_words($text) |
| 352 | 352 | { |
| 353 | 353 | $words = array(); |
@@ -375,12 +375,12 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
| 378 | - * Helper function to split string into an array of words |
|
| 379 | - * |
|
| 380 | - * @param string $text String of plain text words |
|
| 381 | - * @return array Array of plaintext words |
|
| 382 | - * @access protected |
|
| 383 | - */ |
|
| 378 | + * Helper function to split string into an array of words |
|
| 379 | + * |
|
| 380 | + * @param string $text String of plain text words |
|
| 381 | + * @return array Array of plaintext words |
|
| 382 | + * @access protected |
|
| 383 | + */ |
|
| 384 | 384 | protected function make_word_array($text) |
| 385 | 385 | { |
| 386 | 386 | // Strip out any non-alpha-numeric characters using PCRE regex syntax |
@@ -400,33 +400,33 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
| 403 | - * Check if English is the current user's language |
|
| 404 | - * |
|
| 405 | - * @return bool True if lang is 'en' or 'en_us', false otherwise |
|
| 406 | - * @access protected |
|
| 407 | - */ |
|
| 403 | + * Check if English is the current user's language |
|
| 404 | + * |
|
| 405 | + * @return bool True if lang is 'en' or 'en_us', false otherwise |
|
| 406 | + * @access protected |
|
| 407 | + */ |
|
| 408 | 408 | protected function english_lang() |
| 409 | 409 | { |
| 410 | 410 | return ($this->user->lang_name == 'en' || $this->user->lang_name == 'en_us'); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | - * Check if custom ignore words have been defined for similar topics |
|
| 415 | - * |
|
| 416 | - * @return bool True or false |
|
| 417 | - * @access protected |
|
| 418 | - */ |
|
| 414 | + * Check if custom ignore words have been defined for similar topics |
|
| 415 | + * |
|
| 416 | + * @return bool True or false |
|
| 417 | + * @access protected |
|
| 418 | + */ |
|
| 419 | 419 | protected function has_ignore_words() |
| 420 | 420 | { |
| 421 | 421 | return !empty($this->config['similar_topics_words']); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
| 425 | - * Check if the database layer is MySQL4 or later |
|
| 426 | - * |
|
| 427 | - * @return bool True is MySQL4 or later, false otherwise |
|
| 428 | - * @access protected |
|
| 429 | - */ |
|
| 425 | + * Check if the database layer is MySQL4 or later |
|
| 426 | + * |
|
| 427 | + * @return bool True is MySQL4 or later, false otherwise |
|
| 428 | + * @access protected |
|
| 429 | + */ |
|
| 430 | 430 | protected function is_mysql() |
| 431 | 431 | { |
| 432 | 432 | return ($this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli'); |