示例#1
0
 /**
  * @return bool|RESTian_Service
  */
 function get_auth_service()
 {
     $this->client->initialize_client();
     if (!$this->_auth_service) {
         $this->_auth_service = $this->client->get_auth_service();
     }
     return $this->_auth_service;
 }
示例#2
0
 /**
  * @param RESTian_Client $api
  */
 function set_api($api)
 {
     if (empty($this->_forms)) {
         /**
          * What about plugins with an API but no need for forms?  Is that possible since forms=settings in Sidecar?
          */
         $error_message = __('$plugin->set_api($api) cannot be called before forms have been added. Please call $plugin->add_form() in $plugin->initialize_plugin() at least once prior to calling set_api().', 'sidecar');
         trigger_error($error_message);
         exit;
     }
     $api->caller = $this;
     $api->initialize_client();
     $this->_api = $api;
     if ($this->_admin_initialized) {
         /**
          * If Admin has been initialized then set grant.
          * If not, wait to set until after initialization
          * otherwise we get into a bad spiral of not-defined-yet.
          */
         $this->_api->set_grant($this->get_grant());
     }
 }