/**
  * Fetch and cache package data.
  *
  * @since 1.0.0
  *
  * @return array
  */
 protected function fetch_packages_data()
 {
     $packages = get_site_transient(self::PACKAGES_TRANSIENT_KEY);
     if (!$packages) {
         $packages = $this->client->get_packages();
         if (is_wp_error($packages)) {
             $packages = array();
         }
         set_site_transient(self::PACKAGES_TRANSIENT_KEY, (array) $packages, HOUR_IN_SECONDS);
     }
     return $packages;
 }
예제 #2
0
 /**
  * Set a logger.
  *
  * @since 1.0.0
  *
  * @param  AudioTheme_Agent_Logger $logger Logger instance.
  * @return $this
  */
 public function set_logger($logger)
 {
     $this->logger = $logger;
     $this->client->set_logger($logger);
     return $this;
 }