started with plugin class

This commit is contained in:
kremsy 2013-11-09 12:20:38 +01:00
parent 40b5e94ec3
commit 1abbbdb9eb
15 changed files with 444 additions and 17 deletions

1
application/.idea/.name generated Normal file
View File

@ -0,0 +1 @@
application

9
application/.idea/application.iml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="Lukas" />
</component>

5
application/.idea/encodings.xml generated Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

36
application/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>SASS/SCSS</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" />
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

9
application/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/application.iml" filepath="$PROJECT_DIR$/.idea/application.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

8
application/.idea/vagrant.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VagrantSettings">
<option name="instanceFolder" value="" />
<option name="vagrantExecutable" value="vagrant.bat" />
</component>
</project>

7
application/.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>

329
application/.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,329 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="810d50c2-5feb-4cd4-8bb3-d6196e2e83d8" name="Default" comment="" />
<ignored path="application.iws" />
<ignored path=".idea/workspace.xml" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="application" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="plugin.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/core/plugin.php">
<provider selected="true" editor-type-id="text-editor">
<state line="31" column="0" selection-start="501" selection-end="501" vertical-scroll-proportion="-20.26923" vertical-offset="0" max-vertical-offset="1972">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="pluginHandler.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/core/pluginHandler.php">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="3" selection-start="108" selection-end="108" vertical-scroll-proportion="-5.230769" vertical-offset="0" max-vertical-offset="357">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="karma.plugin.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/plugins/karma.plugin.php">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-0.0" vertical-offset="0" max-vertical-offset="5287">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="manialinkIdHandler.php" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/core/manialinkIdHandler.php">
<provider selected="true" editor-type-id="text-editor">
<state line="21" column="7" selection-start="313" selection-end="313" vertical-scroll-proportion="0.47536618" vertical-offset="0" max-vertical-offset="751">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="database.ManiaControl.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/core/database.ManiaControl.php">
<provider selected="true" editor-type-id="text-editor">
<state line="29" column="0" selection-start="380" selection-end="380" vertical-scroll-proportion="-6.486842" vertical-offset="0" max-vertical-offset="6919">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/plugins/chatlog.plugin.php" />
<option value="$PROJECT_DIR$/core/database.ManiaControl.php" />
<option value="$PROJECT_DIR$/core/pluginHandler.php" />
<option value="$PROJECT_DIR$/core/manialinkIdHandler.php" />
<option value="$PROJECT_DIR$/core/plugin.php" />
</list>
</option>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1056" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="plugins" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="true" />
<property name="options.lastSelected" value="vcs.Subversion" />
<property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
</component>
<component name="PublishConfig">
<servers>
<server id="17a42bee-a550-4af8-9ca6-9ec751fda755">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</server>
<server id="cffd73bb-bc3d-46ed-be64-c7c6fe83d23d">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</server>
</servers>
</component>
<component name="RunManager">
<configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
<TestRunner />
<method />
</configuration>
<configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console">
<method />
</configuration>
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug" singleton="true">
<method />
</configuration>
<configuration default="true" type="PhpUnitRemoteRunConfigurationType" factoryName="PHPUnit on Server">
<method />
</configuration>
<list size="0" />
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false" SSL_PROTOCOLS="all">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
<option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
<option name="FORCE_UPDATE" value="false" />
<option name="IGNORE_EXTERNALS" value="false" />
<configuration useDefault="false">C:\Users\Lukas\AppData\Roaming\Subversion</configuration>
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="810d50c2-5feb-4cd4-8bb3-d6196e2e83d8" name="Default" comment="" />
<created>1383994867593</created>
<updated>1383994867593</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.12540022" sideWeight="0.8942093" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.105790645" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="myTodoPanelSettings">
<TodoPanelSettings />
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/plugins/chatlog.plugin.php">
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="20" selection-start="90" selection-end="90" vertical-scroll-proportion="0.14066194" vertical-offset="0" max-vertical-offset="1547">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/core/pluginHandler.php">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="3" selection-start="108" selection-end="108" vertical-scroll-proportion="-5.230769" vertical-offset="0" max-vertical-offset="357">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/plugins/plugin.ManiaControl.php">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="7" selection-start="111" selection-end="111" vertical-scroll-proportion="0.1607565" vertical-offset="0" max-vertical-offset="846">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/core/database.ManiaControl.php">
<provider selected="true" editor-type-id="text-editor">
<state line="29" column="0" selection-start="380" selection-end="380" vertical-scroll-proportion="-6.486842" vertical-offset="0" max-vertical-offset="6919">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/plugins/karma.plugin.php">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="5287">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/core/plugin.php">
<provider selected="true" editor-type-id="text-editor">
<state line="31" column="0" selection-start="501" selection-end="501" vertical-scroll-proportion="-20.26923" vertical-offset="0" max-vertical-offset="1972">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/core/manialinkIdHandler.php">
<provider selected="true" editor-type-id="text-editor">
<state line="21" column="7" selection-start="313" selection-end="313" vertical-scroll-proportion="0.47536618" vertical-offset="0" max-vertical-offset="751">
<folding />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -36,7 +36,7 @@ class Database {
// Load config // Load config
$this->config = Tools::loadConfig('database.ManiaControl.xml'); $this->config = Tools::loadConfig('database.ManiaControl.xml');
$this->iControl->checkConfig($this->config, array("host", "user"), 'database.ManiaControl.xml'); $this->mControl->checkConfig($this->config, array("host", "user"), 'database.ManiaControl.xml');
// Get mysql server information // Get mysql server information
$host = $this->config->xpath('host'); $host = $this->config->xpath('host');
@ -73,8 +73,8 @@ class Database {
$this->initTables(); $this->initTables();
// Register for callbacks // Register for callbacks
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_5_SECOND, $this, 'handle5Second'); $this->mControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_5_SECOND, $this, 'handle5Second');
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_BEGINMAP, $this, 'handleBeginMap'); $this->mControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_BEGINMAP, $this, 'handleBeginMap');
} }
/** /**
@ -227,7 +227,7 @@ class Database {
*/ */
public function handle5Second($callback = null) { public function handle5Second($callback = null) {
// Save current players in database // Save current players in database
$players = $this->iControl->server->getPlayers(); $players = $this->mControl->server->getPlayers();
if ($players) { if ($players) {
$query = ""; $query = "";
foreach ($players as $player) { foreach ($players as $player) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mControl; namespace ManiaControl;
/** /**
* Class manialinkidHandler handles manialink id's * Class manialinkidHandler handles manialink id's
@ -10,7 +10,30 @@ namespace mControl;
class ManialinkIdHandler { class ManialinkIdHandler {
/**
* Private properties
*/
private $maniaLinkIdCount;
public function __construct(){
$maniaLinkIdCount = 0;
}
/**
* Reservses manialinks for a plugin
*
* @param int $count
* @return array with manialink Ids
*/
public function reserveManiaLinkIds($count){
$mlIds = array();
for($i = 0; $i < $count; $i++){
$mlIds[0] = $i + $this->maniaLinkIdCount;
}
$this->maniaLinkIdCount += $count;
return $mlIds;
}
} }
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mControl; namespace ManiaControl;
/** /**
* Class plugin parent class for all plugins * Class plugin parent class for all plugins
@ -30,14 +30,6 @@ namespace mControl;
$this->updateUrl = ''; $this->updateUrl = '';
} }
/*
public function __construct($mControl, $name, $version, $author, $updateUrl = ''){
$this->mControl = $mControl;
$this->name = $name;
$this->version = $version;
$this->author = $author;
$this->updateUrl = $updateUrl;
}*/
/** /**
* Reserves manialinks on the ManialinkIdHandler * Reserves manialinks on the ManialinkIdHandler

View File

@ -1,6 +1,6 @@
<?php <?php
namespace mControl; namespace ManiaControl;
/** /**
* Class handles plugins * Class handles plugins

View File

@ -7,7 +7,7 @@ namespace ManiaControl;
* *
* @author steeffeen * @author steeffeen
*/ */
class Plugin_Chatlog { class Plugin_Chatlog extends Plugin{
/** /**
* Constants * Constants
*/ */
@ -37,7 +37,7 @@ class Plugin_Chatlog {
// Load settings // Load settings
$this->loadSettings(); $this->loadSettings();
// Register for callbacks // Register for callbacksc
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_MP_PLAYERCHAT, $this, 'handlePlayerChatCallback'); $this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_MP_PLAYERCHAT, $this, 'handlePlayerChatCallback');
error_log('Chatlog Pugin v' . self::VERSION . ' ready!'); error_log('Chatlog Pugin v' . self::VERSION . ' ready!');