本文整理汇总了PHP中eL函数的典型用法代码示例。如果您正苦于以下问题:PHP eL函数的具体用法?PHP eL怎么用?PHP eL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eL函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* Returns (safe) HTML which displays a field
* @access public
* @param array $task task data
* @param array $parents parents for a category item
* @param bool $plain this is **not** meant to be safe, but basically to display content where HTML tags are disturbing
* @return string
*/
function view($task = array(), $parents = array(), $plain = false)
{
if (!isset($task['field' . $this->id]) || !$task['field' . $this->id]) {
$html = sprintf('<span class="fade">%s</span>', eL('notspecified'));
} else {
$html = '';
switch ($this->prefs['field_type']) {
case FIELD_LIST:
if ($this->prefs['list_type'] == LIST_CATEGORY && isset($parents[$this->id])) {
foreach ($parents[$this->id] as $cat) {
$html .= Filters::noXSS($cat) . '→';
}
}
$html .= Filters::noXSS($task['field' . $this->id . '_name']);
break;
case FIELD_DATE:
$html .= formatDate($task['field' . $this->id]);
break;
case FIELD_TEXT:
$html .= Filters::noXSS($task['field' . $this->id]);
break;
case FIELD_USER:
$html .= Filters::noXSS($task['field' . $this->id . '_name']);
break;
}
}
return $plain ? strip_tags(htmlspecialchars_decode($html, ENT_QUOTES)) : $html;
}
示例2: Redirect
/**
* Redirects the browser to the page in $url
* This function is based on PEAR HTTP class
* @param string $url
* @param bool $exit
* @param bool $rfc2616
* @license BSD
* @access public static
* @return bool
* @version 1.0
*/
public static function Redirect($url, $exit = true, $rfc2616 = true)
{
@ob_clean();
if (isset($_SESSION) && count($_SESSION)) {
session_write_close();
}
if (headers_sent()) {
die('Headers are already sent, this should not have happened. Please inform Flyspray developers.');
}
$url = FlySpray::absoluteURI($url);
header('Location: ' . $url);
if ($rfc2616 && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
$url = htmlspecialchars($url, ENT_QUOTES, 'utf-8');
printf('%s to: <a href="%s">%s</a>.', eL('Redirect'), $url, $url);
}
if ($exit) {
exit;
}
return true;
}
示例3: define
<?php
/*
This script is the AJAX callback that performs a search
for users, and returns true if the user_name is not given.
*/
define('IN_FS', true);
header('Content-type: text/html; charset=utf-8');
require_once '../../header.php';
$baseurl = dirname(dirname($baseurl)) . '/';
if (Get::has('name')) {
$searchterm = strtolower(Get::val('name'));
}
// Get the list of users from the global groups above
$get_users = $db->x->getRow(' SELECT count(u.user_name) AS anz_u_user,
count(r.user_name) AS anz_r_user
FROM {users} u
LEFT JOIN {registrations} r ON u.user_name = r.user_name
WHERE Lower(u.user_name) = ?
OR
Lower(r.user_name) = ?', null, array($searchterm, $searchterm));
if ($get_users) {
if ($get_users['anz_u_user'] > '0' || $get_users['anz_r_user'] > '0') {
$html = 'false|' . eL('usernametaken');
} else {
$html = 'true';
}
}
echo $html;
示例4: pagenums
function pagenums($pagenum, $perpage, $totalcount)
{
global $proj;
$pagenum = intval($pagenum);
$perpage = intval($perpage);
$totalcount = intval($totalcount);
// Just in case $perpage is something weird, like 0, fix it here:
if ($perpage < 1) {
$perpage = $totalcount > 0 ? $totalcount : 1;
}
$pages = ceil($totalcount / $perpage);
$output = sprintf(eL('page'), $pagenum, $pages);
if ($totalcount / $perpage > 1) {
$params = $_GET;
# unset unneeded params for shorter urls
unset($params['do']);
unset($params['project']);
unset($params['switch']);
$output .= '<span class="pagenums DoNotPrint">';
$start = max(1, $pagenum - 4 + min(2, $pages - $pagenum));
$finish = min($start + 4, $pages);
if ($start > 1) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => 1))));
$output .= sprintf('<a href="%s"><<%s </a>', $url, eL('first'));
}
if ($pagenum > 1) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pagenum - 1))));
$output .= sprintf('<a id="previous" accesskey="p" href="%s">< %s</a> - ', $url, eL('previous'));
}
for ($pagelink = $start; $pagelink <= $finish; $pagelink++) {
if ($pagelink != $start) {
$output .= ' - ';
}
if ($pagelink == $pagenum) {
$output .= sprintf('<strong>%d</strong>', $pagelink);
} else {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pagelink))));
$output .= sprintf('<a href="%s">%d</a>', $url, $pagelink);
}
}
if ($pagenum < $pages) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pagenum + 1))));
$output .= sprintf(' - <a id="next" accesskey="n" href="%s">%s ></a>', $url, eL('next'));
}
if ($finish < $pages) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pages))));
$output .= sprintf('<a href="%s"> %s >></a>', $url, eL('last'));
}
$output .= '</span>';
}
return $output;
}
示例5: tpl_draw_cell
function tpl_draw_cell($task, $colname, $format = "<td class='%s'>%s</td>")
{
global $fs, $proj, $page;
$indexes = array('id' => 'task_id', 'project' => 'project_title', 'tasktype' => 'task_type', 'category' => 'category_name', 'severity' => '', 'priority' => '', 'summary' => 'item_summary', 'dateopened' => 'date_opened', 'status' => 'status_name', 'openedby' => 'opened_by_name', 'assignedto' => 'assigned_to_name', 'lastedit' => 'max_date', 'reportedin' => 'product_version', 'dueversion' => 'closedby_version', 'duedate' => 'due_date', 'comments' => 'num_comments', 'votes' => 'num_votes', 'attachments' => 'num_attachments', 'dateclosed' => 'date_closed', 'progress' => '', 'os' => 'os_name', 'private' => 'mark_private', 'supertask' => 'supertask_id');
//must be an array , must contain elements and be alphanumeric (permitted "_")
if (!is_array($task) || empty($task) || preg_match('![^A-Za-z0-9_]!', $colname)) {
//run away..
return '';
}
switch ($colname) {
case 'id':
$value = tpl_tasklink($task, $task['task_id']);
break;
case 'summary':
$value = tpl_tasklink($task, utf8_substr($task['item_summary'], 0, 55));
if (utf8_strlen($task['item_summary']) > 55) {
$value .= '...';
}
break;
case 'severity':
$value = $fs->severities[$task['task_severity']];
break;
case 'priority':
$value = $fs->priorities[$task['task_priority']];
break;
case 'lastedit':
case 'duedate':
case 'dateopened':
case 'dateclosed':
$value = formatDate($task[$indexes[$colname]]);
break;
case 'status':
if ($task['is_closed']) {
$value = eL('closed');
} else {
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
}
break;
case 'progress':
$value = tpl_img($page->get_image('percent-' . $task['percent_complete'], false), $task['percent_complete'] . '%');
break;
case 'assignedto':
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
if ($task['num_assigned'] > 1) {
$value .= ', +' . ($task['num_assigned'] - 1);
}
break;
case 'private':
$value = $task[$indexes[$colname]] ? L('yes') : L('no');
break;
case 'supertask':
$value = tpl_tasklink($task, $task['supertask_id']);
break;
default:
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
break;
}
return sprintf($format, 'task_' . $colname, $value);
}
示例6: tpl_draw_cell
function tpl_draw_cell($task, $colname, $format = "<td class='%s'>%s</td>")
{
global $fs, $proj, $page, $user;
$indexes = array('id' => 'task_id', 'project' => 'project_title', 'tasktype' => 'task_type', 'tasktypename' => 'tasktype_name', 'category' => 'category_name', 'severity' => '', 'priority' => '', 'summary' => 'item_summary', 'dateopened' => 'date_opened', 'status' => 'status_name', 'openedby' => 'opened_by_name', 'assignedto' => 'assigned_to_name', 'lastedit' => 'max_date', 'reportedin' => 'product_version_name', 'dueversion' => 'closedby_version_name', 'duedate' => 'due_date', 'comments' => 'num_comments', 'votes' => 'num_votes', 'attachments' => 'num_attachments', 'dateclosed' => 'date_closed', 'progress' => '', 'os' => 'os_name', 'private' => 'mark_private', 'parent' => 'supertask_id', 'estimatedeffort' => 'estimated_effort');
//must be an array , must contain elements and be alphanumeric (permitted "_")
if (!is_array($task) || empty($task) || preg_match('![^A-Za-z0-9_]!', $colname)) {
//run away..
return '';
}
$class = 'task_' . $colname;
switch ($colname) {
case 'id':
$value = tpl_tasklink($task, $task['task_id']);
break;
case 'summary':
$value = tpl_tasklink($task, utf8_substr($task['item_summary'], 0, 55));
if (utf8_strlen($task['item_summary']) > 55) {
$value .= '...';
}
break;
case 'tasktype':
$value = $task['tasktype_name'];
$class .= ' typ' . $task['task_type'];
break;
case 'severity':
$value = $task['task_severity'] == 0 ? '' : $fs->severities[$task['task_severity']];
$class .= ' sev' . $task['task_severity'];
break;
case 'priority':
$value = $task['task_priority'] == 0 ? '' : $fs->priorities[$task['task_priority']];
$class .= ' pri' . $task['task_priority'];
break;
case 'lastedit':
case 'duedate':
case 'dateopened':
case 'dateclosed':
$value = formatDate($task[$indexes[$colname]]);
break;
case 'status':
if ($task['is_closed']) {
$value = eL('closed');
} else {
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
}
break;
case 'progress':
$value = tpl_img($page->get_image('percent-' . $task['percent_complete'], false), $task['percent_complete'] . '%');
break;
case 'assignedto':
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
if ($task['num_assigned'] > 1) {
$value .= ', +' . ($task['num_assigned'] - 1);
}
break;
case 'private':
$value = $task[$indexes[$colname]] ? L('yes') : L('no');
break;
case 'parent':
$value = '';
if ($task['supertask_id'] > 0) {
$value = tpl_tasklink($task, $task['supertask_id']);
}
break;
case 'estimatedeffort':
$value = '';
if ($user->perms('view_estimated_effort')) {
if ($task['estimated_effort'] > 0) {
$value = effort::SecondsToString($task['estimated_effort'], $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
}
}
break;
case 'effort':
$value = '';
if ($user->perms('view_current_effort_done')) {
if ($task['effort'] > 0) {
$value = effort::SecondsToString($task['effort'], $proj->prefs['hours_per_manday'], $proj->prefs['current_effort_done_format']);
}
}
break;
default:
$value = '';
// $colname here is NOT column name in database but a name that can appear
// both in a projects visible fields and as a key in language translation
// file, which is also used to draw a localized heading. Column names in
// database customarily use _ t to separate words, translation file entries
// instead do not and can be also be quite different. If you do see an empty
// value when you expected something, check your usage, what visible fields
// in database actually constains, and maybe add a mapping from $colname to
// to the database column name to array $indexes at the beginning of this
// function. Note that inconsistencies between $colname, database column
// name, translation entry key and name in visible fields do occur sometimes
// during development phase.
if (array_key_exists($colname, $indexes)) {
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
}
break;
}
return sprintf($format, $class, $value);
}
示例7: event_description
/**
* XXX: A mess,remove my in 1.0
*/
function event_description($history)
{
$return = '';
global $fs, $baseurl, $details, $page;
$translate = array('item_summary' => 'summary', 'project_id' => 'attachedtoproject', 'mark_private' => 'visibility');
// if soemthing gets double escaped, add it here.
$noescape = array('new_value', 'old_value');
foreach ($history as $key => $value) {
if (!in_array($key, $noescape)) {
$history[$key] = Filters::noXSS($value);
}
}
$new_value = $history['new_value'];
$old_value = $history['old_value'];
switch ($history['event_type']) {
case '3':
//Field changed
if (!$new_value && !$old_value) {
$return .= eL('taskedited');
break;
}
$field = $history['field_changed'];
switch ($field) {
case 'project_id':
$old_value = $history[$field . '1'];
$new_value = $history[$field . '2'];
case 'item_summary':
$field = eL($translate[$field]);
$old_value = Filters::noXSS($old_value);
$new_value = Filters::noXSS($new_value);
break;
case 'percent_complete':
$field = eL('percentcomplete');
$old_value .= '%';
$new_value .= '%';
break;
case 'mark_private':
$field = eL($translate[$field]);
$old_value = $old_value ? eL('private') : eL('public');
$new_value = $new_value ? eL('private') : eL('public');
break;
case 'detailed_desc':
$field = sprintf("<a href=\"javascript:getHistory('%d', '%s', 'history', '%d');\n showTabById('history', true);\">%s</a>", $history['task_id'], $baseurl, $history['history_id'], eL('details'));
if (!empty($details)) {
$details_previous = $page->text->render($old_value);
$details_new = $page->text->render($new_value);
}
$old_value = '';
$new_value = '';
break;
}
if (is_numeric($field)) {
$field = $history['field_name'];
$f = new Field($history);
if ($f->prefs['field_type'] == FIELD_LIST) {
$t = $history['list_type'] == LIST_CATEGORY ? 'c' : 'l';
$new = array('field' . $f->id => $history['new_value_' . $t], 'field' . $f->id . '_name' => $history['new_value_' . $t]);
$old = array('field' . $f->id => $history['old_value_' . $t], 'field' . $f->id . '_name' => $history['old_value_' . $t]);
$new_value = $f->view($new);
$old_value = $f->view($old);
} else {
if ($f->prefs['field_type'] == FIELD_USER) {
$new_value = tpl_userlink($history['new_value']);
$old_value = tpl_userlink($history['old_value']);
} else {
if ($f->prefs['field_type'] == FIELD_DATE) {
$new_value = $f->view(array('field' . $f->id => $history['new_value']));
$old_value = $f->view(array('field' . $f->id => $history['old_value']));
}
}
}
}
$return .= eL('fieldchanged') . ": {$field}";
if ($old_value || $new_value) {
$return .= " ({$old_value} → {$new_value})";
}
break;
case '1':
//Task opened
$return .= eL('taskopened');
break;
case '2':
//Task closed
$return .= eL('taskclosed');
$return .= " ({$history['resolution_name']}";
if (!empty($old_value)) {
$return .= ': ' . $page->text->render($old_value, true);
}
$return .= ')';
break;
case '4':
//Comment added
$return .= sprintf('<a href="%s#comment%d">%s</a>', Filters::noXSS(CreateUrl(array('details', 'task' . $history['task_id']))), $history['new_value'], eL('commentadded'));
break;
case '5':
//Comment edited
$return .= sprintf("<a href=\"javascript:getHistory('%d', '%s', 'history', '%d');\">%s</a>", $history['task_id'], $baseurl, $history['history_id'], eL('commentedited'));
//.........这里部分代码省略.........
示例8: event_description
/**
* XXX: A mess,remove my in 1.0. No time for that, sorry.
*/
function event_description($history)
{
$return = '';
global $fs, $baseurl, $details, $proj;
$translate = array('item_summary' => 'summary', 'project_id' => 'attachedtoproject', 'task_type' => 'tasktype', 'product_category' => 'category', 'item_status' => 'status', 'task_priority' => 'priority', 'operating_system' => 'operatingsystem', 'task_severity' => 'severity', 'product_version' => 'reportedversion', 'mark_private' => 'visibility', 'estimated_effort' => 'estimatedeffort');
// if somehing gets double escaped, add it here.
$noescape = array('new_value', 'old_value');
foreach ($history as $key => $value) {
if (!in_array($key, $noescape)) {
$history[$key] = Filters::noXSS($value);
}
}
$new_value = $history['new_value'];
$old_value = $history['old_value'];
switch ($history['event_type']) {
case '3':
//Field changed
if (!$new_value && !$old_value) {
$return .= eL('taskedited');
break;
}
$field = $history['field_changed'];
switch ($field) {
case 'item_summary':
case 'project_id':
case 'task_type':
case 'product_category':
case 'item_status':
case 'task_priority':
case 'operating_system':
case 'task_severity':
case 'product_version':
if ($field == 'task_priority') {
$old_value = $fs->priorities[$old_value];
$new_value = $fs->priorities[$new_value];
} elseif ($field == 'task_severity') {
$old_value = $fs->severities[$old_value];
$new_value = $fs->severities[$new_value];
} elseif ($field == 'item_summary') {
$old_value = Filters::noXSS($old_value);
$new_value = Filters::noXSS($new_value);
} else {
$old_value = $history[$field . '1'];
$new_value = $history[$field . '2'];
}
$field = eL($translate[$field]);
break;
case 'closedby_version':
$field = eL('dueinversion');
$old_value = $old_value == '0' ? eL('undecided') : $history['product_version1'];
$new_value = $new_value == '0' ? eL('undecided') : $history['product_version2'];
break;
case 'due_date':
$field = eL('duedate');
$old_value = formatDate($old_value, false, eL('undecided'));
$new_value = formatDate($new_value, false, eL('undecided'));
break;
case 'percent_complete':
$field = eL('percentcomplete');
$old_value .= '%';
$new_value .= '%';
break;
case 'mark_private':
$field = eL($translate[$field]);
if ($old_value == 1) {
$old_value = eL('private');
} else {
$old_value = eL('public');
}
if ($new_value == 1) {
$new_value = eL('private');
} else {
$new_value = eL('public');
}
break;
case 'detailed_desc':
$field = "<a href=\"javascript:getHistory('{$history['task_id']}', '{$baseurl}', 'history', '{$history['history_id']}');showTabById('history', true);\">" . eL('details') . '</a>';
if (!empty($details)) {
$details_previous = TextFormatter::render($old_value);
$details_new = TextFormatter::render($new_value);
}
$old_value = '';
$new_value = '';
break;
case 'estimated_effort':
$field = eL($translate[$field]);
$old_value = effort::SecondsToString($old_value, $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
$new_value = effort::SecondsToString($new_value, $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
break;
}
$return .= eL('fieldchanged') . ": {$field}";
if ($old_value || $new_value) {
$return .= " ({$old_value} → {$new_value})";
}
break;
case '1':
//Task opened
//.........这里部分代码省略.........
示例9: getDokuWikiToolbar
/**
* Displays a toolbar for formatting text in the DokuWiki Syntax
* Uses Javascript
*
* @param string $textareaId
*/
static function getDokuWikiToolbar($textareaId)
{
global $conf, $baseurl;
return '<a
tabindex="-1" title="' . eL('editorbold') . '" href="javascript:void(0);" onclick="surroundText(\'**\', \'**\', \'' . $textareaId . '\'); return false;"><img src="' . $baseurl . 'plugins/dokuwiki/img/format-text-bold.png" alt="Bold" border="0" /></a><a
tabindex="-1" title="' . eL('editoritalic') . '" href="javascript:void(0);" onclick="surroundText(\'//\', \'//\', \'' . $textareaId . '\'); return false;"><img src="' . $baseurl . 'plugins/dokuwiki/img/format-text-italic.png" alt="Italicized" border="0" /></a><a
tabindex="-1" title="' . eL('editorunderline') . '" href="javascript:void(0);" onclick="surroundText(\'__\', \'__\', \'' . $textareaId . '\'); return false;"><img src="' . $baseurl . 'plugins/dokuwiki/img/format-text-underline.png" alt="Underline" border="0" /></a><a
tabindex="-1" title="' . eL('editorstrikethrough') . '" href="javascript:void(0);" onclick="surroundText(\'<del>\', \'</del>\', \'' . $textareaId . '\'); return false;"><img src="' . $baseurl . 'plugins/dokuwiki/img/format-text-strikethrough.png" alt="Strikethrough" border="0" /></a>
<img src="' . $baseurl . 'plugins/dokuwiki/img/divider.gif" align="bottom" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'======\', \'======\', \'' . $textareaId . '\'); return false;">
<img title="Level 1 Headline" src="' . $baseurl . 'plugins/dokuwiki/img/h1.gif" width="23" height="22" alt="Heading1" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'=====\', \'=====\', \'' . $textareaId . '\'); return false;">
<img title="Level 2 Headline" src="' . $baseurl . 'plugins/dokuwiki/img/h2.gif" width="23" height="22" alt="Heading2" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'====\', \'====\', \'' . $textareaId . '\'); return false;">
<img title="Level 3 Headline" src="' . $baseurl . 'plugins/dokuwiki/img/h3.gif" width="23" height="22" alt="Heading3" border="0" /></a>
<img title="Divider" src="' . $baseurl . 'plugins/dokuwiki/img/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'{{http://\', \'}}\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/image-x-generic.png" alt="Insert Image" title="Insert Image" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="replaceText(\'\\n * \', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/ul.gif" width="23" height="22" alt="Insert List" title="Insert List" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="replaceText(\'\\n - \', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/ol.gif" width="23" height="22" alt="Insert List" title="Insert List" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="replaceText(\'----\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/hr.gif" width="23" height="22" alt="Horizontal Rule" title="Horizontal Rule" border="0" /></a>
<img src="' . $baseurl . 'plugins/dokuwiki/img/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'[[http://example.com|External Link\', \']]\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/text-html.png" alt="Insert Hyperlink" title="Insert Hyperlink" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'[[\', \']]\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/email.png" alt="Insert Email" title="Insert Email" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'[[ftp://\', \']]\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/network.png" alt="Insert FTP Link" title="Insert FTP Link" border="0" /></a>
<img src="' . $baseurl . 'plugins/dokuwiki/img/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'<code>\', \'</code>\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/source.png" alt="Insert Code" title="Insert Code" border="0" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'<code php>\', \'</code>\', \'' . $textareaId . '\'); return false;">
<img src="' . $baseurl . 'plugins/dokuwiki/img/source_php.png" alt="Insert Code" title="Insert PHP Code" border="0" /></a>
';
}
示例10: tpl_draw_cell
function tpl_draw_cell($task, $colname, $format = "<td class='%s'>%s</td>")
{
global $fs, $db, $proj, $page, $user;
$indexes = array('id' => 'task_id', 'project' => 'project_title', 'tasktype' => 'task_type', 'tasktypename' => 'tasktype_name', 'category' => 'category_name', 'severity' => '', 'priority' => '', 'summary' => 'item_summary', 'dateopened' => 'date_opened', 'status' => 'status_name', 'openedby' => 'opened_by', 'openedbyname' => 'opened_by_name', 'assignedto' => 'assigned_to_name', 'lastedit' => 'max_date', 'editedby' => 'last_edited_by', 'reportedin' => 'product_version_name', 'dueversion' => 'closedby_version_name', 'duedate' => 'due_date', 'comments' => 'num_comments', 'votes' => 'num_votes', 'attachments' => 'num_attachments', 'dateclosed' => 'date_closed', 'closedby' => 'closed_by', 'commentedby' => 'commented_by', 'progress' => '', 'os' => 'os_name', 'private' => 'mark_private', 'parent' => 'supertask_id', 'estimatedeffort' => 'estimated_effort');
//must be an array , must contain elements and be alphanumeric (permitted "_")
if (!is_array($task) || empty($task) || preg_match('![^A-Za-z0-9_]!', $colname)) {
//run away..
return '';
}
$class = 'task_' . $colname;
switch ($colname) {
case 'id':
$value = tpl_tasklink($task, $task['task_id']);
break;
case 'summary':
$value = tpl_tasklink($task, utf8_substr($task['item_summary'], 0, 55));
if (utf8_strlen($task['item_summary']) > 55) {
$value .= '...';
}
# <i> instead of <span> in future for smaller size
# we need also some bytes for classes like <i class="tag t123">tagname</i>
if ($task['tags'] != '') {
$tags = explode(',', $task['tags']);
$tagids = explode(',', $task['tagids']);
$tagclass = explode(',', $task['tagclass']);
$tgs = '';
for ($i = 0; $i < count($tags); $i++) {
$tgs .= '<i class="tag t' . $tagids[$i] . ($tagclass[$i] ? ' ' . $tagclass[$i] : '') . '" title="' . $tags[$i] . '"></i>';
}
$value .= $tgs;
}
break;
case 'tasktype':
$value = $task['tasktype_name'];
$class .= ' typ' . $task['task_type'];
break;
case 'severity':
$value = $task['task_severity'] == 0 ? '' : $fs->severities[$task['task_severity']];
$class .= ' sev' . $task['task_severity'];
break;
case 'priority':
$value = $task['task_priority'] == 0 ? '' : $fs->priorities[$task['task_priority']];
$class .= ' pri' . $task['task_priority'];
break;
case 'lastedit':
case 'duedate':
case 'dateopened':
case 'dateclosed':
$value = formatDate($task[$indexes[$colname]]);
break;
case 'status':
if ($task['is_closed']) {
$value = eL('closed');
} else {
$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
}
break;
case 'progress':
$value = tpl_img($page->get_image('percent-' . $task['percent_complete'], false), $task['percent_complete'] . '%');
break;
case 'assignedto':
# group_concat-ed for mysql/pgsql
#$value = htmlspecialchars($task[$indexes[$colname]], ENT_QUOTES, 'utf-8');
$value = '';
$anames = explode(',', $task[$indexes[$colname]]);
$aids = explode(',', $task['assignedids']);
$aimages = explode(',', $task['assigned_image']);
for ($a = 0; $a < count($anames); $a++) {
if ($aids[$a]) {
if ($fs->prefs['enable_avatars'] == 1 && $aimages[$a]) {
$value .= tpl_userlinkavatar($aids[$a], 30);
} else {
$value .= tpl_userlink($aids[$a]);
}
#$value.='<a href="'.$aids[$a].'">'.htmlspecialchars($anames[$a], ENT_QUOTES, 'utf-8').'</a>';
}
}
# fallback for DBs we haven't written sql string aggregation yet (currently with group_concat() mysql and array_agg() postgresql)
if ('postgres' != $db->dblink->dataProvider && 'mysql' != $db->dblink->dataProvider && $task['num_assigned'] > 1) {
$value .= ', +' . ($task['num_assigned'] - 1);
}
break;
case 'private':
$value = $task[$indexes[$colname]] ? L('yes') : L('no');
break;
case 'commentedby':
case 'openedby':
case 'editedby':
case 'closedby':
$value = '';
# a bit expensive! tpl_userlinkavatar() an additional sql query for each new user in the output table
# at least tpl_userlink() uses a $cache array so query for repeated users
if ($task[$indexes[$colname]] > 0) {
if ($fs->prefs['enable_avatars'] == 1) {
$value = tpl_userlinkavatar($task[$indexes[$colname]], 30);
} else {
$value = tpl_userlink($task[$indexes[$colname]]);
}
}
break;
//.........这里部分代码省略.........
示例11: header
if (!$user->perms('edit_assignments')) {
header('HTTP/1.1 400 Bad Request');
exit;
}
$field = 'assigned_to';
$page = new FSTpl();
$page->assign('id', 'task' . $task['task_id'] . '_' . $field);
$list = $db->x->getCol('SELECT u.user_name
FROM {assigned} a, {users} u
WHERE a.user_id = u.user_id AND task_id = ?
ORDER BY u.user_name DESC', null, $task['task_id']);
$page->assign('userlist', $list);
$page->display('common.multiuserselect.tpl');
break;
default:
// consider custom fields
$field_id = substr($field, 5);
$f = new Field($field_id);
if ($f->id) {
echo $f->edit(!USE_DEFAULT, !LOCK_FIELD, $task, array(), array(), 'task' . $task['task_id'] . '_qe');
$field = 'qe' . $field;
} else {
header('HTTP/1.1 400 Bad Request');
exit;
}
break;
}
$args = sprintf("%s, '%s'", $task['task_id'], $field);
echo '<button type="button" onclick="savequickedit(' . $args . ');this.onclick=function(){}">' . eL('OK') . '</button>
<button type="button" onclick="this.parentNode.update(\'' . $prev . '\')">X</button>';
echo "<script type='text/javascript'>\$('task{$task['task_id']}_{$field}').focus();</script>";
示例12: pagenums
function pagenums($pagenum, $perpage, $totalcount)
{
global $proj;
$pagenum = intval($pagenum);
$perpage = intval($perpage);
$totalcount = intval($totalcount);
// Just in case $perpage is something weird, like 0, fix it here:
if ($perpage < 1) {
$perpage = $totalcount > 0 ? $totalcount : 1;
}
$pages = ceil($totalcount / $perpage);
$pagenum = min($pagenum, $pages);
$output = sprintf(eL('page'), $pagenum, $pages);
if (!($totalcount / $perpage <= 1)) {
$output .= '<span class="DoNotPrint"> -- ';
$start = max(1, $pagenum - 4 + min(2, $pages - $pagenum));
$finish = min($start + 4, $pages);
if ($start > 1) {
$output .= '<a href="' . Filters::noXSS(CreateURL(array('index', 'proj' . $proj->id), array_merge($_GET, array('pagenum' => 1)))) . '"><<' . eL('first') . ' </a>';
}
if ($pagenum > 1) {
$output .= '<a id="previous" accesskey="p" href="' . Filters::noXSS(CreateURL(array('index', 'proj' . $proj->id), array_merge($_GET, array('pagenum' => $pagenum - 1)))) . '">< ' . eL('previous') . '</a> - ';
}
for ($pagelink = $start; $pagelink <= $finish; $pagelink++) {
if ($pagelink != $start) {
$output .= ' - ';
}
if ($pagelink == $pagenum) {
$output .= '<strong>' . $pagelink . '</strong>';
} else {
$output .= '<a href="' . Filters::noXSS(CreateURL(array('index', 'proj' . $proj->id), array_merge($_GET, array('pagenum' => $pagelink)))) . '">' . $pagelink . '</a>';
}
}
if ($pagenum < $pages) {
$output .= ' - <a id="next" accesskey="n" href="' . Filters::noXSS(CreateURL(array('index', 'proj' . $proj->id), array_merge($_GET, array('pagenum' => $pagenum + 1)))) . '">' . eL('next') . ' ></a>';
}
if ($finish < $pages) {
$output .= '<a href="' . Filters::noXSS(CreateURL(array('index', 'proj' . $proj->id), array_merge($_GET, array('pagenum' => $pages)))) . '"> ' . eL('last') . ' >></a>';
}
$output .= '</span>';
}
return $output;
}
示例13: getHtmlBefore
/**
* Displays a toolbar for formatting text in the DokuWiki Syntax
* Uses Javascript. Beware: Ugly code right ahead.
*/
function getHtmlBefore()
{
global $baseurl, $proj;
return '<div class="hide preview" id="%id_preview"></div><div>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'**\', \'**\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/format-text-bold.png" style="vertical-align:bottom;border:none" alt="Bold" title="Bold" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'//\', \'//\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/format-text-italic.png" style="vertical-align:bottom;border:none" alt="Italicized" title="Italicized" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'__\', \'__\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/format-text-underline.png" style="vertical-align:bottom;border:none" alt="Underline" title="Underline" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'<del>\', \'</del>\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/format-text-strikethrough.png" style="vertical-align:bottom;border:none" alt="Strikethrough" title="Strikethrough" /></a>
<img src="' . $baseurl . 'includes/syntaxplugins/img/divider.gif" alt="|" style="vertical-align:bottom;border:none;margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'======\', \'======\', \'%id\'); return false;">
<img title="Level 1 Headline" src="' . $baseurl . 'includes/syntaxplugins/img/h1.gif" style="vertical-align:bottom;border:none" width="23" height="22" alt="Heading1" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'=====\', \'=====\', \'%id\'); return false;">
<img title="Level 2 Headline" src="' . $baseurl . 'includes/syntaxplugins/img/h2.gif" style="vertical-align:bottom;border:none" width="23" height="22" alt="Heading2" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'====\', \'====\', \'%id\'); return false;">
<img title="Level 3 Headline" src="' . $baseurl . 'includes/syntaxplugins/img/h3.gif" style="vertical-align:bottom;border:none" width="23" height="22" alt="Heading3" /></a>
<img title="Divider" src="' . $baseurl . 'includes/syntaxplugins/img/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'{{http://\', \'}}\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/image-x-generic.png" style="vertical-align:bottom;border:none" alt="Insert Image" title="Insert Image" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="replaceText(\'\\n * \', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/ul.gif" style="vertical-align:bottom;border:none" width="23" height="22" alt="Insert List" title="Insert List" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="replaceText(\'\\n - \', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/ol.gif" style="vertical-align:bottom;border:none" width="23" height="22" alt="Insert List" title="Insert List" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="replaceText(\'----\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/hr.gif" style="vertical-align:bottom;border:none" width="23" height="22" alt="Horizontal Rule" title="Horizontal Rule" /></a>
<img src="' . $baseurl . 'includes/syntaxplugins/img/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'[[http://example.com|External Link\', \']]\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/text-html.png" style="vertical-align:bottom;border:none" alt="Insert Hyperlink" title="Insert Hyperlink" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'[[\', \']]\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/email.png" style="vertical-align:bottom;border:none" alt="Insert Email" title="Insert Email" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'[[ftp://\', \']]\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/network.png" style="vertical-align:bottom;border:none" alt="Insert FTP Link" title="Insert FTP Link" /></a>
<img src="' . $baseurl . 'includes/syntaxplugins/img/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'<code>\', \'</code>\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/source.png" style="vertical-align:bottom;border:none" alt="Insert Code" title="Insert Code" /></a>
<a tabindex="-1" href="javascript:void(0);" onclick="surroundText(\'<code php>\', \'</code>\', \'%id\'); return false;">
<img src="' . $baseurl . 'includes/syntaxplugins/img/source_php.png" style="vertical-align:bottom;border:none" alt="Insert Code" title="Insert PHP Code" /></a>
<a tabindex="-1" href="http://wiki.splitbrain.org/wiki:syntax">' . eL('syntax') . '</a>
';
}