various phpdoc improvements and additions

added some getter methods for properties
This commit is contained in:
Steffen Schröder 2014-07-25 16:28:47 +02:00
parent 29f89ec15f
commit 002b537b47
38 changed files with 381 additions and 188 deletions

View File

@ -32,15 +32,11 @@ class AuthenticationManager implements CallbackListener {
const AUTH_NAME_MASTERADMIN = 'MasterAdmin';
const CB_AUTH_LEVEL_CHANGED = 'AuthenticationManager.AuthLevelChanged';
/*
* Public Properties
*/
public $authCommands = null;
/*
* Private Properties
*/
private $maniaControl = null;
private $authCommands = null;
/**
* Construct a new Authentication Manager

View File

@ -2,6 +2,8 @@
namespace ManiaControl\Bills;
use ManiaControl\Players\Player;
/**
* ManiaControl BillData Structure
*
@ -10,8 +12,9 @@ namespace ManiaControl\Bills;
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class BillData {
/*
* Public Properties
* Public properties
*/
public $function = null;
public $pay = false;
@ -21,13 +24,13 @@ class BillData {
public $creationTime = -1;
/**
* Construct new BillData
* Construct new Bill Data Model
*
* @param mixed $function
* @param Player /string $player
* @param int $amount
* @param bool $pay
* @param string $receiverLogin
* @param mixed $function
* @param Player|string $player
* @param int $amount
* @param bool $pay
* @param string $receiverLogin
*/
public function __construct($function, $player, $amount, $pay = false, $receiverLogin = null) {
$this->function = $function;
@ -37,5 +40,4 @@ class BillData {
$this->receiverLogin = $receiverLogin;
$this->creationTime = time();
}
}
}

View File

@ -9,7 +9,7 @@ use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Structures\Bill;
/**
* ManiaControl Bill-Manager
* ManiaControl Bill Manager Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -26,15 +26,15 @@ class BillManager implements CallbackListener {
const ERROR_WHILE_TRANSACTION = 5;
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
private $openBills = array();
/**
* Construct a new Bill Manager
* Construct a new Bill Manager Instance
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
@ -65,13 +65,13 @@ class BillManager implements CallbackListener {
* Send Planets from the server to a Player
*
* @param callable $function
* @param string $receiverLogin
* @param int $amount
* @param string $message
* @param string $receiverLogin
* @param int $amount
* @param string $message
* @return bool
*/
public function sendPlanets(callable $function, $receiverLogin, $amount, $message) {
$bill = $this->maniaControl->client->pay($receiverLogin, $amount, $message);
$bill = $this->maniaControl->client->pay($receiverLogin, $amount, $message);
$this->openBills[$bill] = new BillData($function, $receiverLogin, $amount, true);
return true;
}

View File

@ -16,9 +16,10 @@ use ManiaControl\ManiaControl;
*/
class CommandManager implements CallbackListener {
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/** @var HelpManager $helpManager */
private $helpManager = array();
/** @var Listening[][] $commandListenings */
private $commandListenings = array();
@ -33,13 +34,22 @@ class CommandManager implements CallbackListener {
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
// Create help manager instance
// Children
$this->helpManager = new HelpManager($this->maniaControl);
// Register for callback
// Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handleChatCallback');
}
/**
* Return the help manager instance
*
* @return HelpManager
*/
public function getHelpManager() {
return $this->helpManager;
}
/**
* Register a Command Listener
*

View File

@ -13,7 +13,7 @@ use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Players\Player;
/**
* Help Manager
* ManiaControl Help Manager Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -31,12 +31,12 @@ class HelpManager implements CommandListener, CallbackListener {
/**
* Construct a new Commands Manager
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
// Register for callbacks
// Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
}
@ -44,7 +44,6 @@ class HelpManager implements CommandListener, CallbackListener {
* Handle ManiaControl OnInit Callback
*/
public function handleOnInit() {
//Register the help command
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false, 'Shows all commands in chat.');
$this->maniaControl->commandManager->registerCommandListener('helpall', $this, 'command_playerHelpAll', false, 'Shows all commands in ManiaLink with description.');
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true, 'Shows all admin commands in chat.');
@ -52,7 +51,7 @@ class HelpManager implements CommandListener, CallbackListener {
}
/**
* Shows a list of Admin Commands
* Show a list of Admin Commands
*
* @param array $chatCallback
* @param Player $player
@ -83,7 +82,7 @@ class HelpManager implements CommandListener, CallbackListener {
}
/**
* Shows a list of Player Commands
* Show a list of Player Commands
*
* @param array $chatCallback
* @param Player $player
@ -114,7 +113,7 @@ class HelpManager implements CommandListener, CallbackListener {
}
/**
* Shows a ManiaLink list of Player Commands
* Show a ManiaLink list of Player Commands
*
* @param array $chatCallback
* @param Player $player
@ -155,7 +154,7 @@ class HelpManager implements CommandListener, CallbackListener {
}
/**
* Shows the HelpAll list to the player.
* Show the HelpAll list to the player.
*
* @param array $commands
* @param mixed $player
@ -228,7 +227,7 @@ class HelpManager implements CommandListener, CallbackListener {
}
/**
* Shows a ManiaLink list of Admin Commands
* Show a ManiaLink list of Admin Commands
*
* @param array $chatCallback
* @param Player $player
@ -238,12 +237,12 @@ class HelpManager implements CommandListener, CallbackListener {
}
/**
* Registers a new Command
* Register a new Command
*
* @param $name
* @param string $name
* @param bool $adminCommand
* @param string $description
* @param $method
* @param string $method
*/
public function registerCommand($name, $adminCommand = false, $description = '', $method) {
if ($adminCommand) {

View File

@ -44,17 +44,20 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
const MENU_NAME = 'Configurator';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/** @var ScriptSettings $scriptSettings */
private $scriptSettings = null;
/** @var ServerOptionsMenu $serverOptionsMenu */
private $serverOptionsMenu = null;
/** @var ManiaControlSettings $maniaControlSettings */
private $maniaControlSettings = null;
/** @var ConfiguratorMenu[] $menus */
private $menus = array();
/**
* Create a new Configurator
* Create a new configurator instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -38,12 +38,12 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
const CACHE_CLASS_OPENED = 'ClassOpened';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new Script Settings Instance
* Create a new ManiaControl Settings Instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -37,12 +37,12 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
const SETTING_PERMISSION_CHANGE_SCRIPT_SETTINGS = 'Change Script-Settings';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new Script Settings Instance
* Construct a new script settings instance
*
* @param ManiaControl $maniaControl
*/
@ -50,17 +50,17 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$this->maniaControl = $maniaControl;
$this->initTables();
// Register for callbacks
// Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'onBeginMap');
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, false);
//Permission for Change Script-Settings
// Permissions
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SCRIPT_SETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN);
}
/**
* Create all necessary Database Tables
* Create all necessary database tables
*
* @return boolean
*/

View File

@ -14,13 +14,15 @@ use ManiaControl\ManiaControl;
*/
class Database implements TimerListener {
/*
* Public Properties
* Public properties
*/
/** @var \mysqli $mysqli */
public $mysqli = null;
/** @var MigrationHelper $migrationHelper */
public $migrationHelper = null;
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/** @var Config $config */
@ -181,6 +183,33 @@ class Database implements TimerListener {
return true;
}
/**
* Return the database config
*
* @return Config
*/
public function getConfig() {
return $this->config;
}
/**
* Return the migration helper
*
* @return MigrationHelper
*/
public function getMigrationHelper() {
return $this->migrationHelper;
}
/**
* Return the mysqli instance
*
* @return \mysqli
*/
public function getMysqli() {
return $this->mysqli;
}
/**
* Check whether the Database Connection is still open
*/

View File

@ -15,12 +15,12 @@ use ManiaControl\Utils\ClassUtil;
*/
class MigrationHelper {
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Construct Migration Helper
* Construct a new migration helper instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -31,7 +31,7 @@ class ErrorHandler {
private $handlingError = null;
/**
* Construct Error Handler
* Construct a new error handler instance
*
* @param ManiaControl @maniaControl
*/
@ -43,7 +43,7 @@ class ErrorHandler {
}
/**
* Initialize other Error Handler Features
* Initialize error handler features
*/
public function init() {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_RESTART_ON_EXCEPTION, true);

View File

@ -10,7 +10,7 @@ use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager;
/**
* Class managing the Custom UI Settings
* Class managing the Custom UI in TrackMania
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -23,7 +23,7 @@ class CustomUIManager implements CallbackListener, TimerListener {
const CUSTOMUI_MLID = 'CustomUI.MLID';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/** @var customUI $customUI */
@ -31,7 +31,7 @@ class CustomUIManager implements CallbackListener, TimerListener {
private $updateManialink = false;
/**
* Create a Custom UI Manager
* Create a custom UI manager instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -26,7 +26,7 @@ class IconManager implements CallbackListener {
const PRELOAD_MLID = 'IconManager.Preload.MLID';
/**
* Some Default icons
* Default icons
*/
const MX_ICON = 'ManiaExchange.png';
const MX_ICON_MOVER = 'ManiaExchange_logo_press.png';
@ -35,13 +35,13 @@ class IconManager implements CallbackListener {
const MX_ICON_GREEN_MOVER = 'ManiaExchange_logo_pressGreen.png';
/**
* Private Properties
* Private properties
*/
private $maniaControl = null;
private $icons = array();
/**
* Create a new Icon Manager
* Construct a new icon manager instance
*
* @param ManiaControl $maniaControl
*/
@ -55,14 +55,13 @@ class IconManager implements CallbackListener {
}
/**
* Add the Set of default Icons
* Add the set of default icons
*/
private function addDefaultIcons() {
$this->addIcon(self::MX_ICON);
$this->addIcon(self::MX_ICON_MOVER);
$this->addIcon(self::MX_ICON_GREEN);
$this->addIcon(self::MX_ICON_GREEN_MOVER);
}
/**
@ -125,4 +124,4 @@ class IconManager implements CallbackListener {
public function handlePlayerConnect(Player $player) {
$this->preloadIcons($player);
}
}
}

View File

@ -30,14 +30,17 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
const CB_MAIN_WINDOW_OPENED = 'ManialinkManagerCallback.MainWindowOpened';
/*
* Public Properties
* Public properties
*/
/** @var StyleManager $styleManager */
public $styleManager = null;
/** @var CustomUIManager $customUIManager */
public $customUIManager = null;
/** @var IconManager $iconManager */
public $iconManager = null;
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
// TODO: use listening class
@ -45,17 +48,19 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
private $pageAnswerRegexListener = array();
/**
* Create a new manialink manager
* Construct a new manialink manager instance
*
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
// Children
$this->styleManager = new StyleManager($maniaControl);
$this->customUIManager = new CustomUIManager($maniaControl);
$this->iconManager = new IconManager($maniaControl);
// Register for callbacks
// Callbacks
$this->registerManialinkPageAnswerListener(self::ACTION_CLOSEWIDGET, $this, 'closeWidgetCallback');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
}
@ -85,6 +90,33 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
return true;
}
/**
* Return the style manager
*
* @return StyleManager
*/
public function getStyleManager() {
return $this->styleManager;
}
/**
* Return the custom UI manager
*
* @return CustomUIManager
*/
public function getCustomUIManager() {
return $this->customUIManager;
}
/**
* Return the icon manager
*
* @return IconManager
*/
public function getIconManager() {
return $this->iconManager;
}
/**
* Register a new manialink page answer reg ex listener
*

View File

@ -33,10 +33,10 @@ class StyleManager {
const SETTING_LIST_WIDGETS_WIDTH = 'List Widgets Width';
const SETTING_LIST_WIDGETS_HEIGHT = 'List Widgets Height';
const SETTING_ICON_DEFAULT_OFFSET_SM = 'Default Icon Offset in Shootmania';
const SETTING_ICON_DEFAULT_OFFSET_SM = 'Default Icon Offset in ShootMania';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;

View File

@ -46,7 +46,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
private $maniaControl = null;
/**
* Create a new Directory Browser Instance
* Create a new directory browser instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -6,7 +6,7 @@ use ManiaControl\ManiaExchange\MXMapInfo;
use ManiaControl\Utils\Formatter;
/**
* Map Model Class
* ManiaControl Map Model Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -14,7 +14,7 @@ use ManiaControl\Utils\Formatter;
*/
class Map {
/*
* Public Properties
* Public properties
*/
public $index = -1;
public $name = 'undefined';
@ -42,10 +42,9 @@ class Map {
public $karma = null;
/**
* Create a new Map Object from Rpc Data
* Construct a new map instance from xmlrpc data
*
* @param \Maniaplanet\DedicatedServer\Structures\Map $mpMap
* @internal param \ManiaControl\ManiaControl $maniaControl
*/
public function __construct($mpMap = null) {
$this->startTime = time();
@ -71,7 +70,7 @@ class Map {
}
/**
* Get the escaped Map Name
* Get the escaped map name
*
* @return string
*/
@ -80,7 +79,7 @@ class Map {
}
/**
* Get the Game Type of the Map
* Get the game type of the map
*
* @return string
*/
@ -97,17 +96,12 @@ class Map {
}
/**
* Checks if a map Update is available
* Check whether a map update is available
*
* @return bool
*/
public function updateAvailable() {
if ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid !== $this->mx->uid)) {
return true;
} else {
return false;
}
return ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid !== $this->mx->uid));
}
/**
@ -116,4 +110,4 @@ class Map {
public function dump() {
var_dump(json_decode(json_encode($this)));
}
}
}

View File

@ -6,7 +6,7 @@ use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
/**
* Map Actions Class
* ManiaControl Map Actions Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -14,12 +14,12 @@ use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
*/
class MapActions {
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Construct a Map Actions Instance
* Construct a map actions instance
*
* @param ManiaControl $maniaControl
*/
@ -28,7 +28,7 @@ class MapActions {
}
/**
* Skips the current Map
* Skip the current Map
*/
public function skipMap() {
//Force a EndMap on the MapQueue to set the next Map

View File

@ -34,14 +34,14 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
const ACTION_SHOW_AUTHOR = 'MapList.ShowAuthorList.';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create MapCommands instance
* Construct a new map commands instance
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
@ -102,7 +102,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
}
/**
* Shows which map is the next
* Show which map is the next
*
* @param array $chatCallback
* @param Player $player

View File

@ -57,12 +57,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
const WIDGET_NAME = 'MapList';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new MapList Instance
* Construct a new map list instance
*
* @param ManiaControl $maniaControl
*/
@ -83,7 +83,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
}
/**
* Clears the Map Queue
* Clear the Map Queue
*
* @param array $chatCallback
* @param Player $player

View File

@ -22,10 +22,8 @@ use Maniaplanet\DedicatedServer\Xmlrpc\InvalidMapException;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
use Maniaplanet\DedicatedServer\Xmlrpc\UnavailableFeatureException;
// TODO: adding of local maps
/**
* Manager for Maps
* ManiaControl Map Manager Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -54,20 +52,29 @@ class MapManager implements CallbackListener {
const CB_ENDMAP = 'Callbacks.EndMap';
/*
* Public Properties
* Public properties
*/
/** @var MapQueue $mapQueue */
public $mapQueue = null;
/** @var MapCommands $mapCommands */
public $mapCommands = null;
public $mapList = null;
public $directoryBrowser = null;
public $mxList = null;
public $mxManager = null;
/** @var MapActions $mapActions */
public $mapActions = null;
/** @var MapList $mapList */
public $mapList = null;
/** @var DirectoryBrowser $directoryBrowser */
public $directoryBrowser = null;
/** @var ManiaExchangeList $mxList */
public $mxList = null;
/** @var ManiaExchangeManager $mxManager */
public $mxManager = null;
/*
* Private Properties
* Private properties
*/
/** @var ManiaControl $maniaControl */
private $maniaControl = null;
/** @var Map[] $maps */
private $maps = array();
/** @var Map $currentMap */
private $currentMap = null;
@ -75,7 +82,7 @@ class MapManager implements CallbackListener {
private $mapBegan = false;
/**
* Construct a new Map Manager
* Construct a new map manager instance
*
* @param ManiaControl $maniaControl
*/
@ -83,7 +90,7 @@ class MapManager implements CallbackListener {
$this->maniaControl = $maniaControl;
$this->initTables();
// Create map commands instance
// Children
$this->mxManager = new ManiaExchangeManager($this->maniaControl);
$this->mapList = new MapList($this->maniaControl);
$this->directoryBrowser = new DirectoryBrowser($this->maniaControl);
@ -92,12 +99,12 @@ class MapManager implements CallbackListener {
$this->mapQueue = new MapQueue($this->maniaControl);
$this->mapActions = new MapActions($maniaControl);
// Register for callbacks
// Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified');
// Define Rights
// Permissions
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_REMOVE_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ERASE_MAP, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
@ -106,12 +113,13 @@ class MapManager implements CallbackListener {
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SKIP_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR);
// Settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTOSAVE_MAPLIST, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIST_FILE, "MatchSettings/tracklist.txt");
}
/**
* Initialize necessary Database Tables
* Initialize necessary database tables
*
* @return bool
*/
@ -138,6 +146,69 @@ class MapManager implements CallbackListener {
return $result;
}
/**
* Return the map queue
*
* @return MapQueue
*/
public function getMapQueue() {
return $this->mapQueue;
}
/**
* Return the map commands
*
* @return MapCommands
*/
public function getMapCommands() {
return $this->mapCommands;
}
/**
* Return the map actions
*
* @return MapActions
*/
public function getMapActions() {
return $this->mapActions;
}
/**
* Return the map list
*
* @return MapList
*/
public function getMapList() {
return $this->mapList;
}
/**
* Return the directory browser
*
* @return DirectoryBrowser
*/
public function getDirectoryBrowser() {
return $this->directoryBrowser;
}
/**
* Return the mx list
*
* @return ManiaExchangeList
*/
public function getMXList() {
return $this->mxList;
}
/**
* Return the mx manager
*
* @return ManiaExchangeManager
*/
public function getMXManager() {
return $this->mxManager;
}
/**
* Update a Map from Mania Exchange
*

View File

@ -12,7 +12,7 @@ use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\NextMapException;
/**
* MapQueue Class
* ManiaControl Map Queue Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -36,7 +36,7 @@ class MapQueue implements CallbackListener, CommandListener {
const ADMIN_COMMAND_CLEAR_JUKEBOX = 'clearjukebox';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
private $queuedMaps = array();
@ -45,7 +45,7 @@ class MapQueue implements CallbackListener, CommandListener {
private $nextNoQueue = false;
/**
* Create a new server MapQueue
* Construct a new map queue instance
*
* @param ManiaControl $maniaControl
*/
@ -80,7 +80,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Adds current map to buffer on startup
* Add current map to buffer on startup
*/
public function handleAfterInit() {
$currentMap = $this->maniaControl->mapManager->getCurrentMap();
@ -88,7 +88,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Clears the map-queue via admin command clear map queue
* Clear the map-queue via admin command clear map queue
*
* @param array $chatCallback
* @param Player $admin
@ -126,7 +126,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Handles the mapqueue/jukebox command
* Handle the mapqueue/jukebox command
*
* @param array $chatCallback
* @param Player $player
@ -156,7 +156,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Shows current mapqueue in the chat
* Show current mapqueue in the chat
*
* @param Player $player
*/
@ -177,7 +177,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Shows current mapqueue in a manialink
* Show current mapqueue in a manialink
*
* @param Player $player
*/
@ -196,7 +196,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns the current queue buffer
* Return the current queue buffer
*
* @return string[]
*/
@ -205,7 +205,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Adds map as first map in queue (for /replay)
* Add map as first map in queue (for /replay)
*
* @param Player $player
* @param Map $map
@ -221,7 +221,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Adds a Map to the map-queue
* Add a Map to the map-queue
*
* @param string $login
* @param string $uid
@ -308,7 +308,6 @@ class MapQueue implements CallbackListener, CommandListener {
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('remove', $map));
}
/**
* Called on endmap
*
@ -388,7 +387,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns the next Map if the next map is a queuedmap or null if it's not
* Return the next Map if the next map is a queuedmap or null if it's not
*
* @return Map
*/
@ -397,7 +396,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns the first Queued Map
* Return the first Queued Map
*
* @return array(Player $player, Map $map)
*/
@ -410,7 +409,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns a list with the indexes of the queued maps
* Return a list with the indexes of the queued maps
*
* @return array
*/

View File

@ -32,12 +32,12 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
const ACTION_REFRESH_LIST = 'PluginInstallMenu.RefreshList';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new Plugin Install Menu
* Create a new plugin install menu instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -62,7 +62,7 @@ interface Plugin {
/**
* Load the plugin
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
* @return bool
*/
public function load(ManiaControl $maniaControl);

View File

@ -24,10 +24,12 @@ class PluginManager {
const CB_PLUGIN_UNLOADED = 'PluginManager.PluginUnloaded';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/** @var PluginMenu $pluginMenu */
private $pluginMenu = null;
/** @var InstallMenu $pluginInstallMenu */
private $pluginInstallMenu = null;
/** @var Plugin[] $activePlugins */
private $activePlugins = array();
@ -35,9 +37,9 @@ class PluginManager {
private $pluginClasses = array();
/**
* Construct plugin manager
* Construct a new plugin manager instance
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
@ -459,7 +461,6 @@ class PluginManager {
*/
public function fetchPluginList(callable $function) {
$url = ManiaControl::URL_WEBSERVICE . 'plugins';
$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) {
$data = json_decode($dataJson);
call_user_func($function, $data, $error);

View File

@ -46,12 +46,12 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
const CACHE_SETTING_CLASS = 'PluginMenuCache.SettingClass';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new Plugin Menu Instance
* Create a new plugin menu instance
*
* @param ManiaControl $maniaControl
*/
@ -71,7 +71,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
/**
* Return back to the Plugins
* Return back to the plugins overview page
*
* @param array $callback
* @param Player $player

View File

@ -41,7 +41,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
const COMMAND_FORCE_WARMUP = 'Command_ForceWarmUp';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
private $serverShutdownTime = -1;

View File

@ -11,7 +11,7 @@ namespace ManiaControl\Server;
*/
class Config {
/*
* Public Properties
* Public properties
*/
public $id = null;
public $host = null;
@ -20,7 +20,7 @@ class Config {
public $pass = null;
/**
* Create a new Server Config Instance
* Create a new server config instance
*
* @param mixed $id
* @param mixed $host

View File

@ -16,12 +16,12 @@ use ManiaControl\ManiaControl;
*/
class Directory implements CallbackListener {
/**
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create new Server Directory Object
* Create new server directory instance
*
* @param ManiaControl $maniaControl
*/
@ -75,6 +75,15 @@ class Directory implements CallbackListener {
return $this->getGameDataFolder() . '..' . DIRECTORY_SEPARATOR . 'Logs' . DIRECTORY_SEPARATOR;
}
/**
* Retrieve the Game Data Folder Path
*
* @return string
*/
public function getGameDataFolder() {
return $this->maniaControl->client->gameDataDirectory();
}
/**
* @return bool
*/
@ -90,13 +99,4 @@ class Directory implements CallbackListener {
public function getCacheFolder() {
return $this->getGameDataFolder() . '..' . DIRECTORY_SEPARATOR . 'CommonData' . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR;
}
/**
* Retrieve the Game Data Folder Path
*
* @return string
*/
public function getGameDataFolder() {
return $this->maniaControl->client->gameDataDirectory();
}
}

View File

@ -17,14 +17,14 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
*/
class RankingManager implements CallbackListener {
/*
* Private Properties
* Private properties
*/
private $rankings = array();
/**
* Construct player manager
* Construct a new ranking manager instance
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
@ -37,7 +37,7 @@ class RankingManager implements CallbackListener {
}
/**
* Initialize the Rankings (never call this Method)
* Initialize the Rankings (never call this Method)
*/
public function onInit() {
try {
@ -124,4 +124,4 @@ class RankingManager implements CallbackListener {
public function getPlayerRanking() {
//TODO complete this
}
}
}

View File

@ -15,15 +15,11 @@ class ScriptManager {
/*
* Private Properties
*/
public $maniaControl = null;
/*
* Private Properties
*/
private $maniaControl = null;
private $isScriptMode = null;
/**
* Construct a new Script Manager
* Construct a new script manager instance
*
* @param ManiaControl $maniaControl
*/
@ -32,7 +28,7 @@ class ScriptManager {
}
/**
* Enable Script Callbacks
* Enable script callbacks
*
* @param bool $enable
* @return bool
@ -56,7 +52,7 @@ class ScriptManager {
}
/**
* Check if the Server is running in Script Mode
* Check whether the Server is running in Script Mode
*
* @return bool
*/

View File

@ -10,7 +10,7 @@ use ManiaControl\Utils\CommandLineHelper;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class providing Access to the connected ManiaPlanet Server
* Class providing access to the connected ManiaPlanet Server
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -24,7 +24,7 @@ class Server implements CallbackListener {
const CB_TEAM_MODE_CHANGED = 'Server.TeamModeChanged';
/*
* Public Properties
* Public properties
*/
/** @var Config $config */
public $config = null;
@ -34,10 +34,15 @@ class Server implements CallbackListener {
public $p2pPort = -1;
public $login = null;
public $titleId = null;
/** @var Directory $directory */
public $directory = null;
/** @var Commands $commands */
public $commands = null;
/** @var UsageReporter $usageReporter */
public $usageReporter = null;
/** @var RankingManager $rankingManager */
public $rankingManager = null;
/** @var ScriptManager $scriptManager */
public $scriptManager = null;
/*
@ -92,6 +97,51 @@ class Server implements CallbackListener {
return true;
}
/**
* Return the server config
*
* @return Config
*/
public function getConfig() {
return $this->config;
}
/**
* Return the server directory
*
* @return Directory
*/
public function getDirectory() {
return $this->directory;
}
/**
* Return the server commands
*
* @return Commands
*/
public function getCommands() {
return $this->commands;
}
/**
* Return the usage reporter
*
* @return UsageReporter
*/
public function getUsageReporter() {
return $this->usageReporter;
}
/**
* Return the script manager
*
* @return ScriptManager
*/
public function getScriptManager() {
return $this->scriptManager;
}
/**
* Load the Server Configuration from the Config XML
*/

View File

@ -5,7 +5,7 @@ namespace ManiaControl\Settings;
use ManiaControl\Utils\ClassUtil;
/**
* Model Class for a Setting
* ManiaControl Setting Model Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -24,7 +24,7 @@ class Setting {
const VALUE_DELIMITER = ';;';
/*
* Public Properties
* Public properties
*/
public $index = null;
public $class = null;
@ -36,7 +36,7 @@ class Setting {
public $fetchTime = null;
/**
* Construct a new Setting
* Construct a new setting instance
*
* @param mixed $object
* @param string $settingName

View File

@ -9,7 +9,7 @@ use ManiaControl\Plugins\PluginManager;
use ManiaControl\Utils\ClassUtil;
/**
* Class managing Settings and Configurations
* Class managing ManiaControl Settings and Configurations
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -22,16 +22,16 @@ class SettingManager implements CallbackListener {
const TABLE_SETTINGS = 'mc_settings';
const CB_SETTING_CHANGED = 'SettingManager.SettingChanged';
/** @deprecated Use CB_SETTING_CHANGED */
const CB_SETTINGS_CHANGED = 'SettingManager.SettingsChanged';
const CB_SETTINGS_CHANGED = 'SettingManager.SettingChanged';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
private $storedSettings = array();
/**
* Construct a new Setting Manager
* Construct a new setting manager instance
*
* @param ManiaControl $maniaControl
*/
@ -39,11 +39,12 @@ class SettingManager implements CallbackListener {
$this->maniaControl = $maniaControl;
$this->initTables();
// Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
}
/**
* Initialize the necessary Database Tables
* Initialize the necessary database tables
*
* @return bool
*/
@ -321,7 +322,7 @@ class SettingManager implements CallbackListener {
$settingStatement->close();
// Trigger Settings Changed Callback
if(!$init){
if (!$init) {
$this->maniaControl->callbackManager->triggerCallback(self::CB_SETTING_CHANGED, $setting);
}
return true;

View File

@ -3,7 +3,7 @@
namespace ManiaControl\Update;
/**
* Plugin Update Data Structure
* Plugin Update Data Model Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -11,7 +11,7 @@ namespace ManiaControl\Update;
*/
class PluginUpdateData {
/*
* Public Properties
* Public properties
*/
public $pluginId = null;
public $pluginName = null;
@ -23,7 +23,7 @@ class PluginUpdateData {
public $url = null;
/**
* Construct new Plugin Update Data
* Construct new plugin update data instance
*
* @param object $updateData
*/
@ -41,7 +41,7 @@ class PluginUpdateData {
}
/**
* Check if the Plugin Update Data is newer than the given Plugin Version
* Check if the plugin update data is newer than the given plugin version
*
* @param float $version
* @return bool

View File

@ -25,12 +25,12 @@ use ManiaControl\Utils\WebReader;
*/
class PluginUpdateManager implements CallbackListener, CommandListener, TimerListener {
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new Plugin Update Manager
* Create a new plugin update manager instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -3,7 +3,7 @@
namespace ManiaControl\Update;
/**
* Update Data Structure
* ManiaControl Update Data Model Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -11,7 +11,7 @@ namespace ManiaControl\Update;
*/
class UpdateData {
/*
* Public Properties
* Public properties
*/
public $version = null;
public $channel = null;
@ -20,7 +20,7 @@ class UpdateData {
public $minDedicatedBuild = null;
/**
* Construct new Update Data
* Construct new update data instance
*
* @param object $updateData
*/
@ -33,7 +33,7 @@ class UpdateData {
}
/**
* Check if the Update Data is newer than the given Date
* Check if the update data is newer than the given date
*
* @param string $compareDate
* @return bool

View File

@ -35,22 +35,22 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
const CHANNEL_NIGHTLY = 'nightly';
/*
* Public Properties
* Public properties
*/
/** @var PluginUpdateManager $pluginUpdateManager */
public $pluginUpdateManager = null;
/** @var UpdateData $coreUpdateData */
public $coreUpdateData = null;
/*
* Private Properties
* Private properties
*/
/** @var ManiaControl $maniaControl */
private $maniaControl = null;
private $currentBuildDate = null;
/** @var UpdateData $coreUpdateData */
private $coreUpdateData = null;
/**
* Create a new Update Manager
* Create a new update manager instance
*
* @param ManiaControl $maniaControl
*/
@ -83,7 +83,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
}
/**
* Get the possible Update Channels
* Get the possible update channels
*
* @return string[]
*/
@ -92,6 +92,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return array(self::CHANNEL_BETA, self::CHANNEL_RELEASE, self::CHANNEL_NIGHTLY);
}
/**
* Return the plugin update manager
*
* @return PluginUpdateManager
*/
public function getPluginUpdateManager() {
return $this->pluginUpdateManager;
}
/**
* Perform Hourly Update Check
*/
@ -316,7 +325,9 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
}
$updateData = $this->coreUpdateData;
$this->maniaControl->fileReader->loadFile($updateData->url, function ($updateFileContent, $error) use ($updateData, &$player) {
$this->maniaControl->fileReader->loadFile($updateData->url, function ($updateFileContent, $error) use (
$updateData, &$player
) {
if (!$updateFileContent || $error) {
$message = "Update failed: Couldn't load Update zip! {$error}";
if ($player) {