当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlSpecialChars函数代码示例

本文整理汇总了PHP中HtmlSpecialChars函数的典型用法代码示例。如果您正苦于以下问题:PHP HtmlSpecialChars函数的具体用法?PHP HtmlSpecialChars怎么用?PHP HtmlSpecialChars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了HtmlSpecialChars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TextDump

/**
* Помощник для отладки
*
* @version 1.0
* @author Ibragimov "MpaK" Renat <renat@bestweb.ru>
 * @copyright Copyright (c) 2009-2010, BESTWEB ltd. www.BESTWEB.ru
*/
function TextDump(&$Var, $Level = 0)
{
    $out = '';
    if (is_array($Var)) {
        $Type = "Array[" . count($Var) . "]";
    } else {
        if (is_object($Var)) {
            $Type = "Object";
        } else {
            $Type = "";
        }
    }
    if ($Type) {
        $out .= "{$Type}\n";
        for (Reset($Var), $Level++; list($k, $v) = each($Var);) {
            if (is_array($v) && $k === "GLOBALS") {
                continue;
            }
            for ($i = 0; $i < $Level * 3; $i++) {
                $out .= " ";
            }
            $out .= "<b>" . HtmlSpecialChars($k) . "</b> => " . TextDump($v, $Level);
        }
    } else {
        $out .= '"' . HtmlSpecialChars($Var) . '"' . "\n";
    }
    return $out;
}
开发者ID:ReginaReality,项目名称:AOmega.blog,代码行数:35,代码来源:dump_helper.php

示例2: dumpVar

/**
 * @author Melvil (https://github.com/Melvil)
 **/
function dumpVar(&$Var, $Level = 0, $Var_s = null, $level_limit = 5)
{
	$is_ob_ar = false;
	$Type = gettype($Var);
	if (is_array($Var))
	{
		$is_ob_ar = true;
		$Type = 'Array[' . count($Var) . ']';
	}
	if (is_object($Var)) $is_ob_ar = true;
	if ($Level == 0)
	{
		if ($Var_s) echo NL . '<br>' . NL . '<b><span style="color:#ff0000">' . $Var_s . ' = {</span></b>';
		if ($is_ob_ar && count($Var)) echo '<pre>' . NL;
		else echo NL . '<tt>';
		$Level_zero = 0;
	}
	if ($is_ob_ar)
	{
		
		if ($Type == 'object') echo '<span style="color:#05a209">object of</span> <span style="color:#A03000">' . get_class($Var) . '</span>';
		else echo '<span style="color:#05a209">' . $Type . '</span>';
		if ($Level > $level_limit)
		{
			if ($level_limit > 1) echo '<b>...</b> LEVEL > 5<br>' . NL;
			else echo NL;
			return;
		}
		echo NL;
		if ($Level == 0 || !is_object($Var))
			for (Reset($Var), $Level++; list($k, $v)=each($Var);)
			{
				for ($i = 0; $i < $Level*3; $i++) echo ' ';
				echo '<b>'.HtmlSpecialChars($k).'</b> => ';
				// if (is_object($v) || ($k === 'GLOBALS' && is_array($v))) { echo "\n"; continue; }
				if ($k === 'GLOBALS' && is_array($v)) { echo NL; continue; }
				dumpVar($v, $Level, null, $level_limit);
			}
	}
	else
	{
		$iss = is_string($Var);
		if ($iss && strlen($Var)>400)
			echo '('.$Type.') <span style="color:#35BBFA">strlen = '.strlen($Var).'</span>' . NL;
		else {
			echo '(' . $Type . ') ' . ($iss ? '"' : '') . '<span style="color:#0000FF">';
			if ($Type == 'boolean') echo ($Var ? 'true' : 'false');
			else echo HtmlSpecialChars($Var);
			echo '</span>' . ($iss ? '"' : '') . NL;
		}
	}
	if (isset($Level_zero))
	{
		if ($is_ob_ar && count($Var)) echo '</pre>'; else echo '</tt>';
		if ($Var_s) echo '<b><span style="color:#ff0000">}</span></b><br>' . NL;
	}
	return true;
}
开发者ID:naffbeats,项目名称:cms,代码行数:61,代码来源:dumpvar.php

示例3: OutputDebug

 function OutputDebug($message)
 {
     $message .= "\n";
     if ($this->html_debug) {
         $message = str_replace("\n", "<br />\n", HtmlSpecialChars($message));
     }
     echo $message;
     flush();
 }
开发者ID:laiello,项目名称:we-promote-this,代码行数:9,代码来源:pop3.php

示例4: Output

function Output($message)
{
    global $html;
    if ($html) {
        echo nl2br(HtmlSpecialChars($message));
    } else {
        echo $message, "\n";
    }
}
开发者ID:wycus,项目名称:darmedic,代码行数:9,代码来源:setup_locations_database.php

示例5: GoogleUser

 public function GoogleUser()
 {
     $client = new \Google_Client();
     $client->setApplicationName(\SKT_GOOGLEOAUTH2_SETAPPLICATIONNAME);
     // Visit https://code.google.com/apis/console?api=plus to generate your
     // oauth2_client_id, oauth2_client_secret, and to register your oauth2_redirect_uri.
     $client->setClientId(\SKT_GOOGLEOAUTH2_SETCLIENTID);
     $client->setClientSecret(\SKT_GOOGLEOAUTH2_SETCLIENTSECRET);
     $client->setRedirectUri(\SKT_GOOGLEOAUTH2_SETREDIRECTURI);
     $client->setDeveloperKey(\SKT_GOOGLEOAUTH2_SETDEVELOPERKEY);
     $oauth2 = new \Google_Oauth2Service($client);
     if (isset($_GET['code'])) {
         $client->authenticate($_GET['code']);
         $_SESSION['token'] = $client->getAccessToken();
         $redirect = \SITE_SERVER;
         \CmsDev\Header\refresh::refreshNow(\filter_var($redirect, FILTER_SANITIZE_URL));
         return;
     }
     if (isset($_SESSION['token'])) {
         $client->setAccessToken($_SESSION['token']);
     }
     if (isset($_REQUEST['logout']) or \THIS_URL_REAL === 'UserLogout') {
         unset($_SESSION['token']);
         $client->revokeToken();
     }
     if ($client->getAccessToken()) {
         $user = $oauth2->userinfo->get();
         // These fields are currently filtered through the PHP sanitize filters.
         // See http://www.php.net/manual/en/filter.filters.sanitize.php
         $this->family_name = filter_var($user['family_name'], \FILTER_SANITIZE_STRING);
         $this->name = filter_var($user['name'], \FILTER_SANITIZE_STRING);
         $this->locale = filter_var($user['locale'], \FILTER_SANITIZE_STRING);
         $this->gender = filter_var($user['gender'], \FILTER_SANITIZE_STRING);
         $this->email = filter_var($user['email'], \FILTER_SANITIZE_EMAIL);
         $this->link = filter_var($user['link'], \FILTER_SANITIZE_URL);
         $this->given_name = filter_var($user['given_name'], \FILTER_SANITIZE_STRING);
         $this->id = filter_var($user['id'], \FILTER_SANITIZE_STRING);
         $this->verified_email = filter_var($user['verified_email'], \FILTER_SANITIZE_STRING);
         if (isset($user['picture']) && $user['picture'] != '') {
             $this->picture = filter_var($user['picture'], \FILTER_VALIDATE_URL);
         } else {
             $this->picture = \SKT_ACCESS_AVATAR;
         }
         $this->ClientAuth = 'Google';
         $_SESSION['token'] = $client->getAccessToken();
         $this->createAuthUrl = $client->createAuthUrl();
         $this->Info = array('family_name' => HtmlSpecialChars($this->family_name), 'name' => HtmlSpecialChars($this->name), 'locale' => $this->locale, 'gender' => $this->gender, 'email' => $this->email, 'link' => $this->link, 'given_name' => HtmlSpecialChars($this->given_name), 'id' => $this->id, 'verified_email' => $this->verified_email, 'picture' => $this->picture, 'ClientAuth' => $this->ClientAuth, 'createAuthUrl' => $this->createAuthUrl);
         \CmsDev\Security\UserRegister::checkAction($this->Info);
         return true;
     } else {
         $this->createAuthUrl = $client->createAuthUrl();
         new \CmsDev\Url\refer();
         return false;
     }
 }
开发者ID:neruruguay,项目名称:neru,代码行数:55,代码来源:oauth.php

示例6: db_write

function db_write($sql)
{
    $result = mysql_query($sql);
    if (!$result) {
        echo "<hr /><pre>";
        echo "ERROR: " . HtmlSpecialChars(mysql_error()) . "\n";
        echo "SQL  : " . HtmlSpecialChars($sql) . "\n";
        echo "STACK: " . HtmlSpecialChars(db_trace()) . "\n";
        echo "</pre><hr />\n";
    }
    return $result;
}
开发者ID:Digitalbil,项目名称:Choose,代码行数:12,代码来源:db.php

示例7: test_table

	function test_table($show){

		$uid = $GLOBALS['pageuids']++;
		$num = count($show);

		echo "<div id=\"tests-{$uid}-1\"><a href=\"#\" onclick=\"show('$uid'); return false;\" style=\"font-size: 12px;\">Show $num tests</a></div>\n";
		echo "<div id=\"tests-{$uid}-2\" style=\"display: none;\"><a href=\"#\" onclick=\"hide('$uid'); return false;\" style=\"font-size: 12px\">Hide tests</a><br />\n";

		echo "<table border=1>\n";
		echo "<tr><th>ID</th><th>Address</th><th>Expected</th></tr>\n";
		foreach ($show as $id){
			$test = $GLOBALS['tests'][$id];

			$address = $test['address'];
			$address = wordwrap($address, 50, "{FORCEBREAK}", true);
			$address = HtmlSpecialChars($address);
			$address = str_replace(array("\r","\n"," ","\0"), array("&amp;#13;","&amp;#10;","&nbsp;","&amp;#0;"), $address);
			$address = str_replace('{FORCEBREAK}', "\n ", $address);

			echo "<tr>";
			echo "<td>$test[id]</td>";
			echo "<td><small>".HtmlSpecialChars($address)."</small></td>";

			if ($test['valid']){
				if ($test['warning']){
					echo "<td>Pass w/ Warning</td>";
				}else{
					echo "<td>Pass</td>";
				}
			}else{
				echo "<td>Fail</td>";
			}
			echo "</td></tr>\n";
		}
		echo "</table>\n";

		echo "</div>\n";
	}
开发者ID:jacques,项目名称:rfc822,代码行数:38,代码来源:explain.php

示例8: HtmlSpecialChars

"><?php 
            echo HtmlSpecialChars($endpoint['docs_url']);
            ?>
</a> </li>
		<?php 
        }
        ?>

		<?php 
        foreach ($endpoint['example_urls'] as $example_url) {
            ?>
			<li> Example: <a href="<?php 
            echo HtmlSpecialChars($example_url);
            ?>
"><?php 
            echo HtmlSpecialChars($example_url);
            ?>
</a> </li>
		<?php 
        }
        ?>

		<?php 
        foreach ($endpoint['notes'] as $note) {
            ?>
			<li><?php 
            echo format_html($note);
            ?>
</li>
		<?php 
        }
开发者ID:rycks,项目名称:oembed,代码行数:31,代码来源:index.php

示例9: ob_start

ob_start();
//testing show the raw email
//echo "Message: \n".$msg."\n";
//includes
require 'resources/pop3/mime_parser.php';
require 'resources/pop3/rfc822_addresses.php';
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/emails/email_translation.php")) {
    require_once $_SERVER["PROJECT_ROOT"] . "/app/emails/email_translation.php";
}
//parse the email message
$mime = new mime_parser_class();
$mime->decode_bodies = 1;
$parameters = array('Data' => $msg);
$success = $mime->Decode($parameters, $decoded);
if (!$success) {
    echo "MIME message decoding error: " . HtmlSpecialChars($mime->error) . "\n";
} else {
    //get the headers
    //print_r($decoded[0]);
    $headers = json_decode($decoded[0]["Headers"]["x-headers:"], true);
    $subject = $decoded[0]["Headers"]["subject:"];
    $from = $decoded[0]["Headers"]["from:"];
    $reply_to = $decoded[0]["Headers"]["reply-to:"];
    $to = $decoded[0]["Headers"]["to:"];
    $date = $decoded[0]["Headers"]["date:"];
    //get the body
    $body = '';
    //$parts_array["Parts"][0]["Headers"]["content-type:"];
    //get the body
    $body = '';
    $content_type = $decoded[0]['Headers']['content-type:'];
开发者ID:kpabijanskas,项目名称:fusionpbx,代码行数:31,代码来源:v_mailto.php

示例10: testFetch

 function testFetch($url)
 {
     $http = new http_class();
     owa_coreAPI::debug('hello owa_http testfetch method');
     /* Connection timeout */
     $http->timeout = 0;
     /* Data transfer timeout */
     $http->data_timeout = 0;
     /* Output debugging information about the progress of the connection */
     $http->debug = 1;
     $http->user_agent = owa_coreAPI::getSetting('base', 'owa_user_agent');
     $http->follow_redirect = 1;
     $http->redirection_limit = 5;
     $http->exclude_address = "";
     $http->prefer_curl = 0;
     $arguments = array();
     $error = $http->GetRequestArguments($url, $arguments);
     $error = $http->Open($arguments);
     //for(;;)
     //		{
     $error = $http->ReadReplyBody($body, 50000);
     if ($error != "" || strlen($body) == 0) {
         owa_coreAPI::debug(HtmlSpecialChars($body));
     }
     //		}
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:26,代码来源:owa_httpRequest.php

示例11: cff_autolink_do

function cff_autolink_do($text, $link_color, $sub, $limit, $tagfill, $auto_title, $span_tag, $force_prefix = null)
{
    $text_l = StrToLower($text);
    $cursor = 0;
    $loop = 1;
    $buffer = '';
    while ($cursor < strlen($text) && $loop) {
        $ok = 1;
        $matched = preg_match($sub, $text_l, $m, PREG_OFFSET_CAPTURE, $cursor);
        if (!$matched) {
            $loop = 0;
            $ok = 0;
        } else {
            $pos = $m[0][1];
            $sub_len = strlen($m[0][0]);
            $pre_hit = substr($text, $cursor, $pos - $cursor);
            $hit = substr($text, $pos, $sub_len);
            $pre = substr($text, 0, $pos);
            $post = substr($text, $pos + $sub_len);
            $fail_text = $pre_hit . $hit;
            $fail_len = strlen($fail_text);
            #
            # substring found - first check to see if we're inside a link tag already...
            #
            $bits = preg_split("!</a>!i", $pre);
            $last_bit = array_pop($bits);
            if (preg_match("!<a\\s!i", $last_bit)) {
                #echo "fail 1 at $cursor<br />\n";
                $ok = 0;
                $cursor += $fail_len;
                $buffer .= $fail_text;
            }
        }
        #
        # looks like a nice spot to autolink from - check the pre
        # to see if there was whitespace before this match
        #
        if ($ok) {
            if ($pre) {
                if (!preg_match('![\\s\\(\\[\\{>]$!s', $pre)) {
                    #echo "fail 2 at $cursor ($pre)<br />\n";
                    $ok = 0;
                    $cursor += $fail_len;
                    $buffer .= $fail_text;
                }
            }
        }
        #
        # we want to autolink here - find the extent of the url
        #
        if ($ok) {
            if (preg_match('/^([a-z0-9\\-\\.\\/\\-_%~!?=,:;&+*#@\\(\\)\\$]+)/i', $post, $matches)) {
                $url = $hit . $matches[1];
                $cursor += strlen($url) + strlen($pre_hit);
                $buffer .= $pre_hit;
                $url = html_entity_decode($url);
                #
                # remove trailing punctuation from url
                #
                while (preg_match('|[.,!;:?]$|', $url)) {
                    $url = substr($url, 0, strlen($url) - 1);
                    $cursor--;
                }
                foreach (array('()', '[]', '{}') as $pair) {
                    $o = substr($pair, 0, 1);
                    $c = substr($pair, 1, 1);
                    if (preg_match("!^(\\{$c}|^)[^\\{$o}]+\\{$c}\$!", $url)) {
                        $url = substr($url, 0, strlen($url) - 1);
                        $cursor--;
                    }
                }
                #
                # nice-i-fy url here
                #
                $link_url = $url;
                $display_url = $url;
                if ($force_prefix) {
                    $link_url = $force_prefix . $link_url;
                }
                if ($GLOBALS['autolink_options']['strip_protocols']) {
                    if (preg_match('!^(http|https)://!i', $display_url, $m)) {
                        $display_url = substr($display_url, strlen($m[1]) + 3);
                    }
                }
                $display_url = cff_autolink_label($display_url, $limit);
                #
                # add the url
                #
                if ($display_url != $link_url && !preg_match('@title=@msi', $tagfill) && $auto_title) {
                    $display_quoted = preg_quote($display_url, '!');
                    if (!preg_match("!^(http|https)://{$display_quoted}\$!i", $link_url)) {
                        $tagfill .= ' title="' . $link_url . '"';
                    }
                }
                $link_url_enc = HtmlSpecialChars($link_url);
                $display_url_enc = HtmlSpecialChars($display_url);
                if (substr($link_url_enc, 0, 4) !== "http") {
                    $link_url_enc = 'http://' . $link_url_enc;
                }
                $buffer .= "<a href=\"{$link_url_enc}\">{$display_url_enc}</a>";
//.........这里部分代码省略.........
开发者ID:welearncodes,项目名称:traktern,代码行数:101,代码来源:custom-facebook-feed.php

示例12: HtmlSpecialChars

?>
<HTML>
<HEAD>
  <TITLE>mnoGoSearch: <? echo HtmlSpecialChars(StripSlashes($query_orig)); ?></TITLE>
</HEAD>

<body BGCOLOR="#FFFFFF" LINK="#0050A0" VLINK="#0050A0" ALINK="#0050A0">
<center>

  <FORM METHOD=GET ACTION="<? echo $self; ?>">
    <table bgcolor=#eeeee0 border=0 width=100%>
      <tr><td>
          <BR>
          <INPUT TYPE="hidden" NAME="ps" VALUE="10">
          Search for: <INPUT TYPE="text" NAME="q" SIZE=50 VALUE="<? echo HtmlSpecialChars(StripSlashes($query_orig)); ?>">
          <INPUT TYPE="submit" VALUE="Search!"><BR>

          Results per page:
          <SELECT NAME="ps">
            <OPTION VALUE="10" <? if ($ps==10) echo 'SELECTED';?>>10
            <OPTION VALUE="20" <? if ($ps==20) echo 'SELECTED';?>>20
            <OPTION VALUE="50" <? if ($ps==50) echo 'SELECTED';?>>50
          </SELECT>

          Match:
          <SELECT NAME="m">
            <OPTION VALUE="all" <? if ($m=='all') echo 'SELECTED';?>>All
            <OPTION VALUE="any" <? if ($m=='any') echo 'SELECTED';?>>Any
            <OPTION VALUE="bool" <? if ($m=='bool') echo 'SELECTED';?>>Boolean
          </SELECT>
开发者ID:ntemple,项目名称:Mnogosearch-PHP-Search-Class,代码行数:30,代码来源:search.php

示例13: close

 /**
  * close server connection and delete marked messages
  *
  * @return bool
  * @author Elias Müller
  **/
 public function close()
 {
     if (($error = $this->server->Close()) == "") {
         return true;
     } else {
         Error::addError("Fehler beim Trennen der Verbindung zum Mail-Server: " . HtmlSpecialChars($error), true);
         return false;
     }
 }
开发者ID:anhvn,项目名称:pokerspot,代码行数:15,代码来源:mail_receive.class.php

示例14: FormatCompleteValue

 function FormatCompleteValue($result)
 {
     return HtmlSpecialChars($result[0]);
 }
开发者ID:wycus,项目名称:darmedic,代码行数:4,代码来源:form_metabase_auto_complete.php

示例15: flush

                    for ($header_value = 0; $header_value < count($headers[$header_name]); $header_value++) {
                        echo $header_name . ": " . $headers[$header_name][$header_value], "\r\n";
                    }
                } else {
                    echo $header_name . ": " . $headers[$header_name], "\r\n";
                }
            }
            echo "</PRE>\n";
            flush();
            echo "<H2><LI>Response body:</LI</H2>\n<PRE>\n";
            for (;;) {
                $error = $http->ReadReplyBody($body, 1000);
                if ($error != "" || strlen($body) == 0) {
                    break;
                }
                echo HtmlSpecialChars($body);
            }
            echo "</PRE>\n";
            flush();
        }
    }
    $http->Close();
}
if (strlen($error)) {
    echo "<CENTER><H2>Error: ", $error, "</H2><CENTER>\n";
}
?>
</UL>
<HR>
</BODY>
</HTML>
开发者ID:3nj0y,项目名称:webvulscan,代码行数:31,代码来源:test_http_post.php


注:本文中的HtmlSpecialChars函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。