/**
  * @param $xml
  * @return array
  */
 protected function processResponse($xml)
 {
     $result = [];
     foreach ($xml->subdomain->get->result as $node) {
         $result[] = ['id' => (int) $node->id, 'status' => (string) $node->status, 'parent' => (string) $node->data->parent, 'name' => (string) $node->data->name, 'php' => (string) Xml::findProperty($node->data, 'php'), 'php_handler_type' => (string) Xml::findProperty($node->data, 'php_handler_type'), 'www_root' => (string) Xml::findProperty($node->data, 'www_root')];
     }
     return $result;
 }
Exemple #2
0
 /**
  * @param $xml
  * @return array
  */
 protected function processResponse($xml)
 {
     $result = [];
     for ($i = 0; $i < count($xml->{"service-plan"}->get->result); $i++) {
         $plan = $xml->{"service-plan"}->get->result[$i];
         $hosting = [];
         foreach ($plan->hosting as $host) {
             $hosting[$host->getName()] = Xml::getProperties($host);
         }
         $result[] = ['id' => (string) $plan->id, 'guid' => (string) $plan->guid, 'status' => (string) $plan->status, 'name' => (string) $plan->name, 'limits' => ['overuse' => (string) $plan->limits->overuse, 'max_sites' => Xml::findProperty($plan->limits, 'max_site', 'limit'), 'max_subdomains' => Xml::findProperty($plan->limits, 'max_subdom', 'limit'), 'max_domain_aliases' => Xml::findProperty($plan->limits, 'max_dom_aliases', 'limit'), 'disk_space' => Xml::findProperty($plan->limits, 'disk_space', 'limit'), 'max_traffic' => Xml::findProperty($plan->limits, 'max_traffic', 'limit'), 'max_web_users' => Xml::findProperty($plan->limits, 'max_wu', 'limit'), 'max_subftp_users' => Xml::findProperty($plan->limits, 'max_subftp_users', 'limit'), 'max_databases' => Xml::findProperty($plan->limits, 'max_db', 'limit'), 'max_mailboxes' => Xml::findProperty($plan->limits, 'max_box', 'limit'), 'mailbox_quota' => Xml::findProperty($plan->limits, 'mbox_quota', 'limit'), 'max_maillists' => Xml::findProperty($plan->limits, 'max_maillists', 'limit'), 'max_webapps' => Xml::findProperty($plan->limits, 'max_webapps', 'limit'), 'max_site_builder' => Xml::findProperty($plan->limits, 'max_site_builder', 'limit'), 'expiration' => Xml::findProperty($plan->limits, 'expiration', 'limit')], 'log_rotation' => ['on' => (string) $plan->{"log-rotation"}->on->{"log-condition"}->{"log-bytime"}, 'max_num_files' => (int) $plan->{"log-rotation"}->on->{"log-max-num-files"}, 'compressed' => (string) $plan->{"log-rotation"}->on->{"log-compress"}], 'preferences' => ['stat' => (int) $plan->preferences->stat, 'maillists' => (string) $plan->preferences->maillists, 'dns_zone_type' => (string) $plan->preferences->dns_zone_type], 'hosting' => $hosting, 'performance' => ['bandwidth' => (int) $plan->performance->bandwidth, 'max_connections' => (int) $plan->performance->max_connections], 'permissions' => Xml::getProperties($plan->permissions, 'permission')];
     }
     return $result;
 }
Exemple #3
0
 /**
  * @return string
  */
 public function __toString()
 {
     if (is_null($this->value)) {
         return sprintf('<%s/>', $this->tag);
     }
     if (is_string($this->value)) {
         $this->value = Xml::sanitize($this->value);
     }
     if (is_bool($this->value)) {
         $this->value = $this->value ? 'true' : 'false';
     }
     return sprintf('<%s>%s</%s>', $this->tag, (string) $this->value, $this->tag);
 }
 /**
  * @param $xml
  * @return array
  */
 protected function processResponse($xml)
 {
     $result = [];
     for ($i = 0; $i < count($xml->webspace->get->result); $i++) {
         $webspace = $xml->webspace->get->result[$i];
         $hosting = [];
         foreach ($webspace->data->hosting->children() as $host) {
             $hosting[$host->getName()] = Xml::getProperties($host);
         }
         $subscriptions = [];
         foreach ($webspace->data->subscriptions->children() as $subscription) {
             $subscriptions[] = ['locked' => (bool) $subscription->locked, 'synchronized' => (bool) $subscription->synchronized, 'plan-guid' => (string) $subscription->plan->{"plan-guid"}];
         }
         $result[] = ['id' => (string) $webspace->id, 'status' => (string) $webspace->status, 'subscription_status' => (int) $webspace->data->gen_info->status, 'created' => (string) $webspace->data->gen_info->cr_date, 'name' => (string) $webspace->data->gen_info->name, 'owner_id' => (string) $webspace->data->gen_info->{"owner-id"}, 'hosting' => $hosting, 'real_size' => (int) $webspace->data->gen_info->real_size, 'dns_ip_address' => (string) $webspace->data->gen_info->dns_ip_address, 'htype' => (string) $webspace->data->gen_info->htype, 'subscriptions' => $subscriptions];
     }
     return $result;
 }
Exemple #5
0
 /**
  * Submits the xml packet to the Plesk server and forwards the response on for processing
  *
  * @return object
  */
 public function process()
 {
     try {
         $response = $this->sendRequest($this->getPacket());
         if ($response !== false) {
             $this->xml_response = $response;
             $responseXml = Xml::convertStringToXml($response);
             $this->checkResponse($responseXml);
             return $this->processResponse($responseXml);
         }
     } catch (ApiRequestException $e) {
         $this->error = $e;
     }
     return false;
 }