本文整理汇总了PHP中formatReady函数的典型用法代码示例。如果您正苦于以下问题:PHP formatReady函数的具体用法?PHP formatReady怎么用?PHP formatReady使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatReady函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
public static function format($text)
{
StudipFormat::addStudipMarkup("blubberhashtag", "(^|\\s)#([\\w\\d_\\.\\-]*[\\w\\d])", "", "ForumPosting::markupHashtags");
$output = formatReady($text);
StudipFormat::removeStudipMarkup("blubberhashtag");
return $output;
}
示例2: format
/**
* Special format-function that adds hashtags to the common formatReady-markup.
* @param string $text : original text with studip-markup plus hashtags
* @return string : formatted text
*/
public static function format($text)
{
StudipFormat::addStudipMarkup("blubberhashtag", BlubberPosting::$hashtags_regexp, null, "BlubberPosting::markupHashtags");
$output = formatReady($text);
StudipFormat::removeStudipMarkup("blubberhashtag");
return $output;
}
示例3: get_data_action
/**
* sends tour object as json data
*
* @param string $tour_id id of tour object
* @param String $step_nr number of step to start with
*/
function get_data_action($tour_id, $step_nr = 1)
{
$this->route = get_route(Request::get('route'));
$this->tour = new HelpTour($tour_id);
if (!$this->tour->isVisible() or !$this->route) {
return $this->render_nothing();
}
$this->user_visit = new HelpTourUser(array($tour_id, $GLOBALS['user']->user_id));
if ($this->user_visit->step_nr > 1 and !$_SESSION['active_tour']['step_nr'] and $this->tour->type == 'tour') {
$data['last_run'] = sprintf(_('Wollen Sie die Tour "%s" an der letzten Position fortsetzen?'), $this->tour->name);
$data['last_run_step'] = $this->user_visit->step_nr;
$data['last_run_href'] = URLHelper::getURL($this->tour->steps[$this->user_visit->step_nr - 1]->route, NULL, true);
} else {
$_SESSION['active_tour'] = array('tour_id' => $tour_id, 'step_nr' => $step_nr, 'last_route' => $this->tour->steps[$step_nr - 1]->route, 'previous_route' => '', 'next_route' => '');
$this->user_visit->step_nr = $step_nr;
$this->user_visit->store();
}
$first_step = $step_nr;
while ($first_step > 1 and $this->route == $this->tour->steps[$first_step - 2]->route) {
$first_step--;
}
if ($first_step > 1 and $this->tour->type == 'tour') {
$data['back_link'] = URLHelper::getURL($this->tour->steps[$first_step - 2]->route, NULL, true);
$_SESSION['active_tour']['previous_route'] = $this->tour->steps[$first_step - 2]->route;
}
$data['route_step_nr'] = $first_step;
$next_first_step = $first_step;
while ($this->route == $this->tour->steps[$next_first_step - 1]->route) {
$data['data'][] = array('step_nr' => $this->tour->steps[$next_first_step - 1]->step, 'element' => $this->tour->steps[$next_first_step - 1]->css_selector, 'title' => htmlReady($this->tour->steps[$next_first_step - 1]->title), 'tip' => formatReady($this->tour->steps[$next_first_step - 1]->tip), 'route' => $this->tour->steps[$next_first_step - 1]->route, 'action_next' => $this->tour->steps[$next_first_step - 1]->action_next, 'action_prev' => $this->tour->steps[$next_first_step - 1]->action_prev, 'interactive' => $this->tour->steps[$next_first_step - 1]->interactive ? '1' : '', 'orientation' => $this->tour->steps[$next_first_step - 1]->orientation);
$next_first_step++;
}
if ($this->tour->steps[$step_nr - 1]->route != $this->route) {
$data['redirect'] = URLHelper::getURL($this->tour->steps[$step_nr - 1]->route, NULL, true);
} elseif (!count($data['data'])) {
return $this->render_nothing();
}
if ($next_first_step <= count($this->tour->steps)) {
if ($this->tour->type == 'tour') {
$data['proceed_link'] = URLHelper::getURL($this->tour->steps[$next_first_step - 1]->route, NULL, true);
}
$_SESSION['active_tour']['next_route'] = $this->tour->steps[$next_first_step - 1]->route;
}
$data['edit_mode'] = $this->help_admin;
$data['step_count'] = count($this->tour->steps);
$data['controls_position'] = 'BR';
$data['tour_type'] = $this->tour->type;
$data['tour_title'] = htmlReady($this->tour->name);
$template = $GLOBALS['template_factory']->open('tour/tour.php');
$template->set_layout(null);
$data['tour_html'] = $template->render();
$this->set_content_type('application/json; charset=UTF-8');
return $this->render_text(json_encode(studip_utf8encode($data)));
}
示例4: getStepTemplate
/**
* Returns the Flexi template for entering the necessary values
* for this step.
*
* @param Array $values Pre-set values
* @param int $stepnumber which number has the current step in the wizard?
* @param String $temp_id temporary ID for wizard workflow
* @return String a Flexi template for getting needed data.
*/
public function getStepTemplate($values, $stepnumber, $temp_id)
{
// We only need our own stored values here.
$values = $values[__CLASS__];
// Load template from step template directory.
$factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
$tpl = $factory->open('studyareas/index');
if ($values['studyareas']) {
$tree = $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findMany($values['studyareas'])), false);
$tpl->set_attribute('assigned', $tree);
} else {
$tpl->set_attribute('assigned', array());
}
$tpl->set_attribute('values', $values);
// First tree level is always shown.
$tree = StudipStudyArea::findByParent(StudipStudyArea::ROOT);
if (count($tree) == 0) {
PageLayout::postError(formatReady(_('Das Anlegen einer ' . 'Veranstaltung ist nicht möglich, da keine Studienbereiche ' . 'existieren. Bitte wenden Sie sich an [die ' . 'Stud.IP-Administration]' . URLHelper::getLink('dispatch.php/siteinfo/show') . ' .')));
return false;
}
/*
* Someone works without JS activated, load all ancestors and
* children of open node.
*/
if ($values['open_node']) {
$tpl->set_attribute('open_nodes', $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findByParent($values['open_node'])), false, true));
}
/*
* Someone works without JS and has entered a search term:
* build the partial tree with search results.
*/
if ($values['searchterm']) {
$search = $this->searchSemTree($values['searchterm'], false, true);
if ($search) {
$tpl->set_attribute('open_nodes', $search);
$tpl->set_attribute('search_result', $search);
unset($values['open_node']);
} else {
PageLayout::postMessage(MessageBox::info(_('Es wurde kein Suchergebnis gefunden.')));
unset($values['searchterm']);
}
}
$tpl->set_attribute('tree', $tree);
$tpl->set_attribute('ajax_url', $values['ajax_url'] ?: URLHelper::getLink('dispatch.php/course/wizard/ajax'));
$tpl->set_attribute('no_js_url', $values['no_js_url'] ?: 'dispatch.php/course/wizard/forward/' . $stepnumber . '/' . $temp_id);
$tpl->set_attribute('stepnumber', $stepnumber);
$tpl->set_attribute('temp_id', $temp_id);
return $tpl->render();
}
示例5: createEvaluationHeader
/**
* createEvaluationHeader: generate the head of an evaluation (title and base text)
* @param the evaluation
* @returns a table row
*/
function createEvaluationHeader($eval, $votedNow, $votedEarlier)
{
$br = new HTMpty("br");
$tr = new HTM("tr");
$td = new HTM("td");
$td->attr("class", "table_row_even");
$table2 = new HTM("table");
$table2->attr("width", "100%");
$tr2 = new HTM("tr");
$td2 = new HTM("td");
$td2->attr("width", "90%");
$td2->attr("valign", "top");
if ($eval->isError()) {
$td2->html(EvalCommon::createErrorReport($eval, _("Fehler")));
$td2->html($br);
}
$span = new HTM("span");
$span->attr("class", "eval_title");
$span->html(htmlReady($eval->getTitle()));
$td2->cont($span);
$td2->cont($br);
$td2->cont($br);
if ($votedNow) {
$message = new HTML('div');
$message->_content = array((string) MessageBox::success(_("Vielen Dank für Ihre Teilnahme.")));
$td2->cont($message);
} elseif ($votedEarlier) {
$message = new HTML('div');
$message->_content = array((string) MessageBox::info(_("Sie haben an dieser Evaluation bereits teilgenommen.")));
$td2->cont($message);
} else {
$td2->html(formatReady($eval->getText()));
$td2->cont($br);
}
$tr2->cont($td2);
$td2 = new HTM("td");
$td2->attr("width", "250");
$td2->attr("valign", "top");
$td2->html(EvalShow::createInfoBox($eval, $votedNow || $votedEarlier));
$tr2->cont($td2);
$table2->cont($tr2);
$td->cont($table2);
$tr->cont($td);
return $tr;
}
示例6: addContent
/**
* Adding Stud.IP formatted code to the current page of the pdf.
* Remember to call addPage first.
* @param string $content Stud.IP formatted code
*/
public function addContent($content)
{
preg_match_all("#\\[comment(=.*)?\\](.*)\\[/comment\\]#msU", $content, $matches);
if (count($matches[0])) {
$endnote .= "<br><br>" . _("Kommentare") . "<hr>";
for ($i = 0; $i < count($matches[0]); $i++) {
$endnote .= $i + 1 . ") " . htmlReady(substr($matches[1][$i], 1)) . ": " . htmlReady($matches[2][$i]) . "<br>";
}
}
$content = preg_replace("#\\[comment(=.*)?\\](.*)\\[/comment\\]#emsU", '$this->addEndnote("//1", "//2")', $content);
$content = formatReady($content, true, true, true, null);
$content = str_replace("<table", "<table border=\"1\"", $content);
// Since TCPDF cannot handle missing images at all, the content needs
// to be cleaned from those (see tickets #2957, #3329 and #3688)
$content = preg_replace_callback('/<img[^>]+src="(.*?)"[^>]*>/', function ($match) {
$url = $match[1];
// Detect possible html entities in url and remove them
if (strpos($url, '&') !== false) {
$url = html_entity_decode($url);
}
// Handle optional media proxy
if (Config::GetInstance()->LOAD_EXTERNAL_MEDIA) {
$parsed = parse_url($url);
// Detect media proxy
if (strpos($parsed['path'], 'media_proxy') !== false && strpos($parsed['query'], 'url=') !== false) {
// Remove media proxy
parse_str($parsed['query'], $parameters);
$url = $parameters['url'];
}
}
// Fetch headers from url, handle possible redirects
do {
$headers = get_headers($url, true);
list(, $status) = explode(' ', $headers[0]);
$url = $header['Location'] ?: $header['location'] ?: $url;
} while (in_array($status, array(300, 301, 302, 303, 305, 307)));
$status = $status ?: 404;
// Replace image with link on error (and not internal), otherwise return sainitized
// url
return (!is_internal_url($url) || $status == 404) && $status >= 400 ? sprintf('[<a href="%s">%s</a>]', $url, basename($url)) : str_replace($match[1], $url, $match[0]);
}, $content);
$this->writeHTML($content . $endnote);
}
示例7: __construct
public function __construct($label, $id, $language = null)
{
$language = $language ?: $GLOBALS['user']->preferred_language;
try {
$query = "SELECT content\n FROM help_content\n WHERE content_id = :id AND language = :language\n ORDER BY version DESC\n LIMIT 1";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':id', $id);
$statement->bindValue(':language', $language);
$statement->execute();
$text = $statement->fetchColumn() ?: sprintf('Unknown help id "%s"', $id);
$content = sprintf('<strong>%s</strong><p>%s</p>', htmlReady($label), formatReady($text));
} catch (Exception $e) {
if ($GLOBALS['user']->perms === 'root') {
$content = 'DB-Error: please migrate';
} else {
$content = '';
}
}
parent::__construct($content);
}
示例8: getItemContent
function getItemContent($item_id)
{
$content = "\n<table width=\"90%\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\" style=\"font-size:10pt\">";
if ($item_id == "root") {
$content .= "\n<tr><td class=\"table_header_bold\" align=\"left\">" . htmlReady($this->tree->root_name) . " </td></tr>";
$content .= "\n<tr><td class=\"blank\" align=\"left\">" . htmlReady($this->root_content) . " </td></tr>";
$content .= "\n</table>";
return $content;
}
$range_object = RangeTreeObject::GetInstance($item_id);
$name = $range_object->item_data['type'] ? $range_object->item_data['type'] . ": " : "";
$name .= $range_object->item_data['name'];
$content .= "\n<tr><td class=\"table_header_bold\" align=\"left\">" . htmlReady($name) . " </td></tr>";
if (is_array($range_object->item_data_mapping)) {
$content .= "\n<tr><td class=\"blank\" align=\"left\">";
foreach ($range_object->item_data_mapping as $key => $value) {
if ($range_object->item_data[$key]) {
$content .= "<b>" . htmlReady($value) . ":</b> ";
$content .= formatLinks($range_object->item_data[$key]) . " ";
}
}
$content .= "</td></tr><tr><td class=\"blank\" align=\"left\">" . "<a href=\"" . URLHelper::getLink("dispatch.php/institute/overview?auswahl=" . $range_object->item_data['studip_object_id']) . "\"" . tooltip(_("Seite dieser Einrichtung in Stud.IP aufrufen")) . ">" . htmlReady($range_object->item_data['name']) . "</a> " . _("in Stud.IP") . "</td></tr>";
} elseif (!$range_object->item_data['studip_object']) {
$content .= "\n<tr><td class=\"blank\" align=\"left\">" . _("Dieses Element ist keine Stud.IP-Einrichtung, es hat daher keine Grunddaten.") . "</td></tr>";
} else {
$content .= "\n<tr><td class=\"blank\" align=\"left\">" . _("Keine Grunddaten vorhanden!") . "</td></tr>";
}
$content .= "\n<tr><td> </td></tr>";
$kategorien =& $range_object->getCategories();
if ($kategorien->numRows) {
while ($kategorien->nextRow()) {
$content .= "\n<tr><td class=\"table_header_bold\">" . htmlReady($kategorien->getField("name")) . "</td></tr>";
$content .= "\n<tr><td class=\"blank\">" . formatReady($kategorien->getField("content")) . "</td></tr>";
}
} else {
$content .= "\n<tr><td class=\"blank\">" . _("Keine weiteren Daten vorhanden!") . "</td></tr>";
}
$content .= "</table>";
return $content;
}
示例9: getNotificationObjects
function getNotificationObjects($course_id, $since, $user_id)
{
$items = array();
$type = get_object_type($course_id, array('sem', 'inst', 'fak'));
if ($type == 'sem') {
$query = 'SELECT dokumente.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
FROM dokumente
JOIN auth_user_md5 USING (user_id)
JOIN user_info USING (user_id)
JOIN seminar_user USING (Seminar_id)
JOIN seminare USING (Seminar_id)
WHERE seminar_user.user_id = ? AND Seminar_id = ?
AND dokumente.chdate > ?';
} else {
$query = 'SELECT dokumente.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
FROM dokumente
JOIN auth_user_md5 USING (user_id)
JOIN user_info USING (user_id)
JOIN user_inst ON (seminar_id = Institut_id)
JOIN Institute USING (Institut_id)
WHERE user_inst.user_id = ? AND Institut_id = ?
AND dokumente.chdate > ?';
}
$stmt = DBManager::get()->prepare($query);
$stmt->execute(array($user_id, $course_id, $since));
while ($row = $stmt->fetch()) {
$folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $row['seminar_id']));
if ($folder_tree->isDownloadFolder($row['range_id'], $user_id)) {
// use correct text depending on type of object
if ($type == 'sem') {
$summary = sprintf('%s hat im Dateibereich der Veranstaltung "%s" die Datei "%s" hochgeladen.', $row['fullname'], $row['Name'], $row['name']);
} else {
$summary = sprintf('%s hat im Dateibereich der Einrichtung "%s" die Datei "%s" hochgeladen.', $row['fullname'], $row['Name'], $row['name']);
}
// create ContentElement
$items[] = new ContentElement(_('Datei') . ': ' . $row['name'], $summary, formatReady(GetDownloadLink($row['dokument_id'], $row['name'])), $row['user_id'], $row['fullname'], URLHelper::getLink('folder.php#anker', array('cid' => $row['seminar_id'], 'cmd' => 'tree', 'open' => $row['dokument_id'])), $row['chdate']);
}
}
return $items;
}
示例10: getNotificationObjects
function getNotificationObjects($course_id, $since, $user_id)
{
$items = array();
$type = get_object_type($course_id, array('sem', 'inst', 'fak'));
if ($type == 'sem') {
$query = 'SELECT scm.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
FROM scm
JOIN auth_user_md5 USING (user_id)
JOIN user_info USING (user_id)
JOIN seminar_user ON (range_id = Seminar_id)
JOIN seminare USING (Seminar_id)
WHERE seminar_user.user_id = ? AND Seminar_id = ?
AND scm.chdate > ?';
} else {
$query = 'SELECT scm.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
FROM scm
JOIN auth_user_md5 USING (user_id)
JOIN user_info USING (user_id)
JOIN user_inst ON (range_id = Institut_id)
JOIN Institute USING (Institut_id)
WHERE user_inst.user_id = ? AND Institut_id = ?
AND scm.chdate > ?';
}
$stmt = DBManager::get()->prepare($query);
$stmt->execute(array($user_id, $course_id, $since));
while ($row = $stmt->fetch()) {
// use correct text depending on type of object
if ($type == 'sem') {
$summary = sprintf('%s hat in der Veranstaltung "%s" die Informationsseite "%s" geändert.', $row['fullname'], $row['Name'], $row['tab_name']);
} else {
$summary = sprintf('%s hat in der Einreichtung "%s" die Informationsseite "%s" geändert.', $row['fullname'], $row['Name'], $row['tab_name']);
}
$link = URLHelper::getLink('dispatch.php/course/scm/' . $row['scm_id'], array('cid' => $row['range_id']));
$items[] = new ContentElement('Freie Informationsseite: ' . $row['tab_name'], $summary, formatReady($row['content']), $row['user_id'], $row['fullname'], $link, $row['chdate']);
}
return $items;
}
示例11: if
echo $p["name"] == $plugin_name ? "selected" : "";
?>
>
<?php
echo $p["visual_name"];
?>
</option>
<? endforeach; ?>
</select>
<? if ($plugin_name) : ?>
<br>
<?php
echo strlen($plugin["description"]) > 0 ? Icon::create('info-circle', 'inactive')->asImg() : '';
?>
<?php
echo formatReady($plugin["description"]);
?>
<br>
<br>
<?php
echo _("1. Wählen Sie mit <b>Durchsuchen</b> eine Datei von Ihrer Festplatte aus.");
?>
<br>
<input name="xmlfile" type="file" style="width:250px" accept="text/xml" maxlength="8000000"><br>
<br>
<?php
echo _("2. Klicken Sie auf <b>Absenden</b>, um die Datei hochzuladen.");
?>
<br>
<br>
<?php
示例12: if
<br>
<? if (trim($constraint['content'])) : ?>
<div class="posting">
<div class="postbody">
<div class="content"><?php
echo formatReady(ForumEntry::killEdit($constraint['content']));
?>
</div>
</div>
</div>
<? endif ?>
<? if (!empty($list)) foreach ($list as $category_id => $entries) : ?>
<table class="default forum" data-category-id="<?php
echo $category_id;
?>
">
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th colspan="2"><?php
echo _('Thema');
?>
示例13: htmlReady
<div style="display: flex; width: 100%; margin-bottom: 20px;">
<div>
<img class="avatar-normal" src="<?php
echo htmlReady($user['avatar']);
?>
">
</div>
<div style="width: 100%; padding-left: 10px;">
<h1><?php
echo htmlReady($user['name']);
?>
</h1>
<div>
<?php
echo formatReady($user['description']);
?>
</div>
</div>
</div>
<? if (count($materials)) : ?>
<section class="contentbox">
<header>
<h1>
<?php
echo Icon::create("service", "clickable")->asImg("16px");
?>
<?php
echo _("Lernmaterialien");
?>
</h1>
示例14: formatReady
<?
# Lifter010: TODO
?>
<div class="modaloverlay">
<div class="messagebox">
<div class="content">
<?php
echo formatReady($question);
?>
</div>
<div class="content">
<form action="<?php
echo $action;
?>
" method="post">
<?php
echo CSRFProtection::tokenTag();
?>
<?foreach($elements as $e) :?>
<div style="margin-top: 0.5em; text-align: left;">
<?php
echo $e;
?>
</div>
<?endforeach?>
<div class="buttons">
<?php
echo $approvalbutton;
?>
<span style="margin-left: 1em;">
<?php
示例15: extFormatReady
function extFormatReady ($text) {
if ($this->is_raw_output) {
return $text;
}
return formatReady($text, TRUE, TRUE, FALSE);
}