本文整理汇总了PHP中html::cdata方法的典型用法代码示例。如果您正苦于以下问题:PHP html::cdata方法的具体用法?PHP html::cdata怎么用?PHP html::cdata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::cdata方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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));
}
}
示例3: getXML
public function getXML($data)
{
if (null === ($value = $data->{$this->value})) {
$value = $this->default;
}
return parent::wrapXML(array('type' => 'hidden'), html::cdata($value));
}
示例4: 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));
}
示例5: 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;
}
示例6: 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));
}
}
示例7: 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;
}
示例8: getXML
public function getXML($data)
{
$lines = array();
foreach ((array) $data->{$this->value} as $line) {
$lines[] = count($line) > 1 ? $line['href'] . ' ' . $line['name'] : $line['href'];
}
$this->addClass('form-text');
$this->addClass('resizable');
$this->addClass('nowrap');
return parent::wrapXML(array('rows' => $this->rows, 'cols' => $this->cols), html::cdata(join("\n", $lines)));
}
示例9: on_get_results
/**
* Возвращает результаты по опросу.
*/
public static function on_get_results(Context $ctx)
{
$output = '';
$id = $ctx->get('id');
$data = $ctx->db->getResultsKV("option", "count", "SELECT `option`, COUNT(*) AS `count` FROM `node__poll` WHERE `nid` = ? GROUP BY `option`", array($ctx->get('id')));
foreach ($data as $k => $v) {
$output .= html::em('option', array('count' => $v), html::cdata($k));
}
$voted = $ctx->user->id ? $ctx->db->fetch("SELECT COUNT(*) FROM `node__poll` WHERE `nid` = ? AND `uid` = ?", array($id, $ctx->user->id)) : $ctx->db->fetch("SELECT COUNT(*) FROM `node__poll` WHERE `nid` = ? AND `ip` = ?", array($id, $_SERVER['REMOTE_ADDR']));
return new Response(html::em('results', array('voted' => (bool) $voted), $output), 'text/xml');
}
示例10: 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));
}
}
示例11: 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);
}
}
示例12: 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);
}
示例13: on_get_head
/**
* Выводит <link>
* @mcms_message ru.molinos.cms.page.head
*/
public static function on_get_head(Context $ctx, array $pathinfo, $param)
{
$attrs = array('rel' => 'alternate', 'type' => 'application/x-wiki');
if ($param) {
$attrs['title'] = t('Редактировать');
$attrs['href'] = 'admin/node/' . $param;
} else {
$attrs['title'] = t('Создать документ');
$attrs['href'] = 'admin/create';
}
$attrs['href'] = $ctx->url()->getBase($ctx) . $attrs['href'] . '?destination=' . urlencode($_SERVER['REQUEST_URI']);
$output = html::em('link', $attrs);
return html::em('head', array('module' => 'ueb'), html::cdata($output));
}
示例14: 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']));
}
}
示例15: on_find_xml
public static function on_find_xml(Context $ctx)
{
if (null === ($search = $ctx->get('search'))) {
throw new BadRequestException(t('Не указана подстрока для поиска (GET-параметр search).'));
}
if (!($limit = intval($ctx->get('limit', 5)))) {
throw new BadRequestException(t('Не указано количество возовращаемых меток (GET-параметр limit).'));
}
list($sql, $params) = Query::build(array('class' => 'label', 'deleted' => 0, 'published' => 1, 'name?|' => '%' . $search . '%', '#sort' => 'name'))->getSelect(null, null, 'name');
$result = '';
foreach ((array) $ctx->db->getResultsV("name", $sql, $params) as $name) {
$result .= html::em('label', html::cdata($name));
}
return new Response(html::em('labels', array('search' => $search, 'limit' => $limit), $result), 'text/xml');
}