本文整理匯總了PHP中html::em方法的典型用法代碼示例。如果您正苦於以下問題:PHP html::em方法的具體用法?PHP html::em怎麽用?PHP html::em使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類html
的用法示例。
在下文中一共展示了html::em方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: on_get_list
/**
* Возвращает список файлов, прикреплённых к документу.
*/
public static function on_get_list(Context $ctx)
{
$ids = $ctx->db->getResultsV("nid", "SELECT `nid` FROM `node__rel` WHERE `tid` = ? AND `key` IS NULL AND `nid` IN (SELECT `id` FROM `node` WHERE `class` = 'file')", array($ctx->get('id')));
$output = Node::findXML(array('id' => $ctx->get('id'), 'deleted' => 0));
$output .= html::wrap('files', Node::findXML(array('class' => 'file', 'deleted' => 0, 'id' => $ids), $ctx->db));
return html::em('content', array('name' => 'extrafiles'), $output);
}
示例2: getHTML
public function getHTML($data)
{
if (empty($data[$this->value])) {
return null;
}
$output = "<table>";
$output .= "<tr class='header'>";
$output .= "<th class='check'> </th>";
$output .= "<th class='name'>" . t('Название') . "</th>";
$output .= "<th class='qty'>" . t('Количество') . "</th>";
$output .= "<th class='price'>" . t('Цена') . "</th>";
$output .= "<th class='sum'>" . t('Сумма') . "</th>";
$output .= "</tr>";
$total = 0;
foreach ($data[$this->value] as $row) {
$output .= "<tr class='product'>";
$output .= "<td class='check'>" . html::em('input', array('type' => 'checkbox', 'name' => $this->value . '_checked[]', 'value' => $row['id'])) . "</td>";
$output .= "<td class='name'>" . html::plain($row['name']) . "</td>";
$output .= "<td class='qty'>" . html::em('input', array('type' => 'text', 'name' => "{$this->value}[{$row['id']}][qty]", 'value' => $row['qty'])) . "</td>";
$output .= "<td class='price'>" . number_format($row['price'], 2) . "</td>";
$output .= "<td class='sum'>" . number_format($row['sum'], 2) . "</td>";
$output .= "</tr>";
$total += $row['sum'];
}
$output .= "<tr class='total'>";
$output .= "<td> </td>";
$output .= "<td class='total'><strong>" . t('Итого') . ":</td>";
$output .= "<td class='qty'> </td>";
$output .= "<td class='price'> </td>";
$output .= "<td class='sum'>" . number_format($total, 2) . "</td>";
$output .= "</tr>";
$output .= "</table>";
return $output;
}
示例3: renderContent
private function renderContent(array $content)
{
$sum = 0;
$rows = '<table class=\'orderdetails\'><thead>';
$rows .= '<tr><th>id</th><th>Название</th><th>Цена</th><th>Количество</th><th>Сумма</th></tr>';
$rows .= '</thead><tbody>';
foreach ($content as $k => $item) {
if ($k !== 'total') {
$rows .= '<tr>';
$rows .= html::em('td', $item['id']);
$rows .= html::em('td', $this->getProductLink($item));
$rows .= html::em('td', array('class' => 'sum'), number_format(abs($item['price']), 2, ',', '.'));
if (is_numeric($k)) {
$rows .= html::em('td', array('class' => 'qty'), number_format($item['qty'], 0, ',', ' '));
} else {
$rows .= html::em('td');
}
$rows .= html::em('td', array('class' => 'sum'), number_format(abs($item['sum']), 2, ',', '.'));
$rows .= '</tr>';
}
}
$rows .= '<tr><td colspan=\'3\' class=\'empty\'> </td>' . '<td>' . $content['total']['qty'] . '</td>' . '<td><strong>' . number_format($content['total']['sum'], 2, ',', '.') . '</strong></td></tr>';
$rows .= '</tbody></table>';
return $rows;
}
示例4: render
public function render(Context $ctx, array $options = array())
{
$options = array_merge(array('name' => 'custom', 'title' => MCMS_HOST_NAME, 'xsl' => os::path('lib', 'modules', 'rss', 'default.xsl'), 'base' => $ctx->url()->getBase($ctx), 'description' => 'News from ' . MCMS_HOST_NAME, 'language' => 'ru', 'url' => 'http://' . MCMS_HOST_NAME . $ctx->url()->string()), $options);
$content = html::wrap('nodes', Node::findXML($this->filter, $ctx->db));
$content = html::em('rss', $options, $content);
return xslt::transform($content, $options['xsl'], 'text/xml');
}
示例5: rpc_post_subscribe
public static function rpc_post_subscribe(Context $ctx)
{
$data = $ctx->post;
if (empty($data['sections'])) {
throw new InvalidArgumentException("Не выбраны разделы для подписки.");
}
if (false === strpos($data['email'], '@')) {
throw new InvalidArgumentException(t('Введённый email не похож на email.'));
}
// В массиве могут быть и другие данные, поэтому мы
// выбираем только то, что нам нужно завернуть.
$bulk = array('email' => $data['email'], 'sections' => $data['sections']);
$link = new url(array('args' => array('q' => 'subscription.rpc', 'action' => 'confirm', 'code' => base64_encode(serialize($bulk)))));
$sections = Node::findXML(array('class' => 'tag', 'deleted' => 0, 'published' => 1, 'id' => $data['sections'], '#sort' => 'name'), $ctx->db, 'section');
if (empty($sections)) {
throw new InvalidArgumentException("Выбраны несуществующие разделы для подписки.");
}
$xml = html::em('message', array('mode' => 'confirm', 'host' => MCMS_HOST_NAME, 'email' => $data['email'], 'base' => $ctx->url()->getBase($ctx), 'confirmLink' => $link->string()), html::em('sections', $sections));
$xsl = $ctx->config->get('modules/subscription/stylesheet', os::path('lib', 'modules', 'subscription', 'message.xsl'));
if (false === ($body = xslt::transform($xml, $xsl, null))) {
throw new RuntimeException(t('Возникла ошибка при форматировании почтового сообщения.'));
}
$subject = t('Подписка на новости сайта %host', array('%host' => MCMS_HOST_NAME));
// mcms::debug($data['email'], $subject, $body);
BebopMimeMail::send(null, $data['email'], $subject, $body);
}
示例6: taskRun
/**
* @mcms_message ru.molinos.cms.cron
*/
public static function taskRun(Context $ctx)
{
$types = $ctx->config->get('modules/subscription/types', array());
$xsl = $ctx->config->get('modules/subscription/stylesheet', os::path('lib', 'modules', 'subscription', 'message.xsl'));
$sub = $ctx->config->get('modules/subscription/subject', 'Новости сайта %host');
if (empty($types)) {
return;
}
$ctx->db->beginTransaction();
$users = Node::find(array('class' => 'subscription', 'deleted' => 0, 'published' => 1, '#sort' => 'name'), $ctx->db);
// Обрабатываем активных пользователей.
foreach ($users as $user) {
$olast = $last = intval($user->last);
if ($sections = (array) $user->tags) {
list($sql, $params) = Query::build(array('class' => $types, 'tags' => $sections, 'published' => 1, 'deleted' => 0, 'id' => array('>' . ($olast + 1))))->getSelect(array('id', 'xml'));
$nodes = $ctx->db->getResultsKV('id', 'xml', $sql, $params);
// Отправляем документы.
foreach ($nodes as $nid => $node) {
$xml = html::em('message', array('mode' => 'regular', 'unsubscribe' => 'subscription.rpc?action=remove&name=' . urlencode($user->name) . '&id=' . $user->id, 'base' => $ctx->url()->getBase($ctx), 'host' => MCMS_HOST_NAME), $node);
$body = xslt::transform($xml, $xsl, null);
$subject = t($sub, array('%host' => $ctx->url()->host()));
BebopMimeMail::send(null, $user->name, $subject, $body);
$last = max($last, $nid);
}
// Запоминаем последнее отправленное сообщение.
$user->last = $last;
$user->save();
}
}
$ctx->db->commit();
}
示例7: preview
public function preview($data)
{
if ($url = $data->{$this->value}) {
$a = html::em('a', array('href' => $url), html::plain($url));
return html::em('value', array('html' => true), html::cdata($a));
}
}
示例8: on_get_login_form
/**
* Вывод формы авторизации.
* @route GET//login
*/
public static function on_get_login_form(Context $ctx)
{
if ($ctx->user->id and !$ctx->get('stay')) {
return $ctx->getRedirect();
}
if (class_exists('APIStream')) {
APIStream::init($ctx);
}
$handler = array('theme' => $ctx->config->get('modules/auth/login_theme'));
$content = '';
foreach ((array) $ctx->registry->poll('ru.molinos.cms.page.head', array($ctx, $handler, null), true) as $block) {
if (!empty($block['result'])) {
$content .= $block['result'];
}
}
$content .= self::getXML($ctx);
$xml = html::em('page', array('status' => 401, 'base' => $ctx->url()->getBase($ctx), 'host' => MCMS_HOST_NAME, 'prefix' => os::webpath(MCMS_SITE_FOLDER, 'themes'), 'back' => urlencode(MCMS_REQUEST_URI), 'next' => $ctx->get('destination'), 'api' => APIStream::getPrefix(), 'query' => $ctx->query()), $content);
if (file_exists($xsl = os::path(MCMS_SITE_FOLDER, 'themes', $handler['theme'], 'templates', 'login.xsl'))) {
try {
return xslt::transform($xml, $xsl);
} catch (Exception $e) {
}
}
return xslt::transform($xml, 'lib/modules/auth/xsl/login.xsl');
}
示例9: on_get_head
/**
* Добавляет главный RSS во все страницы.
* @mcms_message ru.molinos.cms.page.head
*/
public static function on_get_head(Context $ctx)
{
$result = '';
if ($rss = $ctx->config->get('modules/rss/feedurl')) {
$result .= html::em('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => $rss, 'title' => $ctx->config->get('modules/rss/feedname')));
}
return html::wrap('head', html::cdata($result), array('module' => 'rss', 'weight' => 50));
}
示例10: format
public function format(Node $node, $em)
{
$value = $node->{$this->value};
$tmp = '';
foreach ((array) $value as $line) {
$tmp .= html::em('link', $line);
}
return html::wrap($em, $tmp);
}
示例11: onGet
public function onGet(array $options)
{
$sections = array_intersect_key(Node::getSortedList('tag'), array_flip(Node::create('subscription')->getEnabledSections()));
$output = html::simpleOptions($sections, 'section', 'sections');
if ($this->description) {
$output .= html::em('description', html::cdata($this->description));
}
return $output;
}
示例12: get_info_xml
public static function get_info_xml(Context $ctx)
{
if ($uid = $ctx->user->id) {
$xml = Node::findXML(array('class' => 'user', 'published' => 1, 'deleted' => 0, 'id' => $uid), $ctx->db);
}
if (empty($xml)) {
$xml = html::em('node', array('class' => 'user', 'name' => 'anonymous'));
}
return new Response($xml, 'text/xml');
}
示例13: on_get_content
/**
* Возвращает код для включения в страницу.
* @mcms_message ru.molinos.cms.page.head
*/
public static function on_get_content(Context $ctx)
{
$conf = $ctx->config->get('modules/googleanalytics');
if (!empty($conf['account'])) {
$proto = empty($_SERVER['HTTPS']) ? 'http' : 'https';
$output = html::em('script', array('src' => $proto . '://www.google-analytics.com/ga.js', 'type' => 'text/javascript'));
$output .= '<script type="text/javascript">try{var pageTracker = _gat._getTracker("' . $conf['account'] . '");pageTracker._trackPageview();}catch(err){}</script>';
return html::em('head', array('module' => 'googleanalytics'), html::cdata($output));
}
}
示例14: getPreviewXML
/**
* Добавляет в предварительный просмотр количество отмеченных документов.
*/
public function getPreviewXML(Context $ctx)
{
$result = parent::getPreviewXML($ctx);
$count = $ctx->db->fetch("SELECT COUNT(*) FROM node WHERE deleted = 0 AND id IN " . "(SELECT nid FROM node__rel WHERE tid = ?) AND class IN " . "(SELECT name FROM node WHERE class = 'type' AND deleted = 0 AND published = 1)", array($this->id));
if ($count) {
$message = t('%count (<a href="@url">список</a>)', array('%count' => $count, '@url' => 'admin/content/list?search=tags%3A' . $this->id));
$result .= html::em('field', array('title' => t('Отмечено документов')), html::em('value', html::cdata($message)));
}
return $result;
}
示例15: on_get_delete
public static function on_get_delete(Context $ctx)
{
$list = '';
foreach ((array) $ctx->get('delete') as $name) {
$list .= html::em('widget', array('name' => $name));
}
if (empty($list)) {
throw new PageNotFoundException();
}
return html::wrap('content', $list, array('name' => 'delete-widgets', 'title' => t('Виджеты'), 'base' => self::listurl));
}