本文整理汇总了PHP中asHtml函数的典型用法代码示例。如果您正苦于以下问题:PHP asHtml函数的具体用法?PHP asHtml怎么用?PHP asHtml使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了asHtml函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_tr
function render_tr(&$obj, $style = "")
{
if (!isset($obj) || !is_object($obj)) {
trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
return;
}
$key = $this->key;
$format = $this->format;
$rest = $this->format;
$style = $this->style ? "class='{$this->style}'" : '';
while (preg_match("/\\{\\?([a-z_]*)\\}(.*)/", $rest, $matches)) {
$key = $matches[1];
$rest = $matches[2];
$value = isset($obj->{$key}) ? $obj->{$key} : "??{$key}";
$format = preg_replace("/\\{\\?{$key}\\}/", asHtml($value), $format);
}
print "<td {$style}>" . $format . '</td>';
}
示例2: taskAjax
/**
* test function for development @ingroup pages
*
* the output of this function could be requested with jquery like:
*
* $('#sideboard div').load('index.php?go=taskAjax',{
* go: 'taskAjax',
* tsk: id
* });
*/
function taskAjax()
{
if ($task_id = intval(get('tsk'))) {
require_once "render/render_wiki.inc.php";
### headline ###
$editable = false;
# flag, if this task can be edited
if ($task = Task::getEditableById($task_id)) {
$editable = true;
} else {
if (!($task = Task::getVisibleById($task_id))) {
echo "Failure";
return;
}
}
echo "<h3>" . asHtml($task->name) . "</h3>";
echo wikifieldAsHtml($task, 'description');
}
}
示例3: __toString
public function __toString()
{
global $PH;
$news = $this->project->getTasks(array('is_news' => 1, 'order_by' => 'created DESC'));
if (!$news) {
return '';
}
#--- news -----------------------------------------------------------
$this->render_blockStart();
$count = 0;
foreach ($news as $n) {
if ($count++ >= $this->max_news) {
break;
}
echo "<div class='post_list_entry'>";
if ($creator = Person::getVisibleById($n->created_by)) {
$link_creator = ' by ' . $creator->getLink();
} else {
$link_creator = '';
}
echo "<h3>" . asHtml($n->name) . "</h3>";
echo "<p class= details>";
echo sprintf(__("%s by %s", "time ago by nickname"), renderTimeAgo($n->created), asHtml($creator->nickname));
if ($comments = $n->getComments()) {
echo " / ";
echo $PH->getLink('taskViewAsDocu', sprintf(__("%s comments"), count($comments)), array('tsk' => $n->id));
}
echo " / ";
echo $PH->getLink("commentNew", __("Add comment"), array('parent_task' => $n->id));
echo "</p>";
echo wikifieldAsHtml($n, 'description');
echo "</div>";
}
$this->render_blockEnd();
return '';
}
示例4: personView
/**
* Person View @ingroup pages
*/
function personView()
{
global $PH;
global $auth;
### get current person ###
$id = getOnePassedId('person', 'people_*');
if (!($person = Person::getVisibleById($id))) {
$PH->abortWarning("invalid person-id");
return;
}
### create from handle ###
$PH->defineFromHandle(array('person' => $person->id));
## is viewed by user ##
$person->nowViewedByUser();
$page = new Page();
$page->cur_tab = 'people';
if ($person->can_login) {
$page->title = $person->nickname;
$page->title_minor = $person->name;
} else {
$page->title = $person->name;
if ($person->category) {
global $g_pcategory_names;
if (isset($g_pcategory_names[$person->category])) {
$page->title_minor = $g_pcategory_names[$person->category];
}
}
}
$page->type = __("Person");
$page->crumbs = build_person_crumbs($person);
$page->options = build_person_options($person);
### skip edit functions ###
if ($edit = Person::getEditableById($person->id)) {
### page functions ###
$page->add_function(new PageFunction(array('target' => 'taskNoteOnPersonNew', 'params' => array('person' => $person->id), 'tooltip' => __('Add task for this people (optionally creating project and effort on the fly)', 'Tooltip for page function'), 'name' => __('Add note', 'Page function person'))));
#$page->add_function(new PageFunction(array(
#'target' =>'personLinkCompanies',
#'params' =>array('person'=>$person->id),
#'tooltip' =>__('Add existing companies to this person'),
#'name' =>__('Companies'),
#)));
$page->add_function(new PageFunction(array('target' => 'personEdit', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit this person', 'Tooltip for page function'), 'name' => __('Edit', 'Page function edit person'))));
$page->add_function(new PageFunction(array('target' => 'personEditRights', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit user rights', 'Tooltip for page function'), 'name' => __('Edit rights', 'Page function for edit user rights'))));
if ($person->id != $auth->cur_user->id) {
$page->add_function(new PageFunction(array('target' => 'personDelete', 'params' => array('person' => $person->id), 'name' => __('Delete'))));
}
$item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $person->id));
if (!$item || $item[0]->is_bookmark == 0) {
#$page->add_function(new PageFunction(array(
# 'target' =>'itemsAsBookmark',
# 'params' =>array('person'=>$person->id),
# 'tooltip' =>__('Mark this person as bookmark'),
# 'name' =>__('Bookmark'),
#)));
} else {
$page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('person' => $person->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark'))));
}
if ($person->state == ITEM_STATE_OK && $person->can_login && ($person->personal_email || $person->office_email)) {
$page->add_function(new PageFunction(array('target' => 'personSendActivation', 'params' => array('person' => $person->id))));
$page->add_function(new PageFunction(array('target' => 'peopleFlushNotifications', 'params' => array('person' => $person->id))));
}
}
### render title ###
echo new PageHeader();
echo new PageContentOpen_Columns();
### write info block (but only for registed users)
global $auth;
if ($auth->cur_user->id != confGet('ANONYMOUS_USER')) {
$block = new PageBlock(array('title' => __('Summary', 'Block title'), 'id' => 'summary'));
$block->render_blockStart();
echo "<div class=text>";
if ($person->mobile_phone) {
echo "<div class=labeled><label>" . __('Mobile', 'Label mobilephone of person') . '</label>' . asHtml($person->mobile_phone) . '</div>';
}
if ($person->office_phone) {
echo "<div class=labeled><label>" . __('Office', 'label for person') . '</label>' . asHtml($person->office_phone) . '</div>';
}
if ($person->personal_phone) {
echo "<div class=labeled><label>" . __('Private', 'label for person') . '</label>' . asHtml($person->personal_phone) . '</div>';
}
if ($person->office_fax) {
echo "<div class=labeled><label>" . __('Fax (office)', 'label for person') . '</label>' . asHtml($person->office_fax) . '</div>';
}
if ($person->office_homepage) {
echo "<div class=labeled><label>" . __('Website', 'label for person') . '</label>' . url2linkExtern($person->office_homepage) . '</div>';
}
if ($person->personal_homepage) {
echo "<div class=labeled><label>" . __('Personal', 'label for person') . '</label>' . url2linkExtern($person->personal_homepage) . '</div>';
}
if ($person->office_email) {
echo "<div class=labeled><label>" . __('E-Mail', 'label for person office email') . '</label>' . url2linkMail($person->office_email) . '</div>';
}
if ($person->personal_email) {
echo "<div class=labeled><label>" . __('E-Mail', 'label for person personal email') . '</label>' . url2linkMail($person->personal_email) . '</div>';
}
if ($person->personal_street) {
echo "<div class=labeled><label>" . __('Adress Personal', 'Label') . '</label>' . asHtml($person->personal_street) . '</div>';
//.........这里部分代码省略.........
示例5: printChangeLine
/**
* writes a changeline as html
*
*
*/
function printChangeLine($c)
{
global $PH;
global $auth;
if ($c->person_by == $auth->cur_user->id) {
$changed_by_current_user = true;
} else {
$changed_by_current_user = false;
}
if ($c->item->type == ITEM_TASK) {
if ($changed_by_current_user) {
echo '<li class=by_cur_user>';
} else {
echo '<li>';
}
echo $c->item->getLink(false);
} elseif ($c->item->type == ITEM_FILE) {
echo '<li>' . $PH->getLink('fileView', $c->item->name, array('file' => $c->item->id));
} else {
trigger_error('printChangeLine() for unknown item item', E_USER_WARNING);
return;
}
/**
* remarks on new, updated or item that require feedback
*/
if ($c->item) {
if ($c->item->isFeedbackRequestedForUser()) {
echo '<span class=new> (' . __('Needs feedback') . ') </span>';
} elseif ($new = $c->item->isChangedForUser()) {
if ($new == 1) {
echo '<span class=new> (' . __('New') . ') </span>';
} else {
echo '<span class=new> (' . __('Updated') . ') </span>';
}
}
}
echo "<span class=sub>{$c->txt_what}";
if ($person = Person::getVisibleById($c->person_by)) {
echo ' ' . __('by') . ' <span class=person>' . asHtml($person->name) . "</span>";
}
echo ' ' . renderTimeAgo($c->timestamp);
echo "</span>";
echo '</li>';
return;
}
示例6: commentsMoveToFolder
/**
* move comments to folder...
*/
function commentsMoveToFolder()
{
global $PH;
$comment_ids = getPassedIds('comment', 'comments_*');
if (!$comment_ids) {
$PH->abortWarning(__("Select some comments to move"));
return;
}
/**
* if folder was given, directly move tasks...
*/
$target_id = -1;
# target is unknown
$folder_ids = getPassedIds('folder', 'folders_*');
if (count($folder_ids) == 1) {
if ($folder_task = Task::getVisibleById($folder_ids[0])) {
$target_id = $folder_task->id;
}
} else {
if (get('from_selection')) {
$target_id = 0;
# to ungrout to root?
}
}
if ($target_id != -1) {
if ($target_id != 0) {
if (!($target_task = Task::getEditableById($target_id))) {
$PH->abortWarning(__("insufficient rights"));
}
}
$count = 0;
foreach ($comment_ids as $id) {
if ($comment = Comment::getEditableById($id)) {
$comment->task = $target_id;
/**
* @@@ do we have to reset ->comment as well?
*
* this splits discussions into separate comments...
*/
$comment->comment = 0;
$comment->update();
} else {
new FeedbackWarning(sprintf(__("Can not edit comment %s"), asHtml($comment->name)));
}
}
### return to from-page? ###
if (!$PH->showFromPage()) {
$PH->show('home');
}
exit;
}
/**
* build page folder list to select target...
*/
require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php';
### get project ####
if (!($comment = Comment::getVisibleById($comment_ids[0]))) {
$PH->abortWarning("could not get comment", ERROR_BUG);
}
if (!($project = Project::getVisibleById($comment->project))) {
$PH->abortWarning("task without project?", ERROR_BUG);
}
$page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'company_name'));
$page->cur_tab = 'projects';
$page->type = __("Edit tasks");
$page->title = $project->name;
$page->title_minor = __("Select one folder to move comments into");
$page->crumbs = build_project_crumbs($project);
$page->options[] = new NaviOption(array('target_id' => 'commentsMoveToFolder'));
echo new PageHeader();
echo new PageContentOpen();
echo __("... or select nothing to move to project root");
### write selected comments as hidden fields ###
foreach ($comment_ids as $id) {
if ($comment = Comment::getEditableById($id)) {
echo "<input type=hidden name='comments_{$id}_chk' value='1'>";
}
}
$list = new ListBlock_tasks();
$list->reduced_header = true;
$list->query_options['show_folders'] = true;
$list->query_options['folders_only'] = true;
$list->query_options['project'] = $project->id;
$list->groupings = NULL;
$list->block_functions = NULL;
$list->id = 'folders';
unset($list->columns['project']);
unset($list->columns['status']);
unset($list->columns['date_start']);
unset($list->columns['days_left']);
unset($list->columns['created_by']);
unset($list->columns['label']);
$list->no_items_html = __("No folders in this project...");
$list->functions = array();
$list->active_block_function = 'tree';
$list->print_automatic($project);
echo "<input type=hidden name='from_selection' value='1'>";
//.........这里部分代码省略.........
示例7: _render_commentField
protected function _render_commentField()
{
global $PH;
echo "<div class=footer_form>";
require_once confGet('DIR_STREBER') . "render/render_form.inc.php";
$project = new Project($this->item_with_comments->project);
$form = new PageForm();
$form->button_cancel = false;
$form->add(new Form_CustomHTML('<h3>' . __("Add Comment") . "</h3>"));
### Comment ###
$comment_name = '';
$comment = new Comment(array('id' => 0, 'name' => $comment_name));
$e = $comment->fields['description']->getFormElement($comment, __('Comment'));
$e->rows = 8;
$form->add($e);
$form->add($comment->fields['name']->getFormElement($comment, __('Summary')));
### request feedback
$form->add(buildRequestFeedbackInput($project));
/**
* to reduce spam, enforce captcha test for guests
*/
global $auth;
if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) {
$form->addCaptcha();
}
### some required hidden fields for correct data passing ###
$form->add(new Form_HiddenField('comment_task', '', $this->item_with_comments->id));
$form->add(new Form_HiddenField('comment', '', 0));
if ($return = get('return')) {
$form->add(new Form_HiddenField('return', '', asHtml($return)));
}
$PH->go_submit = 'commentEditSubmit';
echo $form;
echo "</div>";
}
示例8: getLink
public function getLink($short_name = true, $strikeDone = true)
{
$style_isdone = $this->isOfCategory(array(TCATEGORY_TASK, TCATEGORY_BUG)) && ($strikeDone && $this->status >= STATUS_COMPLETED) ? 'isDone' : '';
global $PH;
if ($short_name) {
return '<span title="' . asHtml($this->name) . '" class="item task">' . $PH->getLink('taskView', $this->getShort(), array('tsk' => $this->id), $style_isdone) . '</span>';
} else {
return $PH->getLink('taskView', $this->name, array('tsk' => $this->id), $style_isdone);
}
}
示例9: getServerVar
function getServerVar($name, $as_html = false)
{
if (isset($_SERVER[$name])) {
if ($as_html) {
return asHtml($_SERVER[$name]);
}
return $_SERVER[$name];
}
}
示例10: __toString
public function __toString()
{
$buffer = "";
$buffer .= '<div id="headline">';
if ($this->page->type) {
$buffer .= '<div class="type">' . $this->page->type . '</div>';
}
$buffer .= '<h1 class="title">' . asHtml($this->page->title);
if ($this->page->title_minor_html) {
$buffer .= '<span class="minor"><span class="separator">/</span>' . $this->page->title_minor_html . '</span>';
} else {
if ($this->page->title_minor) {
$buffer .= '<span class="minor"><span class="separator">/</span>' . asHtml($this->page->title_minor) . '</span>';
}
}
$buffer .= "</h1>";
$buffer .= "</div>";
return $buffer;
}
示例11: activateAccount
/**
* Activate account from notification mail @ingroup pages
*/
function activateAccount()
{
global $auth;
global $PH;
$auth->removeUserCookie();
if ($tuid = get('tuid')) {
$tuid = asKey($tuid);
# clean string
if ($user = $auth->setCurUserByIdentifier($tuid)) {
$auth->storeUserCookie();
$PH->messages[] = sprintf(__("Welcome %s. Please adjust your profile and insert a good password to activate your account."), asHtml($user->name));
global $g_person_fields;
$PH->show('personEdit', array('person' => $user->id));
exit;
}
}
$PH->messages[] = __("Sorry, but this activation code is no longer valid. If you already have an account, you could enter your name and use the <b>forgot password link</b> below.");
$PH->show('loginForm');
}
示例12: arrayAsHtml
/**
* implodes an array of strings into save html output
*
* - used for rendering differences
*/
function arrayAsHtml($strings)
{
$buffer = '';
$sep = '';
foreach ($strings as $s) {
$buffer .= $sep . asHtml($s);
$sep = '<br>';
}
$buffer = str_replace(" ", " ", $buffer);
return $buffer;
}
示例13: __toString
public function __toString()
{
$buffer = "<p " . $this->renderCssClasses() . " {$this->id} {$this->display}><label>{$this->title}</label>";
$buffer .= "<select size=1 name='{$this->name}' id='{$this->name}'>";
foreach ($this->options as $group_title => $group_options) {
if ($group_title != NO_OPTION_GROUP) {
$buffer .= "<optgroup label='" . asHtml($group_title) . "'>";
}
foreach ($group_options as $option_value => $option_name) {
$str_selected = $this->value == $option_value ? 'selected=1' : '';
$buffer .= '<option ' . $str_selected . ' label="' . asHtml($option_name) . '" value="' . asHtml($option_value) . '" >' . asHtml($option_name) . '</option>';
}
if ($group_title != NO_OPTION_GROUP) {
$buffer .= "</optgroup>";
}
}
$buffer .= "</select></p>";
return $buffer;
}
示例14: renderListHtml
//.........这里部分代码省略.........
} else {
$count_estimated += $t->estimated;
}
$this->render_trow($t, $style);
### render additional information ###
if ($this->groupings && $this->active_block_function == 'grouped') {
echo '<tr class=details><td colspan=' . count($this->columns) . '>';
$html_buffer = '';
if ($t->issue_report) {
$ir = Issue::getById($t->issue_report);
} else {
$ir = NULL;
}
global $g_severity_names;
global $g_reproducibility_names;
global $g_prio_names;
global $g_status_names;
#if($t->prio != PRIO_NORMAL && isset($g_prio_names[$t->prio])) {
# echo "<p>".$g_prio_names[$t->prio]."</p>";
#}
if ($ir && $ir->severity && isset($g_severity_names[$ir->severity])) {
$html_buffer .= "<p>" . $g_severity_names[$ir->severity] . "</p>";
}
if ($ir && $ir->version) {
$html_buffer .= "<p>" . $ir->version . "</p>";
}
if ($ir && $ir->production_build) {
$html_buffer .= "<p>" . $ir->production_build . "</p>";
}
if ($ir && $ir->reproducibility && isset($g_reproducibility_names[$ir->reproducibility])) {
$html_buffer .= "<p>" . $g_reproducibility_names[$ir->reproducibility] . "</p>";
}
if ($t->status != STATUS_OPEN && $t->status != STATUS_NEW && isset($g_status_names[$t->status])) {
$html_buffer .= "<p>" . $g_status_names[$t->status] . "</p>";
}
echo '<div class=severity>';
if ($html_buffer) {
echo $html_buffer;
} else {
echo ' ';
# dummy content to keep floating
}
echo '</div>';
echo '<div class=description> ';
if ($t->description) {
echo "<p>" . wikifieldAsHtml($t, 'description') . "</p>";
}
### steps ###
if ($ir && isset($ir->steps_to_reproduce) && $ir->steps_to_reproduce) {
echo "<p>" . wikifieldAsHtml($ir, 'steps_to_reproduce') . "</p>";
}
if ($ir && isset($ir->expected_result) && $ir->expected_result) {
echo "<p>" . wikifieldAsHtml($ir, 'expected_result') . "</p>";
}
if ($ir && isset($ir->suggested_solution) && $ir->suggested_solution) {
echo "<p>" . wikifieldAsHtml($ir, 'suggested_solution') . "</p>";
}
echo ' </div>';
echo '<div class=steps>';
if ($c = $t->getLatestComment()) {
echo "<p>" . __('Latest Comment') . " ";
if ($person = Person::getVisibleById($c->created_by)) {
echo __("by") . ' ' . $person->getLink();
}
echo " (" . renderDateHtml($c->modified) . "):";
echo "</p>";
if ($c->name) {
echo '<p>' . asHtml($c->name) . '</p>';
}
if ($c->description) {
#echo "<p>". wikifieldAsHtml($c->description, $project). "</p>";
echo "<p>" . wikifieldAsHtml($c, "description") . "</p>";
}
}
echo ' </div>';
echo '<div class=assigned_to>';
$people = $t->getAssignedPeople();
if ($people) {
$sep = '';
echo "<p>" . __('for') . " ";
foreach ($people as $p) {
echo $sep . $p->getLink();
$sep = ', ';
}
echo "</p>";
}
echo '</div>';
echo '</td></tr>';
}
}
#$this->render_trow($t);
if ($this->show_summary) {
$this->summary = sprintf(__("%s open tasks / %s h"), count($tasks), $count_estimated);
} else {
$this->summary = '';
}
$this->render_tfoot();
$this->render_blockEnd();
}
}
示例15: render_tr
function render_tr(&$file, $style = "")
{
global $PH;
if (!isset($file) || !$file instanceof File) {
return;
}
#$buffer = $PH->getLink('fileView',__("Details"), array('file'=>$file->id),'item file');
$buffer = '';
if ($file->mimetype == 'image/png' || $file->mimetype == 'image/x-png' || $file->mimetype == 'image/jpeg' || $file->mimetype == 'image/pjpeg' || $file->mimetype == 'image/jpg' || $file->mimetype == 'image/gif') {
$buffer .= "<a target='blank' href='" . $PH->getUrl('fileDownloadAsImage', array('file' => $file->id)) . "'>";
#$buffer.= "<img class='left' title='".asHtml($file->name)."' alt='".asHtml($file->name)."' src='".$PH->getUrl('fileDownloadAsImage',array('file'=>$file->id,'max_size'=>100))."'>"
$buffer .= "<img class='left' title='" . asHtml($file->name) . "' " . " alt='" . asHtml($file->name) . "'" . " src='" . $file->getCachedUrl(100) . "'" . ">";
$buffer .= "</a>";
}
print "<td>{$buffer}</td>";
}