Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor
21  axilent.php
@@ -97,11 +97,10 @@ static function getAxilentClient()
97 97
         if(self::$_axilent) return self::$_axilent;
98 98
         
99 99
         $axilent_project_name   = Axilent_Utility::getOption('axilent_project_name');
100  
-        $axilent_subdomain      = Axilent_Utility::getOption('axilent_subdomain');
101 100
         $axilent_api_key        = Axilent_Utility::getOption('axilent_api_key');
102 101
         $portlet_key            = get_user_meta(get_current_user_id(), 'axilent_portlet_key', true);
103 102
 
104  
-        self::$_axilent = new Axilent($axilent_subdomain, $axilent_project_name, $axilent_api_key, $portlet_key);
  103
+        self::$_axilent = new Axilent($axilent_project_name, $axilent_api_key, $portlet_key);
105 104
         
106 105
         return self::$_axilent;
107 106
     }
@@ -131,9 +130,13 @@ static function adminMenuCallback()
131 130
                 update_user_meta($id, 'axilent_portlet_key', $value);
132 131
             }
133 132
             
134  
-            Axilent_Utility::setOption('axilent_subdomain', $_POST['axilent_subdomain']);
135 133
             Axilent_Utility::setOption('axilent_project_name', $_POST['axilent_project_name']);
136  
-            Axilent_Utility::setOption('axilent_api_key', $_POST['axilent_api_key']);
  134
+            Axilent_Utility::setOption('axilent_project_name', $_POST['axilent_project_name']);
  135
+            
  136
+            if($_POST['axilent_sync'])
  137
+                Axilent_Utility::setOption('axilent_sync', 'yes');
  138
+            else
  139
+                Axilent_Utility::setOption('axilent_sync', 'no');
137 140
         }
138 141
         
139 142
         # Attach the API key to each user object
@@ -143,14 +146,14 @@ static function adminMenuCallback()
143 146
         }
144 147
         
145 148
         $axilent_project_name   = Axilent_Utility::getOption('axilent_project_name');
146  
-        $axilent_subdomain      = Axilent_Utility::getOption('axilent_subdomain');
147 149
         $axilent_api_key        = Axilent_Utility::getOption('axilent_api_key');
  150
+        $axilent_sync           = Axilent_Utility::getOption('axilent_sync');
148 151
 
149 152
         $data = array (
150 153
             'axilent_project_name'  => $axilent_project_name,
151  
-            'axilent_subdomain'     => $axilent_subdomain,
152 154
             'axilent_api_key'       => $axilent_api_key,
153  
-            'axilent_users'         => $users
  155
+            'axilent_users'         => $users,
  156
+            'axilent_sync'          => $axilent_sync
154 157
         );
155 158
 
156 159
         Axilent_View::load('admin', $data);
@@ -162,7 +165,9 @@ static function adminMenuCallback()
162 165
      */
163 166
     public function saveCallback($postId)
164 167
     {
165  
-        if(get_post_status($postId) != 'publish') 
  168
+        $do_sync = Axilent_Utility::getOption('axilent_sync');
  169
+        
  170
+        if(get_post_status($postId) != 'publish' || $do_sync == 'no') 
166 171
         {
167 172
             # No interest
168 173
             return;
20  vendor/Axilent.php
@@ -16,13 +16,7 @@
16 16
  * @version Works with Axilent API beta1
17 17
  */
18 18
 class Axilent 
19  
-{
20  
-    /**
21  
-     * The subdmain used for the API
22  
-     * @var string
23  
-     */
24  
-    protected $_apiDomain = null;
25  
-    
  19
+{    
26 20
     /**
27 21
      * The API Key
28 22
      * @var string
@@ -33,13 +27,13 @@ class Axilent
33 27
      * A template for API Functions
34 28
      * @var string 
35 29
      */
36  
-    protected $_functionPrototype = "http://%s.axilent.net/api/%s/%s/";
  30
+    protected $_functionPrototype = "http://wpdev.axilent.net/api/%s/%s/";
37 31
     
38 32
     /**
39 33
      * A template for API Resources
40 34
      * @var string 
41 35
      */
42  
-    protected $_resourcePrototype = "http://%s.axilent.net/api/resource/%s/%s/";
  36
+    protected $_resourcePrototype = "http://wpdev.axilent.net/api/resource/%s/%s/";
43 37
     
44 38
     /**
45 39
      * The version of the API we're using
@@ -70,9 +64,8 @@ class Axilent
70 64
      * @param type $project The project name
71 65
      * @param type $apiKey 
72 66
      */
73  
-    public function __construct($subdomain, $project, $apiKey, $portlet_key = null)
  67
+    public function __construct($project, $apiKey, $portlet_key = null)
74 68
     {
75  
-        $this->_apiDomain   = $subdomain;
76 69
         $this->_apiKey      = $apiKey;
77 70
         $this->_portletKey  = $portlet_key;
78 71
         $this->_project     = $project;
@@ -114,8 +107,7 @@ protected function _makeRequest($method, $type, $target, $path = false, $argumen
114 107
      */
115 108
     protected function _getRequestURL($type, $target, $path = false)
116 109
     {
117  
-        return sprintf($type == 'resource' ? $this->_resourcePrototype : $this->_functionPrototype, 
118  
-                $this->_apiDomain,
  110
+        return sprintf($type == 'resource' ? $this->_resourcePrototype : $this->_functionPrototype,
119 111
                 $target,
120 112
                 $this->_apiVersion) . ($path ? rtrim($path, '/').'/' : '');
121 113
     }
@@ -231,6 +223,7 @@ public static function fetch($url, $options = array())
231 223
             $f = tmpfile();
232 224
             $options[CURLOPT_VERBOSE] = 1;
233 225
             $options[CURLOPT_STDERR] = $f;
  226
+            self::_log("Call to $url ...");
234 227
         }
235 228
         
236 229
         curl_setopt_array($curl_handle, $options);
@@ -242,6 +235,7 @@ public static function fetch($url, $options = array())
242 235
             fseek($f, 0);
243 236
             self::_log("Request headers (".date('Y-m-d H:i:s')."): " . stream_get_contents($f));
244 237
             fclose($f);
  238
+            self::_log("Recieved HTTP $status and \n $body in respose..");
245 239
         }
246 240
     
247 241
         #exit("$url / $status / $body / " . print_r($options, true));
8  views/admin.php
@@ -61,13 +61,13 @@
61 61
             <td><input type="text" name="axilent_project_name" value="<?php echo $axilent_project_name; ?>" /></td>
62 62
         </tr>
63 63
         <tr>
64  
-            <td>API Subdomain</td>
65  
-            <td><input type="text" name="axilent_subdomain" value="<?php echo $axilent_subdomain; ?>"/></td>
66  
-        </tr>
67  
-        <tr>
68 64
             <td>API Key</td>
69 65
             <td><input type="text" name="axilent_api_key" value="<?php echo $axilent_api_key ?>" /></td>
70 66
         </tr>
  67
+        <tr>
  68
+            <td>Sync posts to Axilent</td>
  69
+            <td><input type="checkbox" name="axilent_sync" value="true" <?php if($axilent_sync == "yes" || !$axilent_sync) echo "checked" ?> /></td>
  70
+        </tr>
71 71
     </tbody>
72 72
 </table>
73 73
 <input type="submit" name="axilent_submit" value="Save All Settings" />

No commit comments for this range

Something went wrong with that request. Please try again.