本文整理汇总了PHP中parseText函数的典型用法代码示例。如果您正苦于以下问题:PHP parseText函数的具体用法?PHP parseText怎么用?PHP parseText使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputHTML
protected function outputHTML()
{
$user = UserRepository::getUserByID($this->message['senderid']);
?>
<div class="container">
<div class="panel panel-info" id="comments">
<div class="panel-heading">
<h3 class="panel-title">Message</h3>
</div>
<div class="panel-body">
<p>From: <?php
echo $user['username'];
?>
</p>
<p>Content: <?php
echo parseText($this->message['content']);
?>
</p>
<p><a href="<?php
echo \route\Route::get("sendMessage")->generate(array("id" => $user['userid']));
?>
" class="btn btn-info">Reply</a></p>
</div>
</div>
</div>
<?php
}
示例2: parse
function parse($args, $page)
{
global $pagestore, $ParseEngine, $ParseObject;
static $visited_array = array();
static $visited_count = 0;
if (!validate_page($args)) {
return '[[Transclude ' . $args . ']]';
}
$visited_array[$visited_count++] = $ParseObject;
for ($i = 0; $i < $visited_count; $i++) {
if ($visited_array[$i] == $args) {
$visited_count--;
return '[[Transclude ' . $args . ']]';
}
}
$pg = $pagestore->page($args);
$pg->read();
if (!$pg->exists) {
$visited_count--;
return '[[Transclude ' . $args . ']]';
}
$result = parseText($pg->text, $ParseEngine, $args);
$visited_count--;
return $result;
}
示例3: get_content
function get_content(&$arguments, $properties)
{
if (!is_readable(PHPGW_SERVER_ROOT . '/wiki') || !@$GLOBALS['phpgw_info']['user']['apps']['wiki']) {
return lang('You have no rights to view wiki content or the wiki is not installed at all !!!');
}
$wikipage = empty($_GET[$this->wikipage_param]) ? empty($arguments['startpage']) ? $GLOBALS['HomePage'] : $arguments['startpage'] : stripslashes(urldecode($_GET['wikipage']));
$parts = explode(':', $wikipage);
if (count($parts) > 1) {
$lang = array_pop($parts);
if (strlen($lang) == 2 || strlen($lang) == 5 && $lang[2] == '-') {
$wikipage = implode(':', $parts);
} else {
$lang = '';
}
}
$pg = $GLOBALS['pagestore']->page($wikipage, $lang);
$pg->read();
// we need to set ViewBase to the name of the actual page, to get wiki to stay inside this page
global $ViewBase;
$ViewBase = $_SERVER['PHP_SELF'] . '?';
foreach ($_GET as $name => $val) {
if ($name != $this->wikipage_param) {
$ViewBase .= $name . '=' . urlencode($val) . '&';
}
}
$ViewBase .= $this->wikipage_param . '=';
return parseText($pg->text, $GLOBALS['ParseEngine'], $wikipage);
}
示例4: niceVarDump
function niceVarDump($obj, $ident = 0)
{
$data = '';
$data .= str_repeat(' ', $ident);
$original_ident = $ident;
$toClose = false;
switch (gettype($obj)) {
case 'object':
$vars = (array) $obj;
$data .= gettype($obj) . ' (' . get_class($obj) . ') (' . count($vars) . ") {\n";
$ident += 2;
foreach ($vars as $key => $var) {
$type = '';
$k = bin2hex($key);
if (strpos($k, '002a00') === 0) {
$k = str_replace('002a00', '', $k);
$type = ':protected';
} elseif (strpos($k, bin2hex("" . get_class($obj) . "")) === 0) {
$k = str_replace(bin2hex("" . get_class($obj) . ""), '', $k);
$type = ':private';
}
$k = hex2bin($k);
if (is_subclass_of($obj, 'ProtobufMessage') && $k == 'values') {
$r = new ReflectionClass($obj);
$constants = $r->getConstants();
$newVar = [];
foreach ($constants as $ckey => $cval) {
if (substr($ckey, 0, 3) != 'PB_') {
$newVar[$ckey] = $var[$cval];
}
}
$var = $newVar;
}
$data .= str_repeat(' ', $ident) . "[{$k}{$type}]=>\n" . niceVarDump($var, $ident) . "\n";
}
$toClose = true;
break;
case 'array':
$data .= 'array (' . count($obj) . ") {\n";
$ident += 2;
foreach ($obj as $key => $val) {
$data .= str_repeat(' ', $ident) . '[' . (is_int($key) ? $key : "\"{$key}\"") . "]=>\n" . niceVarDump($val, $ident) . "\n";
}
$toClose = true;
break;
case 'string':
$data .= 'string "' . parseText($obj) . "\"\n";
break;
case 'NULL':
$data .= gettype($obj);
break;
default:
$data .= gettype($obj) . '(' . strval($obj) . ")\n";
break;
}
if ($toClose) {
$data .= str_repeat(' ', $original_ident) . "}\n";
}
return $data;
}
示例5: action_view
function action_view()
{
global $page, $pagestore, $ParseEngine, $version, $UserName;
global $document, $redirect_from, $view_source;
$pg = $pagestore->page($page);
if (file_exists("modules/" . $page . ".php")) {
require_once "modules/" . $page . ".php";
if (function_exists($page . "_content")) {
eval("\$pg->text=" . $page . "_content();");
}
$pg->mutable = 0;
} else {
if ($version != '') {
$pg->version = $version;
}
$pg->read();
}
$document = $pg->text;
gen_headers($pg->time);
if ($view_source) {
$html = wordwrap($pg->text, 80, "\n", true);
$html = '<pre>' . htmlspecialchars($html) . '</pre>';
} else {
$html = parseText($pg->text, $ParseEngine, $page);
}
template_view(array('page' => $page, 'page_length' => strlen($pg->text), 'html' => $html, 'view_source' => $view_source, 'editable' => $UserName && $pg->mutable, 'timestamp' => $pg->time, 'archive' => $version != '', 'version' => $pg->version, 'edituser' => $pg->username, 'redirect_from' => $redirect_from, 'editver' => $UserName && $pg->mutable ? $version == '' ? 0 : $version : -1));
}
示例6: action_conflict
function action_conflict()
{
global $document, $merge, $page, $pagestore, $ParseEngine;
$pg = $pagestore->page($page);
$pg->read();
template_conflict(array('page' => $page, 'text' => $pg->text, 'html' => parseText($pg->text, $ParseEngine, $page), 'usertext' => $document, 'merge' => $merge, 'timestamp' => $pg->time, 'nextver' => $pg->version + 1));
}
示例7: add_to_category
function add_to_category($page, $catlist)
{
global $pagestore, $Entity, $UserName, $REMOTE_ADDR, $FlgChr;
// Parse the category list for category names.
$parsed = parseText($catlist, array('parse_wikiname', 'parse_freelink'), '');
$pagenames = array();
preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
if (validate_page($page) == 2) {
$page = '((' . $page . '))';
}
// Add it to each category.
foreach ($pagenames as $category) {
$pg = $pagestore->page($category);
$pg->read();
if ($pg->exists) {
if (preg_match('/\\[\\[!.*\\]\\]/', $pg->text)) {
if (!preg_match("/\\[\\[!.*{$page}.*\\]\\]/", $pg->text)) {
$pg->text = preg_replace('/(\\[\\[!.*)\\]\\]/', "\\1 {$page}]]", $pg->text);
} else {
continue;
}
} else {
$pg->text = $pg->text . "\n[[! {$page}]]\n";
}
$pg->text = str_replace("\\", "\\\\", $pg->text);
$pg->text = str_replace("'", "\\'", $pg->text);
$pg->version++;
$pg->comment = '';
$pg->hostname = gethostbyaddr($REMOTE_ADDR);
$pg->username = $UserName;
$pg->write();
}
}
}
示例8: parseFile
function parseFile($path, $baseUrl, $docID)
{
echo " parse file ";
$content = file_get_contents($path, true);
$title = getTitle($content);
deleteFacts($title);
$GLOBALS["paragraphs"] = array();
$contentParse = $content;
while ($contentParse != null) {
$contentParse = parseText($contentParse);
}
echo "got paragraphs, ";
$paragraphs = $GLOBALS["paragraphs"];
$factsExist = count($paragraphs) > 0;
logSubject($title, $factsExist);
foreach ($paragraphs as $text) {
logFact($text, $title, $docID);
}
echo "logged facts";
/*$GLOBALS["urls"] = array();
$contentParse = $content;
while($contentParse != null) {
$contentParse = parseURL($contentParse, $baseUrl);
}/*/
//logURLs($GLOBALS["urls"]);
//echo "<pre>"; print_r($GLOBALS["urls"]); echo "</pre>";
}
示例9: action_preview
function action_preview()
{
global $ParseEngine, $archive;
global $page, $document, $nextver, $pagestore;
$document = str_replace("\r", "", $document);
$pg = $pagestore->page($page);
$pg->read();
template_preview(array('page' => $page, 'text' => $document, 'html' => parseText($document, $ParseEngine, $page), 'timestamp' => $pg->time, 'nextver' => $nextver, 'archive' => $archive));
}
示例10: action_diff
function action_diff()
{
global $pagestore, $page, $ver1, $ver2, $ParseEngine;
$p1 = $pagestore->page($page);
$p1->version = $ver1;
$p2 = $pagestore->page($page);
$p2->version = $ver2;
$diff = diff_compute($p1->read(), $p2->read());
template_diff(array('page' => $p2->as_array(), 'diff_html' => diff_parse($diff), 'html' => parseText($p2->text, $ParseEngine, $page), 'editable' => $p2->acl_check(), 'timestamp' => $p2->time));
}
示例11: action_diff
function action_diff()
{
global $page, $pagestore, $ParseEngine, $UserName, $ver1, $ver2;
$p1 = $pagestore->page($page);
$p1->version = $ver1;
$p2 = $pagestore->page($page);
$p2->version = $ver2;
$diff = diff_compute($p1->read(), $p2->read());
template_diff(array('page' => $page, 'diff_html' => diff_parse($diff), 'html' => parseText($p2->text, $ParseEngine, $page), 'editable' => $p2->mutable, 'timestamp' => $p2->time, 'editver' => $UserName && $p2->mutable ? 0 : -1));
}
示例12: action_tablecsv
function action_tablecsv()
{
global $page, $pagestore, $tablenum;
$pg = $pagestore->page($page);
$pg->read();
$parse_engine = array('parse_htmlpre', 'parse_nowiki', 'parse_tablecsv');
$csv = parseText($pg->text, $parse_engine, $page);
header('Content-Type: text/csv');
header('Content-Disposition: filename="' . $page . '_' . $tablenum . '.csv"');
print $csv;
}
示例13: action_view
function action_view()
{
global $page, $pagestore, $ParseEngine, $version;
$pg = $pagestore->page($page);
if ($version != '') {
$pg->version = $version;
}
$pg->read();
gen_headers($pg->time);
template_view(array('page' => $pg->as_array(), 'title' => $pg->title, 'html' => parseText($pg->text, $ParseEngine, $page), 'editable' => $pg->acl_check(), 'timestamp' => $pg->time, 'archive' => $version != '', 'version' => $pg->version));
}
示例14: text_to_export
function text_to_export($input)
{
$emailuser = parseText($input);
$validuser = $emailuser['valid_email'];
$handle = fopen("export/valid_emails.txt", "w");
foreach ($validuser as $value) {
$content .= "{$value}\n";
}
fwrite($handle, $content);
fclose($handle);
}
示例15: parse
function parse($args, $page)
{
global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
global $FlgChr, $UserName, $UseHotPages;
list($args, $ignoreRegExp) = explode(' ', $args, 2);
$text = '';
if (strstr($args, '*')) {
$list = $pagestore->allpages();
} else {
if (strstr($args, '?')) {
$list = $pagestore->newpages();
} else {
if (strstr($args, '~')) {
$list = $pagestore->emptypages();
} else {
$parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
$pagenames = array();
preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
$list = $pagestore->givenpages($pagenames);
}
}
}
if (count($list) == 0) {
return '';
}
usort($list, 'catSort');
if ($UseHotPages) {
$hotPagesList = $pagestore->getHotPages();
} else {
$hotPagesList = array();
}
$newPages = $pagestore->getNewPages();
$now = time();
for ($i = 0; $i < count($list); $i++) {
if ($ignoreRegExp) {
if (@preg_match($ignoreRegExp, $list[$i][1])) {
continue;
}
}
if ($DayLimit && $i >= $MinEntries && !$full && $now - $list[$i][0] > $DayLimit * 24 * 60 * 60) {
break;
}
$text = $text . html_category($list[$i][0], $list[$i][1], $list[$i][2], $list[$i][3], $list[$i][5], $list[$i][7], $hotPagesList, $newPages);
// Do not put a newline on the last one.
if ($i < count($list) - 1) {
$text = $text . html_newline();
}
}
if ($i < count($list)) {
$text = $text . html_fulllist($page, count($list));
}
return $text;
}