diff options
author | Sebastian <github@afreshmelon.com> | 2015-04-01 23:28:41 +0200 |
---|---|---|
committer | Sebastian <github@afreshmelon.com> | 2015-04-01 23:28:41 +0200 |
commit | dd8dd3b4a09543bd0ab8496580c971d6e614a926 (patch) | |
tree | 7c25dcd1ce629801c81e89e044a93f17de862dbb /docs | |
parent | a718223585cd54bf9a7e2fad9749dc5301a9002d (diff) |
Make xmlrpc.php comply with PSR-2 coding standard
Diffstat (limited to 'docs')
-rw-r--r-- | docs/XMLRPC/xmlrpc.php | 136 |
1 files changed, 69 insertions, 67 deletions
diff --git a/docs/XMLRPC/xmlrpc.php b/docs/XMLRPC/xmlrpc.php index ef5e9a00c..90e7a09c3 100644 --- a/docs/XMLRPC/xmlrpc.php +++ b/docs/XMLRPC/xmlrpc.php @@ -8,83 +8,85 @@ class AnopeXMLRPC { - private $Host; + private $Host; - function __construct($Host) - { - $this->Host = $Host; - } + public function __construct($Host) + { + $this->Host = $Host; + } - /** Run an XMLRPC command. Name should be a query name and params an array of parameters, eg: - * $this->RunXMLRPC("checkAuthentication", array("adam", "qwerty")); - * If successful returns back an array of useful information. - * - * Note that $params["id"] is reserved for query ID, you may set it to something if you wish. - * If you do, the same ID will be passed back with the reply from Anope. - */ - function RunXMLRPC($name, $params) - { - $xmlquery = xmlrpc_encode_request($name, $params); - $context = stream_context_create(array("http" => array( - "method" => "POST", - "header" => "Content-Type: text/xml", - "content" => $xmlquery))); + /** Run an XMLRPC command. Name should be a query name and params an array of parameters, eg: + * $this->RunXMLRPC("checkAuthentication", array("adam", "qwerty")); + * If successful returns back an array of useful information. + * + * Note that $params["id"] is reserved for query ID, you may set it to something if you wish. + * If you do, the same ID will be passed back with the reply from Anope. + */ + public function RunXMLRPC($name, $params) + { + $xmlquery = xmlrpc_encode_request($name, $params); + $context = stream_context_create(array("http" => array( + "method" => "POST", + "header" => "Content-Type: text/xml", + "content" => $xmlquery))); - $inbuf = file_get_contents($this->Host, false, $context); - $response = xmlrpc_decode($inbuf); + $inbuf = file_get_contents($this->Host, false, $context); + $response = xmlrpc_decode($inbuf); - if (isset($response)) - return $response; - return NULL; - } + if (isset($response)) { + return $response; + } - /** Do Command on Service as User, eg: - * $anope->DoCommand("ChanServ", "Adam", "REGISTER #adam"); - * Returns an array of information regarding the command execution, if - * If 'online' is set to yes, then the reply to the command was sent to the user on IRC. - * If 'online' is set to no, then the reply to the command is in the array member 'return' - */ - function DoCommand($Service, $User, $Command) - { - return $this->RunXMLRPC("command", array($Service, $User, $Command)); - } + return null; + } - /** Check an account/nick name and password to see if they are valid - * Returns the account display name if valid - */ - function CheckAuthentication($Account, $Pass) - { - $ret = $this->RunXMLRPC("checkAuthentication", array($Account, $Pass)); + /** Do Command on Service as User, eg: + * $anope->DoCommand("ChanServ", "Adam", "REGISTER #adam"); + * Returns an array of information regarding the command execution, if + * If 'online' is set to yes, then the reply to the command was sent to the user on IRC. + * If 'online' is set to no, then the reply to the command is in the array member 'return' + */ + public function DoCommand($Service, $User, $Command) + { + return $this->RunXMLRPC("command", array($Service, $User, $Command)); + } - if ($ret && $ret["result"] == "Success") - return $ret["account"]; - return NULL; - } + /** Check an account/nick name and password to see if they are valid + * Returns the account display name if valid + */ + public function CheckAuthentication($Account, $Pass) + { + $ret = $this->RunXMLRPC("checkAuthentication", array($Account, $Pass)); - /* Returns an array of misc stats regarding Anope - */ - function DoStats() - { - return $this->RunXMLRPC("stats", NULL); - } + if ($ret && $ret["result"] == "Success") { + return $ret["account"]; + } - /* Look up data for a channel - * Returns an array containing channel information, or an array of size one - * (just containing the name) if the channel does not exist - */ - function DoChannel($Channel) - { - return $this->RunXMLRPC("channel", array($Channel)); - } + return null; + } - /* Like DoChannel(), but different. - */ - function DoUser($User) - { - return $this->RunXMLRPC("user", array($User)); - } + /* Returns an array of misc stats regarding Anope + */ + public function DoStats() + { + return $this->RunXMLRPC("stats", null); + } + + /* Look up data for a channel + * Returns an array containing channel information, or an array of size one + * (just containing the name) if the channel does not exist + */ + public function DoChannel($Channel) + { + return $this->RunXMLRPC("channel", array($Channel)); + } + + /* Like DoChannel(), but different. + */ + public function DoUser($User) + { + return $this->RunXMLRPC("user", array($User)); + } } $anopexmlrpc = new AnopeXMLRPC("http://127.0.0.1:8080/xmlrpc"); - -?> |