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


PHP SS_HTTPRequest::getVar方法代码示例

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


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

示例1: afterPurchase

 /**
  * Default action handler for this page
  * 
  * @param	SS_HTTPRequest	$request
  * @return	Object			AfterPurchasePage
  */
 public function afterPurchase(SS_HTTPRequest $request)
 {
     if ($request->isGET()) {
         if ($this->validateClickBankRequest) {
             $cbreceipt = $request->getVar('cbreceipt');
             $cbpop = $request->getVar('cbpop');
             $name = $request->getVar('cname');
             $email = $request->getVar('cemail');
             if (!empty($cbreceipt) && !empty($cbpop)) {
                 if (ClickBankManager::validate_afterpurchase_request($request->getVars())) {
                     $member = DataObject::get_one('Member', "Email = '{$email}'");
                     // make the member status to logged-in
                     if ($member && $this->loginAfterClickBankRequestIsValid) {
                         $member->logIn();
                     }
                     // few handy replacement texts
                     $content = $this->Content;
                     $content = str_replace('$CBReceipt', $cbreceipt, $content);
                     $content = str_replace('$CBName', $name, $content);
                     $data = array('Title' => $this->Title, 'Content' => $content);
                     return $this->customise($data)->renderWith(array('AfterPurchasePage' => 'Page'));
                 }
             }
         } else {
             $data = array('Title' => $this->Title, 'Content' => $this->Content);
             return $this->customise($data)->renderWith(array('AfterPurchasePage' => 'Page'));
         }
     }
     return $this->redirect('/server-error');
 }
开发者ID:rixrix,项目名称:silverstripe-clickbank,代码行数:36,代码来源:AfterPurchasePage.php

示例2: check

 /**
  * Check that the payment was successful using "Process Response" API (http://www.paymentexpress.com/Technical_Resources/Ecommerce_Hosted/PxPay.aspx).
  * 
  * @param SS_HTTPRequest $request Request from the gateway - transaction response
  * @return PaymentGateway_Result
  */
 public function check($request)
 {
     $data = $request->getVars();
     $url = $request->getVar('url');
     $result = $request->getVar('result');
     $userID = $request->getVar('userid');
     //Construct the request to check the payment status
     $request = new PxPayLookupRequest();
     $request->setResponse($result);
     //Get encrypted URL from DPS to redirect the user to
     $request_string = $this->makeCheckRequest($request, $data);
     //Obtain output XML
     $response = new MifMessage($request_string);
     //Parse output XML
     $success = $response->get_element_text('Success');
     if ($success && is_numeric($success) && $success > 0) {
         return new PaymentGateway_Success();
     } else {
         if (is_numeric($success) && $success == 0) {
             return new PaymentGateway_Failure();
         } else {
             return new PaymentGateway_Incomplete();
         }
     }
 }
开发者ID:helpfulrobot,项目名称:frankmullenger-payment-paymentexpress,代码行数:31,代码来源:PaymentExpressGateway.php

示例3: index

 public function index(SS_HTTPRequest $request)
 {
     $products = Product::get();
     if ($search = $request->getVar('Keywords')) {
         $products = $products->filter(array('Title:PartialMatch' => $search));
     }
     if ($minPrice = $request->getVar('MinPrice')) {
         $products = $products->filter(array('Price:GreaterThanOrEqual' => $minPrice));
     }
     if ($maxPrice = $request->getVar('MaxPrice')) {
         $products = $products->filter(array('Price:LessThanOrEqual' => $maxPrice));
     }
     $paginatedProducts = PaginatedList::create($products, $request)->setPageLength(6);
     $data = array('Results' => $paginatedProducts);
     /*
     if($request->isAjax()){
         return $this->customise(array(
             'Results' => $paginatedProducts
         ))->renderWith('ProductSearchResults');
     }
     */
     if ($request->isAjax()) {
         return $this->customise($data)->renderWith('ProductSearchResults');
     }
     return $data;
 }
开发者ID:dunatron,项目名称:onbaord-revamp,代码行数:26,代码来源:fdf.php

示例4: index

 public function index(SS_HTTPRequest $r)
 {
     $p = SchedPresentation::get()->filter(array('DisplayOnSite' => true));
     $k = $r->getVar('Keywords');
     $cat = $r->getVar('Category');
     $speaker = $r->getVar('Speaker');
     $summit = $r->getVar('Summit');
     $tag = $r->getVar('Tag');
     if (!empty($k)) {
         $p = $p->filterAny(array('Title:PartialMatch' => $k, 'Description:PartialMatch' => $k, 'Tags.Title:ExactMatch' => $k));
     }
     if (!empty($cat)) {
         $p = $p->filter(array('CategoryID' => $cat));
     }
     if (!empty($speaker)) {
         $p = $p->filter(array('PresentationSpeakers.ID' => $speaker));
     }
     if (!empty($summit)) {
         $p = $p->filter(array('SummmitID' => $summit));
     }
     if (!empty($tag)) {
         $p = $p->filter(array('Tags.Title' => $tag));
     }
     return array('Results' => new PaginatedList($p, $this->request));
 }
开发者ID:balajijegan,项目名称:openstack-org,代码行数:25,代码来源:PresentationVideoPage.php

示例5: OAuth

 /**
  * OAuth callback handler.
  *
  * @param SS_HTTPRequest $request
  */
 public function OAuth($request)
 {
     $code = $request->getVar('code');
     $state = $request->getVar('state');
     if (!$code || !$state) {
         return Controller::curr()->redirect($this->Link());
     }
     $client = InstagramAccount::getNewInstagramClient();
     $form = $this->getEditForm();
     try {
         $token = $client->getAccessToken($code);
         $instagramAccountID = $this->getInstagramAccountIDFromSession($state);
         // Find the matching InstagramAccount.
         if (!$instagramAccountID || !($instagramAccount = InstagramAccount::get()->byId($instagramAccountID))) {
             return $this->handleOAuthError($form);
         }
         try {
             $instagramAccount->updateAccessToken(Convert::raw2json($token), $state);
             $instagramAccount->write();
             $form->sessionMessage(_t('Instagram.MessageOAuthSuccess', 'Successfully authorised your account.'), 'good');
             return Controller::curr()->redirect($this->Link());
         } catch (Exception $e) {
             return $this->handleOAuthError($form, _t('Instagram.MessageOAuthErrorUserConflict', 'Unable to authorise account. Make sure you are logged out of Instagram and ' . 'your username is spelled correctly.'));
         }
     } catch (InstagramIdentityProviderException $e) {
         return $this->handleOAuthError($form);
     }
 }
开发者ID:somardesignstudios,项目名称:silverstripe-instagram,代码行数:33,代码来源:InstagramAdmin.php

示例6: childnodes

 /**
  * Request nodes from the server
  *
  * @param SS_HTTPRequest $request
  * @return JSONString
  */
 public function childnodes($request)
 {
     $data = array();
     $rootObjectType = 'SiteTree';
     if ($request->param('ID')) {
         $rootObjectType = $request->param('ID');
     }
     if ($request->getVar('search')) {
         return $this->performSearch($request->getVar('search'), $rootObjectType);
     }
     $parentId = $request->getVar('id');
     if (!$parentId) {
         $parentId = $rootObjectType . '-0';
     }
     $selectable = null;
     if ($request->param('OtherID')) {
         $selectable = explode(',', $request->param('OtherID'));
     }
     list($type, $id) = explode('-', $parentId);
     if (!$type || $id < 0) {
         $data = array(0 => array('data' => 'An error has occurred'));
     } else {
         $children = null;
         if ($id == 0) {
             $children = DataObject::get($rootObjectType, 'ParentID = 0');
         } else {
             $object = DataObject::get_by_id($type, $id);
             $children = $this->childrenOfNode($object);
         }
         $data = array();
         if ($children && count($children)) {
             foreach ($children as $child) {
                 if ($child->ID < 0) {
                     continue;
                 }
                 $haskids = $child->numChildren() > 0;
                 $nodeData = array('title' => isset($child->MenuTitle) ? $child->MenuTitle : $child->Title);
                 if ($selectable && !in_array($child->ClassName, $selectable)) {
                     $nodeData['clickable'] = false;
                 }
                 $thumbs = null;
                 if ($child->ClassName == 'Image') {
                     $thumbs = $this->generateThumbnails($child);
                     $nodeData['icon'] = $thumbs['x16'];
                 } else {
                     if (!$haskids) {
                         $nodeData['icon'] = 'frontend-editing/images/page.png';
                     }
                 }
                 $nodeEntry = array('attributes' => array('id' => $child->ClassName . '-' . $child->ID, 'title' => Convert::raw2att($nodeData['title']), 'link' => $child->RelativeLink()), 'data' => $nodeData, 'state' => $haskids ? 'closed' : 'open');
                 if ($thumbs) {
                     $nodeEntry['thumbs'] = $thumbs;
                 }
                 $data[] = $nodeEntry;
             }
         }
     }
     return Convert::raw2json($data);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-frontend-editing,代码行数:65,代码来源:SimpleTreeController.php

示例7: tree

 public function tree(SS_HTTPRequest $request)
 {
     $oldSubsiteID = Session::get('SubsiteID');
     if ($request->getVar($this->name . '_SubsiteID')) {
         $this->subsiteID = $request->getVar($this->name . '_SubsiteID');
     }
     Session::set('SubsiteID', $this->subsiteID);
     $results = parent::tree($request);
     Session::set('SubsiteID', $oldSubsiteID);
     return $results;
 }
开发者ID:mikenz,项目名称:silverstripe-simplesubsites,代码行数:11,代码来源:SubsitesTreeDropdownField.php

示例8: format

 public function format(SS_HTTPRequest $request)
 {
     $rawNumber = $request->getVar('number');
     $country = $request->getVar('country');
     $format = $request->getVar('format');
     try {
         return LibPhoneNumberField::formatPhoneNumber($rawNumber, $country, $format);
     } catch (\libphonenumber\NumberParseException $e) {
         SS_Log::log($e->getMessage(), SS_Log::DEBUG);
         return $this->httpError(400, $e->getMessage());
     }
 }
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-phonenumber,代码行数:12,代码来源:LibPhoneNumberController.php

示例9: postRequest

 public function postRequest(\SS_HTTPRequest $request, \SS_HTTPResponse $response, \DataModel $model)
 {
     if ($request->getVar('clear') && Member::currentUserID() && Permission::check('ADMIN')) {
         $key = trim($request->getVar('url'), '/');
         $key = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '') . '/' . $key;
         $item = $this->dynamicCache->get($key);
         if ($item) {
             $response->addHeader('X-SilverStripe-Cache', 'deleted ' . $key);
             $this->dynamicCache->delete($key);
         }
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-simplecache,代码行数:12,代码来源:CacheClearFilter.php

示例10: run

 /**
  * @param SS_HTTPRequest $request
  * @return bool
  */
 public function run($request)
 {
     /* @var $permissionChecker AnnotatePermissionChecker */
     $permissionChecker = Injector::inst()->get('AnnotatePermissionChecker');
     if (!$permissionChecker->environmentIsAllowed()) {
         return false;
     }
     /* @var $annotator DataObjectAnnotator */
     $annotator = DataObjectAnnotator::create();
     $annotator->annotateObject($request->getVar('object'));
     $annotator->annotateModule($request->getVar('module'));
     return true;
 }
开发者ID:axyr,项目名称:silverstripe-ideannotator,代码行数:17,代码来源:DataObjectAnnotatorTask.php

示例11: handleGetAllPresentations

 public function handleGetAllPresentations(SS_HTTPRequest $r)
 {
     $limit = $r->getVar('limit') ?: 50;
     if ($limit > 50) {
         $limit = 50;
     }
     $start = $r->getVar('page') ?: 0;
     $presentations = Member::currentUser() ? Member::currentUser()->getRandomisedPresentations() : Presentation::get()->filter(array('SummitEvent.SummitID' => Summit::get_active()->ID));
     if ($r->getVar('category')) {
         $presentations = $presentations->filter('CategoryID', (int) $r->getVar('category'));
     }
     if ($r->getVar('keyword')) {
         $k = $r->getVar('keyword');
         $presentations = $presentations->filterAny(array('Title:PartialMatch' => $k, 'Description:PartialMatch' => $k, 'Speakers.FirstName:PartialMatch' => $k, 'Speakers.LastName:PartialMatch' => $k));
     }
     if ($r->getVar('voted') == "true") {
         $presentations = $presentations->leftJoin("PresentationVote", "PresentationVote.PresentationID = Presentation.ID")->where("IFNULL(PresentationVote.MemberID,0) = " . Member::currentUserID());
     }
     if ($r->getVar('voted') == "false") {
         $presentations = $presentations->leftJoin("PresentationVote", "PresentationVote.PresentationID = Presentation.ID")->where("IFNULL(PresentationVote.MemberID,0) != " . Member::currentUserID());
     }
     $count = $presentations->count();
     $presentations = $presentations->limit($limit, $start * $limit);
     $data = array('results' => array(), 'has_more' => $count > $limit * ($start + 1), 'total' => $count, 'remaining' => $count - $limit * ($start + 1));
     foreach ($presentations as $p) {
         $data['results'][] = array('id' => $p->ID, 'title' => $p->Title, 'user_vote' => $p->getUserVote() ? $p->getUserVote()->Vote : null);
     }
     return (new SS_HTTPResponse(Convert::array2json($data), 200))->addHeader('Content-Type', 'application/json');
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:29,代码来源:PresentationAPI.php

示例12: isRequsetBot

 /**
  * Determins if the given request is from a bot
  *
  * Google ranks sites with the same content on different URLs lower.
  * This makes the site deliver single pages to bots
  *
  * @link http://www.beautifulcoding.com/snippets/178/a-simple-php-bot-checker-are-you-human/
  * @return boolean
  */
 public static function isRequsetBot(\SS_HTTPRequest $request)
 {
     $bots = Config::inst()->get('AllInOnePage', 'Bots');
     $result = $request->getVar("mockBot") == "true";
     if (!$result) {
         foreach ($bots as $spider) {
             //If the spider text is found in the current user agent, then return true
             if (stripos($request->getHeader("User-Agent"), $spider) !== false) {
                 $result = true;
             }
         }
     }
     //        echo '<pre class="debug"> "$result"' . PHP_EOL . print_r($result ? "yes" : "no", true) . PHP_EOL . '</pre>';
     return $result || $request->getVar("mockBot") == "true";
 }
开发者ID:ramana-devasani,项目名称:silverstripe-all-in-one-page,代码行数:24,代码来源:AllInOneHelper.php

示例13: run

 /**
  * @param SS_HTTPRequest $request
  */
 public function run($request)
 {
     /** =========================================
          * @var Page $page
         ===========================================*/
     if (class_exists('Page')) {
         if (Page::has_extension('TwitterCardMeta')) {
             // Should we overwrite?
             $overwrite = $request->getVar('overwrite') ? true : false;
             echo sprintf('Overwrite is %s', $overwrite ? 'enabled' : 'disabled') . $this->eol . $this->eol;
             $pages = Page::get();
             foreach ($pages as $page) {
                 $id = $page->ID;
                 echo $this->hr;
                 echo 'Updating page: ' . $page->Title . $this->eol;
                 foreach ($this->fields_to_update as $fieldName) {
                     $oldData = DB::query("SELECT {$fieldName} FROM Page WHERE ID = {$id}")->column($fieldName);
                     $newData = DB::query("SELECT {$fieldName} FROM SiteTree WHERE ID = {$id}")->column($fieldName);
                     if (!empty($oldData)) {
                         // If new data has been saved and we don't want to overwrite, exit the loop
                         if (!empty($newData) && $overwrite === false) {
                             continue;
                         }
                         DB::query("UPDATE SiteTree SET {$fieldName} = '{$oldData[0]}' WHERE ID = {$id}");
                     } else {
                         echo 'Field "' . $fieldName . '" empty.' . $this->eol;
                     }
                 }
             }
         }
     }
 }
开发者ID:toastnz,项目名称:twitter-card-meta,代码行数:35,代码来源:MigrateSiteTreeMetaTask.php

示例14: delete

 public function delete(SS_HTTPRequest $request)
 {
     $rid = $request->getVar('RID');
     $record = TestObject::get()->filter(array('ID' => $rid))->first();
     $record->delete();
     return $this->customise(new ArrayData(array('Title' => 'Orient DB Demo', 'SubTitle' => "Deleted Record {$rid}", 'Content' => $content)))->renderWith(array('OrientController', 'AppController'));
 }
开发者ID:Cumquat,项目名称:silverstripe-orientdb-poc,代码行数:7,代码来源:OrientController.php

示例15: getDefault

 protected static function getDefault(SS_HTTPRequest $request, $var, $default)
 {
     if ($value = $request->getVar($var)) {
         return $value;
     }
     return $default;
 }
开发者ID:helpfulrobot,项目名称:tom-alexander-silverstripe-griddle,代码行数:7,代码来源:GriddleField.php


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