本文整理汇总了PHP中strip_magic_quotes函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_magic_quotes函数的具体用法?PHP strip_magic_quotes怎么用?PHP strip_magic_quotes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_magic_quotes函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strip_magic_quotes
function strip_magic_quotes($string)
{
if (!is_array($string)) {
return stripslashes($string);
}
foreach ($string as $key => $val) {
$string[$key] = strip_magic_quotes($val);
}
return $string;
}
示例2: strip_magic_quotes
function strip_magic_quotes($arr)
{
foreach ($arr as $k => $v) {
if (is_array($v)) {
$arr[$k] = strip_magic_quotes($v);
} else {
$arr[$k] = stripslashes($v);
}
}
return $arr;
}
示例3: displayHTMLInstallationSummary
function displayHTMLInstallationSummary($data = '')
{
$next = NULL;
$file = $GLOBALS['webfrontend_file'];
$doc_root = strip_magic_quotes($_SERVER['DOCUMENT_ROOT']);
$file_dir = dirname(__FILE__);
if (WINDOWS) {
$file = str_replace('/', '\\', strtolower($file));
$doc_root = str_replace('/', '\\', strtolower($doc_root));
$file_dir = str_replace('/', '\\', strtolower($file_dir));
}
if ($doc_root && substr($file, 0, strlen($doc_root)) == $doc_root) {
$next = substr($file, strlen($doc_root));
// need leading / (file - docroot = path from docroot)
if (substr($next, 0, 1) != '/') {
$next = '/' . $next;
}
} else {
if ($file_dir && substr($file, 0, strlen($file_dir)) == $file_dir) {
$next = substr($file, strlen($file_dir));
// strip leading / (file - file_dir = path from go-pear file)
if (substr($next, 0, 1) == '/') {
$next = substr($next, 1, strlen($next));
}
}
}
if ($data) {
echo "<br/>" . $data;
}
?>
<p>
<span class="title">Installation Completed !</span>
</p>
<table border="0">
<tr>
<td valign="top"><img src="<?php
echo basename(__FILE__);
?>
?action=img&img=note" border="0"></td>
<td>
<span class="green">
<b>Note:</b> To use PEAR without any problems you need to add your<br/>
PEAR Installation path (<?php
echo $GLOBALS['php_dir'];
?>
)<br>
to your <a href="http://www.php.net/manual/en/configuration.directives.php#ini.include_path">include_path</a>.<br/>
<br/>
Using a .htaccess file or directly edit httpd.conf would be working solutions<br/>
for Apache running servers, too.<br/>
</span>
</td>
</tr>
</table>
<br/>
For more information about PEAR, see:<br/>
<a href="http://pear.php.net/faq.php" target="_new" class="green">PEAR FAQ</a><br/>
<a href="http://pear.php.net/manual/" target="_new" class="green">PEAR Manual</a><br/>
<br/>
Thanks for using go-pear!<br/>
<br/>
<?php
if ($next === NULL) {
?>
<table border="0">
<tr>
<td valign="top"><img src="<?php
echo basename(__FILE__);
?>
?action=img&img=note" border="0"></td>
<td>
<span style="color: #ff0000">
<b>Warning:</b> Can not determine the URL of the freshly installed Web Frontend<br />
(file: <?php
echo $file;
?>
).<br />
Please access it manually !
</span>
</td>
</tr>
</table>
<?php
} else {
if ($_GET['step'] == 'install-progress') {
?>
<a href="<?php
echo $next;
?>
" class="green" target="_parent">Start Web Frontend of the PEAR Installer >></a>
<?php
} else {
?>
<a href="<?php
echo $next;
?>
" class="green">Start Web Frontend of the PEAR Installer >></a>
<?php
}
//.........这里部分代码省略.........
示例4: array
$providers = array(array("Amazon", array("amaz"), "http://www.amazon.com/s?ie=UTF8&index=blended&link_code=qs&field-keywords={searchTerms}&sourceid=Mozilla-search"), array("Baidu", array("baidu", "bd"), "http://www.baidu.com/s?wd={searchTerms}"), array("Douban", array("douban", "db"), "http://www.douban.com/subject_search?search_submit=%E6%90%9C%E7%B4%A2&search_text={searchTerms}"), array("Google", array("google", "goog", "g"), "http://www.google.com/search?q={searchTerms}"), array("Google.cn", array("cn"), "http://www.google.cn/search?hl=zh-CN&source=hp&q={searchTerms}&aq=f&oq="), array("Hackage", array("hackage", "hack"), "http://www.google.co.uk/search?hl=en&as_sitesearch=hackage.haskell.org/package&as_q={searchTerms}"), array("Hoogle", array("hoogle", "hoog"), "http://haskell.org/hoogle/?hoogle={searchTerms}"), array("Holumbus", array("holumbus"), "http://www.holumbus.org/hayoo/hayoo.html?query={searchTerms}"), array("iPhone SDK", array("idev"), "http://developer.apple.com/iphone/search/search.php?simp=1&num=10&site=iphone&Search={searchTerms}"), array("JavaDocs", array("jd", "javadocs"), "http://javadocs.org/{searchTerms}/?t={searchTerms}"), array("Live.com", array("live"), "http://search.live.com/results.aspx?q={searchTerms}&go=&form=QBLH"), array("MarketWatch", array("marketwatch"), "http://www.marketwatch.com/search/?value={searchTerms}"), array("Merriam-Webster", array("merriamwebster", "dictionary", "dict"), "http://www.merriam-webster.com/dictionary/{searchTerms}"), array("Metacritic", array("metacritic"), "http://www.metacritic.com/search/process?sort=relevance&termtype=all&ts={searchTerms}&ty=0&button=search"), array("Nciku", array("nciku", "zw"), "http://www.nciku.com/search/all/{searchTerms}"), array("Pydoc", array("pydoc", "pyd", "py"), "http://pydoc.org/2.5.1/search.cgi?key={searchTerms}"), array("Rotten Tomatoes", array("rottentomatoes", "rt"), "http://www.rottentomatoes.com/search/full_search.php?search={searchTerms}"), array("Reviewing The Kanji", array("kanji", "rtk"), "http://kanji.koohii.com/study/index.php?search={searchTerms}"), array("Tudou", array("tudou", "td"), "http://so.tudou.com/isearch/{searchTerms}/"), array("Wikipedia", array("wikipedia", "wp"), "http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}&fulltext=Search"), array("Yahoo", array("yahoo"), "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8&fr=moz2"), array("YellowBridge", array("yb", "yellowbridge"), "http://www.yellowbridge.com/chinese/wordsearch.php?searchMode=C&select=anywhere&word={searchTerms}"), array("YouTube", array("youtube", "yt"), "http://www.youtube.com/results?search_type=&search_query={searchTerms}&aq=f"), array("YouKu", array("youku", "yk"), "http://so.youku.com/search_video/q_{searchTerms}"));
# Utility function to remove magic quotes if necessary
if (get_magic_quotes_gpc()) {
function strip_magic_quotes($value)
{
$value = is_array($value) ? array_map('strip_magic_quotes', $value) : stripslashes($value);
return $value;
}
} else {
function strip_magic_quotes($value)
{
return $value;
}
}
# Find user query, without any magic quotes
$query = strip_magic_quotes($_GET['query']);
if (!$query) {
# If we didn't get a query, show the user what they COULD have done
?>
<html>
<head>
<title>Prefix Search</title>
<link rel="search" type="application/opensearchdescription+xml" href="opensearch.xml" title="Prefix Search" />
</head>
<body>
<h1><a href="index.htm">Prefix Search</a></h1>
<table>
<tr>
<th>Prefix</th>
<th>Template</th>
示例5: displayHTMLInstallationSummary
function displayHTMLInstallationSummary($data = '')
{
$next = NULL;
$prefix = dirname($GLOBALS['webfrontend_file']);
$doc_root = strip_magic_quotes($_SERVER['DOCUMENT_ROOT']);
$file_dir = dirname(__FILE__);
if (WINDOWS) {
$prefix = str_replace('/', '\\', strtolower($prefix));
$doc_root = str_replace('/', '\\', strtolower($doc_root));
$file_dir = str_replace('/', '\\', strtolower($file_dir));
}
if ($doc_root && substr($prefix, 0, strlen($doc_root)) == $doc_root) {
$next = substr($prefix, strlen($doc_root)) . '/index.php';
} else {
if ($file_dir && substr($prefix, 0, strlen($file_dir)) == $file_dir) {
$next = substr($prefix, strlen($file_dir)) . '/index.php';
}
}
if ($data) {
echo "<br/>" . $data;
}
?>
<br/>
<table border="0">
<TR>
<TD valign="top"><img src="<?php
echo basename(__FILE__);
?>
?action=img&img=note" border="0"></TD>
<TD>
<span class="green">
<b>Note:</b> To use PEAR without any problems you need to add your<br/>
PEAR Installation path (<?php
echo $GLOBALS['php_dir'];
?>
)<br>
to your <a href="http://www.php.net/manual/en/configuration.directives.php#ini.include_path">include_path</a>.<br/>
<br/>
Using a .htaccess file or directly edit httpd.conf would be working solutions<br/>
for Apache running servers, too.<br/>
</span>
</TD>
</TR>
</table>
<br/>
For more information about PEAR, see:<br/>
<a href="http://pear.php.net/faq.php" target="_new" class="green">PEAR FAQ</a><br/>
<a href="http://pear.php.net/manual/" target="_new" class="green">PEAR Manual</a><br/>
<br/>
Thanks for using go-pear!<br/>
<br/>
<?php
if ($next === NULL) {
?>
<table border="0">
<TR>
<TD valign="top"><img src="<?php
echo basename(__FILE__);
?>
?action=img&img=note" border="0"></TD>
<TD>
<span style="color: #ff0000">
<b>Warning:</b> Go-PEAR was not able to determine the URL to the newly<br/>
installed Web Frontend of the PEAR Installer. Please access it manually.<br/>
Since you specified the prefix, you should know how to do so.<br/>
</span>
</TD>
</TR>
</table>
<?php
} else {
if ($_GET['step'] == 'install-progress') {
?>
<a href="<?php
echo $next;
?>
" class="green" target="_parent">Start Web Frontend of the PEAR Installer >></a>
<?php
} else {
?>
<a href="<?php
echo $next;
?>
" class="green">Start Web Frontend of the PEAR Installer >></a>
<?php
}
}
}
示例6: strip_magic_quotes
/**
* Удаление "магических" кавычек
* @param array $arr исследуемый массив
* @return array полученный массив
*/
function strip_magic_quotes($arr)
{
if (!function_exists("set_magic_quotes_runtime")) {
return;
}
foreach ($arr as $k => $v) {
if (is_array($v)) {
$arr[$k] = strip_magic_quotes($v);
} else {
$arr[$k] = stripslashes($v);
}
}
return $arr;
}
示例7: unset
unset($input);
unset($display);
unset($blocks);
unset($message);
/// Конец
/// Обнаруживаем IE
if (preg_match("/MSIE\\s*([0-9]+)/siu", $_SERVER['HTTP_USER_AGENT'], $matches)) {
lang::o()->get("ie_error");
// Выгоняем IE ниже 8 версии
if ($matches[1] < 8) {
tpl::o()->display('ie_error.tpl');
die;
}
tpl::o()->assign('MSIE', $matches[1]);
}
if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
if (!empty($_GET)) {
$_GET = strip_magic_quotes($_GET);
}
if (!empty($_POST)) {
$_POST = strip_magic_quotes($_POST);
}
if (!empty($_COOKIE)) {
$_COOKIE = strip_magic_quotes($_COOKIE);
}
}
// INCLUDE BACK-END
globals::s('POST', $_POST);
$_POST = xss_array_protect($_POST);
$_GET = xss_array_protect($_GET);
$_REQUEST = $_POST + $_GET;
示例8: import_vars
function import_vars()
{
// Creates global variables for the passed variable names which will either
// be empty or the value of $_REQUEST[Name], de-magic-quoted if needed
foreach (func_get_args() as $var) {
if (is_array($var)) {
foreach ($var as $v) {
$GLOBALS[$v] = array_key_exists($v, $_REQUEST) ? strip_magic_quotes($_REQUEST[$v]) : NULL;
}
} else {
$GLOBALS[$var] = array_key_exists($var, $_REQUEST) ? strip_magic_quotes($_REQUEST[$var]) : NULL;
}
}
}