当前位置: 首页>>代码示例>>PHP>>正文


PHP Site::GetBySiteUniqId方法代码示例

本文整理汇总了PHP中Site::GetBySiteUniqId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::GetBySiteUniqId方法的具体用法?PHP Site::GetBySiteUniqId怎么用?PHP Site::GetBySiteUniqId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site的用法示例。


在下文中一共展示了Site::GetBySiteUniqId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form

 /**
  * @method POST
  */
 function form()
 {
     // parse request
     parse_str($this->request->data, $request);
     $siteUniqId = SITE_UNIQ_ID;
     $pageUniqId = $request['pageUniqId'];
     $body = $request['body'];
     $site = Site::GetBySiteUniqId($siteUniqId);
     $page = Page::GetByPageUniqId($pageUniqId);
     if ($site != null && $page != null) {
         $subject = 'RespondCMS: Form Submission [' . $site['Name'] . ': ' . $page['Name'] . ']';
         $content = '<h3>Site Information</h3>' . '<table>' . '<tr>' . '<td style="padding: 5px 25px 5px 0;">Site:</td>' . '<td style="padding: 5px 0">' . $site['Name'] . '</td>' . '</tr>' . '<tr>' . '<td style="padding: 5px 25px 5px 0;">Page:</td>' . '<td style="padding: 5px 0">' . $page['Name'] . '</td>' . '</tr>' . '</table>' . '<h3>Form Details</h3>' . $body;
         // send an email
         $headers = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
         $headers .= 'From: ' . $site['PrimaryEmail'] . "\r\n" . 'Reply-To: ' . $site['PrimaryEmail'] . "\r\n";
         // sends the email
         $to = $site['PrimaryEmail'];
         $from = $site['PrimaryEmail'];
         $fromName = $site['Name'];
         Utilities::SendEmail($to, $from, $fromName, $subject, $content);
         // return a successful response (200)
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:31,代码来源:form.php

示例2: get

 /**
  * @method POST
  */
 function get()
 {
     parse_str($this->request->data, $request);
     // parse request
     $term = $request['term'];
     $language = $request['language'];
     $siteUniqId = SITE_UNIQ_ID;
     $site = Site::GetBySiteUniqId($siteUniqId);
     $showSecure = false;
     if (isset($_SESSION[$site['FriendlyId'] . '.UserId'])) {
         $showSecure = true;
     }
     $results = SearchIndex::Search($siteUniqId, $language, $term, $showSecure);
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'application/json';
     $response->body = json_encode($results);
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:22,代码来源:site.php

示例3: checkCaptcha

 /**
  * @method POST
  */
 function checkCaptcha()
 {
     // parse request
     parse_str($this->request->data, $request);
     $siteUniqId = $request['siteUniqId'];
     $pageUniqId = $request['pageUniqId'];
     $recaptcha_challenge_field = $request['recaptcha_challenge_field'];
     $recaptcha_response_field = $request['recaptcha_response_field'];
     require_once '../libs/recaptchalib.php';
     $site = Site::GetBySiteUniqId($siteUniqId);
     $resp = recaptcha_check_answer($site['formPrivateId'], $_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field, $recaptcha_response_field);
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'text/html';
     if ($resp->is_valid) {
         $response->body = 'OK';
     } else {
         $response->body = 'NOK';
     }
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:23,代码来源:checkCaptcha.php

示例4: post

 /**
  * @method POST
  */
 function post()
 {
     // parse request
     parse_str($this->request->data, $request);
     $plan = $request['plan'];
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         try {
             $site = Site::GetBySiteUniqId($authUser->SiteUniqId);
             Stripe::setApiKey(STRIPE_API_KEY);
             $customer = Stripe_Customer::retrieve($site['CustomerId']);
             // retrieve default subscription
             if (isset($customer->subscriptions->data[0])) {
                 $subscription = $customer->subscriptions->data[0];
                 // updates the subscription
                 if ($subscription != NULL) {
                     $subscription->plan = $plan;
                     $subscription->save();
                 }
                 // update the session
                 AuthUser::UpdateSubscription();
             }
             // return a json response
             return new Tonic\Response(Tonic\Response::OK);
         } catch (Exception $e) {
             $response = new Tonic\Response(Tonic\Response::BADREQUEST);
             $response->body = $e->getMessage();
             return $response;
         }
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:38,代码来源:customer.php

示例5: get

 /**
  * @method GET
  */
 function get($siteUniqId)
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $site = Site::GetBySiteUniqId($siteUniqId);
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($site);
         return $response;
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:19,代码来源:site.php

示例6: PublishAllCSS

 public static function PublishAllCSS($siteUniqId, $root = '../')
 {
     $site = Site::GetBySiteUniqId($siteUniqId);
     // test for now
     $lessDir = $root . 'sites/' . $site['FriendlyId'] . '/themes/' . $site['Theme'] . '/styles/';
     //get all image files with a .less ext
     $files = glob($lessDir . "*.less");
     //print each file name
     foreach ($files as $file) {
         $f_arr = explode("/", $file);
         $count = count($f_arr);
         $filename = $f_arr[$count - 1];
         $name = str_replace('.less', '', $filename);
         Publish::PublishCSS($site, $name, $root);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:16,代码来源:Publish.php

示例7: post

 /**
  * @method POST
  */
 function post($theme)
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $site = Site::GetBySiteUniqId($authUser->SiteUniqId);
         // publishes a theme for a site
         Publish::PublishTheme($site, $theme);
         // republish site with the new theme
         Publish::PublishSite($site['SiteUniqId']);
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         return $response;
     } else {
         // return an unauthorized exception (401)
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:22,代码来源:theme.php

示例8: get

 /**
  * @method POST
  */
 function get()
 {
     parse_str($this->request->data, $request);
     // parse request
     $siteUniqId = SITE_UNIQ_ID;
     $pageTypeUniqId = $request['pageTypeUniqId'];
     $site = Site::GetBySiteUniqId($siteUniqId);
     $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
     // Get all pages
     $total = Page::GetPagesCount($site['SiteId'], $pageType['PageTypeId'], true);
     $json = '{"total":"' . $total . '"}';
     header('Content-type: application/json');
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'applicaton/json';
     $response->body = $json;
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:21,代码来源:page.php

示例9: add

 /**
  * @method POST
  */
 function add()
 {
     // parse request
     parse_str($this->request->data, $request);
     // parse request
     $email = $request['email'];
     $password = $request['password'];
     $firstName = $request['firstName'];
     $lastName = $request['lastName'];
     $role = 'Member';
     $isActive = 0;
     $language = $request['language'];
     $site = Site::GetBySiteUniqId(SITE_UNIQ_ID);
     $user = User::Add($email, $password, $firstName, $lastName, $role, $language, $isActive, $site['SiteId']);
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'applicaton/json';
     $response->body = json_encode($user);
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:23,代码来源:user.php

示例10: post

 /**
  * @method POST
  */
 function post()
 {
     // parse request
     parse_str($this->request->data, $request);
     $token = $request['token'];
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         try {
             $site = Site::GetBySiteUniqId($authUser->SiteUniqId);
             Stripe::setApiKey(STRIPE_API_KEY);
             $customer = Stripe_Customer::retrieve($site['CustomerId']);
             //$customer->cards->create(array("card" => $token));
             $customer->card = $token;
             $customer->save();
             // return a 200
             return new Tonic\Response(Tonic\Response::OK);
         } catch (Exception $e) {
             $response = new Tonic\Response(Tonic\Response::BADREQUEST);
             $response->body = $e->getMessage();
             return $response;
         }
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:30,代码来源:card.php

示例11: post

 /**
  * @method POST
  */
 function post()
 {
     parse_str($this->request->data, $request);
     $siteUniqId = $request['custom'];
     // get reference to site
     $site = Site::GetBySiteUniqId($siteUniqId);
     $use_sandbox = false;
     // set whether to use a sandbox
     if ($site['PayPalUseSandbox'] == '1') {
         $use_sandbox = true;
     }
     $listener = new IpnListener();
     $listener->use_curl = false;
     $listener->use_sandbox = $use_sandbox;
     $listener->use_ssl = true;
     try {
         $verified = $listener->processIpn();
     } catch (Exception $e) {
         // fatal error trying to process IPN.
         exit(0);
     }
     // IPN response was "VERIFIED"
     if ($verified) {
         $processor = 'PayPal';
         if ($use_sandbox == true) {
             $processor .= ' (sandbox)';
         }
         $processorTransactionId = $request['txn_id'];
         $processorStatus = $request['payment_status'];
         $email = $request['payer_email'];
         $payerId = $request['payer_id'];
         $name = $request['first_name'] . ' ' . $request['last_name'];
         $shipping = $request['mc_handling'];
         $fee = $request['mc_fee'];
         $tax = $request['tax'];
         $total = $request['mc_gross'];
         $currency = $request['mc_currency'];
         $num_items = 1000;
         if (isset($request['num_cart_items'])) {
             $num_items = $request['num_cart_items'];
         }
         $items = array();
         // line-items (for receipt)
         $line_items = '';
         // get items
         for ($x = 1; $x <= $num_items; $x++) {
             if (isset($request['item_number' . $x])) {
                 $arr_temp = explode('-', $request['item_number' . $x]);
                 // shipping type is the last item of the array
                 $item_shipping_type = $arr_temp[count($arr_temp) - 1];
                 // the sku is the last item less the type
                 $item_sku = str_replace('-' . $item_shipping_type, '', $request['item_number' . $x]);
                 $item_name = $request['item_name' . $x];
                 $item_sku = iconv("ISO-8859-1", "UTF-8", $item_name);
                 $item_name = iconv("ISO-8859-1", "UTF-8", $item_name);
                 $item_quantity = $request['quantity' . $x];
                 $item_total = $request['mc_gross_' . $x];
                 $item_price = floatval($item_total) / intval($item_quantity);
                 $item = array('SKU' => $item_sku, 'Name' => $item_name, 'ShippingType' => $item_shipping_type, 'Quantity' => $item_quantity, 'Price' => $item_price, 'Total' => $item_total);
                 $download_link = '';
                 if ($item_shipping_type == 'DOWNLOAD') {
                     $download_link = '<br><a href="http://' . $site['Domain'] . '/api/transaction/download/{{transactionUniqId}}/' . $item_sku . '">Download</a>';
                 }
                 // setup currency for line items
                 $item_total = $item_total . ' ' . $currency;
                 $item_price = $item_price . ' ' . $currency;
                 // add $ for total and price
                 if ($currency == 'USD') {
                     $item_total = '$' . $item_total;
                     $item_price = '$' . $item_price;
                 }
                 $line_items .= '<tr style="border-bottom: 1px solid #f0f0f0;"><td>' . $item_name . '<br><small>' . $item_sku . '</small>' . $download_link . '</td><td align="right">' . $item_price . '</td><td align="right">' . $item_quantity . '</td><td align="right">' . $item_total . '</td></tr>';
                 array_push($items, $item);
             }
         }
         $items_json = json_encode($items);
         $data_json = json_encode($_POST);
         // add a transaction
         $transaction = Transaction::Add($site['SiteId'], $processor, $processorTransactionId, $processorStatus, $email, $payerId, $name, $shipping, $fee, $tax, $total, $currency, $items_json, $data_json);
         // replace {{transactionUniqId}} in line_items
         $line_items = str_replace('{{transactionUniqId}}', $transaction['TransactionUniqId'], $line_items);
         $site_logo = '';
         if ($site['LogoUrl'] != '' && $site['LogoUrl'] != NULL) {
             $site_logo = '<img src="http://' . $site['Domain'] . '/files/' . $site['LogoUrl'] . '" style="max-height:50px">';
         }
         // setup currency for line items
         $shipping = $shipping . ' ' . $currency;
         $tax = $tax . ' ' . $currency;
         $total = $total . ' ' . $currency;
         // add $ for total and price
         if ($currency == 'USD') {
             $shipping = '$' . $shipping;
             $tax = '$' . $tax;
             $total = '$' . $total;
         }
         // send email
         $replace = array('{{site}}' => $site['Name'], '{{site-logo}}' => $site_logo, '{{reply-to}}' => $site['PrimaryEmail'], '{{line-items}}' => $line_items, '{{shipping}}' => $shipping, '{{tax}}' => $tax, '{{total}}' => $total);
//.........这里部分代码省略.........
开发者ID:eavesmonkey,项目名称:respond,代码行数:101,代码来源:transaction.php


注:本文中的Site::GetBySiteUniqId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。