Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncphp
/
mcClasses
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0cbaad8c
authored
Mar 27, 2014
by
sn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Url klasse 2
1 parent
e03b8769
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
class_mcUrl.inc.php
class_mcUrl.inc.php
0 → 100644
View file @
0cbaad8
<?php
class
mcUrl
{
/**
*
* @param string $param_url example: domain.lc/?var1=1
* @param array $param_Vars example: array('var1'=>1)
* @return string
*/
public
static
function
removeVarFromUrlstring
(
$param_url
,
array
$param_Vars
)
{
foreach
(
$param_Vars
as
$key
=>
$value
)
{
if
(
strpos
(
$param_url
,
'?'
.
$key
.
'='
)
)
{
$seperator
=
'?'
;
}
else
if
(
strpos
(
$param_url
,
'&'
.
$key
.
'='
))
{
$seperator
=
'&'
;
}
$Url
=
substr
(
$param_url
,
0
,
strpos
(
$param_url
,
$seperator
.
$key
.
'='
.
$value
));
if
(
$rest
=
substr
(
$param_url
,
strpos
(
$param_url
,
$seperator
.
$key
.
'='
.
$value
)
+
strlen
(
$seperator
.
$key
.
'='
.
$value
)))
{
if
(
strpos
(
$Url
,
'?'
)
===
false
)
{
$Url
=
$Url
.
'?'
.
substr
(
$rest
,
1
);
}
else
{
$Url
=
$Url
.
'&'
.
substr
(
$rest
,
1
);
}
}
$param_url
=
$Url
;
}
return
$param_url
;
}
/**
*
* @param string $param_url example: domain.lc/?var1=1
* @param array $param_Vars example: array('var1'=>1)
* @return string
*/
public
static
function
addVarToUrlstring
(
$param_url
,
array
$param_Vars
)
{
if
(
strpos
(
$param_url
,
'?'
)
===
false
&&
strpos
(
$param_url
,
'&'
)
===
false
)
{
$onekey
=
key
(
$param_Vars
);
$param_url
.=
'?'
.
$onekey
.
'='
.
$param_Vars
[
$onekey
];
unset
(
$param_Vars
[
$onekey
]);
}
foreach
(
$param_Vars
as
$key
=>
$value
)
{
$param_url
.=
'&'
.
$key
.
'='
.
$value
;
}
return
$param_url
;
}
}
?>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment