From ce863f899302f2650176afcb3a74cd698037e770 Mon Sep 17 00:00:00 2001 From: DrZippie Date: Wed, 17 Jun 2015 14:12:29 +0200 Subject: [PATCH] Removed unused files and renamed XowlClient (remove .class from name ) --- inc/{XowlClient.class.php => XowlClient.php} | 0 inc/XowlService.class.php | 95 -------------------- wp-xowl-client.php | 3 +- 3 files changed, 1 insertion(+), 97 deletions(-) rename inc/{XowlClient.class.php => XowlClient.php} (100%) delete mode 100755 inc/XowlService.class.php diff --git a/inc/XowlClient.class.php b/inc/XowlClient.php similarity index 100% rename from inc/XowlClient.class.php rename to inc/XowlClient.php diff --git a/inc/XowlService.class.php b/inc/XowlService.class.php deleted file mode 100755 index 97695e8..0000000 --- a/inc/XowlService.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @version $Revision$ - */ -class XowlService { - protected $endpoint; - - public function __construct($endpoint) { - $this->setEndpoint($endpoint); - } - - public function setEndpoint($endpoint) { - if (filter_var($endpoint, FILTER_VALIDATE_URL) == FALSE) { - throw new InvalidArgumentException($endpoint . " is not a valid URL"); - } - $this->endpoint = $endpoint; - } - - public function getEndpoint() { - return $this->endpoint; - } - - /** - *

Query the server with the default response format (application/json)

- * @param string $text - * @return this - */ - public function suggest($text) { - return $this->query($text); - } - - /** - *

Send petition to stanbol server and returns the parsed response

- * @param unknown_type $text - * @return this. - */ - private function query($text) { - $token = get_option('xowl_usertoken', ''); - $dataText = array( - 'token' => $token, - 'content' => $text - ); - - $json = $this->doRequest('POST', $dataText); - return $this->parseData($json); - } - - /** - *

Performs the real request

- * @param string $method The HTTP method - * @param string $data The data to be enhanced - * @return StdClass An Object containing the response (code, data, etc) - */ - private function doRequest($method, $data = NULL) { - $content = http_build_query($data); - $options = array( - 'headers' => array(), - 'method' => $method, - 'data' => $content - ); - $response = wp_remote_request($this->endpoint, $options); - return $response; - } - - /** - * - *

Parse response data from stanbol server. JSON Format default.

- * @param string|json $json The data in JSON format to be parsed - * @return an array containing the mentions of the text and their related entities - */ - private function parseData($json) { - return $json->data; - } -} - diff --git a/wp-xowl-client.php b/wp-xowl-client.php index 6f81d3c..b092e53 100755 --- a/wp-xowl-client.php +++ b/wp-xowl-client.php @@ -19,8 +19,7 @@ define('XOWL_PLUGIN_URL', plugin_dir_url(__FILE__)); define('XOWL_PLUGIN_DIR', plugin_dir_path(__FILE__)); -require_once (XOWL_PLUGIN_DIR . '/inc/XowlService.class.php'); -require_once (XOWL_PLUGIN_DIR . '/inc/XowlClient.class.php'); +require_once (XOWL_PLUGIN_DIR . '/inc/XowlClient.php'); register_activation_hook(__FILE__, array('XowlClient', 'plugin_activation')); register_deactivation_hook(__FILE__, array('XowlClient', 'plugin_deactivation'));