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


PHP unhtmlentities函数代码示例

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


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


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