Пример #1
0
 /**
  * Instantiate a Merchant_Billing_CreditCard object
  *
  * @param  KConfig $data
  * @return Merchant_Billing_CreditCard
  */
 protected function _instantiateCreditCard($data)
 {
     if ($data->token) {
         unset($data['creditcard']);
         unset($data['contact']);
         return;
     }
     $data->append(array('creditcard' => new KConfig()));
     $creditcard = $data->creditcard;
     $name = trim($creditcard->name);
     $space = KHelperString::strpos($name, ' ');
     $creditcard_data = array('type' => $creditcard->type, "first_name" => KHelperString::ucwords(KHelperString::substr($name, 0, $space)), "last_name" => KHelperString::ucwords(KHelperString::substr($name, $space + 1)), "number" => $creditcard->number, "month" => $creditcard->month, "year" => $creditcard->year, "verification_value" => $creditcard->csv);
     $creditcard = new Merchant_Billing_CreditCard($creditcard_data);
     $this->creditcard = $creditcard;
     $contact = $this->_instantiateContact($data);
     $this->order->setPaymentMethod(new ComSubscriptionsDomainPaymentMethodCreditcard($creditcard, $contact));
     return $creditcard;
 }
Пример #2
0
 /**
  * Draws an actor cover image
  * 
  * @param ComActorsDomainEntityActor $actor
  * @param string                    $size 
  * @param boolean                   $linked if true it returns a linked image tag of not just an image tag
  * @param array                     $attr link attributes
  * 
  * @return string
  */
 public function cover($actor, $size = 'large', $linked = true, $attr = array())
 {
     if (is_numeric($size)) {
         $width = "width=\"{$size}\"";
         $size = 'large';
     } else {
         $width = '';
     }
     if ($actor->coverSet()) {
         $src = $actor->getCoverURL($size);
         $name = KHelperString::ucwords($actor->name);
         $img = '<img ' . $width . ' alt="' . $name . '" class="cover" src="' . $src . '"  />';
     }
     if ($linked && $actor->authorize('access')) {
         $url = $this->getActorURL($actor);
         $img = '<a ' . $this->_buildAttribute($attr) . ' data-actor="' . $actor->id . '" href="' . $url . '" >' . $img . '</a>';
     }
     return $img;
 }