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


PHP htmlent函数代码示例

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


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

示例1: get_debug

/**
* Print debuginformation from the framework.
*/
function get_debug()
{
    // Only if debug is wanted.
    $Origo = Origin::Instance();
    if (empty($Origo->config['debug'])) {
        return;
    }
    // Get the debug output
    $html = null;
    if (isset($Origo->config['debug']['db-num-queries']) && $Origo->config['debug']['db-num-queries'] && isset($Origo->db)) {
        $flash = $Origo->session->GetFlash('database_numQueries');
        $flash = $flash ? "{$flash} + " : null;
        $html .= "<p>Database made {$flash}" . $Origo->db->GetNumQueries() . " queries.</p>";
    }
    if (isset($Origo->config['debug']['db-queries']) && $Origo->config['debug']['db-queries'] && isset($Origo->db)) {
        $flash = $Origo->session->GetFlash('database_queries');
        $queries = $Origo->db->GetQueries();
        if ($flash) {
            $queries = array_merge($flash, $queries);
        }
        $html .= "<p>Database made the following queries.</p><p>" . implode('<br/><br/>', $queries) . "</p>";
    }
    if (isset($Origo->config['debug']['timer']) && $Origo->config['debug']['timer']) {
        $html .= "<p>Page was loaded in " . round(microtime(true) - $Origo->timer['first'], 5) * 1000 . " msecs.</p>";
    }
    if (isset($Origo->config['debug']['trial']) && $Origo->config['debug']['trial']) {
        $html .= "<hr><h3>Debuginformation</h3><p>The content of trial:</p><pre>" . htmlent(print_r($Origo, true)) . "</pre>";
    }
    if (isset($Origo->config['debug']['session']) && $Origo->config['debug']['session']) {
        $html .= "<hr><h3>SESSION</h3><p>The content of Origin->session:</p><pre>" . htmlent(print_r($Origo->session, true)) . "</pre>";
        $html .= "<p>The content of \$_SESSION:</p><pre>" . htmlent(print_r($_SESSION, true)) . "</pre>";
    }
    return $html;
}
开发者ID:xd3x4L-1,项目名称:page,代码行数:37,代码来源:functions.php

示例2: showForm

 protected function showForm()
 {
     global $site;
     global $tmpl;
     // protected against cross site injection attempts
     $randomKeyName = 'teamReactivate_' . microtime();
     // convert some special chars to underscores
     $randomKeyName = strtr($randomKeyName, array(' ' => '_', '.' => '_'));
     $randomkeyValue = $site->setKey($randomKeyName);
     $tmpl->assign('keyName', $randomKeyName);
     $tmpl->assign('keyValue', htmlent($randomkeyValue));
     // display teams that can be reactivated
     $teamids = \team::getDeletedTeamIds();
     $teamData = array();
     foreach ($teamids as $teamid) {
         $teamData[] = array('id' => $teamid, 'name' => (new team($teamid))->getName());
     }
     $tmpl->assign('teams', $teamData);
     // a team must always have a leader
     // display user choice to admin
     // get all teamless users
     $users = \user::getTeamlessUsers();
     $userData = array();
     foreach ($users as $user) {
         // a team should only be reactivated so it can play...no point of inactive, disabled or banned user
         if ($user->getStatus() === 'active') {
             $userData[] = array('id' => $user->getID(), 'name' => $user->getName());
         }
     }
     $tmpl->assign('users', $userData);
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:31,代码来源:teamReactivate.php

示例3: DisplayObject

    /**
     * Display all items of the CObject.
     */
    public function DisplayObject()
    {
        $this->Menu();
        $this->data['main'] .= <<<EOD
\t<h2>Dumping content of CDeveloper</h2>
\t<p>Here is the content of the controller, including properties from CObject which holds access to common resources in Origin.</p>
EOD;
        $this->data['main'] .= '<pre>' . htmlent(print_r($this, true)) . '</pre>';
    }
开发者ID:xd3x4L-1,项目名称:page,代码行数:12,代码来源:CCDeveloper.php

示例4: addToVisitsLog

 public function addToVisitsLog($id)
 {
     // insert login of user to visits log
     $ip_address = getenv('REMOTE_ADDR');
     $host = gethostbyaddr($ip_address);
     $query = 'INSERT INTO `visits` (`userid`,`ip-address`,`host`,`forwarded_for`,`timestamp`) VALUES' . ' (?, ?, ?, ?, ?)';
     $query = $this->prepare($query);
     $args = array($id, htmlent($ip_address), htmlent($host), htmlent(getenv('HTTP_X_FORWARDED_FOR')), date('Y-m-d H:i:s'));
     $this->execute($query, $args);
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:10,代码来源:userOperations.php

示例5: get_debug

/**
 * Print debuginformation from the framework.
 */
function get_debug()
{
    $bbb = CBehovsboboxen::Instance();
    // Only if debug is wanted.
    if (empty($bbb->config['debug'])) {
        return;
    }
    // Get the debug output
    $html = null;
    if (isset($bbb->config['debug']['db-num-queries']) && $bbb->config['debug']['db-num-queries'] && isset($bbb->db)) {
        $flash = $bbb->session->GetFlash('database_numQueries');
        $flash = $flash ? "{$flash} + " : null;
        $html .= "<p>Database made {$flash}" . $bbb->db->GetNumQueries() . " queries.</p>";
    }
    if (isset($bbb->config['debug']['db-queries']) && $bbb->config['debug']['db-queries'] && isset($bbb->db)) {
        $flash = $bbb->session->GetFlash('database_queries');
        $queries = $bbb->db->GetQueries();
        if ($flash) {
            $queries = array_merge($flash, $queries);
        }
        $html .= "<p>Database made the following queries.</p><pre>" . implode('<br/><br/>', $queries) . "</pre>";
    }
    if (isset($bbb->config['debug']['timer']) && $bbb->config['debug']['timer']) {
        $now = microtime(true);
        //echo 'now: ' . $now . '<br />';
        $flash = $bbb->session->GetFlash('timer');
        //echo 'flash: ' . $flash . '<br />';
        if ($flash) {
            $redirect = $flash ? round($flash['redirect'] - $flash['first'], 3) . ' secs + x + ' : null;
            echo 'redirect: ' . $redirect . '<br />';
            $total = $flash ? round($now - $flash['first'], 3) . ' secs. Per page: ' : null;
            echo 'total: ' . $total . '<br />';
            $html .= "<p>Page was loaded in {$total}{$redirect}" . round($now - $bbb->timer['first'], 3) . " secs.</p>";
        }
    }
    if (isset($bbb->config['debug']['memory']) && $bbb->config['debug']['memory']) {
        $flash = $bbb->session->GetFlash('memory');
        $flash = $flash ? round($flash / 1024 / 1024, 2) . ' Mbytes + ' : null;
        $html .= "<p>Peek memory consumption was {$flash}" . round(memory_get_peak_usage(true) / 1024 / 1024, 2) . " Mbytes.</p>";
    }
    if (isset($bbb->config['debug']['behovsboboxen']) && $bbb->config['debug']['behovsboboxen']) {
        $html .= "<hr><h3>Debuginformation</h3><p>The content of CBehovsboboxen:</p><pre>" . htmlent(print_r($bbb, true)) . "</pre>";
    }
    if (isset($bbb->config['debug']['session']) && $bbb->config['debug']['session']) {
        $html .= "<hr><h3>SESSION</h3><p>The content of CBehovsboboxen->session:</p><pre>" . htmlent(print_r($bbb->session, true)) . "</pre>";
        $html .= "<p>The content of \$_SESSION:</p><pre>" . htmlent(print_r($_SESSION, true)) . "</pre>";
    }
    if (isset($bbb->config['debug']['timestamp']) && $bbb->config['debug']['timestamp']) {
        $html .= $bbb->log->TimestampAsTable();
        $html .= $bbb->log->PageLoadTime();
        $html .= $bbb->log->MemoryPeak();
    }
    return "<div class='debug'>{$html}</div>";
}
开发者ID:Electrotest,项目名称:BehovsBoBoxen,代码行数:57,代码来源:functions.php

示例6: showForm

 protected function showForm()
 {
     global $site;
     global $tmpl;
     // protected against cross site injection attempts
     $randomKeyName = 'teamJoin_' . $this->team->getID() . '_' . microtime();
     // convert some special chars to underscores
     $randomKeyName = strtr($randomKeyName, array(' ' => '_', '.' => '_'));
     $randomkeyValue = $site->setKey($randomKeyName);
     $tmpl->assign('keyName', $randomKeyName);
     $tmpl->assign('keyValue', htmlent($randomkeyValue));
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:12,代码来源:teamJoin.php

示例7: preview

 function preview($folder, $id)
 {
     global $site;
     global $tmpl;
     parent::showMail($folder, $id);
     $tmpl->setTemplate('PMDelete');
     $tmpl->assign('showPreview', true);
     $tmpl->assign('title', 'Delete ' . $tmpl->getTemplateVars('title'));
     // protected against cross site injection attempts
     $randomKeyName = 'pmDelete_' . microtime();
     // convert some special chars to underscores
     $randomKeyName = strtr($randomKeyName, array(' ' => '_', '.' => '_'));
     $randomkeyValue = $site->setKey($randomKeyName);
     $tmpl->assign('keyName', $randomKeyName);
     $tmpl->assign('keyValue', htmlent($randomkeyValue));
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:16,代码来源:pmDelete.php

示例8: Parse

 function Parse($string)
 {
     global $config;
     require_once dirname(__FILE__) . '/nbbc/nbbc.php';
     $setup = new BBCode();
     if (!isset($config)) {
         // old compatibility mode
         $setup->SetSmileyURL(baseaddress() . 'smileys');
     } else {
         $setup->SetSmileyURL($config->getValue('baseaddress') . 'smileys');
     }
     // $setup->SetEnableSmileys(false);
     $setup->SetAllowAmpersand(true);
     // escape (x)html entities
     return $setup->Parse(htmlent($string));
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:16,代码来源:nbbc-wrapper_example.php

示例9: insertEditText

 function insertEditText($readonly = false)
 {
     global $tmpl;
     global $config;
     global $db;
     if ($readonly || isset($_POST['confirmationStep'])) {
         // data passed to form -> use it
         $query = $db->prepare('SELECT `name` FROM `users` WHERE `id`=? LIMIT 1');
         $db->execute($query, user::getCurrentUserId());
         $author = $db->fetchRow($query);
         if ($author === false) {
             $author = 'error: no author could be determined';
         }
         $db->free($query);
     }
     // do not drop original message id that a reply would be refering to
     // but drop reply mode (users and teams are already added to recipients at this point)
     $formArgs = '';
     if (isset($_GET['id'])) {
         $formArgs .= '&amp;id=' . $_GET['id'];
     }
     $tmpl->assign('formArgs', $formArgs);
     $tmpl->assign('subject', $this->pm->getSubject());
     $tmpl->assign('time', $this->pm->getTimestamp());
     $tmpl->assign('playerRecipients', $this->pm->getUserNames());
     $tmpl->assign('teamRecipients', $this->pm->getTeamNames());
     $tmpl->assign('rawContent', htmlent($this->pm->getContent()));
     switch ($readonly) {
         case true:
             $tmpl->assign('authorName', htmlent($author['name']));
             if ($config->getValue('bbcodeLibAvailable')) {
                 $tmpl->assign('content', $tmpl->encodeBBCode($this->pm->getContent()));
             } else {
                 $tmpl->assign('content', htmlent($this->pm->getContent()));
             }
             $tmpl->assign('showPreview', true);
             // overwrite editor's default text ('Write changes')
             $tmpl->assign('submitText', 'Send PM');
             break;
         default:
             $tmpl->assign('showSendForm', true);
             // display the formatting buttons addded by addFormatButtons
             $this->editor->showFormatButtons();
             break;
     }
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:46,代码来源:pmAdd.php

示例10: insertEditText

 function insertEditText($readonly = false)
 {
     global $tmpl;
     global $author;
     global $last_modified;
     global $config;
     if ($readonly || isset($_POST['confirmationStep'])) {
         $content = $_POST['staticContent'];
     } elseif (isset($_GET['edit'])) {
         $content = $this->readContent($this->path, $author, $last_modified, true);
     } else {
         $content = 'Replace this text with the page content.';
     }
     switch ($readonly) {
         case true:
             $tmpl->assign('rawContent', htmlent($content));
             if ($config->getValue('bbcodeLibAvailable')) {
                 $tmpl->assign('contentPreview', $tmpl->encodeBBCode($content));
             } else {
                 // TODO: only fall back to using raw data if config says so
                 $tmpl->assign('contentPreview', $content);
             }
             break;
         default:
             $tmpl->assign('rawContent', htmlent($content));
             // display the formatting buttons addded by addFormatButtons
             $this->editor->showFormatButtons();
             break;
     }
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:30,代码来源:staticPageEditor.php

示例11: showForm

 protected function showForm()
 {
     global $site;
     global $tmpl;
     // protected against cross site injection attempts
     $randomKeyName = 'teamCreate_' . \user::getCurrentUser()->getID() . '_' . microtime();
     // convert some special chars to underscores
     $randomKeyName = strtr($randomKeyName, array(' ' => '_', '.' => '_'));
     $randomkeyValue = $site->setKey($randomKeyName);
     $tmpl->assign('keyName', $randomKeyName);
     $tmpl->assign('keyValue', htmlent($randomkeyValue));
     // bbcode editor
     include_once dirname(dirname(dirname(__FILE__))) . '/bbcode_buttons.php';
     $bbcode = new bbcode_buttons();
     // set up name of field to edit so javascript knows which element to manipulate
     $tmpl->assign('buttonsToFormat', $bbcode->showBBCodeButtons('team_description'));
     unset($bbcode);
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:18,代码来源:teamAdd.php

示例12: htmlent

<?php

if (!isset($account_needs_to_be_converted) || !$account_needs_to_be_converted) {
    if (isset($_SESSION['user_logged_in']) && $_SESSION['user_logged_in']) {
        $this->helper->done('already logged in');
    }
}
$account_old_website = htmlent($config->getValue('oldWebsiteName'));
if (!isset($msg)) {
    $msg = '';
}
if (!(isset($_POST['local_login_wanted']) && $_POST['local_login_wanted'])) {
    $msg .= '<form action="' . $config->getValue('baseaddress') . 'Login/' . '" method="post">' . "\n";
    $msg .= '<p class="first_p">' . "\n";
    if ($config->getValue('login.modules.forceExternalLoginOnly')) {
        $msg .= $this->helper->return_self_closing_tag('input type="submit" name="local_login_wanted" value="Update old account from ' . $account_old_website . '"');
    } else {
        $msg .= $this->helper->return_self_closing_tag('input type="submit" name="local_login_wanted" value="Local login"');
    }
    $msg .= '</p>' . "\n";
    $msg .= '</form>' . "\n";
}
if (isset($_POST['local_login_wanted']) && $_POST['local_login_wanted']) {
    /* 		$msg .= '<div class="static_page_box">' . "\n"; */
    $msg .= '<p class="first_p">';
    if ($config->getValue('login.modules.local.convertUsersToExternalLogin')) {
        require_once dirname(dirname(__FILE__)) . '/login_module_list.php';
        if (isset($module['bzbb']) && $module['bzbb']) {
            $msg .= '<strong><span class="unread_messages">Before you continue make absolutely sure your account here and the my.bzflag.org/bb/ (forum) account have exactly the same username or you will give someone else access to your account and that access can never be revoked.</span></strong></p>';
        }
    }
开发者ID:laiello,项目名称:bz-owl,代码行数:31,代码来源:login_text.php

示例13: bbcode

 function bbcode($string)
 {
     if (strcmp(bbcode_lib_path(), '') === 0) {
         // no bbcode library specified
         return $this->linebreaks(htmlent($string));
     }
     // load the library
     require_once bbcode_lib_path();
     if (strcmp(bbcode_command(), '') === 0) {
         // no command that starts the parser
         return $this->linebreaks(htmlent($string));
     } else {
         $parse_command = bbcode_command();
     }
     if (!(strcmp(bbcode_class(), '') === 0)) {
         // no class specified
         // this is no error, it only means the library stuff isn't started by a command in a class
         $bbcode_class = bbcode_class();
         $bbcode_instance = new $bbcode_class();
     }
     // execute the bbcode algorithm
     if (isset($bbcode_class)) {
         if (bbcode_sets_linebreaks()) {
             return $bbcode_instance->{$parse_command}($string);
         } else {
             return $this->linebreaks($bbcode_instance->{$parse_command}($string));
         }
     } else {
         if (bbcode_sets_linebreaks()) {
             return $parse_command($string);
         } else {
             return $this->linebreaks($parse_command($string));
         }
     }
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:35,代码来源:siteinfo.php

示例14: jquerycommentary_run

function jquerycommentary_run()
{
    global $_SERVER, $output, $session;
    require_once 'lib/commentary.php';
    $section = httpget('section');
    $commentary = db_prefix('commentary');
    $accounts = db_prefix('accounts');
    if (($commid = httpget('rmvcmmnt')) != "") {
        $prefix = db_prefix('commentary');
        check_su_access(SU_EDIT_COMMENTS);
        if ($session['user']['superuser'] & SU_EDIT_COMMENTS) {
            db_query("DELETE FROM {$prefix} WHERE commentid = '{$commid}'");
        }
        db_query("INSERT INTO {$commentary} (section, author, comment, postdate) VALUES ('blackhole', '{$session['user']['acctid']}', 'I fucked up', '" . date('Y-m-d H:i:s') . "')");
        invalidatedatacache("comments-{$section}");
        invalidatedatacache("comments-blackhole");
    }
    if (httpget('section') == get_module_pref('current_section') && httpget('section') != '') {
        //echo 'x';
        //var_dump(get_all_module_settings());
        $output = "";
        $_SERVER['REQUEST_URI'] = httpget('r');
        $session['counter'] = httpget('c');
        viewcommentary(get_module_pref('current_section'), get_module_setting('message'), get_module_setting('limit'), get_module_setting('talkline'));
        $output = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $output);
        $output = substr($output, 0, strpos($output, "<jquerycommentaryend>"));
        db_query("UPDATE accounts SET laston = '" . date('Y-m-d H:i:s') . "' WHERE acctid = '{$session['user']['acctid']}'");
        echo trim("{$output}");
        invalidatedatacache("comments-{$section}");
        /*$sql = db_query(
              "SELECT a.name, a.acctid
              FROM accounts AS a
              LEFT JOIN module_userprefs AS m
              ON m.userid = a.acctid
              LEFT JOIN module_userprefs AS u
              ON u.userid = m.userid
              WHERE m.modulename = 'jquerycommentary'
              AND m.setting = 'is_typing'
              AND m.value = '1'
              AND u.modulename = 'jquerycommentary'
              AND u.setting = 'current_section'
              and u.value = '" . get_module_pref('current_section') ."'"
          );
          $typing = [];
          while ($row = db_fetch_assoc($sql)) {
              array_push($typing, [$row['acctid'], $row['name']]);
          }
          $isTyping = appoencode('`@');
          $i = 0;
          echo appoencode('`@Who\'s typing: `n');
          if (count($typing) != 0) {
              foreach ($typing as $key => $val) {
                  $i++;
                  if ($i == 1) {
                      $isTyping .= appoencode($val[1]);
                  }
                  else if ($i > 1 && count($typing) > $i) {
                      $isTyping .= appoencode("`@, {$val[1]}");
                  }
                  else if ($i == count($typing)) {
                      $isTyping .= appoencode("`@ and {$val[1]}");
                  }
              }
              echo $isTyping;
          }
          else {
              echo appoencode('`@No one');
          }*/
    }
    switch (httpget('op')) {
        case 'get_json':
            $sql = db_query("SELECT commentid, author, comment FROM commentary WHERE section = '{$session['current_commentary_area']}' AND deleted = '0' ORDER BY commentid+0 DESC LIMIT 0, 25");
            $json = [];
            while ($row = db_fetch_assoc($sql)) {
                array_push($json, $row);
            }
            echo "<pre>";
            echo json_encode($json, JSON_PRETTY_PRINT);
            echo "</pre>";
            break;
        case 'post':
            $post = httpallpost();
            $post = modulehook('jquery-post-commentary', $post);
            $commentary = db_prefix('commentary');
            if ($post['method'] == 'insertcommentary') {
                require_once 'lib/commentary.php';
                injectcommentary(get_module_pref('current_section'), get_module_setting('talkline'), $post['comment']);
            } else {
                $commentid = explode('_', $post['method']);
                require_once 'lib/systemmail.php';
                require_once 'lib/sanitize.php';
                $post['comment'] = htmlent($post['comment']);
                db_query("UPDATE {$commentary} SET comment = '{$post['comment']}' WHERE commentid = '{$commentid[1]}'");
                db_query("INSERT INTO {$commentary} (section, author, comment, postdate) VALUES ('blackhole', '{$session['user']['acctid']}', 'I fucked up', '" . date('Y-m-d H:i:s') . "')");
                invalidatedatacache("comments-{$session['current_commentary_section']}");
                invalidatedatacache("comments-blackhole");
            }
            break;
        case 'last_comment':
            require_once 'lib/sanitize.php';
//.........这里部分代码省略.........
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:101,代码来源:jquerycommentary.php

示例15: foreach



<?php 
echo $form->GetHTML();
?>

<div class="page-header">
  <h2>Current messages</h2>
</div>

<?php 
foreach ($entries as $val) {
    ?>
<div class = well>
  <p>
  <strong><?php 
    echo htmlent($val['name']);
    ?>
</strong>
  <br /><small><?php 
    echo $val['created'];
    ?>
</small>
  </p>
  <p><?php 
    echo htmlent($val['entry']);
    ?>
</p>
</div>
<?php 
}
开发者ID:rud0lph,项目名称:HAL,代码行数:29,代码来源:guestbook.tpl.php


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