protected function initializeCDN($token, $catalog) {
    $cdn = $this->cxt('use_cdn', FALSE);

    // No CDN should be enabled.
    if (empty($cdn)) {
      return FALSE;
    }
    // Use the CDN object, if provided.
    elseif ($cdn instanceof \HPCloud\Storage\CDN) {
      $this->cdn = $cdn;
    }
    // Or try to create a new CDN from the catalog.
    else {
      if (empty($catalog)) {
        $ident = $this->authenticate();
        $catalog = $ident->serviceCatalog();
        $token = $ident->token();
      }
      $region = $this->cxt('region');
      $this->cdn = \HPCloud\Storage\CDN::newFromServiceCatalog($catalog, $token, $region);
    }

    if (!empty($this->cdn)) {
      $this->store->useCDN($this->cdn);
    }
    return TRUE;
  }
protected function initializeCDN($token, $catalog) {
    $cdn = $this->cxt('use_cdn', FALSE);

    // No CDN should be enabled.
    if (empty($cdn)) {
      return FALSE;
    }
    // Use the CDN object, if provided.
    elseif ($cdn instanceof \HPCloud\Storage\CDN) {
      $this->cdn = $cdn;
    }
    // Or try to create a new CDN from the catalog.
    else {
      if (empty($catalog)) {
        $ident = $this->authenticate();
        $catalog = $ident->serviceCatalog();
        $token = $ident->token();
      }
      $region = $this->cxt('region');
      $this->cdn = \HPCloud\Storage\CDN::newFromServiceCatalog($catalog, $token, $region);
    }

    if (!empty($this->cdn)) {
      $this->store->useCDN($this->cdn);
    }
    return TRUE;
  }
protected function initializeCDN ( $ token , $ catalog ) { $ cdn = $ this -> cxt ( 'use_cdn' , FALSE ) ; // No CDN should be enabled. if ( empty ( $ cdn ) ) { return FALSE ; } // Use the CDN object, if provided. elseif ( $ cdn instanceof \ HPCloud \ Storage \ CDN ) { $ this -> cdn = $ cdn ; } // Or try to create a new CDN from the catalog. else { if ( empty ( $ catalog ) ) { $ ident = $ this -> authenticate ( ) ; $ catalog = $ ident -> serviceCatalog ( ) ; $ token = $ ident -> token ( ) ; } $ region = $ this -> cxt ( 'region' ) ; $ this -> cdn = \ HPCloud \ Storage \ CDN :: newFromServiceCatalog ( $ catalog , $ token , $ region ) ; } if ( ! empty ( $ this -> cdn ) ) { $ this -> store -> useCDN ( $ this -> cdn ) ; } return TRUE ; }
Initialize CDN service.

When the `use_cdn` parameter is passed into the context, we try
to use a CDN service wherever possible.

If `use_cdn` is set to TRUE, we try to create a new CDN object.
This will require a service catalog.

When use_cdn is set to TRUE, the wrapper tries to use CDN service.
In such cases, we need a handle to the CDN object. This initializes
that handle, which can later be used to get other information.

Also note that CDN's default behavior is to fetch over SSL CDN.
To disable this, set 'cdn_require_ssl' to FALSE.
Initialize CDN service .