本文整理汇总了PHP中tpl_img函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_img函数的具体用法?PHP tpl_img怎么用?PHP tpl_img使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_img函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hsc
?>
<?php
if ($ERROR) {
print $ERROR;
} else {
?>
<h1><?php
echo hsc(tpl_img_getTag('IPTC.Headline', $IMG));
?>
</h1>
<div class="content">
<?php
tpl_img(900, 700);
/* parameters: maximum width, maximum height (and more) */
?>
<div class="img_detail">
<h2><?php
print nl2br(hsc(tpl_img_getTag('simple.title')));
?>
</h2>
<dl>
<?php
$config_files = getConfigFiles('mediameta');
foreach ($config_files as $config_file) {
if (@file_exists($config_file)) {
include $config_file;
示例2: 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);
}
示例3: 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);
}
示例4: if
<?php if(!$ERROR): ?>
<div class="pageId"><span><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG)); ?></span></div>
<?php endif; ?>
<div class="page group">
<?php tpl_flush() ?>
<?php tpl_includeFile('pageheader.html') ?>
<!-- detail start -->
<?php
if($ERROR):
echo '<h1>'.$ERROR.'</h1>';
else: ?>
<h1><?php echo nl2br(hsc(tpl_img_getTag('simple.title'))); ?></h1>
<?php tpl_img(900,700); /* parameters: maximum width, maximum height (and more) */ ?>
<div class="img_detail">
<dl>
<?php
// @todo: logic should be transferred to backend
$config_files = getConfigFiles('mediameta');
foreach ($config_files as $config_file) {
if(@file_exists($config_file)) {
include($config_file);
}
}
foreach($fields as $key => $tag){
$t = array();
if (!empty($tag[0])) {
示例5: 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;
//.........这里部分代码省略.........
示例6: html_msgarea
</head>
<body>
<div class="dokuwiki">
';
html_msgarea();
echo '
<div class="page" style="margin-left: 1em;">
';
if ($ERROR) {
print $ERROR;
} else {
echo '
<h1>', hsc(tpl_img_getTag('IPTC.Headline', $IMG)), '</h1>
<div class="img_big">
';
tpl_img(900, 500);
echo ' <p class="img_caption">';
print nl2br(hsc(tpl_img_getTag('simple.title')));
echo '</p>
';
echo ' </div>
<div class="img_detail">
<dl class="img_tags">
';
$config_files = getConfigFiles('mediameta');
foreach ($config_files as $config_file) {
if (@file_exists($config_file)) {
include $config_file;
}
}
foreach ($fields as $key => $tag) {