本文整理汇总了PHP中html::img方法的典型用法代码示例。如果您正苦于以下问题:PHP html::img方法的具体用法?PHP html::img怎么用?PHP html::img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::img方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_output
/**
* This callback function adds a box below the message content
* if there is a vcard attachment available
*/
function html_output($p)
{
$attach_script = false;
$icon = 'plugins/vcard_attachments/' . $this->local_skin_path() . '/vcard_add_contact.png';
foreach ($this->vcard_parts as $part) {
$vcards = rcube_vcard::import($this->message->get_part_content($part));
// successfully parsed vcards?
if (empty($vcards)) {
continue;
}
// remove part's body
if (in_array($part, $this->vcard_bodies)) {
$p['content'] = '';
}
$style = 'margin:0.5em 1em; padding:0.2em 0.5em; border:1px solid #999; ' . 'border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto';
foreach ($vcards as $idx => $vcard) {
$display = $vcard->displayname;
if ($vcard->email[0]) {
$display .= ' <' . $vcard->email[0] . '>';
}
// add box below messsage body
$p['content'] .= html::p(array('style' => $style), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::img(array('src' => $icon, 'style' => "vertical-align:middle"))) . ' ' . html::span(null, Q($display)));
}
$attach_script = true;
}
if ($attach_script) {
$this->include_script('vcardattach.js');
}
return $p;
}
示例2: index
/**
* ****************************************************
* HOME
* ****************************************************
*/
function index()
{
$vars = array();
$img = array();
$vars['img'] =& $img;
$img['up'] = 'images/icons/up.png';
$img['down'] = 'images/icons/down.png';
$img['edit'] = 'images/icons/edit.png';
$img['delete'] = 'images/icons/delete.png';
// action & id
$action = $this->validate->get->getRaw('action');
$action_list = array();
if (in_array($action, $action_list)) {
$this->{$action}();
}
$vars['nagavitor'] = $this->forum->get_nagavitor();
$vars['board_move_data'] = $this->forum->get_redirect_data();
$cats = $this->forum->get_category();
$vars['cats'] = array();
foreach ($cats as $key => $cat) {
$newcat = array();
$newcat['up'] = $newcat['down'] = '';
if ($key - 1 >= 0) {
$newcat['up'] = html::anchor('forum.php?c=admin&m=movecat&cat1=' . $cat['cat_id'] . '&order1=' . $cat['cat_order'] . '&cat2=' . $cats[$key - 1]['cat_order'] . '&order2=' . $cats[$key - 1]['cat_order'], html::img($img['up']));
}
if ($key + 2 <= count($cats)) {
$newcat['down'] = html::anchor('forum.php?c=admin&m=movecat&cat1=' . $cat['cat_id'] . '&order1=' . $cat['cat_order'] . '&cat2=' . $cats[$key + 1]['cat_id'] . '&order2=' . $cats[$key + 1]['cat_order'], html::img($img['down']));
}
$newcat['id'] = $cat['cat_id'];
$newcat['name'] = $cat['name'];
$vars['cats'][$key] = $newcat;
unset($newcat);
$vars['cats'][$key]['boards'] = array();
$catkey = $key;
// get the board data
$boards = array();
$this->forum->get_board_list2($cat['cat_id'], 0, $boards);
foreach ($boards as $key => $board) {
$newboard = array();
$newboard['up'] = $newboard['down'] = '';
$min_order = $this->forum->get_board_min_order($cat['cat_id'], $board['child_level'], $board['parent_id']);
$max_order = $this->forum->get_board_max_order($cat['cat_id'], $board['child_level'], $board['parent_id']);
if ($board['board_order'] > $min_order) {
$newboard['up'] = html::anchor('forum.php?c=admin&m=moveboard&board1=' . $board['board_id'] . '&order1=' . $board['board_order'] . '&board2=' . $boards[$key - 1]['board_id'] . '&order2=' . $boards[$key - 1]['board_order'], html::img($img['up']));
}
if ($board['board_order'] < $max_order) {
$newboard['down'] = html::anchor('forum.php?c=admin&m=moveboard&board1=' . $board['board_id'] . '&order1=' . $board['board_order'] . '&board2=' . $boards[$key + 1]['board_id'] . '&order2=' . $boards[$key + 1]['board_order'], html::img($img['down']));
}
$newboard['level'] = $board['child_level'];
$newboard['id'] = $board['board_id'];
$newboard['name'] = $board['name'];
$newboard['child_level'] = $board['name'];
$newboard['parent'] = $board['parent_id'];
$vars['cats'][$catkey]['boards'][] = $newboard;
unset($newboard);
}
}
$this->view->render('admin/index', $vars);
}
示例3: startup_chbox
function startup_chbox($args)
{
$this->add_texts('localization');
$rcmail = rcmail::get_instance();
$icon = 'plugins/chbox/' . $this->local_skin_path() . '/columncheck.png';
$chboxicon = html::img(array('src' => $icon, 'id' => 'selectmenulink', 'title' => $this->gettext('chbox'), 'alt' => $this->gettext('chbox')));
$rcmail->output->add_label('chbox.chbox');
$rcmail->output->set_env('chboxicon', $chboxicon);
$this->include_stylesheet($this->local_skin_path() . '/chbox.css');
return $args;
}
示例4: captcha
/**
* Captcha
*
* @param array $options
* @return string
*/
public static function captcha($options = [])
{
$captcha_link = $options['id'] ?? 'default';
// validation
if (!empty($options['validate'])) {
return self::validate($captcha_link, $options['password']);
}
// generating password
$password = self::generate_password($captcha_link, $options['password_letters'] ?? null, $options['password_length'] ?? 5);
array_key_unset($options, ['password_letters', 'password_length']);
$image_options = ['src' => 'data:image/png;base64,' . base64_encode(self::draw($password, ['return_image' => true])), 'style' => $options['img_style'] ?? 'vertical-align: middle;'];
if (!empty($options['only_image'])) {
return html::img($image_options);
} else {
return '<table width="100%"><tr><td>' . html::input($options) . '</td><td width="1%"> </td><td width="1%">' . html::img($image_options) . '</td></tr></table>';
}
}
示例5: html_output
/**
* This callback function adds a box below the message content
* if there is a vcard attachment available
*/
function html_output($p)
{
if ($this->vcard_part) {
$vcard = new rcube_vcard($this->message->get_part_content($this->vcard_part));
// successfully parsed vcard
if ($vcard->displayname) {
$display = $vcard->displayname;
if ($vcard->email[0]) {
$display .= ' <' . $vcard->email[0] . '>';
}
// add box below messsage body
$p['content'] .= html::p(array('style' => "margin:1em; padding:0.5em; border:1px solid #999; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto;"), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($this->vcard_part) . "')", 'title' => $this->gettext('addvardmsg')), html::img(array('src' => $this->url('vcard_add_contact.png'), 'align' => "middle"))) . ' ' . html::span(null, Q($display)));
$this->include_script('vcardattach.js');
}
}
return $p;
}
示例6: testHTML
public function testHTML()
{
$expected = '<img src="myimage.jpg" width="100" height="200">';
$this->assertEquals($expected, html::tag('img', null, array('src' => 'myimage.jpg', 'width' => 100, 'height' => 200)));
$expected = '<a href="http://google.com" title="Google">Google</a>';
$this->assertEquals($expected, html::tag('a', 'Google', array('href' => 'http://google.com', 'title' => 'Google')));
$expected = '<p>Nice Paragraph</p>';
$this->assertEquals($expected, html::tag('p', 'Nice Paragraph'));
$expected = '<br>';
$this->assertEquals($expected, html::tag('br'));
$expected = '<a href="http://google.com" title="Google">Google</a>';
$this->assertEquals($expected, html::a('http://google.com', 'Google', array('title' => 'Google')));
$expected = '<img src="myimage.jpg" alt="myimage" width="100" height="200">';
$this->assertEquals($expected, html::img('myimage.jpg', array('width' => 100, 'height' => 200)));
$expected = '<!--[if lt IE 9]>' . PHP_EOL;
$expected .= '<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>' . PHP_EOL;
$expected .= '<![endif]-->' . PHP_EOL;
$this->assertEquals($expected, html::shiv());
}
示例7:
* @copyright (c) 2014 Asoc. Coop. Tecnologia Terabyte 124, RL.
* @Extension: [yii2-adminlte-advanced].
* @Themes: AdminLTE - Views [Frontend - layouts/_userpanel].
* @since 1.0
*/
use yii\helpers\Html;
?>
<?php
echo Html::beginTag('div', ['class' => 'user-panel']);
?>
<?php
echo Html::beginTag('div', ['class' => 'pull-left image']);
?>
<?php
echo html::img(\yii::$app->params['Images_Url_60'], $options = ['class' => 'img-rounded', 'aria-expanded' => 'false']);
?>
<?php
echo Html::endTag('div');
?>
<?php
echo Html::beginTag('div', ['class' => 'pull-left info']);
?>
<?php
echo html::tag('p', \yii::$app->user->identity->username);
?>
<?php
echo Html::a(Html::tag('i', '', ['class' => 'fa fa-circle text-success']), '#');
?>
<?php
echo Html::tag('i', Yii::t('adminlte', 'On Line'));
示例8: kirby_get_srcset
if ($file && empty($srcset)) {
$srcset = kirby_get_srcset($file);
}
// sizes builder
if ($file && empty($sizes)) {
$classes = !empty($tag->attr('imgclass')) ? explode(' ', $tag->attr('imgclass')) : '';
$sizes = kirby_get_sizes($file, $tag->attr('width'), $classes);
}
// allows src attribute to be overwritten
$defaultsource = kirby()->option('responsiveimages.defaultsource');
if (isset($sources[$defaultsource])) {
$url = thumb($file, $sources[$defaultsource])->url();
}
// image builder
$_image = function ($class) use($tag, $url, $alt, $title, $srcset, $sizes) {
return html::img($url, array('width' => $tag->attr('width'), 'height' => $tag->attr('height'), 'class' => $class, 'title' => $title, 'alt' => $alt, 'srcset' => $srcset, 'sizes' => $sizes));
};
if (kirby()->option('kirbytext.image.figure') or !empty($caption)) {
$image = $_link($_image($tag->attr('imgclass')));
$figure = new Brick('figure');
$figure->addClass($tag->attr('class'));
$figure->append($image);
if (!empty($caption)) {
$figure->append('<figcaption>' . html($caption) . '</figcaption>');
}
return $figure;
} else {
$class = trim($tag->attr('class') . ' ' . $tag->attr('imgclass'));
return $_link($_image($class));
}
}));
示例9:
<div class="box box-primary box-solid">
<div class="box-header">
<h3 class="box-title"><i class="fa fa-home"></i> <?php
echo Html::encode($this->title);
?>
</h3>
</div>
<div class="box-body">
<p>
<?php
echo Html::a('แก้ไข', ['update', 'id' => $model->id], ['class' => 'btn btn-success']);
?>
<?php
echo Html::a('ลบ', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
</p>
<div class="text-center">
<?php
echo html::img('uploads/room/' . $model->photo, ['class' => 'circle']);
?>
</div>
<?php
echo DetailView::widget(['model' => $model, 'attributes' => ['name', 'description:ntext', 'photo', ['attribute' => 'color', 'format' => 'html', 'value' => '<span style="color:' . $model->color . ';">' . $model->color . '</span>']]]);
?>
</div>
</div>
示例10: xml_command
//.........这里部分代码省略.........
return $hook['content'];
}
break;
// return code for a specific application object
// return code for a specific application object
case 'object':
$object = strtolower($attrib['name']);
$content = '';
// we are calling a class/method
if (($handler = $this->object_handlers[$object]) && is_array($handler)) {
if (is_object($handler[0]) && method_exists($handler[0], $handler[1]) || is_string($handler[0]) && class_exists($handler[0])) {
$content = call_user_func($handler, $attrib);
}
} else {
if (function_exists($handler)) {
$content = call_user_func($handler, $attrib);
} else {
if ($object == 'doctype') {
$content = html::doctype($attrib['value']);
} else {
if ($object == 'logo') {
$attrib += array('alt' => $this->xml_command(array('', 'object', 'name="productname"')));
if ($logo = $this->config->get('skin_logo')) {
if (is_array($logo)) {
if ($template_logo = $logo[$this->template_name]) {
$attrib['src'] = $template_logo;
} elseif ($template_logo = $logo['*']) {
$attrib['src'] = $template_logo;
}
} else {
$attrib['src'] = $logo;
}
}
$content = html::img($attrib);
} else {
if ($object == 'productname') {
$name = $this->config->get('product_name', 'Roundcube Webmail');
$content = html::quote($name);
} else {
if ($object == 'version') {
$ver = (string) RCMAIL_VERSION;
if (is_file(RCUBE_INSTALL_PATH . '.svn/entries')) {
if (preg_match('/Revision:\\s(\\d+)/', @shell_exec('svn info'), $regs)) {
$ver .= ' [SVN r' . $regs[1] . ']';
}
} else {
if (is_file(RCUBE_INSTALL_PATH . '.git/index')) {
if (preg_match('/Date:\\s+([^\\n]+)/', @shell_exec('git log -1'), $regs)) {
if ($date = date('Ymd.Hi', strtotime($regs[1]))) {
$ver .= ' [GIT ' . $date . ']';
}
}
}
}
$content = html::quote($ver);
} else {
if ($object == 'steptitle') {
$content = html::quote($this->get_pagetitle());
} else {
if ($object == 'pagetitle') {
if ($this->devel_mode && !empty($_SESSION['username'])) {
$title = $_SESSION['username'] . ' :: ';
} else {
if ($prod_name = $this->config->get('product_name')) {
$title = $prod_name . ' :: ';
} else {
示例11: testImg
public function testImg()
{
$expected = '<img src="myimage.jpg" alt="myimage" width="100" height="200">';
$this->assertEquals($expected, html::img('myimage.jpg', array('width' => 100, 'height' => 200)));
}
示例12: foreach
<?php
foreach ($this->results as $result) {
if (isset($result->Medium->uri)) {
echo "<div>";
echo html::img($result->Medium->uri) . "<br />";
echo "<div>";
}
}
示例13: attachment_upload
/**
* Handler for attachment uploads
*/
public function attachment_upload($session_key, $id_prefix = '')
{
// Upload progress update
if (!empty($_GET['_progress'])) {
$this->rc->upload_progress();
}
$recid = $id_prefix . rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC);
$uploadid = rcube_utils::get_input_value('_uploadid', rcube_utils::INPUT_GPC);
if (!is_array($_SESSION[$session_key]) || $_SESSION[$session_key]['id'] != $recid) {
$_SESSION[$session_key] = array();
$_SESSION[$session_key]['id'] = $recid;
$_SESSION[$session_key]['attachments'] = array();
}
// clear all stored output properties (like scripts and env vars)
$this->rc->output->reset();
if (is_array($_FILES['_attachments']['tmp_name'])) {
foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) {
// Process uploaded attachment if there is no error
$err = $_FILES['_attachments']['error'][$i];
if (!$err) {
$attachment = array('path' => $filepath, 'size' => $_FILES['_attachments']['size'][$i], 'name' => $_FILES['_attachments']['name'][$i], 'mimetype' => rcube_mime::file_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]), 'group' => $recid);
$attachment = $this->rc->plugins->exec_hook('attachment_upload', $attachment);
}
if (!$err && $attachment['status'] && !$attachment['abort']) {
$id = $attachment['id'];
// store new attachment in session
unset($attachment['status'], $attachment['abort']);
$_SESSION[$session_key]['attachments'][$id] = $attachment;
if (($icon = $_SESSION[$session_key . '_deleteicon']) && is_file($icon)) {
$button = html::img(array('src' => $icon, 'alt' => $this->rc->gettext('delete')));
} else {
$button = rcube::Q($this->rc->gettext('delete'));
}
$content = html::a(array('href' => "#delete", 'class' => 'delete', 'onclick' => sprintf("return %s.remove_from_attachment_list('rcmfile%s')", rcmail_output::JS_OBJECT_NAME, $id), 'title' => $this->rc->gettext('delete'), 'aria-label' => $this->rc->gettext('delete') . ' ' . $attachment['name']), $button);
$content .= rcube::Q($attachment['name']);
$this->rc->output->command('add2attachment_list', "rcmfile{$id}", array('html' => $content, 'name' => $attachment['name'], 'mimetype' => $attachment['mimetype'], 'classname' => rcube_utils::file2class($attachment['mimetype'], $attachment['name']), 'complete' => true), $uploadid);
} else {
// upload failed
if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
$msg = $this->rc->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $this->rc->show_bytes(parse_bytes(ini_get('upload_max_filesize'))))));
} else {
if ($attachment['error']) {
$msg = $attachment['error'];
} else {
$msg = $this->rc->gettext('fileuploaderror');
}
}
$this->rc->output->command('display_message', $msg, 'error');
$this->rc->output->command('remove_from_attachment_list', $uploadid);
}
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// if filesize exceeds post_max_size then $_FILES array is empty,
// show filesizeerror instead of fileuploaderror
if ($maxsize = ini_get('post_max_size')) {
$msg = $this->rc->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $this->rc->show_bytes(parse_bytes($maxsize)))));
} else {
$msg = $this->rc->gettext('fileuploaderror');
}
$this->rc->output->command('display_message', $msg, 'error');
$this->rc->output->command('remove_from_attachment_list', $uploadid);
}
}
$this->rc->output->send('iframe');
}
示例14: pathinfo
if ($text = $tag->attr('text')) {
$alt = $text;
}
// try to get the title from the image object and use it as alt text
if ($file) {
if (empty($alt) and $file->alt() != '') {
$alt = $file->alt();
}
if (empty($title) and $file->title() != '') {
$title = $file->title();
}
}
if (empty($alt)) {
$alt = pathinfo($url, PATHINFO_FILENAME);
}
$image = html::img($url, array('width' => $tag->attr('width'), 'height' => $tag->attr('height'), 'class' => $tag->attr('imgclass'), 'title' => html($title), 'alt' => html($alt)));
if ($tag->attr('link')) {
// build the href for the link
if ($link == 'self') {
$href = $url;
} else {
if ($file and $link == $file->filename()) {
$href = $file->url();
} else {
$href = $link;
}
}
$image = html::a(url($href), $image, array('rel' => $tag->attr('rel'), 'class' => $tag->attr('linkclass'), 'title' => html($tag->attr('title')), 'target' => $tag->target()));
}
$figure = new Brick('figure');
$figure->addClass($tag->attr('class'));
示例15: array
}
// build the href for the link
if ($link == 'self') {
$href = $url;
} else {
if ($file and $link == $file->filename()) {
$href = $file->url();
} else {
$href = $link;
}
}
return html::a(url($href), $image, array('rel' => $tag->attr('rel'), 'class' => $tag->attr('linkclass'), 'title' => $tag->attr('title'), 'target' => $tag->target()));
};
// image builder
$_image = function ($class) use($tag, $url, $alt, $title) {
return html::img($url, array('width' => $tag->attr('width'), 'height' => $tag->attr('height'), 'class' => $class, 'title' => $title, 'alt' => $alt));
};
if (kirby()->option('kirbytext.image.figure') or !empty($caption)) {
$image = $_link($_image($tag->attr('imgclass')));
$figure = new Brick('figure');
$figure->addClass($tag->attr('class'));
$figure->append($image);
if (!empty($caption)) {
$figure->append('<figcaption>' . html($caption) . '</figcaption>');
}
return $figure;
} else {
$class = trim($tag->attr('class') . ' ' . $tag->attr('imgclass'));
return $_link($_image($class));
}
});