Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed subdomain setting

  • Loading branch information...
commit 6800edc3e38dffca126f6b64abe987a8434d83fa 1 parent ac82f93
@katzgrau katzgrau authored
Showing with 21 additions and 24 deletions.
  1. +10 −7 axilent.php
  2. +7 −13 vendor/Axilent.php
  3. +4 −4 views/admin.php
View
17 axilent.php
@@ -97,11 +97,10 @@ static function getAxilentClient()
if(self::$_axilent) return self::$_axilent;
$axilent_project_name = Axilent_Utility::getOption('axilent_project_name');
- $axilent_subdomain = Axilent_Utility::getOption('axilent_subdomain');
$axilent_api_key = Axilent_Utility::getOption('axilent_api_key');
$portlet_key = get_user_meta(get_current_user_id(), 'axilent_portlet_key', true);
- self::$_axilent = new Axilent($axilent_subdomain, $axilent_project_name, $axilent_api_key, $portlet_key);
+ self::$_axilent = new Axilent($axilent_project_name, $axilent_api_key, $portlet_key);
return self::$_axilent;
}
@@ -131,9 +130,13 @@ static function adminMenuCallback()
update_user_meta($id, 'axilent_portlet_key', $value);
}
- Axilent_Utility::setOption('axilent_subdomain', $_POST['axilent_subdomain']);
Axilent_Utility::setOption('axilent_project_name', $_POST['axilent_project_name']);
- Axilent_Utility::setOption('axilent_api_key', $_POST['axilent_api_key']);
+ Axilent_Utility::setOption('axilent_project_name', $_POST['axilent_project_name']);
+
+ if($_POST['axilent_sync'])
+ Axilent_Utility::setOption('axilent_sync', 'yes');
+ else
+ Axilent_Utility::setOption('axilent_sync', 'no');
}
# Attach the API key to each user object
@@ -143,14 +146,14 @@ static function adminMenuCallback()
}
$axilent_project_name = Axilent_Utility::getOption('axilent_project_name');
- $axilent_subdomain = Axilent_Utility::getOption('axilent_subdomain');
$axilent_api_key = Axilent_Utility::getOption('axilent_api_key');
+ $axilent_sync = Axilent_Utility::getOption('axilent_sync');
$data = array (
'axilent_project_name' => $axilent_project_name,
- 'axilent_subdomain' => $axilent_subdomain,
'axilent_api_key' => $axilent_api_key,
- 'axilent_users' => $users
+ 'axilent_users' => $users,
+ 'axilent_sync' => $axilent_sync
);
Axilent_View::load('admin', $data);
View
20 vendor/Axilent.php
@@ -16,13 +16,7 @@
* @version Works with Axilent API beta1
*/
class Axilent
-{
- /**
- * The subdmain used for the API
- * @var string
- */
- protected $_apiDomain = null;
-
+{
/**
* The API Key
* @var string
@@ -33,13 +27,13 @@ class Axilent
* A template for API Functions
* @var string
*/
- protected $_functionPrototype = "http://%s.axilent.net/api/%s/%s/";
+ protected $_functionPrototype = "http://wpdev.axilent.net/api/%s/%s/";
/**
* A template for API Resources
* @var string
*/
- protected $_resourcePrototype = "http://%s.axilent.net/api/resource/%s/%s/";
+ protected $_resourcePrototype = "http://wpdev.axilent.net/api/resource/%s/%s/";
/**
* The version of the API we're using
@@ -70,9 +64,8 @@ class Axilent
* @param type $project The project name
* @param type $apiKey
*/
- public function __construct($subdomain, $project, $apiKey, $portlet_key = null)
+ public function __construct($project, $apiKey, $portlet_key = null)
{
- $this->_apiDomain = $subdomain;
$this->_apiKey = $apiKey;
$this->_portletKey = $portlet_key;
$this->_project = $project;
@@ -114,8 +107,7 @@ protected function _makeRequest($method, $type, $target, $path = false, $argumen
*/
protected function _getRequestURL($type, $target, $path = false)
{
- return sprintf($type == 'resource' ? $this->_resourcePrototype : $this->_functionPrototype,
- $this->_apiDomain,
+ return sprintf($type == 'resource' ? $this->_resourcePrototype : $this->_functionPrototype,
$target,
$this->_apiVersion) . ($path ? rtrim($path, '/').'/' : '');
}
@@ -231,6 +223,7 @@ public static function fetch($url, $options = array())
$f = tmpfile();
$options[CURLOPT_VERBOSE] = 1;
$options[CURLOPT_STDERR] = $f;
+ self::_log("Call to $url ...");
}
curl_setopt_array($curl_handle, $options);
@@ -242,6 +235,7 @@ public static function fetch($url, $options = array())
fseek($f, 0);
self::_log("Request headers (".date('Y-m-d H:i:s')."): " . stream_get_contents($f));
fclose($f);
+ self::_log("Recieved HTTP $status and \n $body in respose..");
}
#exit("$url / $status / $body / " . print_r($options, true));
View
8 views/admin.php
@@ -61,13 +61,13 @@
<td><input type="text" name="axilent_project_name" value="<?php echo $axilent_project_name; ?>" /></td>
</tr>
<tr>
- <td>API Subdomain</td>
- <td><input type="text" name="axilent_subdomain" value="<?php echo $axilent_subdomain; ?>"/></td>
- </tr>
- <tr>
<td>API Key</td>
<td><input type="text" name="axilent_api_key" value="<?php echo $axilent_api_key ?>" /></td>
</tr>
+ <tr>
+ <td>Sync posts to Axilent</td>
+ <td><input type="checkbox" name="axilent_sync" value="true" <?php if($axilent_sync == "yes" || !$axilent_sync) echo "checked" ?> /></td>
+ </tr>
</tbody>
</table>
<input type="submit" name="axilent_submit" value="Save All Settings" />
Please sign in to comment.
Something went wrong with that request. Please try again.