for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
*
* Topic Prefixes extension for the phpBB Forum Software package.
* @copyright (c) 2016 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*/
namespace phpbb\topicprefixes\acp;
* Class topic_prefixes_module
class topic_prefixes_module
{
/** @var string */
public $u_action;
* Main ACP module
public function main()
global $phpbb_container;
global
Instead of relying on global state, we recommend one of these alternatives:
function myFunction($a, $b) { // Do something }
class MyClass { private $a; private $b; public function __construct($a, $b) { $this->a = $a; $this->b = $b; } public function myFunction() { // Do something } }
$user = $phpbb_container->get('user');
$user->add_lang('acp/forums');
$user->add_lang_ext('phpbb/topicprefixes', 'acp_topic_prefixes');
$this->tpl_name = 'acp_topic_prefixes';
tpl_name
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->page_title = $user->lang('TOPIC_PREFIXES');
page_title
$admin_controller = $phpbb_container->get('phpbb.topicprefixes.admin_controller');
$admin_controller->set_u_action($this->u_action)->main();
}
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state