本文整理汇总了PHP中common::HrefEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP common::HrefEncode方法的具体用法?PHP common::HrefEncode怎么用?PHP common::HrefEncode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::HrefEncode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetHead_InlineJS
/**
* Prepare and output any inline Javascript for the current page
* @static
*/
static function GetHead_InlineJS()
{
global $page, $linkPrefix, $GP_INLINE_VARS;
ob_start();
if (gpdebugjs) {
if (is_string(gpdebugjs)) {
$GP_INLINE_VARS['debugjs'] = 'send';
} else {
$GP_INLINE_VARS['debugjs'] = true;
}
}
if (common::LoggedIn()) {
$GP_INLINE_VARS += array('isadmin' => true, 'gpBLink' => common::HrefEncode($linkPrefix, false), 'post_nonce' => common::new_nonce('post', true));
gpsession::GPUIVars();
}
if (count($GP_INLINE_VARS) > 0) {
echo 'var ';
$comma = '';
foreach ($GP_INLINE_VARS as $key => $value) {
echo $comma . $key . '=' . json_encode($value);
$comma = ',';
}
echo ';';
}
$inline = ob_get_clean();
if (!empty($inline)) {
echo "\n<script>\n" . $inline . "\n</script>";
}
ob_start();
echo $page->head_script;
if (!empty($page->jQueryCode)) {
echo '$(function(){';
echo $page->jQueryCode;
echo '});';
}
$inline = ob_get_clean();
$inline = ltrim($inline);
if (!empty($inline)) {
echo "\n<script>\n" . $inline . "\n</script>\n";
}
}
示例2: cookie
/**
* Set a session cookie
* Attempt to use httponly if available
*
*/
function cookie($name, $value, $expires = false)
{
global $config, $dirPrefix;
$cookiePath = '/';
if (!empty($dirPrefix)) {
$cookiePath = $dirPrefix;
}
$cookiePath = common::HrefEncode($cookiePath);
if ($expires === false) {
$expires = time() + 2592000;
} elseif ($expires === true) {
$expires = 0;
//expire at end of session
}
if (version_compare(phpversion(), '5.2', '>=')) {
setcookie($name, $value, $expires, $cookiePath, '', '', true);
} else {
setcookie($name, $value, $expires, $cookiePath);
}
}
示例3: GetDir
/**
* Get the full path of a physical file on the server
* The query string component of a path should not be included but will be protected from being encoded
*
*/
static function GetDir($dir = '', $ampersands = false)
{
global $dirPrefix;
$query = '';
$pos = mb_strpos($dir, '?');
if ($pos !== false) {
$query = mb_substr($dir, $pos);
$dir = mb_substr($dir, 0, $pos);
}
$dir = $dirPrefix . '/' . ltrim($dir, '/');
return common::HrefEncode($dir, $ampersands) . $query;
}
示例4: TextContent
/**
* Replace gpEasy content variables in $content
*
*/
static function TextContent(&$content)
{
self::$meta += array('modified' => '');
//variables
$vars = array('dirPrefix' => $GLOBALS['dirPrefix'], 'linkPrefix' => common::HrefEncode($GLOBALS['linkPrefix']), 'fileModTime' => self::$meta['modified'], 'title' => self::$title, 'label' => self::$label);
$offset = 0;
$i = 0;
do {
$i++;
$pos = strpos($content, '$', $offset);
if ($pos === false) {
break;
}
//escaped?
if ($pos > 0) {
$prev_char = $content[$pos - 1];
if ($prev_char == '\\') {
$offset = $pos + 1;
continue;
}
}
$len = strspn($content, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', $pos + 1);
if ($len == 0) {
$offset = $pos + 1;
continue;
}
$var = substr($content, $pos + 1, $len);
if (isset($vars[$var])) {
$content = substr_replace($content, $vars[$var], $pos, $len + 1);
}
$offset = $pos + $len;
} while (true);
/* Testing old includes system ... this breaks editing */
self::ReplaceContent($content);
return $content;
}
示例5: cookie
/**
* Set a session cookie
* Attempt to use httponly if available
*
*/
static function cookie($name, $value = '', $expires = false)
{
global $dirPrefix;
$cookiePath = empty($dirPrefix) ? '/' : $dirPrefix;
$cookiePath = common::HrefEncode($cookiePath, false);
$secure = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
$domain = self::ServerName();
if (!$domain || strpos($domain, '.') === false) {
$domain = '';
}
// expire if value is empty
// cookies are set with either www removed from the domain or with an empty string
if (empty($value)) {
$expires = time() - 2592000;
if ($domain) {
setcookie($name, $value, $expires, $cookiePath, $domain, $secure, true);
setcookie($name, $value, $expires, $cookiePath, $domain, false, true);
}
setcookie($name, $value, $expires, $cookiePath, '', $secure, true);
setcookie($name, $value, $expires, $cookiePath, '', false, true);
return;
}
// get expiration and set
if ($expires === false) {
$expires = time() + 2592000;
//30 days
} elseif ($expires === true) {
$expires = 0;
//expire at end of session
}
setcookie($name, $value, $expires, $cookiePath, $domain, $secure, true);
}
示例6: GetHead_InlineJS
/**
* Prepare and output any inline Javascript for the current page
* @static
*/
function GetHead_InlineJS()
{
global $page, $linkPrefix;
ob_start();
if (gpdebugjs) {
echo 'var debugjs=true;';
}
if (common::LoggedIn()) {
echo 'var isadmin=true';
echo ',gpBLink="' . common::HrefEncode($linkPrefix) . '"';
//here because of index.php
gpsession::GPUIVars();
if (!admin_tools::CanRemoteInstall()) {
echo ',gpRem=false';
}
echo ',post_nonce="' . common::new_nonce('post', true) . '"';
echo ';';
gpOutput::GP_STYLES();
}
echo $page->head_script;
if (!empty($page->jQueryCode)) {
echo '$(function(){';
echo $page->jQueryCode;
echo '});';
}
$inline = ob_get_clean();
if (!empty($inline)) {
echo "\n<script type=\"text/javascript\">/* <![CDATA[ */\n";
echo $inline;
echo "\n/* ]]> */</script>";
}
}
示例7: cookie
/**
* Set a session cookie
* Attempt to use httponly if available
*
*/
static function cookie($name, $value, $expires = false)
{
global $dirPrefix;
$cookiePath = '/';
if (!empty($dirPrefix)) {
$cookiePath = $dirPrefix;
}
$cookiePath = common::HrefEncode($cookiePath, false);
if ($expires === false) {
$expires = time() + 2592000;
//30 days
} elseif ($expires === true) {
$expires = 0;
//expire at end of session
}
setcookie($name, $value, $expires, $cookiePath, '', false, true);
}
示例8: GetDir
/**
* Get the full path of a physical file on the server
* The query string component of a path should not be included but will be protected from being encoded
*
*/
function GetDir($dir = '', $ampersands = false)
{
global $dirPrefix;
$query = '';
if (strpos($dir, '?') !== false) {
$list = explode('?', $dir, 2);
$dir = $list[0];
$query = '?' . $list[1];
}
$dir = $dirPrefix . '/' . ltrim($dir, '/');
if ($ampersands) {
$dir = common::ampersands($dir);
}
return common::HrefEncode($dir) . $query;
}