Skip to content

Commit c9f5823

Browse files
committed
Clean up
Fix things
1 parent 291012c commit c9f5823

4 files changed

Lines changed: 17 additions & 35 deletions

File tree

controller/base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function __construct(auth $auth, config $config, helper $helper, language
9292
/**
9393
* Set the Ideas entity
9494
*
95-
* @param string $entity
95+
* @param \phpbb\ideas\factory\ideas|\phpbb\ideas\factory\idea $entity
9696
*/
9797
public function get_entity($entity)
9898
{

controller/post_controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace phpbb\ideas\controller;
1212

13-
use \phpbb\exception\http_exception;
13+
use phpbb\exception\http_exception;
1414
use Symfony\Component\HttpFoundation\RedirectResponse;
1515

1616
class post_controller extends base

factory/base.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use phpbb\auth\auth;
1414
use phpbb\config\config;
1515
use phpbb\db\driver\driver_interface;
16+
use phpbb\ideas\ext;
1617
use phpbb\language\language;
1718
use phpbb\user;
1819

@@ -76,6 +77,18 @@ public function __construct(auth $auth, config $config, driver_interface $db, la
7677
$this->table_topics = $table_topics;
7778
}
7879

80+
/**
81+
* Returns the status name from the status ID specified.
82+
*
83+
* @param int $id ID of the status.
84+
*
85+
* @return string|bool The status name if it exists, false otherwise.
86+
*/
87+
public function get_status_from_id($id)
88+
{
89+
return $this->language->lang(array_search($id, ext::$statuses));
90+
}
91+
7992
/**
8093
* Helper method for inserting new idea data
8194
*

factory/idea.php

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
*/
1818
class idea extends base
1919
{
20-
/** @var string */
21-
protected $profile_url;
22-
2320
/**
2421
* Returns the specified idea.
2522
*
@@ -58,18 +55,6 @@ public function get_idea_by_topic_id($id)
5855
return $this->get_idea($idea_id);
5956
}
6057

61-
/**
62-
* Returns the status name from the status ID specified.
63-
*
64-
* @param int $id ID of the status.
65-
*
66-
* @return string|bool The status name if it exists, false otherwise.
67-
*/
68-
public function get_status_from_id($id)
69-
{
70-
return $this->language->lang(array_search($id, ext::$statuses));
71-
}
72-
7358
/**
7459
* Updates the status of an idea.
7560
*
@@ -437,28 +422,12 @@ public function get_voters($id)
437422

438423
// Process the username for the template now, so it is
439424
// ready to use in AJAX responses and DOM injections.
425+
$profile_url = append_sid(generate_board_url() . "/memberlist.{$this->php_ext}", array('mode' => 'viewprofile'));
440426
foreach ($rows as &$row)
441427
{
442-
$row['user'] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, $this->profile_url());
428+
$row['user'] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, $profile_url);
443429
}
444430

445431
return $rows;
446432
}
447-
448-
/**
449-
* Helper to generate the user profile URL with an
450-
* absolute URL, which helps avoid problems when
451-
* used in AJAX requests.
452-
*
453-
* @return string User profile URL
454-
*/
455-
protected function profile_url()
456-
{
457-
if (!isset($this->profile_url))
458-
{
459-
$this->profile_url = append_sid(generate_board_url() . "/memberlist.{$this->php_ext}", array('mode' => 'viewprofile'));
460-
}
461-
462-
return $this->profile_url;
463-
}
464433
}

0 commit comments

Comments
 (0)