Util
, DB
, User
, etc), please ensure your module is passing a valid values to methods, and that it expects valid results from the methods.HookHandler
class renamed & method changesHookHandler
has been renamed to EventHandler
to better suite it's purposes.registerHooks()
-> registerWebhooks()
registerHook()
-> registerListener()
getHooks()
-> getEvents()
getHook()
getParameters()
getDebugInfo()
method in Module
classesModule
class now must have a function named getDebugInfo()
which returns an array.Module::loadPage()
changesModule::loadPage()
method, please note these two changes:
$mod_nav
has been renamed to $staffcp_nav
within the Navigation[]
param of the method.$template
variable is now required at the end of the method. It was optional before, so you may not need to add anything.404
to Redirect::to()
methodRedirect::to(404);
to redirect the user to the 404 page, but this functionality has been removed, as it was seldom used within NamelessMC itself.void
return type added to WidgetBase->initialize()
methodremoveGroups()
method removed from User
classUtil::curlGetContents()
method deprecatedHttpClient
class.DB->query()
method deprecatedDB->selectQuery()
method.Email::send()
method changesThe new usage is as follows:
Timeago
class renamedTimeAgo
class with its corrected capitalization.Validate
initialization changesValidate::check(...)
to use the Validator.// Before
$validator = new Validate();
$validation = $validator->check(...);
if ($validation->passed()) {
// ...
}
// After
$validation = Validate::check(...);
if ($validation->passed()) {
// ...
}
TEMPLATE_TINY_EDITOR_STYLE
to TEMPLATE_TINY_EDITOR_DARKMODE
.$pages->registerSitemapMethod()
changesrequire
'd.$pages->registerSitemapMethod([MySitemapGenerator::class, 'generateSitemap']);
English.json
in the output directory):php scripts/language_convert.php --in /Users/aberdeener/Desktop/Nameless/custom/languages/English --out /Users/aberdeener/Desktop/Nameless/custom/new_languages
core/classes/Core/Language.php
and add your new language to the LANGUAGES
constant.
LANGUAGE
const.Queries
class deprecatedPlease migrate to the equivalent methods in the DB class.
Instancable
classgetInstance()
method attached to t.Placeholders
class.GroupSyncInjector
interfaceGroupSyncInjector
contract in a class, and register it using the GroupSyncManager::getInstance()->registerInjector(...)
method in your modules constructor.NamelessMCGroupSyncInjector
class.Util::isModuleEnabled()
methodUtil::isModuleEnabled(string $name)
method.HttpClient
classGET
or POST
requests rather than using cURL manually.$client = HttpClient::get($url); // or HttpClient::post($url, $data)
if ($client->hasError()) {
die($client->getError();
}
$status = $client->status(); // 200, 404, 500, etc
$data = $client->data();
Endpoints::registerTransformer(string $type, Closure $transformer)
"user"
transformer for finding a user by the given ID in the request URL{user}
appears in an API endpoint URLexecute(Nameless2API $api, ...);
method!"post"
-> get a specific post"report"
-> get a specific reportEmail::addPlaceholder()
method[SquareBrackets]
.API error codes have been removed and replaced with string constants.
$ALL_USERS
variable has been changed from a comma seperated string of usernames to an array of usernames.