當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OpenVBX::_twilioValidator方法代碼示例

本文整理匯總了PHP中OpenVBX::_twilioValidator方法的典型用法代碼示例。如果您正苦於以下問題:PHP OpenVBX::_twilioValidator方法的具體用法?PHP OpenVBX::_twilioValidator怎麽用?PHP OpenVBX::_twilioValidator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenVBX的用法示例。


在下文中一共展示了OpenVBX::_twilioValidator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateRequest

 /**
  * Validate that the current request came from Twilio
  * 
  * If no url is passed then the default $_SERVER['REQUEST_URI'] will be passed
  * through site_url().
  * 
  * If no post_vars are passed then $_POST will be used directly.
  *
  * @param bool/string $uri
  * @param bool/array $post_vars
  * @return bool
  */
 public static function validateRequest($url = false, $post_vars = false)
 {
     $ci =& get_instance();
     if ($ci->tenant->type == VBX_Settings::AUTH_TYPE_CONNECT) {
         return true;
     }
     if (!self::$_twilioValidator instanceof Services_Twilio_RequestValidator) {
         self::$_twilioValidator = new Services_Twilio_RequestValidator($ci->twilio_token);
     }
     if (empty($url)) {
         // we weren't handed a uri, use the default
         $url = site_url($ci->uri->uri_string());
     } elseif (strpos($url, '://') === false) {
         // we were handed a relative uri, make it full
         $url = site_url($url);
     }
     // without rewrite enabled we need to ensure that the query string
     // is properly appended to the url when being reconstructed
     if ($ci->vbx_settings->get('rewrite_enabled', VBX_PARENT_TENANT) < 1 && !empty($_SERVER['QUERY_STRING']) && strpos($url, $_SERVER['QUERY_STRING']) === false) {
         $qs = parse_str($_SERVER['QUERY_STRING']);
         // make sure that the rewrite var doesn't stay in the query
         // string if we're not doing rewriting
         if ($ci->vbx_settings->get('rewrite_enabled', VBX_PARENT_TENANT) < 1) {
             foreach ($qs as $name => $value) {
                 if ($name == 'vbxsite') {
                     unset($qs[$name]);
                 }
             }
         }
         if (!empty($qs)) {
             $url .= '?' . http_build_query($qs);
         }
     }
     if (empty($post_vars)) {
         // we weren't handed post-vars, use the default
         $post_vars = $_POST;
     }
     return self::$_twilioValidator->validate(self::getRequestSignature(), $url, $post_vars);
 }
開發者ID:AsaadQ,項目名稱:OpenVBX,代碼行數:51,代碼來源:OpenVBX.php


注:本文中的OpenVBX::_twilioValidator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。