本文整理汇总了PHP中Get::rawTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::rawTag方法的具体用法?PHP Get::rawTag怎么用?PHP Get::rawTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Get
的用法示例。
在下文中一共展示了Get::rawTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ceil
echo '<link>' . $config->url . '/</link>';
echo '<description>' . $config->description . '</description>';
echo '<lastBuildDate>' . Date::format(time(), 'r') . '</lastBuildDate>';
echo '<atom:link rel="self" href="' . $config->url_current . '"/>';
echo $config->offset > 1 ? '<atom:link rel="previous" href="' . $url_base . '/' . ($config->offset - 1) . '"/>' : "";
echo $config->offset < ceil($config->total_articles / $rss_limit) ? '<atom:link rel="next" href="' . $url_base . '/' . ($config->offset + 1) . '"/>' : "";
Weapon::fire('rss_meta');
if (!empty($bucket)) {
foreach ($bucket as $i => $item) {
$title = Text::parse(str_replace(array_values($str_replace), array_keys($str_replace), strip_tags($item->title)), '->encoded_html');
$description = Text::parse(str_replace(array_values($str_replace), array_keys($str_replace), $item->description), '->encoded_html');
$kind = Mecha::A($item->kind);
echo '<item>';
echo '<title>' . $title . '</title>';
echo '<link>' . $item->url . '</link>';
echo '<description>' . $description . '</description>';
echo '<pubDate>' . Date::format($item->time, 'r') . '</pubDate>';
echo '<guid>' . $item->url . '</guid>';
if (!empty($kind)) {
foreach ($kind as $k) {
$tag = Get::rawTag($k);
echo '<category domain="' . $config->url . '/' . $config->tag->slug . '/' . $tag['slug'] . '">' . $tag['name'] . '</category>';
}
}
echo '<source url="' . $item->url . '">' . $config->title . ': ' . $title . '</source>';
Weapon::fire('rss_item', array($item, $i));
echo '</item>';
}
}
echo '</channel>';
echo '</rss>';
示例2: tag
/**
* Widget Tag
* ----------
*
* [1]. Widget::tag('LIST');
* [2]. Widget::tag('LIST', 'ASC');
* [3]. Widget::tag('CLOUD', 'ASC', 'count');
* [4]. Widget::tag('CLOUD', 'ASC', 'name', 7);
*
*/
public static function tag($type = 'LIST', $order = 'ASC', $sorter = 'name', $max_level = 6)
{
$T1 = TAB;
$T2 = str_repeat($T1, 2);
$config = Config::get();
$speak = Config::speak();
$counters = array();
$tags = array();
if (!($files = Get::articles())) {
return O_BEGIN . '<div class="widget widget-tag">' . Config::speak('notify_empty', strtolower($speak->posts)) . '</div>' . O_END;
}
foreach ($files as $file) {
list($_time, $_kind, $_name) = explode('_', File::B($file), 3);
foreach (explode(',', $_kind) as $kind) {
$counters[] = (int) $kind;
}
}
$i = 0;
foreach (array_count_values($counters) as $id => $count) {
$tag = Get::rawTag($id);
if ($tag && $id !== 0) {
$tags[$i] = array('id' => $id, 'name' => $tag['name'], 'slug' => $tag['slug'], 'count' => $count);
$i++;
}
}
if (empty($tags)) {
return O_BEGIN . '<div class="widget widget-tag">' . Config::speak('notify_empty', strtolower($speak->tags)) . '</div>' . O_END;
}
$tags = Mecha::eat($tags)->order($order, $sorter)->vomit();
if ($type === 'LIST') {
$html = O_BEGIN . '<div class="widget widget-tag widget-tag-list" id="widget-tag-list-' . self::$id['tag_list'] . '">' . NL;
self::$id['tag_list']++;
$html .= $T1 . '<ul>' . NL;
foreach ($tags as $tag) {
$html .= $T2 . '<li' . ($config->tag_query === $tag['slug'] ? ' class="selected"' : "") . '><a href="' . $config->url . '/' . $config->tag->slug . '/' . $tag['slug'] . '" rel="tag">' . $tag['name'] . '</a> <span class="counter">' . $tag['count'] . '</span></li>' . NL;
}
$html .= $T1 . '</ul>' . NL;
$html .= '</div>' . O_END;
$html = Filter::apply('widget', $html);
return Filter::apply('widget:tag.list', Filter::apply('widget:tag', $html));
}
if ($type === 'CLOUD') {
$tags_counter = array();
foreach ($tags as $tag) {
$tags_counter[] = $tag['count'];
}
$highest_count = max($tags_counter);
$html = O_BEGIN . '<div class="widget widget-tag widget-tag-cloud" id="widget-tag-cloud-' . self::$id['tag_cloud'] . '">' . NL . TAB;
self::$id['tag_cloud']++;
$_html = array();
foreach ($tags as $tag) {
$size = ceil($tag['count'] / $highest_count * $max_level);
$_html[] = '<span class="size size-' . $size . ($config->tag_query === $tag['slug'] ? ' selected' : "") . '"><a href="' . $config->url . '/' . $config->tag->slug . '/' . $tag['slug'] . '" rel="tag">' . $tag['name'] . '</a> <span class="counter">' . $tag['count'] . '</span></span>';
}
$html .= implode(' ', $_html) . NL . '</div>' . O_END;
$html = Filter::apply('widget', $html);
return Filter::apply('widget:tag.cloud', Filter::apply('widget:tag', $html));
}
if ($type === 'DROPDOWN') {
$html = O_BEGIN . '<div class="widget widget-tag widget-tag-dropdown" id="widget-tag-dropdown-' . self::$id['tag_dropdown'] . '">' . NL;
self::$id['tag_dropdown']++;
$html .= $T1 . '<select>' . NL . ($config->tag_query === "" ? $T2 . '<option disabled selected>' . $speak->select . '…</option>' . NL : "");
foreach ($tags as $tag) {
$html .= $T2 . '<option value="' . $config->url . '/' . $config->tag->slug . '/' . $tag['slug'] . '"' . ($config->tag_query === $tag['slug'] ? ' selected' : "") . '>' . $tag['name'] . ' (' . $tag['count'] . ')</option>' . NL;
}
$html .= $T1 . '</select>' . NL;
$html .= '</div>' . O_END;
$html = Filter::apply('widget', $html);
return Filter::apply('widget:tag.dropdown', Filter::apply('widget:tag', $html));
}
}