• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP unhtmlentities函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: text2etc

function text2etc($text, $CP, $mode = "png", $trans = 1)
{
    global $TTF_LOCATION, $FONT_SIZE;
    //$outputtext = implode('',file($f));
    $outputtext = $text;
    $outputtext = Conv2UTF8($outputtext, 1, $CP);
    $outputtext = str_replace("\r\n", "\n", $outputtext);
    $outputtext = str_replace("\r", "\n", $outputtext);
    $outputtext = str_replace("\n", "\r\n", $outputtext);
    $outputtext = str_replace("<br />", "\r\n", $outputtext);
    $outputtext = str_replace("&nbsp;", " ", $outputtext);
    $outputtext = unhtmlentities($outputtext);
    if ($mode == "png") {
        $dim = imageftbbox($FONT_SIZE, 0, $TTF_LOCATION, $outputtext, array("linespacing" => 1.0));
        #		$dim= imagettfbbox($FONT_SIZE, 0, $TTF_LOCATION, $outputtext);
        $min_x = min($dim[0], $dim[2], $dim[4], $dim[6]);
        $max_x = max($dim[0], $dim[2], $dim[4], $dim[6]);
        $width = $max_x - $min_x + 1;
        $min_y = min($dim[1], $dim[3], $dim[5], $dim[7]);
        $max_y = max($dim[1], $dim[3], $dim[5], $dim[7]);
        $height = $max_y - $min_y + 1;
        $img = imagecreate($width + 1, $height + 1);
        $white = ImageColorAllocate($img, 255, 255, 255);
        if ($trans) {
            $twhite = imagecolortransparent($img, $white);
        }
        $black = ImageColorAllocate($img, 0, 0, 0);
        #		ImageTTFText($img, $FONT_SIZE, 0, -$min_x+$dim[0],-$min_y, $black, $TTF_LOCATION, $outputtext);
        ImageFTText($img, $FONT_SIZE, 0, -$min_x + $dim[0], -$min_y, $black, $TTF_LOCATION, $outputtext, array("linespacing" => 1.0));
        Header("Content-type: image/png");
        ImagePng($img);
        ImageDestroy($img);
    } else {
        if ($mode == "pre") {
            echo "<pre>\n{$outputtext}\n</pre>";
        } else {
            if ($mode == "text") {
                Header("Content-type: text/plain");
                echo utf8Encode($outputtext);
            }
        }
    }
}
开发者ID:h16o2u9u,项目名称:rtoss,代码行数:43,代码来源:txtrender.php


示例2: getCaveBookmarks

 function getCaveBookmarks($extended = false)
 {
     global $db;
     // init return value
     $result = array();
     $names = array();
     // prepare query
     $sql = $db->prepare("SELECT cb.*, c.name, c.xCoord, c.yCoord, " . "p.playerID, p.name as playerName, p.tribe, " . "r.name as region " . "FROM " . CAVE_BOOKMARKS_TABLE . " cb " . "LEFT JOIN " . CAVE_TABLE . " c ON cb.caveID = c.caveID " . "LEFT JOIN " . PLAYER_TABLE . " p ON c.playerID = p.playerID " . "LEFT JOIN " . REGIONS_TABLE . " r ON c.regionID = r.regionID " . "WHERE cb.playerID = :playerID " . "ORDER BY c.name");
     $sql->bindValue('playerID', $_SESSION['player']->playerID, PDO::PARAM_INT);
     // collect rows
     if ($sql->execute()) {
         while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
             $row['raw_name'] = unhtmlentities($row['name']);
             $result[] = $row;
             array_push($names, $row['name']);
         }
     }
     if ($extended) {
         $sql = $db->prepare("SELECT c.caveID, c.name, c.xCoord, c.yCoord, " . "p.playerID, p.name as playerName, p.tribe, " . "r.name as region " . "FROM " . CAVE_TABLE . " c " . "LEFT JOIN " . PLAYER_TABLE . " p ON c.playerID = p.playerID " . "LEFT JOIN " . REGIONS_TABLE . " r ON c.regionID = r.regionID " . "WHERE c.playerID = :playerID " . "ORDER BY c.name");
         $sql->bindValue('playerID', $_SESSION['player']->playerID, PDO::PARAM_INT);
         // collect rows
         if ($sql->execute()) {
             while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
                 if (!in_array($row['name'], $names)) {
                     $row['raw_name'] = unhtmlentities($row['name']);
                     $result[] = $row;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:norter,项目名称:Game,代码行数:32,代码来源:CaveBookmarks.php


示例3: code_syntax

function code_syntax($output)
{
    $ret = $output[1];
    $ret = wordwrap($ret, 120, "\n", 0);
    $ret = unhtmlentities($ret);
    return "<pre>" . $ret . "</pre>";
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:7,代码来源:bbcode2xhtml.php


示例4: getCaveBookmarks

 function getCaveBookmarks($extended = false)
 {
     global $db, $params;
     // init return value
     $result = array();
     $names = array();
     // prepare query
     $sql = sprintf("SELECT cb.*, c.name, c.xCoord, c.yCoord, " . "p.playerID, p.name as playerName, p.tribe, " . "r.name as region " . "FROM `CaveBookmarks` cb " . "LEFT JOIN `Cave` c ON cb.caveID = c.caveID " . "LEFT JOIN `Player` p ON c.playerID = p.playerID " . "LEFT JOIN `Regions` r ON c.regionID = r.regionID " . "WHERE cb.playerID = '%d' " . "ORDER BY c.name", $params->SESSION->player->playerID);
     // send query
     $dbresult = $db->query($sql);
     // collect rows
     if ($dbresult) {
         while ($row = $dbresult->nextRow(MYSQL_ASSOC)) {
             $row['raw_name'] = unhtmlentities($row['name']);
             $result[] = $row;
             array_push($names, $row['name']);
         }
     }
     if ($extended) {
         $sql = sprintf("SELECT  c.name, c.xCoord, c.yCoord, " . "p.playerID, p.name as playerName, p.tribe, " . "r.name as region " . "FROM `Cave` c " . "LEFT JOIN `Player` p ON c.playerID = p.playerID " . "LEFT JOIN `Regions` r ON c.regionID = r.regionID " . "WHERE c.playerID = '%d'  " . "ORDER BY c.name", $params->SESSION->player->playerID);
         echo "<!-- {$sql} -->";
         // send query
         $dbresult = $db->query($sql);
         // collect rows
         if ($dbresult) {
             while ($row = $dbresult->nextRow(MYSQL_ASSOC)) {
                 if (!in_array($row['name'], $names)) {
                     $row['raw_name'] = unhtmlentities($row['name']);
                     $result[] = $row;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:agatho,项目名称:uaenhanced,代码行数:35,代码来源:CaveBookmarks.php


示例5: tribe_getContent

function tribe_getContent($caveID, $tag)
{
    global $db, $no_resource_flag, $config, $params;
    $no_resource_flag = 1;
    if (!($r = $db->query("SELECT t.*, p.playerID, p.name AS leaderName " . "FROM Tribe t " . "LEFT JOIN Player p " . "ON p.playerID = t.leaderID " . "WHERE t.tag LIKE '{$tag}'"))) {
        page_dberror();
    }
    if (!($row = $r->nextRow(MYSQL_ASSOC))) {
        page_dberror();
    }
    $JuniorAdmin = $targetPlayer = new Player(getPlayerByID($row['juniorLeaderID']));
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribeDetail.ihtml');
    $row["urltag"] = urlencode(unhtmlentities($tag));
    $row["playerList_modus"] = TRIBE_PLAYER_LIST;
    $row["playerDetail_modus"] = PLAYER_DETAIL;
    $row["tribeHistory_modus"] = TRIBE_HISTORY;
    $row["tribeRelationList_modus"] = TRIBE_RELATION_LIST;
    if (!empty($row['awards'])) {
        $tmp = explode('|', $row['awards']);
        $awards = array();
        foreach ($tmp as $tag) {
            $awards[] = array('tag' => $tag, 'award_modus' => AWARD_DETAIL);
        }
        $row['award'] = $awards;
    }
    foreach ($row as $k => $v) {
        if (!$v) {
            $row[$k] = "k.A.";
        }
    }
    $row['juniorLeaderName'] = $JuniorAdmin->name;
    $row['juniorLeaderID'] = $JuniorAdmin->playerID;
    tmpl_set($template, 'DETAILS', $row);
    return tmpl_parse($template);
}
开发者ID:agatho,项目名称:uaenhanced,代码行数:35,代码来源:tribeDetail.html.php


示例6: init

 function init()
 {
     if (!empty($this->admin_page->id)) {
         $temp = new entity($this->admin_page->id, false);
         if ($temp->get_value('new') && $temp->get_value('state') == 'Pending' && !$temp->get_value('name') && reason_user_has_privs($this->admin_page->user_id, 'delete_pending')) {
             reason_expunge_entity($this->admin_page->id, $this->admin_page->user_id);
         }
     }
     if (!empty($this->admin_page->request[CM_VAR_PREFIX . 'type_id'])) {
         $old_vars = array();
         foreach ($this->admin_page->request as $key => $val) {
             if (substr($key, 0, strlen(CM_VAR_PREFIX)) == CM_VAR_PREFIX) {
                 $old_vars[substr($key, strlen(CM_VAR_PREFIX))] = $val;
                 $old_vars[$key] = '';
             }
         }
         foreach ($this->admin_page->default_args as $arg) {
             if (!isset($old_vars[$arg])) {
                 $old_vars[$arg] = '';
             }
         }
         $link = $this->admin_page->make_link($old_vars);
     } else {
         $link = $this->admin_page->make_link(array('id' => '', 'site_id' => $this->admin_page->site_id, 'type_id' => $this->admin_page->type_id, 'cur_module' => 'Lister'));
     }
     header('Location: ' . unhtmlentities($link));
     die;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:cancel.php


示例7: init

 function init()
 {
     $this->type_entity = new entity($this->admin_page->type_id);
     if (!reason_site_can_edit_type($this->admin_page->site_id, $this->admin_page->type_id)) {
         echo 'This site does not have permission to edit ' . $this->type_entity->get_value('plural_name') . '.';
         die;
     }
     if (empty($this->admin_page->id)) {
         if (reason_user_has_privs($this->admin_page->user_id, 'add')) {
             $new_id = create_entity($this->admin_page->site_id, $this->admin_page->type_id, $this->admin_page->user_id, '', array('entity' => array('state' => 'Pending')));
             header('Location: ' . unhtmlentities($this->admin_page->make_link(array('id' => $new_id), true)));
             die;
         } else {
             echo 'You do not have the privileges needed to add a ' . $this->type_entity->get_value('name');
             die;
         }
     }
     $this->entity = new entity($this->admin_page->id);
     if ($this->_cm_ok_to_run()) {
         $this->_do_admin_page_prep();
         $this->disco_item = $this->_build_content_manager();
     }
     $this->head_items->add_javascript(JQUERY_UI_URL, true);
     $this->head_items->add_javascript(JQUERY_URL, true);
     $this->head_items->add_stylesheet(JQUERY_UI_CSS_URL);
     $this->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'change_detection.js');
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:27,代码来源:editor.php


示例8: takeover_getContent

function takeover_getContent($playerID, $caveID, $xCoord = NULL, $yCoord = NULL)
{
    global $config, $params, $resourceTypeList, $TAKEOVERMAXPOPULARITYPOINTS, $TAKEOVERMINRESOURCEVALUE;
    $template = @tmpl_open('templates/' . $config->template_paths[$params->SESSION->user['template']] . '/takeover.ihtml');
    if (getNumberOfCaves($playerID) >= $params->SESSION->user['takeover_max_caves']) {
        tmpl_set($template, 'feedback', "Sie haben bereits die maximale Anzahl von " . $params->SESSION->user['takeover_max_caves'] . " Siedlung(en) erreicht.");
    } else {
        $beliebtheit = $TAKEOVERMAXPOPULARITYPOINTS;
        $mindestgebot = $TAKEOVERMINRESOURCEVALUE;
        $resourcevalues = array();
        for ($i = 0; $i < sizeof($resourceTypeList); ++$i) {
            array_push($resourcevalues, array('dbFieldName' => $resourceTypeList[$i]->dbFieldName, 'name' => $resourceTypeList[$i]->name, 'value' => $resourceTypeList[$i]->takeoverValue));
        }
        tmpl_set($template, 'TAKEOVER', array('beliebtheit' => $beliebtheit, 'maxcaves' => $params->SESSION->user['takeover_max_caves'], 'mindestgebot' => $mindestgebot, 'targetXCoord' => $params->POST->targetXCoord, 'targetYCoord' => $params->POST->targetYCoord, 'RESOURCEVALUE' => $resourcevalues, 'HIDDEN' => array('name' => 'modus', 'value' => TAKEOVER_CHANGE)));
        for ($i = 0; $i < $beliebtheit; ++$i) {
            tmpl_iterate($template, 'TAKEOVER/LEGENDE');
            tmpl_set($template, 'TAKEOVER/LEGENDE/status', $i);
            tmpl_set($template, 'TAKEOVER/LEGENDE', getStatusPic($i));
        }
        if (!($xCoord == "" || $yCoord == "")) {
            // neue Koordinaten
            // 1. pruefen, ob freie Hoehle
            // 2. neuen Eintrag in Cave_takeover (alten ueberschreiben)
            if (changeCaveIfReasonable($playerID, $xCoord, $yCoord)) {
                tmpl_set($template, 'feedback', "Sie bieten nun f&uuml;r die Siedlung in (" . $xCoord . " | " . $yCoord . ").");
            } else {
                tmpl_set($template, 'feedback', "Sie k&ouml;nnen nicht f&uuml;r diese" . " Siedlung (" . $xCoord . " | " . $yCoord . ")." . " bieten. W&auml;hlen sie eine freie Siedlung.");
            }
        }
        $takeover = new Takeover($playerID);
        if (!is_null($takeover)) {
            tmpl_iterate($template, 'TAKEOVER/HIDDEN');
            tmpl_set($template, 'TAKEOVER/HIDDEN', array(array('name' => 'currentXCoord', 'value' => $takeover->xCoord), array('name' => 'currentYCoord', 'value' => $takeover->yCoord)));
            tmpl_context($template, '/TAKEOVER/CHOSEN');
            tmpl_set($template, 'xCoord', $takeover->xCoord);
            tmpl_set($template, 'yCoord', $takeover->yCoord);
            tmpl_set($template, 'caveName', $takeover->caveName);
            tmpl_set($template, $takeover->getStatus());
            tmpl_set($template, 'bewegung', "?modus=" . MOVEMENT . "&caveID=" . $caveID . "&targetXCoord=" . $takeover->xCoord . "&targetYCoord=" . $takeover->yCoord . "&targetCaveName=" . unhtmlentities($takeover->caveName));
            if (sizeof($takeover->resources) != 0) {
                tmpl_context($template, '/TAKEOVER/CHOSEN/RESOURCES/RESOURCE');
                tmpl_set($template, $takeover->resources);
                tmpl_set($template, '../SUM/sum', $takeover->resources_sum);
            } else {
                tmpl_context($template, '/TAKEOVER/CHOSEN/RESOURCES/NONE');
                tmpl_set($template, 'none', 'keine');
            }
            if (sizeof($takeover->bidders) != 0) {
                tmpl_context($template, '/TAKEOVER/CHOSEN/BIDDERS/BIDDER');
                tmpl_set($template, $takeover->bidders);
            } else {
                tmpl_context($template, '/TAKEOVER/CHOSEN/BIDDERS/NOONE');
                tmpl_set($template, 'noone', 'niemand');
            }
        }
    }
    return tmpl_parse($template);
}
开发者ID:agatho,项目名称:uaenhanced,代码行数:58,代码来源:takeover.html.php


示例9: dataHandler

 function dataHandler(&$parser, $data)
 {
     //            $GLOBALS['word'][$this->i]['data'] = $data;
     //            $this->i++;
     if (!in_array('HA-spellcheck-fixed', $this->attrs)) {
         $beforeword = substr($text, 0, $this->start_pos);
         $afterword = substr($text, $this->start_pos + strlen($data) + 1);
         $GLOBALS['text'] = str_replace($data, text_handler(unhtmlentities($data)), $GLOBALS['text']);
     }
     //if
 }
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:11,代码来源:spell-check-logic.php


示例10: init

 function init()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'borrow')) {
         die('You do not have privileges to borrow or unborrow items');
     }
     $this->set_borrowship_first_level();
     if ($this->admin_page->is_second_level()) {
         $this->add_relationship_second_level();
     }
     $link = unhtmlentities($this->admin_page->make_link(array('cur_module' => 'Sharing', 'id' => '')));
     header('Location: ' . $link);
     die;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:13,代码来源:doBorrow.php


示例11: init

 function init()
 {
     $es = $this->get_entity_selector();
     $this->values = $es->run_one();
     if ($this->is_new()) {
         $this->get_links();
         if (count($this->links) == 1) {
             $l = unhtmlentities(current($this->links));
             header('Location: ' . $l);
             die;
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:13,代码来源:sorter.php


示例12: F_print_error

/**
 * Handle error/warning/system messages.
 * Print a message
 * @param $messagetype (string) Type of message:  0=no message, message; warning; error.
 * @param $messagetoprint (string)  message to print.
 * @param $exit (bool) if true output a message and terminate the current script [default = false].
 */
function F_print_error($messagetype = 'MESSAGE', $messagetoprint = '', $exit = false)
{
    require_once dirname(__FILE__) . '/../config/tce_config.php';
    global $l;
    $messagetype = strtolower($messagetype);
    //message is appended to the log file
    if (K_USE_ERROR_LOG and !strcmp($messagetype, 'error')) {
        $logsttring = date(K_TIMESTAMP_FORMAT) . K_TAB;
        $logsttring .= $_SESSION['session_user_id'] . K_TAB;
        $logsttring .= $_SESSION['session_user_ip'] . K_TAB;
        $logsttring .= $messagetype . K_TAB;
        $logsttring .= $_SERVER['SCRIPT_NAME'] . K_TAB;
        $logsttring .= $messagetoprint . K_NEWLINE;
        error_log($logsttring, 3, '../log/tce_errors.log');
    }
    if (strlen($messagetoprint) > 0) {
        switch ($messagetype) {
            case 'message':
                $msgtitle = $l['t_message'];
                break;
            case 'warning':
                $msgtitle = $l['t_warning'];
                break;
            case 'error':
                $msgtitle = $l['t_error'];
                break;
            default:
                //no message
                $msgtitle = $messagetype;
                break;
        }
        echo '<div class="' . $messagetype . '">' . $msgtitle . ': ' . $messagetoprint . '</div>' . K_NEWLINE;
        if (K_ENABLE_JSERRORS) {
            //display message on JavaScript Alert Window.
            echo '<script type="text/javascript">' . K_NEWLINE;
            echo '//<![CDATA[' . K_NEWLINE;
            $messagetoprint = unhtmlentities(strip_tags($messagetoprint));
            $messagetoprint = str_replace("'", "\\'", $messagetoprint);
            echo 'alert(\'[' . $msgtitle . ']: ' . $messagetoprint . '\');' . K_NEWLINE;
            echo '//]]>' . K_NEWLINE;
            echo '</script>' . K_NEWLINE;
        }
    }
    if ($exit) {
        exit;
        // terminate the current script
    }
}
开发者ID:dungvu,项目名称:tcexam,代码行数:55,代码来源:tce_functions_errmsg.php


示例13: show_adressbook

function show_adressbook($playerID, $deleteID)
{
    global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $unitTypeList, $config, $params, $db;
    // messages
    $messageText = array(0 => "Spieler wurde eingetragen.", 1 => "Es gibt keinen Spieler mit diesem Namen.", 2 => "Dieser Spieler ist schon in der Liste.", 3 => "Spieler aus der Liste gel&ouml;scht.", 4 => "Spieler konnte nicht aus der Liste entfernt werden.", 5 => "Verarsch mich nicht!", 6 => "Datenbank Fehler.");
    // enter something new
    if (isset($params->POST->empfaenger)) {
        $messageID = book_newEntry($playerID, $params->POST->empfaenger);
    }
    if (isset($params->POST->newEntryName)) {
        $messageID = book_newEntry($playerID, $params->POST->newEntryName);
    } else {
        if ($deleteID > 0) {
            $messageID = book_deleteEntry($playerID, $deleteID);
        }
    }
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/message_book.ihtml");
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
    }
    // Getting entries
    // call our function
    $playerlist = book_getEntries($playerID);
    // Show the player table
    for ($i = 0; $i < sizeof($playerlist[id]); $i++) {
        $playername = $playerlist[name][$i];
        // the current playername
        $tribe = $playerlist[tribe][$i];
        // the current tribe
        $tribelink = "<a href=\"main.php?modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($tribe)) . "\" target=\"_blank\">";
        if ($tribe != "") {
            $tribe = "(" . $tribe . ")";
        }
        $playerID = $playerlist[id][$i];
        $link = "<a href=\"main.php?modus=" . NEW_MESSAGE . "&amp;playerID=" . $playername . "\">";
        tmpl_iterate($template, '/PLAYER');
        tmpl_set($template, "PLAYER/alternate", $count++ % 2 ? "alternate" : "");
        if ($playername != "Spieler nicht auffindbar") {
            tmpl_set($template, "PLAYER/LINK/link", $link);
        }
        tmpl_set($template, 'PLAYER', array('name' => $playername, 'tribe' => $tribe, 'tribelink' => $tribelink, 'playerID' => $playerID, 'modus' => NEW_MESSAGE, 'modus_delete' => MESSAGE_BOOK_DELETE));
    }
    if (sizeof($playerlist) < 1) {
        tmpl_set($template, "NOPLAYER/dummy", "");
    }
    return tmpl_parse($template);
}
开发者ID:agatho,项目名称:uaenhanced,代码行数:48,代码来源:message_book.html.php


示例14: F_html_to_text

/**
 * Convert HTML code to Text string.
 * @param $str (string) HTML code string to convert.
 * @param $preserve_newlines (boolean) If true convert newline characters to HTML line breaks.
 * @param $display_links (boolean) If true gives a textual representation of links and images.
 * @return text string
 */
function F_html_to_text($str, $preserve_newlines = false, $display_links = false)
{
    require_once '../../shared/code/tce_functions_general.php';
    $dollar_replacement = ":.dlr.:";
    //string replacement for dollar symbol
    //tags conversion table
    $tags2textTable = array("'<br[^>]*?>'i" => "\n", "'<p[^>]*?>'i" => "\n", "'</p>'i" => "\n", "'<div[^>]*?>'i" => "\n", "'</div>'i" => "\n", "'<table[^>]*?>'i" => "\n", "'</table>'i" => "\n", "'<tr[^>]*?>'i" => "\n", "'<th[^>]*?>'i" => "\t ", "'<td[^>]*?>'i" => "\t ", "'<li[^>]*?>\t'i" => "\n", "'<h[0-9][^>]*?>'i" => "\n\n", "'</h[0-9]>'i" => "\n", "'<head[^>]*?>.*?</head>'si" => "\n", "'<style[^>]*?>.*?</style>'si" => "\n", "'<script[^>]*?>.*?</script>'si" => "\n");
    $str = str_replace("\r\n", "\n", $str);
    $str = str_replace("\$", $dollar_replacement, $str);
    //replace special character
    //remove session variable PHPSESSID from links
    $str = preg_replace("/(\\?|\\&|%3F|%26|\\&amp;|%26amp%3B)PHPSESSID(=|%3D)[a-z0-9]{32,32}/i", "", $str);
    //remove applet and get alternative content
    $str = preg_replace("/<applet[^>]*?>(.*?)<\\/applet>/esi", "preg_replace(\"/<param[^>]*>/i\", \"\", \"\\1\")", $str);
    //remove object and get alternative content
    $str = preg_replace("/<object[^>]*?>(.*?)<\\/object>/esi", "preg_replace(\"/<param[^>]*>/i\", \"\", \"\\1\")", $str);
    //indent list elements
    $firstposition = 0;
    while (($pos = strpos($str, "<ul")) > $firstposition) {
        $str = preg_replace("/<ul[^>]*?>(.*?)<\\/ul>/esi", "preg_replace(\"/<li[^>]*>/i\", \"<li>\t\", \"\\1\")", $str);
        $firstposition = $pos;
    }
    $firstposition = 0;
    while (($pos = strpos($str, "<ol")) > $firstposition) {
        $str = preg_replace("/<ol[^>]*?>(.*?)<\\/ol>/esi", "preg_replace(\"/<li[^>]*>/i\", \"<li>\t\", \"\\1\")", $str);
        $firstposition = $pos;
    }
    $str = preg_replace("'<img[^>]*alt[\\s]*=[\\s]*[\"\\']*([^\"\\'<>]*)[\"\\'][^>]*>'i", "[IMAGE: \\1]", $str);
    // give a textual representation of links and images
    if ($display_links) {
        $str = preg_replace("'<a[^>]*href[\\s]*=[\\s]*[\"\\']*([^\"\\'<>]*)[\"\\'][^>]*>(.*?)</a>'si", "\\2 [LINK: \\1]", $str);
    }
    if (!$preserve_newlines) {
        //remove newlines
        $str = str_replace("\n", "", $str);
    }
    $str = preg_replace(array_keys($tags2textTable), array_values($tags2textTable), $str);
    $str = preg_replace("'<[^>]*?>'si", "", $str);
    //strip out remaining tags
    //remove some newlines in excess
    $str = preg_replace("'[ \t\f]+[\r\n]'si", "\n", $str);
    $str = preg_replace("'[\r\n][\r\n]+'si", "\n\n", $str);
    $str = unhtmlentities($str, FALSE);
    $str = str_replace($dollar_replacement, "\$", $str);
    //restore special character
    return stripslashes(trim($str));
}
开发者ID:dungvu,项目名称:tcexam,代码行数:54,代码来源:tce_functions_html2txt.php


示例15: init

 function init()
 {
     $this->admin_page->set_show('leftbar', false);
     if (empty($this->admin_page->id)) {
         $this->_not_undeletable_reason = 'no_id_provided';
         return false;
     }
     if (!reason_user_has_privs($this->admin_page->user_id, 'publish')) {
         $this->_not_undeletable_reason = 'insufficient_privileges';
         return false;
     }
     $item = new entity($this->admin_page->id);
     $user = new entity($this->admin_page->user_id);
     if (!$item->user_can_edit_field('state', $user)) {
         $this->_not_undeletable_reason = 'state_field_locked';
         return false;
     }
     if ($item->get_value('state') != 'Deleted') {
         $this->_not_undeletable_reason = 'not_deleted_yet';
         return false;
     }
     reason_update_entity($this->admin_page->id, $this->admin_page->user_id, array('state' => 'Live'), false);
     if ($this->admin_page->type_id == id_of('minisite_page')) {
         // zap nav cache so it reappears.
         reason_include_once('classes/object_cache.php');
         $cache = new ReasonObjectCache($this->admin_page->site_id . '_navigation_cache');
         $cache->clear();
     }
     $manager_site_id = $this->admin_page->site_id;
     if ($item->get_value('type') == id_of('site')) {
         $manager_site_id = $item->id();
     }
     //Updates the rewrites to prevent infinite redirection loop.
     reason_include_once('classes/url_manager.php');
     $urlm = new url_manager($manager_site_id);
     $urlm->update_rewrites();
     $link = unhtmlentities($this->admin_page->make_link(array('cur_module' => 'Lister', 'id' => '', 'state' => 'deleted')));
     header('Location: ' . $link);
     die;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:40,代码来源:undelete.php


示例16: myalerts_redirect_alert

/**
 * Handle a request to view a single alert by marking the alert read and
 * forwarding on to the correct location.
 *
 * @param MyBB       $mybb MyBB core object.
 * @param MyLanguage $lang Language object.
 */
function myalerts_redirect_alert($mybb, $lang)
{
    $alertId = $mybb->get_input('id', MyBB::INPUT_INT);
    /** @var MybbStuff_MyAlerts_Entity_Alert $alert */
    $alert = MybbStuff_MyAlerts_AlertManager::getInstance()->getAlert($alertId);
    if ($alert === null) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
        error($lang->myalerts_error_alert_not_found);
        return;
    }
    /** @var MybbStuff_MyAlerts_Formatter_AbstractFormatter $alertTypeFormatter */
    $alertTypeFormatter = MybbStuff_MyAlerts_AlertFormatterManager::getInstance()->getFormatterForAlertType($alert->getType()->getCode());
    if (!$alert || !$alertTypeFormatter) {
        error($lang->myalerts_error_alert_not_found);
    }
    MybbStuff_MyAlerts_AlertManager::getInstance()->markRead(array($alertId));
    $redirectLink = unhtmlentities($alertTypeFormatter->buildShowLink($alert));
    if (empty($redirectLink)) {
        $redirectLink = $mybb->settings['bburl'] . '/alerts.php';
    }
    header('Location: ' . $redirectLink);
}
开发者ID:WhiteNeo,项目名称:MyAlerts,代码行数:29,代码来源:alerts.php


示例17: run

 /**
  * Lists the current and available themes (if appropriate to do so) otherwise, changes the theme
  * if the user has selected a new one
  * 
  * @return void
  */
 function run()
 {
     if (!empty($this->admin_page->request['chosen_theme'])) {
         if ($this->self_change) {
             //create a relationship of type site_has_had_theme (if needed)
             $oldies = $this->get_previously_selected_themes();
             $site_type_themes = $this->get_site_type_themes(false);
             $e = $this->get_current_theme();
             if ($e) {
                 if (!entity_in_array($oldies, $e->id()) and !entity_in_array($site_type_themes, $e->id())) {
                     create_relationship($this->admin_page->site_id, $e->id(), relationship_id_of('site_has_had_theme'));
                 }
             }
             //do relationship adding/deleting
             delete_relationships(array('entity_a' => $this->admin_page->site_id, 'type' => relationship_id_of('site_to_theme')));
             create_relationship($this->admin_page->site_id, $this->admin_page->request['chosen_theme'], relationship_id_of('site_to_theme'));
         }
         $link = $this->admin_page->make_link(array('cur_module' => 'ChooseTheme', 'chosen_theme' => ''));
         header('Location: ' . unhtmlentities($link));
     } else {
         $this->list_available_themes();
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:choose_theme.php


示例18: takeover_getBidding

/**
 *
 */
function takeover_getBidding($caveCount = 0)
{
    global $db;
    // prepare query
    $sql = $db->prepare("SELECT * FROM " . CAVE_TAKEOVER_TABLE . " WHERE playerID = :playerID");
    $sql->bindValue('playerID', $_SESSION['player']->playerID, PDO::PARAM_INT);
    // return NULL on error or if recordSet is empty, as there is no bidding
    if (!$sql->execute()) {
        return NULL;
    }
    // fetch row
    $row = $sql->fetch();
    if (!$row) {
        return NULL;
    }
    // fill return value
    $bidding = array('caveID' => $row['caveID'], 'xCoord' => $row['xCoord'], 'yCoord' => $row['yCoord'], 'status' => $row['status'], 'caveName' => $row['name'], 'uh_caveName' => unhtmlentities($row['name']));
    // get own status
    $bidding += takeover_getStatusPic($row['status']);
    // get sent resources
    $sum = 0;
    $resources = array();
    foreach ($GLOBALS['resourceTypeList'] as $resource) {
        $amount = $row[$resource->dbFieldName];
        if ($amount > 0) {
            $resources[] = array('name' => $resource->name, 'value' => $amount);
            $sum += $amount * $resource->takeoverValue;
        }
    }
    // merge $resources with bidding
    if (sizeof($resources)) {
        $bidding['resource'] = $resources;
        $bidding['sum'] = $sum;
        $bidding['proportion'] = $sum > 0 && $caveCount > 0 ? round($sum / (200 * pow($caveCount, 2)), 3) : 0;
    }
    // get other bidders
    $bidders = array();
    $sql = $db->prepare("SELECT p.name, p.playerID, ct.status \n                       FROM " . CAVE_TAKEOVER_TABLE . " ct, Player p \n                       WHERE caveID = :caveID AND ct.playerID = p.playerID \n                       AND ct.playerID != :playerID");
    $sql->bindValue('caveID', $row['caveID'], PDO::PARAM_INT);
    $sql->bindValue('playerID', $_SESSION['player']->playerID, PDO::PARAM_INT);
    if ($sql->execute()) {
        while ($row = $sql->fetch()) {
            $temp = array('playername' => $row['name'], 'playerID' => $row['playerID']);
            $temp += takeover_getStatusPic($row['status']);
            $bidders[] = $temp;
        }
    }
    // merge $bidders with bidding
    if (sizeof($bidders)) {
        $bidding['bidder'] = $bidders;
    }
    return $bidding;
}
开发者ID:microlefes,项目名称:Game,代码行数:56,代码来源:takeover.html.php


示例19: run

 function run()
 {
     if ($this->expungable) {
         $this->disco_item->run();
     } else {
         switch ($this->_not_expungable_reason) {
             case 'no_id_provided':
                 echo '<p>Unable to expunge item. Item may already have been expunged (sometimes this happens if you click twice on the expunge button)</p>';
                 return false;
             case 'state_field_locked':
                 echo '<p>This item has been locked, preventing it from being expunged. Please contact an administrator if it is important to expunge this item.</p>';
                 return false;
             case 'insufficient_privileges':
                 echo '<p>You do not have the privileges to expunge this item.</p>';
                 return false;
             case 'not_deleted_yet':
                 echo '<p>This item cannot be expunged because it has not been deleted yet</p>';
                 return false;
             case 'dependencies':
                 $link = unhtmlentities($this->admin_page->make_link(array('cur_module' => 'NoDelete')));
                 header('Location: ' . $link);
                 die;
             default:
                 trigger_error('Unknown reason given for not being able to expunge item: ' . $this->_not_expungable_reason);
                 echo '<p>Not able to expunge item</p>';
                 return false;
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:expunge.php


示例20: rules_get_article

function rules_get_article($content, $rules_info)
{
    $url = $_GET['url'];
    $rules_info = pstripslashes($rules_info);
    $rules_info['title_filter_rules'] = dstripslashes(unserialize($rules_info['title_filter_rules']));
    $rules_info['content_filter_rules'] = dstripslashes(unserialize($rules_info['content_filter_rules']));
    require_once libfile('function/home');
    //先取标题
    if ($rules_info['theme_get_type'] == 3) {
        //智能识别
        $data = get_single_article($content);
    } else {
        if ($rules_info['theme_get_type'] == 1) {
            //dom获取
            $data = dom_single_article($content, array('title' => $rules_info['theme_rules']));
        } else {
            if ($rules_info['theme_get_type'] == 2) {
                //字符串
                $re = pregmessage($content, '<title>[title]</title>', 'title', -1);
                $data['other']['old_title'] = $re[0];
                $re = pregmessage($content, $rules_info['theme_rules'], 'title', -1);
                $data['title'] = $re[0];
            }
        }
    }
    if (!trim($data['title'])) {
        return $data;
    }
    //如果标题都取不到,不必浪费时间获取内容
    $data['content'] = rules_get_contents($content, $rules_info);
    if ($rules_info['content_page_rules'] && $data['content']) {
        //分页文章
        $content_page_arr = get_content_page($url, $content, $rules_info);
        if ($content_page_arr) {
            $args = array('oldurl' => array(), 'content_arr' => array(), 'content_page_arr' => $content_page_arr, 'page_hash' => array(), 'rules' => $rules_info, 'url' => $url);
            $data['content_arr'] = page_get_content($content, $args);
            foreach ((array) $data['content_arr'] as $k => $v) {
                $content_arr[] = $v['content'];
            }
            $data['content'] = implode('', $content_arr);
        }
    }
    $data['title'] = unhtmlentities(strip_tags($data['title'], '&nbsp;'));
    $data['content'] = unhtmlentities($data['content']);
    $data['title'] = getstr(trim($data['title']), 80, 1, 1, 0, 1);
    $data['content'] = getstr($data['content'], 0, 1, 1, 0, 1);
    //print_r($data);
    //处理文章标题和内容,包括替换和过滤
    $format_args_title = array('is_fiter' => $rules_info['is_fiter_title'], 'show_type' => 'title', 'test' => 2, 'result_data' => $data['title'], 'replace_rules' => $rules_info['title_replace_rules'], 'filter_data' => $rules_info['title_filter_rules']);
    $data['title'] = filter_article($format_args_title);
    $data['content'] = dstripslashes($data['content']);
    $format_args_content = array('is_fiter' => $rules_info 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP unhtmlspecialchars函数代码示例发布时间:2022-05-23
下一篇:
PHP unhtml函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap