public function test_pausing_release_updates_url()
 {
     $product = $this->product_factory->create_and_get(array('update-file' => wp_insert_post(array('post_type' => 'it_exchange_download'))));
     $file1 = $this->factory->attachment->create_object('file.zip', $product->ID, array('post_mime_type' => 'application/zip'));
     /** @var Release $r1 */
     $r1 = $this->release_factory->create_and_get(array('product' => $product->ID, 'file' => $file1, 'version' => '1.0', 'type' => Release::TYPE_MAJOR, 'status' => Release::STATUS_ACTIVE));
     update_post_meta($product->ID, '_itelic_first_release', $r1->get_pk());
     $file2 = $this->factory->attachment->create_object('file - 1.1 . zip', $product->ID, array('post_mime_type' => 'application / zip'));
     /** @var Release $r2 */
     $r2 = $this->release_factory->create_and_get(array('product' => $product->ID, 'file' => $file2, 'version' => '1.1', 'type' => Release::TYPE_MAJOR, 'status' => Release::STATUS_ACTIVE));
     $r2->pause();
     $download_id = it_exchange_get_product_feature($product->ID, 'licensing', array('field' => 'update-file'));
     $download_data = get_post_meta($download_id, '_it-exchange-download-info', true);
     $this->assertEquals(wp_get_attachment_url($file1), $download_data['source']);
 }
 /**
  * Does the product have the feature?
  *
  * @since 1.5
  *
  * @param mixed   $result Not used by core
  * @param integer $product_id
  * @param array   $options
  *
  * @return boolean
  */
 function product_has_feature($result, $product_id, $options = array())
 {
     $supports = it_exchange_product_supports_feature($product_id, $this->slug);
     $not_empty = it_exchange_get_product_feature($product_id, $this->slug, array('field' => 'rate')) != '';
     return $supports && $not_empty;
 }
 /**
  * Does the product have the feature?
  *
  * @since 1.0
  *
  * @param mixed   $result Not used by core
  * @param integer $product_id
  * @param array   $options
  *
  * @return boolean
  */
 public function product_has_feature($result, $product_id, $options = array())
 {
     return !(bool) it_exchange_get_product_feature($product_id, $this->slug, array('field' => 'disable'));
 }
 /**
  * Get the latest release available for an activation record.
  *
  * By default, returns the latest version saved. But is used for getting
  * pre-release or restricted versions.
  *
  * @since 1.0
  *
  * @param Activation $activation
  *
  * @return Release
  */
 public function get_latest_release_for_activation(Activation $activation)
 {
     $track = $activation->get_meta('track', true);
     if (!$track || $track != 'pre-release') {
         $version = it_exchange_get_product_feature($this->ID, 'licensing', array('field' => 'version'));
         $release = itelic_get_release_by_version($this->ID, $version);
     } else {
         $releases = itelic_get_releases(array('product' => $activation->get_key()->get_product()->ID, 'order' => array('start_date' => 'DESC'), 'items_per_page' => 1));
         $release = reset($releases);
     }
     /**
      * Filter the latest release for an activation record.
      *
      * @since 1.0
      *
      * @param Release    $release
      * @param Activation $activation
      */
     return apply_filters('itelic_get_latest_release_for_activation', $release, $activation);
 }