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


PHP Net_URL2::setQueryVariable方法代码示例

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


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

示例1: init

 public function init(array $options)
 {
     // base url
     if (isset($options['baseURL'])) {
         $this->baseURL = $options['baseURL'];
     } else {
         $this->baseURL = 'http://' . $_SERVER['SERVER_NAME'];
     }
     if (isset($options['ezrpPath'])) {
         $this->ezrpPath = $options['ezrpPath'];
     }
     $this->sessionID = $options['sessionID'];
     $verifyURL = new Net_URL2(rtrim($this->baseURL, '/') . $this->ezrpPath);
     $verifyURL->setQueryVariable('ezrpd', $this->driver);
     $this->verifyURL = $verifyURL->getURL();
 }
开发者ID:shupp,项目名称:EZRP,代码行数:16,代码来源:Common.php

示例2: get

 /**
  * Required to request the root i-name (XRI) XRD which will provide an
  * error message that the i-name does not exist, or else return a valid
  * XRD document containing the i-name's Canonical ID.
  *
  * @param string $url         URI
  * @param string $serviceType Optional service type
  *
  * @return HTTP_Request
  * @todo   Finish this a bit better using the QXRI rules.
  */
 protected function get($url, $serviceType = null)
 {
     $request = new HTTP_Request2($url, HTTP_Request2::METHOD_GET, $this->getHttpRequestOptions());
     $netURL = new Net_URL2($url);
     $request->setHeader('Accept', 'application/xrds+xml');
     if ($serviceType) {
         $netURL->setQueryVariable('_xrd_r', 'application/xrds+xml');
         $netURL->setQueryVariable('_xrd_t', $serviceType);
     } else {
         $netURL->setQueryVariable('_xrd_r', 'application/xrds+xml;sep=false');
     }
     $request->setURL($netURL->getURL());
     try {
         return $request->send();
     } catch (HTTP_Request2_Exception $e) {
         throw new Services_Yadis_Exception('Invalid response to Yadis protocol received: ' . $e->getMessage(), $e->getCode());
     }
 }
开发者ID:pear,项目名称:services_yadis,代码行数:29,代码来源:Xri.php

示例3: setQueryVariable

 /**
  * Sets a an existing query parameter to value or creates a new one if the $key
  * doesn't exist.
  * 
  * @param string $key   query parameter name.
  * @param string $value query value.
  * 
  * @return none
  */
 public function setQueryVariable($key, $value)
 {
     Validate::isString($key, 'key');
     Validate::isString($value, 'value');
     $this->_url->setQueryVariable($key, $value);
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:15,代码来源:Url.php

示例4: MakePagination

 public function MakePagination($query, $rpp_def = NULL, $location = "DB")
 {
     $return_set = array();
     $this->{$location}->query($query);
     // This query should select all needed fields from database
     if ((int) $this->_S->Get('rpp') != 0) {
         if (isset($_POST['rpp'])) {
             if ((int) $_POST['rpp'] == 0) {
                 $this->_S->Set('rpp', 50);
             } else {
                 $this->_S->Set('rpp', (int) $_POST['rpp']);
             }
         }
         $rpp = (int) $this->_S->Get('rpp');
     } else {
         $this->_S->Set('rpp', 50);
         $rpp = (int) $this->_S->Get('rpp');
     }
     // http://pear.php.net/package/Net_URL2
     $op = new Net_URL2($_SERVER["REQUEST_URI"]);
     $op->unsetQueryVariable('cpage');
     $op->setQueryVariable('cpage', '');
     $str = (string) $op;
     if (strpos($str, "search=1")) {
         $str = str_replace("search=1", "search=0", $str);
     }
     $OptionForm = new TForm();
     $OptionForm->Action = $str . $this->CurrentPage;
     $OptionForm->Name = "paginationform";
     $OptionForm->class_name = "pagination_form";
     $TSelect = new TForm_TSelect('rpp');
     $TSelect->class_name = 'select2';
     $TSelect->style = 'width: 60px;';
     $OptionForm->Add("SlRPP", $TSelect);
     $OptionForm->SlRPP->Label = "Rezultate pe pagina:   ";
     $OptionForm->SlRPP->label_class = 'inline';
     $OptionForm->SlRPP->AddOption('10', '10');
     $OptionForm->SlRPP->AddOption('20', '20');
     $OptionForm->SlRPP->AddOption('30', '30');
     $OptionForm->SlRPP->AddOption('50', '50');
     $OptionForm->SlRPP->AddOption('100', '100');
     $OptionForm->SlRPP->Value = $rpp;
     $OptionForm->SlRPP->Paragraph = false;
     $OptionForm->SlRPP->onChange = 'this.form.submit();';
     $total_pages = ceil($this->{$location}->numRows() / $rpp);
     if (!$this->CurrentPage || $this->CurrentPage <= 0 || $this->CurrentPage > $total_pages) {
         $this->CurrentPage = 1;
     }
     $return_set[1] = " LIMIT " . ($this->CurrentPage - 1) * $rpp . ", " . $rpp;
     $TSelect = new TForm_TSelect('pag');
     $TSelect->class_name = 'select2';
     $TSelect->style = 'width: 60px;';
     $OptionForm->Add('SlPag', $TSelect);
     for ($i = 1; $i <= $total_pages; $i++) {
         $OptionForm->SlPag->AddOption($str . $i, $i);
     }
     $OptionForm->SlPag->Label = "Afiseaza pagina: ";
     $OptionForm->SlPag->label_class = 'inline';
     $OptionForm->SlPag->Paragraph = false;
     $OptionForm->SlPag->Value = $str . $this->CurrentPage;
     $OptionForm->SlPag->onChange = 'pagination_check_link(this.options[this.selectedIndex].value);';
     $return_set[2] = "<div class=\"result_pages\">" . $OptionForm->Html() . "";
     $ppages = '';
     $j = 0;
     $nextpage = $pervpage = '';
     if ($this->CurrentPage != 1) {
         $pervpage = '<li><a href="' . $str . '1"> <i class="icon-double-angle-left"></i></a></li><li><a href="' . $str . ($this->CurrentPage - 1) . '"> <i class="icon-angle-left"></i></a></li>';
     } else {
         $pervpage = '<li class="disabled"><a href="' . $str . '1"> <i class="icon-double-angle-left"></i></a></li><li class="disabled"><a href="' . $str . ($this->CurrentPage - 1) . '"> <i class="icon-angle-left"></i></a></li>';
     }
     if ($this->CurrentPage != $total_pages) {
         $nextpage = '<li><a href="' . $str . ($this->CurrentPage + 1) . '"><i class="icon-angle-right"></i> </a></li><li><a href="' . $str . $total_pages . '"><i class="icon-double-angle-right"></i> </a></li>';
     } else {
         $nextpage = '<li class="disabled"><a href="' . $str . ($this->CurrentPage + 1) . '"><i class="icon-angle-right"></i> </a></li><li class="disabled"><a href="' . $str . $total_pages . '"><i class="icon-double-angle-right"></i> </a></li>';
     }
     for ($i = 0; $i <= $j + 10; $i++) {
         if ($this->CurrentPage - 5 + $i > 0 && $this->CurrentPage - 5 + $i <= $total_pages) {
             if ($this->CurrentPage == $this->CurrentPage - 5 + $i) {
                 $ppages .= '<li class="active"><a>' . ($this->CurrentPage - 5 + $i) . '</a></li>';
             } else {
                 $ppages .= '<li><a href="' . $str . ($this->CurrentPage - 5 + $i) . '">' . ($this->CurrentPage - 5 + $i) . '</a></li>';
             }
         } else {
             if ($this->CurrentPage - 5 + $i <= $total_pages) {
                 $j++;
             }
         }
     }
     $return_set[2] .= '<ul class="pagination">';
     if ($total_pages > 1) {
         $return_set[2] .= $pervpage . $ppages . $nextpage;
     } else {
         $return_set[2] .= '<li class="active"><a>' . $this->CurrentPage . '</a></li>';
     }
     $return_set[2] .= '</ul>';
     $return_set[2] .= '</div>';
     return $return_set;
 }
开发者ID:alexchitoraga,项目名称:tunet,代码行数:98,代码来源:Page.class.php

示例5: get_request

    /**
     * GET Request
     *
     * @param $url
     * @param $datas
     * @return string
     */
    public function get_request($url, $datas = array())
    {
        $body = '';
        try {
            $url2 = new Net_URL2($url);
            foreach ($datas as $key => $val) {
                $url2->setQueryVariable($key, mb_convert_encoding($val, $this->response_encoding, 'UTF-8'), true);
            }

            $this->http->setURL($url2);
            $this->http->setMethod(HTTP_Request2::METHOD_GET);
            if (!empty($this->cookies)) {
                foreach ($this->cookies as $cookie) {
                    $this->http->addCookie($cookie['name'], $cookie['value']);
                }
            }

            $response = $this->http->send();

            if (count($response->getCookies())) {
                $this->cookies = $response->getCookies();
            }

            $body = mb_convert_encoding($response->getBody(), 'UTF-8', $this->response_encoding);

        } catch (Exception $e) {
            debug($e->getMessage());
        }

        return $body;
    }
开发者ID:nojimage,项目名称:twitter2mixivoice,代码行数:38,代码来源:Client.php

示例6: addNonce

 /**
  * Adds a nonce to the openid.return_to URL parameter.  Only used in OpenID 1.1
  * 
  * @return void
  */
 protected function addNonce()
 {
     $nonce = $this->getNonce()->createNonceAndStore();
     $returnToURL = new Net_URL2($this->message->get('openid.return_to'));
     $returnToURL->setQueryVariable(OpenID_Nonce::RETURN_TO_NONCE, urlencode($nonce));
     $this->message->set('openid.return_to', $returnToURL->getURL());
     // Observing
     $logMessage = "Nonce: {$nonce}\n";
     $logMessage = 'New ReturnTo: ' . $returnToURL->getURL() . "\n";
     $logMessage .= 'OP URIs: ' . print_r($this->serviceEndpoint->getURIs(), true);
     OpenID::setLastEvent(__METHOD__, $logMessage);
 }
开发者ID:shupp,项目名称:openid,代码行数:17,代码来源:Request.php

示例7: testValidateReturnToOneOneImmediateNegative

 /**
  * testValidateReturnToOneOneImmediateNegative 
  * 
  * @return void
  */
 public function testValidateReturnToOneOneImmediateNegative()
 {
     $opEndpoint = new OpenID_ServiceEndpoint();
     $opEndpoint->setURIs(array($this->opEndpointURL));
     $opEndpoints = new OpenID_ServiceEndpoints($this->claimedID, $opEndpoint);
     $nonce = new OpenID_Nonce($this->opEndpointURL);
     $nonceValue = $nonce->createNonce();
     $rt = new Net_URL2('http://examplerp.com');
     $rt->setQueryVariable(OpenID_Nonce::RETURN_TO_NONCE, $nonceValue);
     $setupMessage = new OpenID_Message();
     $setupMessage->set('openid.identity', $this->claimedID);
     $setupMessage->set('openid.return_to', $rt->getURL());
     $setupMessage->set(OpenID_Nonce::RETURN_TO_NONCE, $nonceValue);
     $this->message = new OpenID_Message();
     $this->message->set('openid.mode', OpenID::MODE_ID_RES);
     $this->message->set(OpenID_Nonce::RETURN_TO_NONCE, $nonceValue);
     $this->message->set('openid.user_setup_url', 'http://examplerp.com/?' . $setupMessage->getHTTPFormat());
     $this->discover = $this->getMock('OpenID_Discover', array('__get'), array($this->claimedID));
     $this->discover->expects($this->once())->method('__get')->will($this->returnValue($opEndpoints));
     $this->store->expects($this->once())->method('getDiscover')->will($this->returnValue($this->discover));
     $this->store->expects($this->any())->method('getNonce')->will($this->returnValue($nonceValue));
     $this->createObjects();
 }
开发者ID:shupp,项目名称:openid,代码行数:28,代码来源:AssertionTest.php

示例8: testSetQueryVariable

 /**
  * Tests setQueryVariable().
  */
 public function testSetQueryVariable()
 {
     $url = new Net_URL2('http://www.example.com/');
     $url->setQueryVariable('pear', 'fun');
     $this->assertEquals($url->getURL(), 'http://www.example.com/?pear=fun');
 }
开发者ID:vube,项目名称:php-pear-net_url2,代码行数:9,代码来源:URL2Test.php

示例9: addQueryParameter

 /**
  * Adds a query parameter to the uri query string.
  *
  * @param string $name        Parameter name
  * @param mixed  $value       Parameter value (can be an an array)
  * @param bool   $preencoded  Whether the parameter value is already 
  *                            urlencoded or not (default: false)
  *
  * @return void
  * @todo report a bug / provide a patch for Net_URL2
  */
 public function addQueryParameter($name, $value, $encoded = false)
 {
     // FIXME: Net_URL2 query string management is broken and should
     // be reimplemented:
     // - does not encode values when passing an array,
     // - does not provide an option for already encoded values,
     // - slow (reparse all query variables each time).
     // Need a good bug report.
     $this->_uri->setQueryVariable($name, $value);
 }
开发者ID:baijnath-sag,项目名称:izi-sandbox,代码行数:21,代码来源:Request2.php

示例10: appDir

 public function appDir($path = '')
 {
     $url = new \Net_URL2($this->path . '/app/' . Config::get('application.directory', 'dist') . '/' . ltrim($path, '/'));
     $url->setQueryVariable('ver', Config::get('application.version', 'false'));
     return $url->getURL();
 }
开发者ID:CruGlobal,项目名称:mpd-dashboard-app,代码行数:6,代码来源:ApplicationWrapper.php


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