本文整理汇总了PHP中Net_URL2::unsetQueryVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_URL2::unsetQueryVariable方法的具体用法?PHP Net_URL2::unsetQueryVariable怎么用?PHP Net_URL2::unsetQueryVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_URL2
的用法示例。
在下文中一共展示了Net_URL2::unsetQueryVariable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUnsetQueryVariable
/**
* Tests unsetQueryVariable()
*/
public function testUnsetQueryVariable()
{
$url = new Net_URL2('http://www.example.com/?name=david&pear=fun&fish=slippery');
$url->unsetQueryVariable('pear');
$this->assertEquals($url->getURL(), 'http://www.example.com/?name=david&fish=slippery');
$url->unsetQueryVariable('name');
$this->assertEquals($url->getURL(), 'http://www.example.com/?fish=slippery');
$url->unsetQueryVariable('fish');
$this->assertEquals($url->getURL(), 'http://www.example.com/');
}
示例2: 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;
}
示例3: testUnsetQueryVariable
/**
* Tests unsetQueryVariable()
*
* @return void
*/
public function testUnsetQueryVariable()
{
$url = new Net_URL2('http://www.example.com/?name=david&pear=fun&fish=slippery');
$removes = array('pear' => 'http://www.example.com/?name=david&fish=slippery', 'name' => 'http://www.example.com/?fish=slippery', 'fish' => 'http://www.example.com/');
foreach ($removes as $name => $expected) {
$url->unsetQueryVariable($name);
$this->assertEquals($expected, $url);
}
}