<?php
/**************************************************************
*
* DataFeedFile.com (DFF) Framework API
* Copyright (c) 2008 DataFeedFile.com
*
* DFF Framework API uses CreativeCommons.org by-sa license.
* This license lets others remix, tweak, and build upon your work even for commercial reasons,
* as long as they CREDIT DataFeedFile.com and license their new creations under the identical terms.
* This license is often compared to open source software licenses.
* All new works based on yours will carry the same license, so any derivatives will also allow commercial use.
* Please read our license.txt file for more detail.
*
**************************************************************/
class DFF_QueryString{
var $QueryString;
var $original;
function __construct($getvar){
$this->QueryString = $getvar;
$this->original = $getvar;
}
function remove($except){
if($except =="")return;
$str_except = "";
if(is_array($except)){
foreach($except as $x){
$str_except .= "[$x]";
}
}else{
if($except!=""){
$str_except = "[$except]";
}
}
$str_ret = "";
unset($new_qs);
if($this->QueryString){
foreach($this->QueryString as $key => $value){
if(strpos(' '. $str_except, '['. $key .']')==0){
$new_qs[$key] = $value;
}
}
}
$this->QueryString = $new_qs;
}
function add($key, $value){
$this->QueryString[$key] = $value;
}
function reset(){
$this->QueryString = $this->original;
}
function toString(){
// debug($this->original);
if(is_array($this->QueryString)){
foreach($this->QueryString as $key => $value){
if($str_ret == ""){
$str_ret = "?". $key . "=" . urlencode($value) ;
}else{
$str_ret .= "&". $key . "=" . urlencode($value) ;
}
}
}
return $str_ret;
}
} //end querystring class
//////////////////////////////////////////////////////////////////////////////////////////////////
?>