%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_1ec2d7c2/apps/helpers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* query_string_helper
*
* Functions to help with assembling a XSS filtered query string, allowing
* to remove and add key/value pairs.
*
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @author Mike Funk
* @link http://mikefunk.com
* @email mike@mikefunk.com
*
* @file query_string_helper.php
* @version 1.2.4
* @date 04/27/2012
*/
// --------------------------------------------------------------------------
/**
* query_string function.
*
* Returns query string with added or removed key/value pairs.
*
* @param mixed $add (default: '') can be string or array
* @param mixed $remove (default: '') can be string or array
* @param bool $include_current (default: TRUE)
* @return string
*/
function query_string($add = '', $remove = '', $include_current = TRUE)
{
$_ci =& get_instance();
// set initial query string
$query_string = array();
if ($include_current && $_ci->input->get() !== FALSE)
{
$query_string = $_ci->input->get();
}
// add to query string
if ($add != '')
{
// convert to array
if (is_string($add))
{
$add = array($add);
}
$query_string = array_merge($query_string, $add);
}
// remove from query string
if ($remove != '')
{
// convert to array
if (is_string($remove))
{
$remove = array($remove);
}
// remove from query_string
foreach ($remove as $rm)
{
$key = array_search($rm, array_keys($query_string));
if ($key !== FALSE)
{
unset($query_string[$rm]);
}
}
}
// return result
$return = '';
if (count($query_string) > 0)
{
$return = '?' . http_build_query($query_string);
}
return html_entity_decode($return);
}
// --------------------------------------------------------------------------
/**
* uri_query_string function.
*
* returns uri_string with query_string on the end.
*
* @param mixed $add (default: '')
* @param mixed $remove (default: '')
* @param bool $include_current (default: TRUE) Whether to include the
* current page's query string or start fresh.
* @return string
*/
function uri_query_string($add = '', $remove = '', $include_current = TRUE)
{
$_ci =& get_instance();
return $_ci->uri->uri_string() . query_string($add, $remove, $include_current);
}
// --------------------------------------------------------------------------
/**
* current_url_query_string function.
*
* returns uri_string with query_string on the end and current_url at the
* beginning.
*
* @param mixed $add (default: '')
* @param mixed $remove (default: '')
* @param bool $include_current (default: TRUE) Whether to include the
* current page's query string or start fresh.
* @return string
*/
function current_url_query_string($add = '', $remove = '', $include_current = TRUE)
{
$_ci =& get_instance();
$_ci->load->helper('url');
return current_url() . query_string($add, $remove, $include_current);
}
// --------------------------------------------------------------------------
/* End of file query_string_helper.php */
/* Location: ./query_string_helper/helpers/query_string_helper.php */