本文整理匯總了PHP中html::plain方法的典型用法代碼示例。如果您正苦於以下問題:PHP html::plain方法的具體用法?PHP html::plain怎麽用?PHP html::plain使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類html
的用法示例。
在下文中一共展示了html::plain方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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));
}
}
示例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: attrs
public static function attrs(array $attrs)
{
$result = '';
foreach ($attrs as $k => $v) {
if ('#' == substr($k, 0, 1)) {
continue;
}
if ('class' == $k) {
if (!is_array($v)) {
$v = preg_split('/\\s+/', $v, -1, PREG_SPLIT_NO_EMPTY);
}
$v = join(' ', array_unique($v));
}
if (null === $v or '' === $v or is_array($v)) {
continue;
}
if (!empty($v)) {
if (true === $v) {
$v = 'yes';
} else {
$v = html::plain($v, false);
}
$result .= ' ' . self::attrname($k) . '=\'' . $v . '\'';
} elseif ($k == 'value') {
$result .= " value=''";
}
}
return $result;
}
示例4: getProductLink
private function getProductLink(array $item)
{
$ctx = Context::last();
if (empty($item['id'])) {
return htmlspecialchars($item['name']);
}
if (0 === strpos($ctx->query(), 'admin/')) {
$url = '?q=admin/edit/' . $item['id'] . '&destination=admin';
} else {
$url = '?q=nodeapi.rpc&action=locate&node=' . $item['id'];
}
return html::link($url, html::plain($item['name']));
}
示例5: on_preview_tags
/**
* Добавляет информацию о разделах в предварительный просмотр.
* @mcms_message ru.molinos.cms.hook.preview.xml
*/
public static function on_preview_tags(Node $node)
{
if (!$node->checkPermission(ACL::UPDATE)) {
return;
}
if ($data = $node->getDB()->getResultsKV("id", "name", "SELECT `id`, `name` FROM `node` WHERE `deleted` = 0 AND `class` = 'tag' AND `id` IN (SELECT `tid` FROM `node__rel` WHERE `nid` = ?)", array($node->id))) {
$result = array();
foreach ($data as $k => $v) {
$result[] = html::em('a', array('href' => "admin/node/{$k}?destination=CURRENT"), html::plain($v));
}
$result = html::em('value', html::cdata(implode(', ', $result)));
return html::em('field', array('html' => true, 'title' => t('Находится в разделах'), 'editurl' => "admin/structure/taxonomy/setup?node={$node->id}&destination=" . urlencode(MCMS_REQUEST_URI)), $result);
}
}
示例6: reindexNode
private static function reindexNode(Node $node)
{
return;
$html = '';
$schema = Schema::load($node->getDB(), $node->class);
foreach ($schema['fields'] as $k => $v) {
if (isset($node->{$k})) {
$html .= '<strong>' . html::plain($v['label']) . '</strong>';
$html .= '<div class=\'data\'>' . $node->{$k} . '</div>';
}
}
$lang = empty($node->lang) ? 'en' : $node->lang;
$html = "HTTP/1.0 200 OK\n" . "Content-Type: text/html; charset=utf-8\n" . "Content-Language: {$lang}\n\n" . "<html><head><title>{$node->name}</title></head>" . "<body><h1>{$node->name}</h1>{$html}</body></html>";
try {
$node->getDB()->exec('DELETE FROM `node__searchindex` WHERE `nid` = :nid', array(':nid' => $node->id));
$node->getDB()->exec('INSERT INTO `node__searchindex` (`nid`, `url`, `html`) ' . 'VALUES (:nid, :url, :html)', array(':nid' => $node->id, ':url' => self::getNodeUrl($node), ':html' => $html));
} catch (TableNotFoundException $e) {
}
}
示例7: getPreviewXML
/**
* Формирует таблицу для предварительного просмотра.
*/
public function getPreviewXML(Context $ctx)
{
$xml = parent::getPreviewXML($ctx);
if (is_array($this->orderdetails)) {
$params = array();
$names = $this->getDB()->getResultsKV("id", "name", "SELECT `id`, `name` FROM `node` WHERE `id` " . sql::in(array_keys($this->orderdetails), $params), $params);
$table = '';
foreach ($this->orderdetails as $k => $v) {
$name = isset($names[$k]) ? $names[$k] : '???';
$row = html::em('td', html::em('a', array('href' => "admin/node/{$k}?destination=CURRENT"), html::plain($name)));
$row .= html::em('td', html::cdata('× ' . $v));
$table .= html::em('tr', $row);
}
if ($value = html::wrap('table', $table, array('class' => 'classic'))) {
$xml .= html::em('field', array('title' => t('Содержимое заказа')), html::em('value', array('html' => true), html::cdata($value)));
}
}
return $xml;
}
示例8: send
public static function send($from, $to, $subject, $body, array $attachments = null, array $headers = null)
{
if (empty($to)) {
Logger::trace("mail not sent: no recipients: {$subject}");
return;
}
$config = Context::last()->config;
if (empty($from)) {
if (!($from = $config->get('modules/mail/from'))) {
$from = "Molinos.CMS <no-reply@" . MCMS_HOST_NAME . ">";
}
}
if (strstr($body, '<html>') === false) {
$body = '<html><head><title>' . html::plain($subject) . '</title></head><body>' . $body . '</body></html>';
}
if (!is_array($to)) {
$to = preg_split('/, */', $to, -1, PREG_SPLIT_NO_EMPTY);
}
Logger::log(sprintf('to=%s, subject=%s', join(',', $to), $subject), 'mail');
$mail = new htmlMimeMail();
if ('smtp' == ($transport = ($server = $config->get('modules/mail/server')) ? 'smtp' : 'mail')) {
$mail->setSMTPParams($server);
}
$mail->setFrom($from);
$mail->setSubject($subject);
$mail->setHtml(self::fixhtml($body));
$mail->setTextCharset('UTF-8');
$mail->setTextEncoding('base64');
$mail->setHTMLCharset('UTF-8');
$mail->setHTMLEncoding('UTF-8');
$mail->setHeadCharset('UTF-8');
foreach ((array) $attachments as $file) {
$mail->addAttachment($file['data'], $file['name'], $file['type']);
}
foreach ((array) $headers as $k => $v) {
if (!empty($v)) {
$mail->setHeader($k, $v);
}
}
return $mail->send($to, $transport);
}
示例9: getNodeBody
private static function getNodeBody(Node $node)
{
$body = '<dl>';
$schema = $node->getSchema();
foreach ($schema as $k => $v) {
if (isset($node->{$k})) {
if ($v instanceof PasswordControl) {
$value = null;
} elseif ($v instanceof EmailControl) {
$value = html::em('a', array('href' => 'mailto:' . $node->{$k}), $node->{$k});
} elseif (!is_object($node->{$k})) {
$value = $node->{$k};
}
if (null !== $value) {
$body .= '<dt>' . html::plain($v->label) . ':</dt>';
$body .= '<dd>' . $value . '</dd>';
}
}
}
$body .= '</dl>';
$body .= '<p>' . html::link('admin/node/' . $node->id . '?destination=admin', t('Открыть в админке')) . '</p>';
return $body;
}
示例10: preview
public function preview($value)
{
if ($value = $value->{$this->value}) {
if (is_object($value)) {
$link = html::em('a', array('href' => 'admin/node/' . $value->id), html::plain($value->name));
return html::wrap('value', html::cdata($link), array('html' => true));
}
}
}
示例11: preview
public function preview($value)
{
$file = $value->{$this->value};
if (!$file instanceof FileNode) {
return;
}
if (0 === strpos($file->filetype, 'image/')) {
$path = Context::last()->config->getPath('modules/files/storage');
if (isset($file->versions['thumbnail'])) {
$attrs = array('width' => $file->versions['thumbnail']['width'], 'height' => $file->versions['thumbnail']['height'], 'src' => os::webpath($path, $file->versions['thumbnail']['filename']));
} else {
$attrs = array('width' => $file->width, 'height' => $file->height, 'src' => os::webpath($path, $file->filepath));
}
$attrs['alt'] = $file->filename;
$img = html::em('img', $attrs);
$html = html::em('a', array('href' => 'admin/node/' . $file->id . '?destination=' . urlencode(MCMS_REQUEST_URI)), $img);
} else {
$html = html::em('a', array('href' => "admin/node/{$file->id}?destination=CURRENT"), html::plain($file->filename));
// $html = $this->getEmbedCode($file);
}
if ($value->checkPermission(ACL::UPDATE)) {
$html .= t('<p><a href="@url">Открепить файл</a></p>', array('@url' => "files/unlink.rpc?node={$value->id}&file={$file->id}&field={$this->value}&destination=" . urlencode(MCMS_REQUEST_URI)));
}
return html::em('value', array('html' => true), html::cdata($html));
}
示例12: preview
public function preview($data)
{
$nodes = Node::find($filter = array('class' => $this->dictionary, 'deleted' => 0, $this->parents ? 'tagged' : 'tags' => $data->id));
$items = array();
foreach ($nodes as $node) {
$items[$node->id] = $node->getName();
}
asort($items);
$result = array();
foreach ($items as $k => $v) {
$result[] = html::em('a', array('href' => 'admin/node/' . $k), html::plain($v));
}
$result = empty($result) ? null : implode(', ', $result) . '.';
if (empty($result)) {
$result = t('нет');
}
return html::em('value', array('html' => true), html::cdata($result));
}
示例13: preview
/**
* Возвращает информацию для предварительного просмотра.
*/
public function preview($node)
{
if ($user = $node->{$this->value}) {
if (!is_object($user)) {
$user = Node::load($user);
}
$html = html::em('a', array('href' => 'admin/node/' . $user->id), html::cdata($user->getName()));
} elseif ($name = $node->{$this->value . ':name'}) {
$html = html::plain($name);
} else {
$html = t('Авторство не установлено.');
}
return html::wrap('value', html::cdata($html));
}
示例14: preview
/**
* Возвращает имя связанного объекта для предварительного просмотра.
*/
public function preview($value)
{
if (is_object($value = $value->{$this->value})) {
$html = html::em('a', array('href' => 'admin/node/' . $value->id . '?destination=CURRENT'), html::plain($value->getName()));
return html::em('value', array('html' => true), html::cdata($html));
}
}
示例15: getData
protected function getData()
{
if ('404' == $this->preset) {
$data = array();
$limit = $this->ctx->get('limit', 10);
$offset = $limit * $this->ctx->get('page') - $limit;
foreach ($this->ctx->db->getResults("SELECT * FROM `node__fallback` ORDER BY `old` LIMIT {$offset}, {$limit}") as $row) {
$row['_links'] = array('edit' => array('href' => '?q=admin/content/edit/404' . '&subid=' . urlencode($row['old']) . '&destination=CURRENT', 'title' => 'Изменить', 'icon' => 'edit'), 'delete' => array('href' => '?q=admin.rpc&action=404&mode=delete' . '&src=' . urlencode($row['old']) . '&destination=CURRENT', 'title' => 'Удалить', 'icon' => 'delete'));
if (!empty($row['new'])) {
$row['new'] = html::em('a', array('href' => '?q=' . urlencode($row['new'])), html::plain($row['new']));
}
if (!empty($row['ref'])) {
$url = new url($row['ref']);
if (0 === strpos($name = $url->host, 'www.')) {
$name = substr($name, 4);
}
$row['ref'] = html::link($row['ref'], $name);
}
$data[] = $row;
}
return $data;
}
$result = '';
$filter = $this->getNodeFilter();
if (null !== $this->limit) {
$filter['#limit'] = $this->limit;
$filter['#offset'] = ($this->page - 1) * $this->limit;
}
$result = Node::findXML($filter);
return html::em('data', $result);
}