Example #1
0
 /**
  * Dislike a video
  *
  * @param string
  * @return array
  */
 public function dislike($videoId)
 {
     //argument 1 must be a string
     Eden_Google_Error::i()->argument(1, 'string');
     //make a xml template
     $query = Eden_Template::i()->set(self::VALUE, self::DISLIKE)->parsePHP(dirname(__FILE__) . '/template/like.php');
     return $this->_post(sprintf(self::URL_YOUTUBE_RATINGS, $videoId), $query);
 }
Example #2
0
 /**
  * Retrieving a user's favorite videos.
  *
  * @param string
  * @param string
  * @return array
  */
 public function addFavorites($videoId, $userId = self::DEFAULT_VALUE)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string');
     //argument 2 must be a string
     //make a xml template file
     $query = Eden_Template::i()->set(self::VIDEO_ID, $videoId)->parsePHP(dirname(__FILE__) . '/template/addfavorites.php');
     return $this->_post(sprintf(self::URL_YOUTUBE_FAVORITES, $userId), $query);
 }
Example #3
0
 /**
  * Upload video to youtube
  *
  * @return form
  */
 public function upload($uploadToken, $postUrl, $redirectUrl)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'object', 'string')->argument(2, 'object', 'string')->argument(3, 'string');
     //argument 3 must be a string
     //make a xml template
     $query = Eden_Template::i()->set(self::UPLOAD_TOKEN, $uploadToken)->set(self::REDIRECT_URL, $redirectUrl)->set(self::POST_URL, $postUrl)->parsePHP(dirname(__FILE__) . '/template/form.php');
     return $query;
 }
Example #4
0
 /**
  * Send a video message
  *
  * @param string
  * @param string
  * @param string
  * @return array
  */
 public function sendMessage($videoId, $summary, $userName)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string');
     //argument 3 must be a string
     //make a xml template
     $query = Eden_Template::i()->set(self::VIDEO_ID, $videoId)->set(self::SUMMARY, $summary)->parsePHP(dirname(__FILE__) . '/template/sendmessage.php');
     return $this->_post(sprintf(self::URL_YOUTUBE_MESSAGE, $userName), $query);
 }
Example #5
0
 /**
  * Retrieve all group list
  *
  * @param string
  * @param string
  * @param string
  * @param string
  * @return array
  */
 public function create($title, $description, $info, $userEmail = self::DEFAULT_VALUE)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'string');
     //argument 4 must be a string
     //populate fields
     $parameters = array(self::TITLE => $title, self::DESCRIPTION => $description, self::INFO => $info);
     //make a xml template
     $query = Eden_Template::i()->set($parameters)->parsePHP(dirname(__FILE__) . '/template/addgroups.php');
     return $this->_post(sprintf(self::URL_CONTACTS_GROUPS_LIST, $userEmail), $query);
 }
Example #6
0
 /**
  * Returns a checkout form
  *
  * @param string
  * @param string|integer
  * @param string
  * @param string|integer
  * @param string 
  * @param boolean Set to false for live url
  * @return array
  */
 public function checkoutForm($itemName, $price, $description, $quantity, $currency = 'USD', $test = true)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string', 'int')->argument(3, 'string')->argument(4, 'string', 'int')->argument(5, 'string')->argument(6, 'bool');
     //argument 6 must be a booelean
     if ($test = true) {
         //set url to sandbox
         $url = sprintf(self::URL_TEST_CHECKOUT, $this->_merchantId);
     } else {
         //set url to live account
         $url = sprintf(self::URL_LIVE_CHECKOUT, $this->_merchantId);
     }
     //make a xml template
     $form = Eden_Template::i()->set('url', $url)->set('itemName', $itemName)->set('itemDescription', $description)->set('itemPrice', $price)->set('itemCurrency', $currency)->set('itemQuantity', $quantity)->set('merchantId', $this->_merchantId)->parsePHP(dirname(__FILE__) . '/template/form.php');
     return $form;
 }
Example #7
0
 /**
  * Reply to a comment in a video
  *
  * @param string
  * @param string
  * @param string
  * @return array
  */
 public function replyToComment($videoId, $commentId, $comment)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string');
     //argument 3 must be a string
     //make a xml template file
     $query = Eden_Template::i()->set(self::COMMENT, $comment)->set(self::COMMENT_ID, $commentId)->set(self::VIDEO_ID, $videoId)->parsePHP(dirname(__FILE__) . '/template/replytocomment.php');
     return $this->_post(sprintf(self::URL_YOUTUBE_GET_COMMENTS, $videoId), $query);
 }
Example #8
0
 public function createForm($amount, $successUrl, $failUrl, $cancelUrl)
 {
     Eden_Asiapay_Error::i()->argument(1, 'int', 'float')->argument(2, 'url')->argument(3, 'url')->argument(4, 'url');
     $orderRef = rand(10000, 99999);
     $query = array('amount' => $amount, 'successUrl' => $successUrl, 'failUrl' => $failUrl, 'cancelUrl' => $cancelUrl, 'orderRef' => $orderRef, 'merchantId' => $this->_merchantId, 'currCode' => $this->_currencyCode, 'payType' => $this->_payType, 'lang' => $this->_language, 'payMethod' => $this->_payMethod, 'mpsMode' => $this->_mpsMode, 'remark' => $this->_remark, 'redirect' => $this->_redirect, 'print' => $this->_print, 'failRetry' => $this->_failRetry);
     $query = $this->_removeNull($query);
     if ($this->_test) {
         $url = self::CLIENTPOST_TEST_URL;
     } else {
         $url = self::CLIENTPOST_LIVE_URL;
         $hash = $this->_generateHash($amount, $orderRef);
         $query['secureHash'] = $hash;
     }
     $parameters = Eden_Template::i()->set('query', $query)->set('url', $url)->parsePHP(dirname(__FILE__) . '/template/asiapay.php');
     $this->_reset();
     return $parameters;
 }
Example #9
0
 /**
  * Create asia pay form 
  *  
  * @param integer|float The total amount your want to charge the customer for the provided currency
  * @param url A Web page address you want us to redirect upon the transaction being rejected by us.
  * @param url A Web page address you want us to redirect upon the transaction being rejected by us.
  * @param url A Web page address you want us to redirect upon the transaction being cancelled by your customer
  * @return string
  */
 public function createForm($amount, $successUrl, $failUrl, $cancelUrl)
 {
     //argument test
     Eden_Asiapay_Error::i()->argument(1, 'int', 'float')->argument(2, 'url')->argument(3, 'url')->argument(4, 'url');
     //argument 4 must be a url
     //creata a random order reference number
     $orderRef = rand(10000, 99999);
     $this->_query['amount'] = $amount;
     $this->_query['successUrl'] = $successUrl;
     $this->_query['failUrl'] = $failUrl;
     $this->_query['cancelUrl'] = $cancelUrl;
     $this->_query['orderRef'] = $orderRef;
     $this->_query['merchantId'] = $this->_merchantId;
     $this->_query['currCode'] = $this->_currencyCode;
     //if not specify, default is '608' - PH
     $this->_query['payType'] = $this->_payType;
     //if not specify, default is 'N' - Normal Payment (Sales)
     $this->_query['lang'] = $this->_language;
     //if not specify, default is 'E' - English
     $this->_query['payMethod'] = $this->_payMethod;
     //if not specify, default is 'CC' - Credit Card Payment
     //prevent sending fields with no value
     $this->_query = $this->_removeNull($this->_query);
     //if test is true
     if ($this->_test) {
         //use the test url
         $url = self::CLIENTPOST_TEST_URL;
         //else test is false
     } else {
         //use the live url
         $url = self::CLIENTPOST_LIVE_URL;
         //make a secure hash to prevent hacking
         $hash = $this->_generateHash($amount, $orderRef);
         //use secure hash when using live transaction
         $this->_query['secureHash'] = $hash;
     }
     //echo '<pre>'; print_r($this->_query); exit;
     //make a form template
     $parameters = Eden_Template::i()->set('query', $this->_query)->set('url', $url)->parsePHP(dirname(__FILE__) . '/template/asiapay.php');
     //reset variables
     unset($this->_query);
     return $parameters;
 }
 /**
  * Create asia pay form 
  *  
  * @param integer|float The total amount your want to charge the customer for the provided currency
  * @param url A Web page address you want us to redirect upon the transaction being rejected by us.
  * @param url A Web page address you want us to redirect upon the transaction being rejected by us.
  * @param url A Web page address you want us to redirect upon the transaction being cancelled by your customer
  * @param credit card number 
  * @param string Credit Card Verification Code
  * @param string Credit card holder name
  * @param string Credit card expiry month
  * @param string Credit card expiry year
  * @return string
  */
 public function createForm($amount, $successUrl, $failUrl, $cancelUrl, $cardNumber, $securityCode, $cardHolder, $month, $year)
 {
     //argument test
     Eden_Asiapay_Error::i()->argument(1, 'int', 'float')->argument(2, 'url')->argument(3, 'url')->argument(4, 'url')->argument(5, 'cc')->argument(6, 'string')->argument(7, 'string')->argument(8, 'string')->argument(9, 'string');
     //argument 9 must be a string
     //creata a random order reference number
     $orderRef = rand(10000, 99999);
     //populate fields
     $query = array('amount' => $amount, 'successUrl' => $successUrl, 'failUrl' => $failUrl, 'cancelUrl' => $cancelUrl, 'cardNo' => $cardNumber, 'securityCode' => $securityCode, 'cardHolder' => $cardHolder, 'epMonth' => $month, 'epYear' => $year, 'orderRef' => $orderRef, 'merchantId' => $this->_merchantId, 'currCode' => $this->_currencyCode, 'payType' => $this->_payType, 'lang' => $this->_language, 'pMethod' => $this->_payMethod, 'mpsMode' => $this->_mpsMode, 'remark' => $this->_remark, 'redirect' => $this->_redirect, 'print' => $this->_print, 'failRetry' => $this->_failRetry);
     //optional
     //prevent sending fields with no value
     $query = $this->_removeNull($query);
     //if test is true
     if ($this->_test) {
         //use the test url
         $url = self::DIRECTCLIENT_TEST_URL;
         //else test is false
     } else {
         //use the live url
         $url = self::DIRECTCLIENT_LIVE_URL;
         //make a secure hash to prevent hacking
         $hash = $this->_generateHash($amount, $orderRef);
         //use secure hash when using live transaction
         $query['secureHash'] = $hash;
     }
     //make a form template
     $parameters = Eden_Template::i()->set('query', $query)->set('url', $url)->parsePHP(dirname(__FILE__) . '/template/asiapay.php');
     //reset variables
     $this->_reset();
     return $parameters;
 }
Example #11
0
</entry>', true);return $this->_upload(sprintf(self::URL_YOUTUBE_UPLOAD,$userId),$query);}public function upload($uploadToken,$postUrl,$redirectUrl){Eden_Google_Error::i()->argument(1,'object','string')->argument(2,'object','string')->argument(3,'string');$query=Eden_Template::i()->set(self::UPLOAD_TOKEN,$uploadToken)->set(self::REDIRECT_URL,$redirectUrl)->set(self::POST_URL,$postUrl)->parsePHP('<form action="<?php echo $postUrl; ?>?nexturl=<?php echo $redirectUrl; ?>" method="post" enctype="multipart/form-data"> 
        <input name="file" type="file"/>
        <input name="token" type="hidden" value="<?php echo $uploadToken; ?>"/>
        <input value="Upload Video File" type="submit" />
</form>', true);return $query;}}}
Example #12
0
 /**
  * Subscribe to a users activity
  *
  * @param string
  * @param string
  * @return array
  */
 public function subscribeToUser($user, $userId = self::DEFAULT_VALUE)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string');
     //argument 2 must be a string
     //make a xml template
     $query = Eden_Template::i()->set(self::USER, $user)->parsePHP(dirname(__FILE__) . '/template/subscribe.php');
     return $this->_post(sprintf(self::URL_YOUTUBE_SUBSCRIPTION, $userId), $query);
 }
Example #13
0
 /**
  * Update contacts
  *
  * @param string
  * @param string
  * @param string
  * @return array
  */
 public function updateContacts($userName, $status, $userId = self::DEFAULT_VALUE)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string');
     //argument 3 must be a string
     //if the input value is not allowed
     if (!in_array($status, array('accepted', 'rejected'))) {
         //throw error
         Eden_Google_Error::i()->setMessage(Eden_Google_Error::INVALID_STATUS)->addVariable($status)->trigger();
     }
     //make a xml template file
     $query = Eden_Template::i()->set(self::STATUS, $status)->parsePHP(dirname(__FILE__) . '/template/updatecontacts.php');
     return $this->_put(sprintf(self::URL_YOUTUBE_CONTACTS_GET, $userId, $userName), $query);
 }
Example #14
0
 /**
  * Creates a contacts.
  *
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @return array
  */
 public function create($givenName, $familyName, $phoneNumber, $city, $street, $postCode, $country, $notes, $email, $userEmail = self::DEFAULT_VALUE)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'string')->argument(5, 'string')->argument(6, 'string')->argument(7, 'string')->argument(8, 'string')->argument(9, 'string')->argument(10, 'string');
     //argument 10 must be a string
     //make a xml template
     $query = Eden_Template::i()->set(self::GIVEN_NAME, $givenName)->set(self::FAMILY_NAME, $familyName)->set(self::PHONE_NUMBER, $phoneNumber)->set(self::CITY, $city)->set(self::STREET, $street)->set(self::POST_CODE, $postCode)->set(self::COUNTRY, $country)->set(self::NOTES, $notes)->set(self::EMAIL, $email)->parsePHP(dirname(__FILE__) . '/template/addcontacts.php');
     return $this->_post(sprintf(self::URL_CONTACTS_LIST, $userEmail), $query);
 }
Example #15
0
 /**
  * Add video to a playlist
  *
  * @param string
  * @param string
  * @param string
  * @return array
  */
 public function updateVideo($position, $playlistId, $entryId)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string');
     //argument 3 must be a string
     //make a xml template
     $query = Eden_Template::i()->set(self::POSITION, $position)->parsePHP(dirname(__FILE__) . '/template/addvideo.php');
     return $this->_put(sprintf(self::URL_YOUTUBE_PLAYLIST_VIDEO, $playlistId, $entryId), $query);
 }
Example #16
0
 /**
  * Returns the template loaded with specified data
  *
  * @param array
  * @return Eden_Template
  */
 public function template($file, array $data = array())
 {
     Jquery_Error::i()->argument(1, 'string');
     return Eden_Template::i()->set($data)->parsePhp($file);
 }
 /**
  * Activate user account for youtube 
  *
  * @param string
  * @param string
  * @return array
  */
 public function activateAccount($userName, $userId = self::DEFAULT_VALUE)
 {
     //argument test
     Eden_Google_Error::i()->argument(1, 'string')->argument(2, 'string');
     //argument 2 must be a string
     //make a xml template
     $query = Eden_Template::i()->set(self::USER_NAME, $userName)->parsePHP(dirname(__FILE__) . '/template/activate.php');
     return $this->_put(sprintf(self::URL_YOUTUBE_PROFILE, $userId), $query);
 }
Example #18
0
 /**
  * Error trigger output
  *
  * @return void
  */
 public function error($error, $event, $type, $level, $class, $file, $line, $message, $trace, $offset)
 {
     $history = array();
     for (; isset($trace[$offset]); $offset++) {
         $row = $trace[$offset];
         //lets formulate the method
         $method = $row['function'] . '()';
         if (isset($row['class'])) {
             $method = $row['class'] . '->' . $method;
         }
         $rowLine = isset($row['line']) ? $row['line'] : 'N/A';
         $rowFile = isset($row['file']) ? $row['file'] : 'Virtual Call';
         //add to history
         $history[] = array($method, $rowFile, $rowLine);
     }
     echo Eden_Template::i()->set('history', $history)->set('type', $type)->set('level', $level)->set('class', $class)->set('file', $file)->set('line', $line)->set('message', $message)->parsePhp(dirname(__FILE__) . '/front/error.phtml');
 }
Example #19
0
 /**
  * Transform block to string
  *
  * @param array
  * @return string
  */
 public function render()
 {
     return Eden_Template::i()->set($this->getVariables())->parsePhp($this->getTemplate());
 }