constants names improved

This commit is contained in:
Steffen Schröder 2014-06-17 23:35:56 +02:00
parent 2e0a0359dd
commit b1ce658fc9
5 changed files with 76 additions and 76 deletions

View File

@ -28,7 +28,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
/*
* Constants
*/
const ACTION_OPEN_ADMINLIST = 'AdminList.OpenAdminList';
const ACTION_OPEN_ADMIN_LIST = 'AdminList.OpenAdminList';
const ACTION_REVOKE_RIGHTS = 'AdminList.RevokeRights';
const MAX_PLAYERS_PER_PAGE = 15;
@ -51,10 +51,10 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget');
// Menu Entry AdminList
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMINLIST, $this, 'openAdminList');
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMIN_LIST, $this, 'openAdminList');
$itemQuad = new Quad_UIConstruction_Buttons();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
$itemQuad->setAction(self::ACTION_OPEN_ADMINLIST);
$itemQuad->setAction(self::ACTION_OPEN_ADMIN_LIST);
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 50, 'Open AdminList');
}

View File

@ -40,21 +40,21 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
const MLID_DEDIMANIA = 'Dedimania.ManialinkId';
const XMLRPC_MULTICALL = 'system.multicall';
const DEDIMANIA_URL = 'http://dedimania.net:8081/Dedimania';
const DEDIMANIA_OPENSESSION = 'dedimania.OpenSession';
const DEDIMANIA_CHECKSESSION = 'dedimania.CheckSession';
const DEDIMANIA_GETRECORDS = 'dedimania.GetChallengeRecords';
const DEDIMANIA_OPEN_SESSION = 'dedimania.OpenSession';
const DEDIMANIA_CHECK_SESSION = 'dedimania.CheckSession';
const DEDIMANIA_GET_RECORDS = 'dedimania.GetChallengeRecords';
const DEDIMANIA_PLAYERCONNECT = 'dedimania.PlayerConnect';
const DEDIMANIA_PLAYERDISCONNECT = 'dedimania.PlayerDisconnect';
const DEDIMANIA_UPDATESERVERPLAYERS = 'dedimania.UpdateServerPlayers';
const DEDIMANIA_SETCHALLENGETIMES = 'dedimania.SetChallengeTimes';
const DEDIMANIA_UPDATE_SERVER_PLAYERS = 'dedimania.UpdateServerPlayers';
const DEDIMANIA_SET_CHALLENGE_TIMES = 'dedimania.SetChallengeTimes';
const DEDIMANIA_WARNINGSANDTTR2 = 'dedimania.WarningsAndTTR2';
const SETTING_WIDGET_ENABLE = 'Enable Dedimania Widget';
const SETTING_WIDGET_TITLE = 'Widget Title';
const SETTING_WIDGET_POSX = 'Widget Position: X';
const SETTING_WIDGET_POSY = 'Widget Position: Y';
const SETTING_WIDGET_WIDTH = 'Widget Width';
const SETTING_WIDGET_LINESCOUNT = 'Widget Displayed Lines Count';
const SETTING_WIDGET_LINEHEIGHT = 'Widget Line Height';
const SETTING_WIDGET_LINE_COUNT = 'Widget Displayed Lines Count';
const SETTING_WIDGET_LINE_HEIGHT = 'Widget Line Height';
const SETTING_DEDIMANIA_CODE = '$l[http://dedimania.net/tm2stats/?do=register]Dedimania Code for ';
const CB_DEDIMANIA_CHANGED = 'Dedimania.Changed';
const CB_DEDIMANIA_UPDATED = 'Dedimania.Updated';
@ -131,8 +131,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, -139);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 7);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 40);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINEHEIGHT, 4);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINESCOUNT, 12);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINE_HEIGHT, 4);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINE_COUNT, 12);
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleMapEnd');
@ -171,7 +171,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
* Opens the Dedimania Session
*/
private function openDedimaniaSession() {
$content = $this->encode_request(self::DEDIMANIA_OPENSESSION, array($this->dedimaniaData->toArray()));
$content = $this->encode_request(self::DEDIMANIA_OPEN_SESSION, array($this->dedimaniaData->toArray()));
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
$this->maniaControl->log("Try to connect on Dedimania");
@ -187,7 +187,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_OPENSESSION);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_OPEN_SESSION);
return;
}
@ -261,7 +261,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
}
$data = array($this->dedimaniaData->sessionId, $mapInfo, $gameMode, $serverInfo, $playerInfo);
$content = $this->encode_request(self::DEDIMANIA_GETRECORDS, $data);
$content = $this->encode_request(self::DEDIMANIA_GET_RECORDS, $data);
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
@ -275,7 +275,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_GETRECORDS);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_GET_RECORDS);
return;
}
@ -426,8 +426,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
$lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT);
$lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT);
$lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINE_COUNT);
$lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINE_HEIGHT);
$labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle();
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
@ -525,7 +525,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
return;
}
$content = $this->encode_request(self::DEDIMANIA_CHECKSESSION, array($this->dedimaniaData->sessionId));
$content = $this->encode_request(self::DEDIMANIA_CHECK_SESSION, array($this->dedimaniaData->sessionId));
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
@ -539,7 +539,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_CHECKSESSION);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_CHECK_SESSION);
return;
}
@ -675,7 +675,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
//var_dump($replays);
$data = array($this->dedimaniaData->sessionId, $this->getMapInfo(), $gameMode, $times, $replays);
//var_dump($data);
$content = $this->encode_request(self::DEDIMANIA_SETCHALLENGETIMES, $data);
$content = $this->encode_request(self::DEDIMANIA_SET_CHALLENGE_TIMES, $data);
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
@ -689,7 +689,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_SETCHALLENGETIMES);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_SET_CHALLENGE_TIMES);
return;
}
@ -713,7 +713,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
// Send Dedimania request
$data = array($this->dedimaniaData->sessionId, $serverInfo, $votesInfo, $playerList);
$content = $this->encode_request(self::DEDIMANIA_UPDATESERVERPLAYERS, $data);
$content = $this->encode_request(self::DEDIMANIA_UPDATE_SERVER_PLAYERS, $data);
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
@ -727,7 +727,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_UPDATESERVERPLAYERS);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_UPDATE_SERVER_PLAYERS);
}
}, $content, true);
}

View File

@ -38,7 +38,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
const VERSION = 0.1;
const AUTHOR = 'MCTeam';
const NAME = 'Donation Plugin';
const SETTING_ANNOUNCE_SERVERDONATION = 'Enable Server-Donation Announcements';
const SETTING_ANNOUNCE_SERVER_DONATION = 'Enable Server-Donation Announcements';
const STAT_PLAYER_DONATIONS = 'Donated Planets';
const ACTION_DONATE_VALUE = 'Donate.DonateValue';
@ -285,7 +285,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$this->maniaControl->billManager->sendBill(function ($data, $status) use (&$player, $amount, $receiver) {
switch ($status) {
case BillManager::DONATED_TO_SERVER:
if ($this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVERDONATION, true) && $amount >= $this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)) {
if ($this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVER_DONATION, true) && $amount >= $this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)) {
$login = null;
$message = '$<' . $player->nickname . '$> donated ' . $amount . ' Planets! Thanks.';
} else {

View File

@ -59,10 +59,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
const SETTING_MX_KARMA_IMPORTING = 'Import old MX-Karma';
const MX_IMPORT_TABLE = 'mc_karma_mximport';
const MX_KARMA_URL = 'http://karma.mania-exchange.com/api2/';
const MX_KARMA_STARTSESSION = 'startSession';
const MX_KARMA_ACTIVATESESSION = 'activateSession';
const MX_KARMA_SAVEVOTES = 'saveVotes';
const MX_KARMA_GETMAPRATING = 'getMapRating';
const MX_KARMA_START_SESSION = 'startSession';
const MX_KARMA_ACTIVATE_SESSION = 'activateSession';
const MX_KARMA_SAVE_VOTES = 'saveVotes';
const MX_KARMA_GET_MAP_RATING = 'getMapRating';
/*
* Private Properties
@ -246,7 +246,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$applicationIdentifier = 'ManiaControl v' . ManiaControl::VERSION;
$testMode = 'true';
$query = self::MX_KARMA_URL . self::MX_KARMA_STARTSESSION;
$query = self::MX_KARMA_URL . self::MX_KARMA_START_SESSION;
$query .= '?serverLogin=' . $serverLogin;
$query .= '&applicationIdentifier=' . urlencode($applicationIdentifier);
$query .= '&testMode=' . $testMode;
@ -283,7 +283,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
// TODO: unused private method! remove?
$hash = $this->buildActivationHash($this->mxKarma['session']->sessionSeed, $mxKarmaCode);
$query = self::MX_KARMA_URL . self::MX_KARMA_ACTIVATESESSION;
$query = self::MX_KARMA_URL . self::MX_KARMA_ACTIVATE_SESSION;
$query .= '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey);
$query .= '&activationHash=' . urlencode($hash);
@ -370,7 +370,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
}
$content = json_encode($properties);
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_GETMAPRATING . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) use (&$player) {
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_GET_MAP_RATING . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) use (&$player) {
if (!$error) {
$data = json_decode($data);
if ($data->success) {
@ -397,7 +397,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return;
}
// TODO remove temp trigger
$this->maniaControl->errorHandler->triggerDebugNotice("Error while fetching votes: '{$data->data->message}' " . KarmaPlugin::MX_KARMA_URL . KarmaPlugin::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey));
$this->maniaControl->errorHandler->triggerDebugNotice("Error while fetching votes: '{$data->data->message}' " . KarmaPlugin::MX_KARMA_URL . KarmaPlugin::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey));
}
} else {
$this->maniaControl->log($error);
@ -479,7 +479,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$content = json_encode($properties);
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) {
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) {
if (!$error) {
$data = json_decode($data);
if ($data->success) {
@ -491,7 +491,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return;
}
// TODO remove temp trigger
$this->maniaControl->errorHandler->triggerDebugNotice("Error while updating votes: " . $data->data->message . " " . KarmaPlugin::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey));
$this->maniaControl->errorHandler->triggerDebugNotice("Error while updating votes: " . $data->data->message . " " . KarmaPlugin::MX_KARMA_URL . self::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey));
}
} else {
$this->maniaControl->log($error);

View File

@ -37,7 +37,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
const PLUGIN_AUTHOR = 'kremsy';
// MapWidget Properties
const MLID_MAPWIDGET = 'WidgetPlugin.MapWidget';
const MLID_MAP_WIDGET = 'WidgetPlugin.MapWidget';
const SETTING_MAP_WIDGET_ACTIVATED = 'Map-Widget Activated';
const SETTING_MAP_WIDGET_POSX = 'Map-Widget-Position: X';
const SETTING_MAP_WIDGET_POSY = 'Map-Widget-Position: Y';
@ -45,7 +45,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
const SETTING_MAP_WIDGET_HEIGHT = 'Map-Widget-Size: Height';
// ClockWidget Properties
const MLID_CLOCKWIDGET = 'WidgetPlugin.ClockWidget';
const MLID_CLOCK_WIDGET = 'WidgetPlugin.ClockWidget';
const SETTING_CLOCK_WIDGET_ACTIVATED = 'Clock-Widget Activated';
const SETTING_CLOCK_WIDGET_POSX = 'Clock-Widget-Position: X';
const SETTING_CLOCK_WIDGET_POSY = 'Clock-Widget-Position: Y';
@ -53,7 +53,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
const SETTING_CLOCK_WIDGET_HEIGHT = 'Clock-Widget-Size: Height';
// NextMapWidget Properties
const MLID_NEXTMAPWIDGET = 'WidgetPlugin.NextMapWidget';
const MLID_NEXTMAP_WIDGET = 'WidgetPlugin.NextMapWidget';
const SETTING_NEXTMAP_WIDGET_ACTIVATED = 'Nextmap-Widget Activated';
const SETTING_NEXTMAP_WIDGET_POSX = 'Nextmap-Widget-Position: X';
const SETTING_NEXTMAP_WIDGET_POSY = 'Nextmap-Widget-Position: Y';
@ -61,7 +61,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
const SETTING_NEXTMAP_WIDGET_HEIGHT = 'Nextmap-Widget-Size: Height';
// ServerInfoWidget Properties
const MLID_SERVERINFOWIDGET = 'WidgetPlugin.ServerInfoWidget';
const MLID_SERVERINFO_WIDGET = 'WidgetPlugin.ServerInfoWidget';
const SETTING_SERVERINFO_WIDGET_ACTIVATED = 'ServerInfo-Widget Activated';
const SETTING_SERVERINFO_WIDGET_POSX = 'ServerInfo-Widget-Position: X';
const SETTING_SERVERINFO_WIDGET_POSY = 'ServerInfo-Widget-Position: Y';
@ -189,7 +189,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
$maniaLink = new ManiaLink(self::MLID_MAPWIDGET);
$maniaLink = new ManiaLink(self::MLID_MAP_WIDGET);
$script = new Script();
$maniaLink->setScript($script);
@ -252,7 +252,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
$maniaLink = new ManiaLink(self::MLID_CLOCKWIDGET);
$maniaLink = new ManiaLink(self::MLID_CLOCK_WIDGET);
// mainframe
$frame = new Frame();
@ -291,7 +291,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
$maniaLink = new ManiaLink(self::MLID_SERVERINFOWIDGET);
$maniaLink = new ManiaLink(self::MLID_SERVERINFO_WIDGET);
// mainframe
$frame = new Frame();
@ -372,10 +372,10 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
//Restore Siege Progression Layer
$this->maniaControl->client->triggerModeScriptEvent("Siege_SetProgressionLayerPosition", array("160.", "90.", "0."));
$this->closeWidget(self::MLID_CLOCKWIDGET);
$this->closeWidget(self::MLID_SERVERINFOWIDGET);
$this->closeWidget(self::MLID_MAPWIDGET);
$this->closeWidget(self::MLID_NEXTMAPWIDGET);
$this->closeWidget(self::MLID_CLOCK_WIDGET);
$this->closeWidget(self::MLID_SERVERINFO_WIDGET);
$this->closeWidget(self::MLID_MAP_WIDGET);
$this->closeWidget(self::MLID_NEXTMAP_WIDGET);
}
/**
@ -395,7 +395,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
$this->displayMapWidget();
}
$this->closeWidget(self::MLID_NEXTMAPWIDGET);
$this->closeWidget(self::MLID_NEXTMAP_WIDGET);
}
/**
@ -421,7 +421,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
$labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle();
$maniaLink = new ManiaLink(self::MLID_NEXTMAPWIDGET);
$maniaLink = new ManiaLink(self::MLID_NEXTMAP_WIDGET);
// mainframe
$frame = new Frame();