本文整理汇总了PHP中html::wrap方法的典型用法代码示例。如果您正苦于以下问题:PHP html::wrap方法的具体用法?PHP html::wrap怎么用?PHP html::wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::wrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: on_get_node_xml
/**
* Добавление произвольных файлов в XML ноды.
* @mcms_message ru.molinos.cms.node.xml
*/
public static function on_get_node_xml(Node $node)
{
if ($node instanceof FileNode) {
return;
}
return html::wrap('files', Node::findXML(array('class' => 'file', 'deleted' => 0, 'id' => $node->getDB()->getResultsV("nid", "SELECT `nid` FROM `node__rel` WHERE `tid` = ? AND `key` IS NULL", array($node->id))), $node->getDB()));
}
示例3: onGetSimple
protected function onGetSimple(array $options)
{
$cart = new Cart($this->ctx);
$result = $cart->getXML();
$result .= $cart->getConfigXML();
return html::wrap('cart', $result, array('mode' => 'simple'));
}
示例4: format
/**
* Форматирование значения. Вызывает обработчики вроде типографа.
*/
public function format(Node $node, $em)
{
$value = $node->{$this->value};
$ctx = Context::last();
$ctx->registry->broadcast('ru.molinos.cms.format.text', array($ctx, $this->value, &$value));
return html::wrap($em, html::cdata($value));
}
示例5: getExtraXMLContent
public function getExtraXMLContent()
{
$result = '';
foreach (self::split($this->answers) as $k => $v) {
$result .= html::em('answer', array('value' => $k), html::cdata($v));
}
return parent::getExtraXMLContent() . html::wrap('answers', $result);
}
示例6: 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));
}
示例7: format
public function format(Node $node, $em)
{
if (is_array($value = $node->{$this->value})) {
$data = $value;
$embed = $data['embed'];
unset($data['embed']);
return html::wrap($em, html::cdata($embed), $data);
}
}
示例8: 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);
}
示例9: 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));
}
示例10: on_get_delete
public static function on_get_delete(Context $ctx)
{
$pages = '';
foreach ((array) $ctx->get('check') as $id) {
$pages .= html::em('page', urldecode($id));
}
if (empty($pages)) {
throw new ForbiddenException(t('Не выбраны пути для удаления.'));
}
return html::wrap('content', $pages, array('name' => 'route-delete'));
}
示例11: on_get_groups
public static function on_get_groups(Context $ctx)
{
$nodes = Node::find(array('class' => 'group', 'deleted' => 0), $ctx->db);
$counts = $ctx->db->getResultsKV('id', 'count', "SELECT tid AS id, COUNT(*) AS count FROM node__rel r INNER JOIN node g ON g.id = r.tid INNER JOIN node u ON u.id = r.nid WHERE g.deleted = 0 AND u.deleted = 0 AND g.class = 'group' AND u.class = 'user' GROUP BY tid");
$html = '';
foreach ($nodes as $node) {
$count = isset($counts[$node->id]) ? $counts[$node->id] : 0;
$html .= html::em('node', array('id' => $node->id, 'name' => $node->getName(), 'created' => $node->created, 'users' => $count, 'editable' => $node->checkPermission(ACL::UPDATE), 'published' => true));
}
$html = html::wrap('data', $html);
return html::em('content', array('name' => 'list', 'preset' => 'groups', 'title' => t('Группы пользователей'), 'nosearch' => true, 'create' => 'admin/create/group'), $html);
}
示例12: preview
/**
* Формирование предварительного просмотра.
*
* Загружает данные прямо из БД, чтобы видеть метки, которые не дошли
* до XML представления. Такие метки выделяются курсивом.
*/
public function preview($value)
{
if ($labels = $value->{$this->value}) {
$result = array();
foreach ($this->getLabelsFor($value) as $id => $name) {
if (!array_key_exists($id, $labels)) {
$name = html::em('em', $name);
}
$result[] = html::em('a', array('href' => 'admin/node/' . $id), $name);
}
return html::wrap('value', html::cdata(implode(', ', $result)), array('html' => true));
}
}
示例13: format
public function format(Node $node, $em)
{
$value = $node->{$this->value};
include_once os::path(dirname(__FILE__), 'markdown.php');
$output = Markdown($value);
$ctx = Context::last();
$ctx->registry->broadcast('ru.molinos.cms.format.text', array($ctx, $this->value, &$output));
$attrs = array();
if (!($sniplen = $this->sniplen)) {
$sniplen = 50;
}
$attrs['snippet'] = mb_strimwidth(strip_tags($output), 0, $sniplen, '…');
return html::wrap($em, html::cdata(trim($output)), $attrs);
}
示例14: getData
protected function getData()
{
$data = Node::find(array('class' => 'type', 'deleted' => 0, '#sort' => '-published name'), $this->ctx->db);
$counts = $this->ctx->db->getResultsKV("name", "count", "SELECT `class` AS `name`, COUNT(*) AS `count` FROM `node` WHERE `deleted` = 0 GROUP BY `class`");
$nodes = '';
foreach ($data as $node) {
if ($node->isdictionary) {
$attrs = array('id' => $node->id, 'name' => $node->name, 'title' => $node->title, 'list' => Node::create($node->name)->getListURL(), 'published' => (bool) $node->published);
$attrs['count'] = array_key_exists($node->name, $counts) ? $counts[$node->name] : 0;
$nodes .= html::em('node', $attrs);
}
}
return html::wrap('data', $nodes);
}
示例15: format
public function format(Node $noed, $em)
{
$value = $node->{$this->value};
if (is_array($value) and !empty($value['lat']) and !empty($value['lon'])) {
$ll = $value['lat'] . ',' . $value['lon'];
$key = Context::last()->config->get('modules/googlemaps/key');
$img = html::em('img', array('src' => sprintf('http://maps.google.com/staticmap?center=%s&zoom=%u&size=%ux%u&hl=ru&key=%s', $ll, $this->zoom_embed, $this->width, $this->height, $key), 'width' => $this->width, 'height' => $this->height, 'alt' => $value));
if (!($zoom_link = $this->zoom_link)) {
$zoom_link = $this->zoom_embed + 2;
}
$result = html::em('a', array('href' => sprintf('http://maps.google.com/maps?ll=%s&z=%u', $ll, $zoom_link), 'title' => $value), $img);
return html::wrap($em, html::cdata($result), array('address' => $value['query']));
}
}