本文整理汇总了PHP中HTML::img方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::img方法的具体用法?PHP HTML::img怎么用?PHP HTML::img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::img方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Show icon
*
* @param $name
*/
public function show($name, $set = '')
{
$set or $set = self::DEFAULT_SET;
$this->sets->{$set} or $this->addSet($set, $this->dir . DS . 'sets' . DS . $set);
if ($src = $this->sets->{$set}->get($name)) {
$size = explode('x', $this->sets->{$set}->size);
return HTML::img($src, t($name, 'Icons'), array('width' => $size[0], 'height' => $size[1]));
}
}
示例2: run
function run($dbi, $argstr, $request)
{
extract($this->getArgs($argstr, $request));
// Any text that is returned will not be further transformed,
// so use html where necessary.
if (empty($jid)) {
$html = HTML();
} else {
$html = HTML::img(array('src' => urlencode($scripturl) . '&jid=' . urlencode($jid) . '&type=' . urlencode($type) . '&iconset=' . $iconset));
}
return $html;
}
示例3: folderArrow
function folderArrow($id, $init = 'Open')
{
global $request;
if ($cookie = $request->cookies->get("folder_" . $id)) {
$init = $cookie;
}
if ($init == 'Open' or $init == 'Closed') {
$png = $this->_findData('images/folderArrow' . $init . '.png');
} else {
$png = $this->_findData('images/folderArrowOpen.png');
}
return HTML::img(array('id' => $id . '-img', 'src' => $png, 'onclick' => "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show")));
}
示例4: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$request->setArg('nocache', 1);
$args = $this->getArgs($argstr, $request);
// use the "online.tmpl" template
// todo: check which arguments are really needed in the template.
$stats = $this->getStats($dbi, $request, $args['mode']);
if ($src = $WikiTheme->getImageURL("whosonline")) {
$img = HTML::img(array('src' => $src, 'alt' => $this->getName()));
} else {
$img = '';
}
$other = array();
$other['ONLINE_ICON'] = $img;
return new Template('online', $request, array_merge($args, $stats, $other));
}
示例5: index
public function index($action = NULL)
{
switch ($action) {
case 'file':
$tpl = new Template('Upload.file');
$tpl->show();
break;
case 'image':
$image = new Upload_Image('file', array('preset' => 'post', 'path' => UPLOADS . DS . 'posts' . DS . date('Y/m/d')));
if ($result = $image->upload()) {
exit(HTML::img($result));
}
break;
default:
append('content', HTML::a(Url::gear('upload') . '/file?iframe', t('Upload'), array('rel' => 'modal', 'class' => 'button')));
}
}
示例6: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request, false);
$page =& $args['page'];
if (ENABLE_AJAX) {
if ($args['state']) {
$html = WikiPlugin_IncludePage::run($dbi, $argstr, $request, $basepage);
} else {
$html = HTML(HTML::p(array('class' => 'transclusion-title'), fmt(" %s :", WikiLink($page))), HTML::div(array('class' => 'transclusion'), ''));
}
$ajaxuri = WikiURL($page, array('format' => 'xml'));
} else {
$html = WikiPlugin_IncludePage::run($dbi, $argstr, $request, $basepage);
}
$header = $html->_content[0];
$body = $html->_content[1];
$id = 'DynInc-' . MangleXmlIdentifier($page);
$body->setAttr('id', $id . '-body');
$png = $WikiTheme->_findData('images/folderArrow' . ($args['state'] ? 'Open' : 'Closed') . '.png');
$icon = HTML::img(array('id' => $id . '-img', 'src' => $png, 'onclick' => ENABLE_AJAX ? "showHideAsync('" . $ajaxuri . "','{$id}')" : "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show")));
$header = HTML::p(array('class' => 'transclusion-title', 'style' => "text-decoration: none;"), $icon, fmt(" %s :", WikiLink($page)));
if ($args['state']) {
// show base
$body->setAttr('style', 'display:block');
return HTML($header, $body);
} else {
// do not show base
$body->setAttr('style', 'display:none');
if (ENABLE_AJAX) {
return HTML($header, $body);
} else {
return HTML($header, $body);
}
// sync (load but display:none)
}
}
示例7: OptionsButtonBars
function OptionsButtonBars($plugin_args)
{
$this->__construct('fieldset', array('class' => 'wiki-rc-action'));
// Add ShowHideFolder button
$icon = $GLOBALS['WikiTheme']->_findData('images/folderArrowOpen.png');
$img = HTML::img(array('id' => 'rc-action-img', 'src' => $icon, 'onclick' => "showHideFolder('rc-action')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show")));
// Display selection buttons
extract($plugin_args);
// Custom caption
if (!$caption) {
$caption = _("Show changes for:");
}
$this->pushContent(HTML::legend($caption, ' ', $img));
$table = HTML::table(array('id' => 'rc-action-body', 'style' => 'display:block'));
$tr = HTML::tr();
foreach (explode(",", $daylist) as $days_button) {
$tr->pushContent($this->_makeDayButton($days_button, $days));
}
$table->pushContent($tr);
$tr = HTML::tr();
$tr->pushContent($this->_makeUsersButton(0));
$tr->pushContent($this->_makeUsersButton(1));
$table->pushContent($tr);
$tr = HTML::tr();
$tr->pushContent($this->_makePagesButton(0));
$tr->pushContent($this->_makePagesButton(1));
$table->pushContent($tr);
$tr = HTML::tr();
$tr->pushContent($this->_makeMinorButton(1, $show_minor));
$tr->pushContent($this->_makeMinorButton(0, $show_minor));
$table->pushContent($tr);
$tr = HTML::tr();
$tr->pushContent($this->_makeShowAllButton(1, $show_all));
$tr->pushContent($this->_makeShowAllButton(0, $show_all));
$table->pushContent($tr);
$tr = HTML::tr();
$tr->pushContent($this->_makeNewPagesButton(0, $only_new));
$tr->pushContent($this->_makeNewPagesButton(1, $only_new));
$table->pushContent($tr);
$this->pushContent($table);
}
示例8: getDocumentPath
function getDocumentPath($id, $group_id, $referrer_id = null)
{
$parents = array();
$html = HTML();
$hp =& Codendi_HTMLPurifier::instance();
$item_factory =& $this->_getItemFactory($group_id);
$item =& $item_factory->getItemFromDb($id);
$reference =& $item;
if ($reference && $referrer_id != $id) {
while ($item && $item->getParentId() != 0) {
$item =& $item_factory->getItemFromDb($item->getParentId());
$parents[] = array('id' => $item->getId(), 'title' => $item->getTitle());
}
$parents = array_reverse($parents);
$item_url = '/plugins/docman/?group_id=' . $group_id . '&sort_update_date=0&action=show&id=';
foreach ($parents as $parent) {
$html->pushContent(HTML::a(array('href' => $item_url . $parent['id'], 'target' => '_blank'), HTML::strong($parent['title'])));
$html->pushContent(' / ');
}
$md_uri = '/plugins/docman/?group_id=' . $group_id . '&action=details&id=' . $id;
//Add a pen icon linked to document properties.
$pen_icon = HTML::a(array('href' => $md_uri), HTML::img(array('src' => util_get_image_theme("ic/edit.png"))));
$html->pushContent(HTML::a(array('href' => $item_url . $reference->getId()), HTML::strong($reference->getTitle())));
$html->pushContent($pen_icon);
$html->pushContent(HTML::br());
}
return $html;
}
示例9: foreach
$i = 0;
foreach ($nodes as $node) {
?>
<?php
if ($i != 0 && $i % 3 == 0) {
?>
</div><div class="clearfix">
<?php
}
?>
<div class="col-lg-4">
<div class="thumbnail">
<?php
echo HTML::a(Yii::$app->imageCache->thumb($node->image, 'post'), ['product/view', 'slug' => $node->slug]);
?>
</div>
<h5 class="grid-product-title"><?php
echo HTML::a($node->title, ['product/view', 'slug' => $node->slug]);
?>
</h5>
</div><!--One Item-->
<?php
$i++;
}
?>
</div>
<div class="text-center">
<?php
echo HTML::a(HTML::img('img/icon-xem-them.png'), ['category/view', 'slug' => $category_slug]);
?>
</div>
示例10: array
<div id="container">
<div id="header">
<?php
echo HTML::link('', HTML::img('images/yawf-240x50.png', array('width' => 240, 'height' => 50, 'alt' => 'YAWF')));
?>
<div id="login">
<p><strong><?php
echo $greeting;
?>
</strong> <?php
echo HTML::link('admin/login', 'Log in');
?>
or <?php
echo HTML::link('admin/sign_up', 'sign up');
?>
to get involved.</p>
</div>
</div>
<div id="menu">
<ul>
<li<?php
echo array_key($active_tab, 'default/index');
?>
><?php
echo HTML::link("default", 'Welcome');
?>
</li>
<li<?php
echo array_key($active_tab, 'project/news');
示例11: RatingWidgetHtml
/**
* HTML widget display
*
* This needs to be put in the <body> section of the page.
*
* @param pagename Name of the page to rate
* @param version Version of the page to rate (may be "" for current)
* @param imgPrefix Prefix of the names of the images that display the rating
* You can have two widgets for the same page displayed at
* once iff the imgPrefix-s are different.
* @param dimension Id of the dimension to rate
* @param small Makes a smaller ratings widget if non-false
*
* Limitations: Currently this can only print the current users ratings.
* And only the widget, but no value (for buddies) also.
*/
function RatingWidgetHtml($pagename, $version, $imgPrefix, $dimension, $small = false)
{
global $WikiTheme, $request;
$imgId = MangleXmlIdentifier($pagename) . $imgPrefix;
$actionImgName = $imgId . 'RateItAction';
$dbi =& $GLOBALS['request']->_dbi;
$version = $dbi->_backend->get_latest_version($pagename);
//$rdbi =& $this->_rdbi;
$rdbi = RatingsDb::getTheRatingsDb();
// check if the imgPrefix icons exist.
if (!$WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk0.png", true)) {
$imgPrefix = '';
}
// Protect against 's, though not \r or \n
$reImgPrefix = $this->_javascript_quote_string($imgPrefix);
$reActionImgName = $this->_javascript_quote_string($actionImgName);
$rePagename = $this->_javascript_quote_string($pagename);
//$dimension = $args['pagename'] . "rat";
$html = HTML::span(array("id" => $imgId));
for ($i = 0; $i < 2; $i++) {
$nk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk" . $i . ".png");
$none[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Rk" . $i . ".png");
}
$user = $request->getUser();
$userid = $user->getId();
//if (!isset($args['rating']))
$rating = $rdbi->getRating($userid, $pagename, $dimension);
if (!$rating) {
$pred = $rdbi->getPrediction($userid, $pagename, $dimension);
}
for ($i = 1; $i <= 10; $i++) {
$a1 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',' . $i / 2 . ')'));
$img_attr = array();
$img_attr['src'] = $nk[$i % 2];
//if (!$rating and !$pred)
// $img_attr['src'] = $none[$i%2];
$img_attr['name'] = $imgPrefix . $i;
$img_attr['alt'] = $img_attr['name'];
$img_attr['border'] = 0;
$a1->pushContent(HTML::img($img_attr));
$a1->addToolTip(_("Rate the topic of this page"));
$html->pushContent($a1);
//This adds a space between the rating smilies:
// if (($i%2) == 0) $html->pushContent(' ');
}
$html->pushContent(HTML::Raw(' '));
$a0 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',\'X\')'));
$msg = _("Cancel rating");
$a0->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), 'name' => $imgPrefix . 'Cancel', 'alt' => $msg)));
$a0->addToolTip($msg);
$html->pushContent($a0);
/*} elseif ($pred) {
$msg = _("No opinion");
$html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"),
'name'=> $imgPrefix.'Cancel',
'alt' => $msg)));
//$a0->addToolTip($msg);
//$html->pushContent($a0);
}*/
$img_attr = array();
$img_attr['src'] = $WikiTheme->_findData("images/RateItAction.png");
$img_attr['name'] = $actionImgName;
$img_attr['alt'] = $img_attr['name'];
//$img_attr['class'] = 'k' . $i;
$img_attr['border'] = 0;
$html->pushContent(HTML::img($img_attr));
// Display the current rating if there is one
if ($rating) {
$html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',' . $rating . ',0)'));
} elseif ($pred) {
$html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',' . $pred . ',1)'));
} else {
$html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',0,0)'));
}
return $html;
}
示例12: templatePulldown
function templatePulldown($query, $case_exact = false, $regex = 'auto')
{
global $request;
require_once 'lib/TextSearchQuery.php';
$dbi =& $request->_dbi;
$page_iter = $dbi->titleSearch(new TextSearchQuery($query, $case_exact, $regex));
$count = 0;
if ($page_iter->count()) {
global $WikiTheme;
$pages_js = '';
while ($p = $page_iter->next()) {
$rev = $p->getCurrentRevision();
$toinsert = str_replace(array("\n", '"'), array('_nl', '_quot'), $rev->_get_content());
//$toinsert = str_replace("\n",'\n',addslashes($rev->_get_content()));
$pages_js .= ",['" . $p->getName() . "','_nl{$toinsert}']";
}
$pages_js = substr($pages_js, 1);
if (!empty($pages_js)) {
return HTML("\n", HTML::img(array('class' => "toolbar", 'id' => 'tb-templates', 'src' => $WikiTheme->getImageURL("ed_template.png"), 'title' => _("AddTemplate"), 'alt' => _("AddTemplate"), 'onclick' => "showPulldown('" . _("Insert Template") . "',[" . $pages_js . "],'" . _("Insert") . "','" . _("Close") . "','tb-templates')")));
}
}
return '';
}
示例13: text2png
function text2png($text, $l)
{
/**
* Basic image creation and caching
*
* You MUST delete the image cache yourself in /images if you
* change the drawing routines!
*/
$filename = $text . ".png";
/**
* FIXME: need something more elegant, and a way to gettext a
* different language depending on any individual
* user's locale preferences.
*/
if ($l == "C") {
$l = "en";
}
//english=C
$filepath = getcwd() . "/images/{$l}";
if (!file_exists($filepath . "/" . $filename)) {
if (!file_exists($filepath)) {
$oldumask = umask(0);
// permissions affected by user the www server is running as
mkdir($filepath, 0777);
umask($oldumask);
}
// add trailing slash to save some keystrokes later
$filepath .= "/";
/**
* prepare a new image
*
* FIXME: needs a dynamic image size depending on text
* width and height
*/
$im = @ImageCreate(150, 50);
if (empty($im)) {
$error_html = _("PHP was unable to create a new GD image stream. Read 'lib/plugin/text2png.php' for details.");
// FIXME: Error manager does not transform URLs passed
// through it.
$link = "http://www.php.net/manual/en/function.imagecreate.php";
$error_html .= sprintf(_("See %s"), $link) . ".";
trigger_error($error_html, E_USER_NOTICE);
return;
}
// get ready to draw
$bg_color = ImageColorAllocate($im, 255, 255, 255);
$ttfont = "/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/lib/fonts/LucidaSansRegular.ttf";
/* http://download.php.net/manual/en/function.imagettftext.php
* array imagettftext (int im, int size, int angle, int x, int y,
* int col, string fontfile, string text)
*/
// draw shadow
$text_color = ImageColorAllocate($im, 175, 175, 175);
// shadow is 1 pixel down and 2 pixels right
ImageTTFText($im, 10, 0, 12, 31, $text_color, $ttfont, $text);
// draw text
$text_color = ImageColorAllocate($im, 0, 0, 0);
ImageTTFText($im, 10, 0, 10, 30, $text_color, $ttfont, $text);
/**
* An alternate text drawing method in case ImageTTFText
* doesn't work.
**/
//ImageString($im, 2, 10, 40, $text, $text_color);
// To dump directly to browser:
//header("Content-type: image/png");
//ImagePng($im);
// to save to file:
$success = ImagePng($im, $filepath . $filename);
} else {
$filepath .= "/";
$success = 2;
}
// create an <img src= tag to show the image!
$html = HTML();
if ($success > 0) {
if (defined('text2png_debug')) {
switch ($success) {
case 1:
trigger_error(sprintf(_("Image saved to cache file: %s"), $filepath . $filename), E_USER_NOTICE);
case 2:
trigger_error(sprintf(_("Image loaded from cache file: %s"), $filepath . $filename), E_USER_NOTICE);
}
}
$url = "images/{$l}/{$filename}";
if (defined('DATA_PATH')) {
$url = DATA_PATH . "/{$url}";
}
$html->pushContent(HTML::img(array('src' => $url, 'alt' => $text)));
} else {
trigger_error(sprintf(_("couldn't open file '%s' for writing"), $filepath . $filename), E_USER_NOTICE);
}
return $html;
}
示例14: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request);
extract($args);
if ($since) {
$since = strtotime($since);
}
if ($month) {
$since = strtotime($month);
$since = mktime(0, 0, 0, date("m", $since), 1, date("Y", $since));
$until = mktime(23, 59, 59, date("m", $since) + 1, 0, date("Y", $since));
} else {
$until = 0;
}
$iter = $dbi->getAllPages(false, '-mtime');
$pages = array();
while ($page = $iter->next()) {
$pagename = $page->getName();
if (!$page->exists()) {
continue;
}
$rev = $page->getRevision(1, false);
$date = $rev->get('mtime');
//$author = $rev->get('author_id');
$author = $page->getOwner();
if (defined('DEBUG') && DEBUG && $debug) {
echo "<i>{$pagename}, ", strftime("%Y-%m-%d %h:%m:%s", $date), ", {$author}</i><br />\n";
}
if ($userid and !preg_match("/" . $userid . "/", $author)) {
continue;
}
if ($since and $date < $since) {
continue;
}
if ($until and $date > $until) {
continue;
}
if (!$comments and preg_match("/\\/Comment/", $pagename)) {
continue;
}
$monthnum = strftime("%Y%m", $date);
if (!isset($pages[$monthnum])) {
$pages[$monthnum] = array('author' => array(), 'month' => strftime("%B, %Y", $date));
}
if (!isset($pages[$monthnum]['author'][$author])) {
$pages[$monthnum]['author'][$author] = array('count' => 0, 'pages' => array());
}
$pages[$monthnum]['author'][$author]['count']++;
$pages[$monthnum]['author'][$author]['pages'][] = $pagename;
}
$iter->free();
$html = HTML::table(HTML::col(array('span' => 2, 'align' => 'left')));
$nbsp = HTML::raw(' ');
krsort($pages);
foreach ($pages as $monthname => $parr) {
$html->pushContent(HTML::tr(HTML::td(array('colspan' => 2), HTML::strong($parr['month']))));
uasort($parr['author'], 'cmp_by_count');
foreach ($parr['author'] as $user => $authorarr) {
$count = $authorarr['count'];
$id = preg_replace("/ /", "_", 'pages-' . $monthname . '-' . $user);
$html->pushContent(HTML::tr(HTML::td($nbsp, $nbsp, HTML::img(array('id' => "{$id}-img", 'src' => $WikiTheme->_findData("images/folderArrowClosed.png"), 'onclick' => "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show"))), $nbsp, $user), HTML::td($count)));
if ($links) {
$pagelist = HTML();
foreach ($authorarr['pages'] as $p) {
$pagelist->pushContent(WikiLink($p), ', ');
}
} else {
$pagelist = join(', ', $authorarr['pages']);
}
$html->pushContent(HTML::tr(array('id' => $id . '-body', 'style' => 'display:none; background-color: #eee;'), HTML::td(array('colspan' => 2, 'style' => 'font-size:smaller'), $pagelist)));
}
}
return $html;
}
示例15:
<?if($value):?>
<div class="image-preview"><?php
echo HTML::img($value, '', $image);
?>
<a href="<?php
echo Ajax::link(array('action' => 'replace', 'form' => $form->name, 'element' => $element->name));
?>
" class="form-action delete">x</a></div>
<?endif;?>
<?php
echo HTML::input($attributes);