本文整理汇总了PHP中tag_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP tag_escape函数的具体用法?PHP tag_escape怎么用?PHP tag_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tag_escape函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: cleanGallery
public function cleanGallery($output, $attr)
{
static $cleaner_gallery_instance = 0;
$cleaner_gallery_instance++;
if (is_feed()) {
return $output;
}
/* Default gallery settings. */
$defaults = array('order' => 'ASC', 'orderby' => 'ID', 'id' => get_the_ID(), 'link' => '', 'itemtag' => 'figure', 'icontag' => '', 'captiontag' => '', 'columns' => 3, 'size' => 'thumbnail', 'ids' => '', 'include' => '', 'exclude' => '', 'numberposts' => -1, 'offset' => '');
$attr = array_merge($defaults, $attr);
extract($attr);
$id = intval($id);
/* Arguments for get_children(). */
$children = array('post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby, 'exclude' => $exclude, 'include' => $include, 'numberposts' => $numberposts, 'offset' => $offset, 'suppress_filters' => true);
if (empty($include)) {
$attachments = get_children(array_merge(array('post_parent' => $id), $children));
} else {
$attachments = get_posts($children);
}
$attr['link'] = get_option('yopress_gallery_clean_link');
if ($attr['link'] == '' || $attr['link'] == null) {
$attr['link'] = 'big-thumbnail';
update_option('yopress_gallery_clean_link', 'full');
}
$size = get_option('yopress_theme_gallery_def_size');
if ($size == '' || $size == null) {
$size = 'thumbnail';
update_option('yopress_gallery_clean_size', 'thumbnail');
}
if (empty($attachments)) {
return '<!-- No images. -->';
}
$itemtag = tag_escape($itemtag);
$icontag = tag_escape($icontag);
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
$i = 0;
$galleryWidth = floor(100 / $columns);
$style = '<style type="text/css">#gallery-' . $cleaner_gallery_instance . ' .gallery-item { width : ' . $galleryWidth . '%}</style>';
$output = $style;
$output .= '<div id="gallery-' . $cleaner_gallery_instance . '" class="gallery gallery-columns-' . $columns . ' gallery-size-thumbnail">';
$itemInColum = 0;
foreach ($attachments as $attachment) {
$output .= '<dl class="gallery-item"><dt class="gallery-icon">';
$image = isset($attr['link']) && 'full' == $attr['link'] ? wp_get_attachment_link($attachment->ID, $size, false, false) : wp_get_attachment_link($attachment->ID, $size, true, false);
$lightbox = $attr['link'] == 'full' ? 'class="apply-lightbox"' : '';
$output .= "<div " . $lightbox . ">";
$output .= apply_filters('cleaner_gallery_image', $image, $attachment->ID, $attr, $cleaner_gallery_instance);
$output .= '</div>';
$output .= '</dt></dl>';
$itemInColum++;
if ($itemInColum == $columns) {
$itemInColum = 0;
$output .= '<br class="clearfix">';
}
}
$output .= '<br class="clearfix">';
$output .= "</div><!-- .gallery -->";
return $output;
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:60,代码来源:YoPressGalleryClean.php
示例2: vanilla_gallery
/**
* OVERRIDES: gallery_shortcode()
*
* This implements the functionality of the Gallery Shortcode for displaying
* WordPress images on a post.
*/
function vanilla_gallery($attr)
{
global $post, $tpl;
// BUG: I'm doing something wrong, because $attr is not the array of attributes from gallery_shortcode function. Why not??
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail'), $attr));
$id = intval($id);
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $id => $attachment) {
$output .= wp_get_attachment_link($id, $size, true) . "\n";
}
return $output;
}
$images = array();
foreach ($attachments as $id => $attachment) {
$images[] = array("link" => wp_get_attachment_link($id, $size, true), "caption" => $captiontag && trim($attachment->post_excerpt) ? $attachment->post_excerpt : 0);
}
// Prepare the template data
$tpl["gallery"] = array("tpl_file" => "shortcodes/gallery.html", "itemtag" => tag_escape($itemtag), "icontag" => tag_escape($icontag), "captiontag" => tag_escape($captiontag), "columns" => intval($columns), "itemwidth" => $columns > 0 ? floor(100 / $columns) - 1 : 100, "images" => $images);
// Execute the template
return vanilla_shortcode("gallery");
}
开发者ID:alicam,项目名称:vanilla-theme,代码行数:39,代码来源:gallery.php
示例3: __construct
public function __construct(array $aTabs, $asActiveTabSlugs, $sTabTag = 'h2', $aAttributes = array('class' => 'nav-tab-wrapper'), $aCallbacks = array())
{
$this->aCallbacks = $aCallbacks + array('format' => null, 'arguments' => null);
$this->aTabs = $this->_getFormattedTabs($aTabs);
$this->aActiveSlugs = $this->getAsArray($asActiveTabSlugs);
$this->sTabTag = $sTabTag ? tag_escape($sTabTag) : $this->sTabTag;
$this->aAttributes = $aAttributes;
}
开发者ID:jaime5x5,项目名称:seamless-donations,代码行数:8,代码来源:AdminPageFramework_TabNavigationBar.php
示例4: vw_custom_post_gallery
function vw_custom_post_gallery($null, $attr = array())
{
global $post, $wp_locale;
static $instance = 0;
$instance++;
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'figure', 'captiontag' => 'figcaption', 'columns' => 3, 'size' => 'vw_medium', 'include' => '', 'exclude' => ''), $attr));
$id = intval($id);
if ('RAND' == $order) {
$orderby = 'none';
}
if (!empty($include)) {
$include = preg_replace('/[^0-9,]+/', '', $include);
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
$attachments = array();
foreach ($_attachments as $key => $val) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif (!empty($exclude)) {
$exclude = preg_replace('/[^0-9,]+/', '', $exclude);
$attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
} else {
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
}
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $att_id => $attachment) {
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
}
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$float = is_rtl() ? 'right' : 'left';
$gallery_layout = vw_get_option('blog_custom_gallery_layout', '213');
$output = "<div id='gallery-{$instance}' class='custom-gallery galleryid-{$id} clearfix' data-gallery-layout='{$gallery_layout}'>";
if ($itemtag != '' && $captiontag != '') {
$i = 1;
foreach ($attachments as $id => $attachment) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, false, false);
$link = str_replace('<a', '<a title="' . $attachment->post_excerpt . '" ', $link);
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "{$link}";
if ($captiontag && trim($attachment->post_excerpt)) {
$output .= "\r\n\t\t\t\t\t<{$captiontag} class='gallery-caption'>\r\n\t\t\t\t\t" . wptexturize($attachment->post_excerpt) . "\r\n\t\t\t\t\t</{$captiontag}>";
}
$output .= "</{$itemtag}>";
$i++;
}
}
$output .= "</div>\n";
return $output;
}
开发者ID:wilxsv,项目名称:prevensionPublicLibrary,代码行数:55,代码来源:gallery.php
示例5: pressplay_gallery_shortcode
function pressplay_gallery_shortcode($null, $attr = array())
{
global $post;
static $instance = 0;
$instance++;
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail'), $attr));
$id = intval($id);
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $att_id => $attachment) {
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
}
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
if ($columns >= 4) {
$galleryItemDimensions = "height:80%;width:80%;";
} else {
$galleryItemDimensions = "";
}
$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
$itemheight = $itemwidth;
$selector = "gallery-{$instance}";
$output = apply_filters('gallery_style', "\r\n\t\t<style type='text/css'>\r\n\t\t\t#{$selector} {\r\n\t\t\t\tmargin: auto;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-item {\r\n\t\t\t\tfloat: left;\r\n\t\t\t\tmargin-top: 10px;\r\n\t\t\t\ttext-align: center;\r\n\t\t\t\twidth: {$itemwidth}%;\r\n\t\t\t\theight: {$itemheight}%;\r\n\t\t\t}\r\n\t\t\t#{$selector} img {\r\n\t\t\t\tborder: 2px solid #cfcfcf;\r\n\t\t\t\t" . $galleryItemDimensions . "\t\t\t\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-caption {\r\n\t\t\t\tmargin-left: 0;\r\n\t\t\t}\r\n\t\t</style>\r\n\t\t<!-- see gallery_shortcode() in wp-includes/media.php -->\r\n\t\t<div id='{$selector}' class='gallery galleryid-{$id}'>");
$i = 0;
foreach ($attachments as $id => $attachment) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "\r\n\t\t\t<{$icontag} class='gallery-icon'>\r\n\t\t\t\t{$link}\r\n\t\t\t</{$icontag}>";
if ($captiontag && trim($attachment->post_excerpt)) {
$output .= "\r\n\t\t\t\t<{$captiontag} class='gallery-caption'>\r\n\t\t\t\t" . wptexturize($attachment->post_excerpt) . "\r\n\t\t\t\t</{$captiontag}>";
}
$output .= "</{$itemtag}>";
if ($columns > 0 && ++$i % $columns == 0) {
$output .= '<br style="clear: both" />';
}
}
$output .= "\r\n\t\t\t<br style='clear: both;' />\r\n\t\t</div>\n";
return $output;
}
开发者ID:rraval,项目名称:PressPlay,代码行数:53,代码来源:gallery-mod.php
示例6: cherry_comments_default_list
/**
* Dispaly the list of comments.
*
* @since 4.0.0
*/
function cherry_comments_default_list()
{
$defaults = array('style' => 'ol', 'type' => 'all', 'avatar_size' => 48, 'short_ping' => true, 'callback' => 'cherry_rewrite_comment_item');
/**
* Filter the defaults list arguments of comments.
*
* @since 4.0.0
* @param array $defaults Defaults arguments.
*/
$args = apply_filters('cherry_comment_list_args', $defaults);
// Set argument 'echo' to the function 'wp_list_comments' for return result.
$args = array_merge($args, array('echo' => false));
printf('<%1$s class="comment-list">%2$s</%1$s>', tag_escape($args['style']), wp_list_comments($args));
}
开发者ID:xav335,项目名称:sfnettoyage,代码行数:19,代码来源:template-comments.php
示例7: theme_gallery_shortcode
function theme_gallery_shortcode($attr)
{
global $post;
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ($output != '') {
return $output;
}
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail'), $attr));
$id = intval($id);
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $id => $attachment) {
$output .= wp_get_attachment_link($id, $size, true) . "\n";
}
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
$output = '<div class="gallery">' . "\n";
$i = 0;
foreach ($attachments as $id => $attachment) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$output .= "\n<" . $itemtag . ' class="gallery-item" style="width:' . $itemwidth . '%;">' . "\n";
$output .= '<' . $icontag . ' class="gallery-icon">' . $link . '</' . $icontag . '>';
if ($captiontag && trim($attachment->post_excerpt)) {
$output .= '<' . $captiontag . ' class="gallery-caption">' . $attachment->post_excerpt . '</' . $captiontag . '>';
}
$output .= '</' . $itemtag . '>' . "\n";
if ($columns > 0 && ++$i % $columns == 0) {
$output .= "\n" . '<br class="clear" />' . "\n";
}
}
$output .= "\n" . '<br class="clear" />' . "</div>\n";
return $output;
}
开发者ID:jeremylightsmith,项目名称:blog,代码行数:49,代码来源:functions.php
示例8: cfct_post_gallery
function cfct_post_gallery($attr)
{
global $post;
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail'), $attr));
$id = intval($id);
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $id => $attachment) {
$output .= wp_get_attachment_link($id, $size, true) . "\n";
}
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$columns = apply_filters('cfct_post_gallery_columns', intval($columns));
$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
$output = apply_filters('gallery_style', "\n\t\t<style type='text/css'>\n\t\t\t.gallery {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t.gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: {$itemwidth}%;\t\t\t}\n\t\t\t.gallery img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t.gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t</style>\n\t\t<!-- see gallery_shortcode() in wp-includes/media.php -->\n\t\t<div class='gallery'>");
$i = 0;
foreach ($attachments as $id => $attachment) {
// get full item src
$item_src = wp_get_attachment_image_src($id, 'full', false);
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
// add full item src as rel
$link = str_replace('><img', ' class="thickbox" rel="' . $item_src[0] . '"><img', $link);
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "\n\t\t\t<{$icontag} class='gallery-icon'>\n\t\t\t\t{$link}\n\t\t\t</{$icontag}>";
if ($captiontag && trim($attachment->post_excerpt)) {
$output .= "\n\t\t\t\t<{$captiontag} class='gallery-caption'>\n\t\t\t\t{$attachment->post_excerpt}\n\t\t\t\t</{$captiontag}>";
}
$output .= "</{$itemtag}>";
if ($columns > 0 && ++$i % $columns == 0) {
$output .= '<br style="clear: both" />';
}
}
$output .= "\n\t\t\t<br style='clear: both;' />\n\t\t</div>\n";
return $output;
}
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:48,代码来源:attachment.php
示例9: tc_breadcrumb_trail
/**
* Shows a breadcrumb for all types of pages. This function is formatting the final output of the
* breadcrumb trail. The breadcrumb_trail_get_items() function returns the items and this function
* formats those items.
*
* @since 0.1.0
* @access public
* @param array $args Mixed arguments for the menu.
* @return string Output of the breadcrumb menu.
*/
function tc_breadcrumb_trail($args = array())
{
/* Create an empty variable for the breadcrumb. */
$breadcrumb = '';
/* Set up the default arguments for the breadcrumb. */
$defaults = array('container' => 'div', 'separator' => '/', 'before' => __('Browse:', 'breadcrumb-trail'), 'after' => false, 'front_page' => true, 'show_home' => __('Home', 'breadcrumb-trail'), 'network' => false, 'echo' => true);
/* Allow singular post views to have a taxonomy's terms prefixing the trail. */
if (is_singular()) {
$post = get_queried_object();
$defaults["singular_{$post->post_type}_taxonomy"] = false;
}
/* Apply filters to the arguments. */
$args = apply_filters('breadcrumb_trail_args', $args);
/* Parse the arguments and extract them for easy variable naming. */
$args = wp_parse_args($args, $defaults);
/* Get the trail items. */
$trail = tc_breadcrumb_trail_get_items($args);
/* Connect the breadcrumb trail if there are items in the trail. */
if (!empty($trail) && is_array($trail)) {
/* Open the breadcrumb trail containers. */
$breadcrumb = '<' . tag_escape($args['container']) . ' class="breadcrumb-trail breadcrumbs" itemprop="breadcrumb">';
/* If $before was set, wrap it in a container. */
$breadcrumb .= !empty($args['before']) ? '<span class="trail-before">' . $args['before'] . '</span> ' : '';
/* Adds the 'trail-begin' class around first item if there's more than one item. */
if (1 < count($trail)) {
array_unshift($trail, '<span class="trail-begin">' . array_shift($trail) . '</span>');
}
/* Adds the 'trail-end' class around last item. */
array_push($trail, '<span class="trail-end">' . array_pop($trail) . '</span>');
/* Format the separator. */
$separator = !empty($args['separator']) ? '<span class="sep">' . $args['separator'] . '</span>' : '<span class="sep">/</span>';
/* Join the individual trail items into a single string. */
$breadcrumb .= join(" {$separator} ", $trail);
/* If $after was set, wrap it in a container. */
$breadcrumb .= !empty($args['after']) ? ' <span class="trail-after">' . $args['after'] . '</span>' : '';
/* Close the breadcrumb trail containers. */
$breadcrumb .= '</' . tag_escape($args['container']) . '>';
}
/* Allow developers to filter the breadcrumb trail HTML. */
$breadcrumb = apply_filters('breadcrumb_trail', $breadcrumb, $args);
/* Output the breadcrumb. */
if ($args['echo']) {
echo $breadcrumb;
} else {
return $breadcrumb;
}
}
开发者ID:keoniworld,项目名称:Customizr,代码行数:57,代码来源:tc_hot_crumble.php
示例10: post_gallery_output
function post_gallery_output($output, $attr)
{
global $post;
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr));
$id = intval($id);
if ('RAND' == $order) {
$orderby = 'none';
}
if (!empty($include)) {
$include = preg_replace('/[^0-9,]+/', '', $include);
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
$attachments = array();
foreach ($_attachments as $key => $val) {
$attachments[$val->ID] = $_attachments[$key];
}
}
if (empty($attachments)) {
return '';
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
// Here's your actual output, you may customize it to your need
$output = "<div id=\"gallery-{$id}\" class=\"gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}\">\n";
// Now you loop through each attachment
foreach ($attachments as $id => $attachment) {
// Fetch the thumbnail (or full image, it's up to you)
// $img = wp_get_attachment_image_src($id, 'medium');
$img_large = wp_get_attachment_image_src($id, 'large');
$img = wp_get_attachment_image_src($id, 'thumbnail');
$output .= "<div class=\"gallery-item\">\n";
$output .= "<a href=\"{$img_large[0]}\" data-lightbox=\"post-gallery\" data-title=\" {$attachment->post_excerpt} \">\n";
$output .= "<img src=\"{$img[0]}\" width=\"{$img[1]}\" height=\"{$img[2]}\" alt=\"\" />\n";
$output .= "</a>\n";
$output .= "</div>\n";
}
$output .= "</div>\n";
return $output;
}
开发者ID:peymanslh,项目名称:MyBlog,代码行数:46,代码来源:gallery.php
示例11: kleo_breadcrumb
/**
* Displays the breadcrumb for the current page
* @since 1.0
* @access public
* @param array $args Mixed arguments for the menu.
* @return string Output of the breadcrumb menu.
*/
function kleo_breadcrumb($args = array())
{
/* Empty variable for the breadcrumb. */
$breadcrumb = '';
/* Default arguments for the breadcrumb. */
$defaults = array('container' => 'ul', 'container_class' => '', 'item_tag' => 'li', 'separator' => '', 'before' => '', 'after' => false, 'front_page' => true, 'show_home' => __('Home', 'kleo_framework'), 'network' => false, 'echo' => false);
/* Allow singular post views to have a taxonomy's terms prefixing the trail. */
if (is_singular()) {
$post = get_queried_object();
$defaults["singular_{$post->post_type}_taxonomy"] = false;
}
/* Apply filters to the arguments. */
$args = apply_filters('breadcrumb_trail_args', $args);
/* Parse the arguments and extract them for easy variable naming. */
$args = wp_parse_args($args, $defaults);
/* Get the trail items. */
$trail = breadcrumb_trail_get_items($args);
/* Connect the breadcrumb trail if there are items in the trail. */
if (!empty($trail) && is_array($trail)) {
/* Open the breadcrumb trail containers. */
$breadcrumb = '<' . tag_escape($args['container']) . (!empty($args['container_class']) ? ' class="' . $args['container_class'] . '"' : '') . '>';
/* If $before was set, wrap it in a container. */
$breadcrumb .= !empty($args['before']) ? $args['before'] : '';
/* Format the separator. */
$separator = !empty($args['separator']) ? '<span class="sep">' . $args['separator'] . '</span>' : '';
/* Join the individual trail items into a single string. */
$breadcrumb .= '<' . $args['item_tag'] . '>' . join(" {$separator} " . '</' . $args['item_tag'] . '>' . '<' . $args['item_tag'] . '>', $trail) . '</' . $args['item_tag'] . '>';
/* If $after was set, wrap it in a container. */
$breadcrumb .= !empty($args['after']) ? $args['after'] : '';
/* Close the breadcrumb trail containers. */
$breadcrumb .= '</' . tag_escape($args['container']) . '>';
}
/* Allow developers to filter the breadcrumb trail HTML. */
$breadcrumb = apply_filters('kleo_breadcrumb', $breadcrumb, $args);
/* Output the breadcrumb. */
if ($args['echo']) {
echo $breadcrumb;
} else {
return $breadcrumb;
}
}
开发者ID:6226,项目名称:wp,代码行数:48,代码来源:function-breadcrumb.php
示例12: sf_gallery
function sf_gallery($attr)
{
$post = get_post();
static $instance = 0;
$instance++;
if (!empty($attr['ids'])) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if (empty($attr['orderby'])) {
$attr['orderby'] = 'post__in';
$attr['include'] = $attr['ids'];
}
}
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ($output != '') {
return $output;
}
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'large', 'include' => '', 'exclude' => ''), $attr, 'gallery'));
$id = intval($id);
if ('RAND' == $order) {
$orderby = 'none';
}
if (!empty($include)) {
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
$attachments = array();
foreach ($_attachments as $key => $val) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif (!empty($exclude)) {
$attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
} else {
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
}
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $att_id => $attachment) {
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
}
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$icontag = tag_escape($icontag);
$valid_tags = wp_kses_allowed_html('post');
if (!isset($valid_tags[$itemtag])) {
$itemtag = 'dl';
}
if (!isset($valid_tags[$captiontag])) {
$captiontag = 'dd';
}
if (!isset($valid_tags[$icontag])) {
$icontag = 'dt';
}
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
$gallery_style = '';
$size_class = sanitize_html_class($size);
$output = "<div id='{$selector}' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
$i = 0;
foreach ($attachments as $id => $attachment) {
$image_output = '<figure class="animated-overlay">';
$image_file_url = wp_get_attachment_image_src($id, $size);
$image_file_lightbox_url = wp_get_attachment_url($id, "full");
$image_caption = wptexturize($attachment->post_excerpt);
$image_meta = wp_get_attachment_metadata($id);
$image_alt = get_post_meta($id, '_wp_attachment_image_alt', true);
$image_output .= '<img src="' . $image_file_url[0] . '" alt="' . $image_alt . '" />';
if (!empty($attr['link']) && 'file' === $attr['link']) {
$image_output .= '<a href="' . $image_file_lightbox_url . '" class="view" rel="' . $selector . '" title="' . $image_alt . '"></a>';
} elseif (!empty($attr['link']) && 'none' === $attr['link']) {
} else {
$image_output .= '<a href="' . get_attachment_link($id) . '"></a>';
}
if ($captiontag && trim($attachment->post_excerpt) && $columns <= 3) {
$image_output .= '<figcaption><div class="thumb-info">';
$image_output .= '<h4 itemprop="name headline">' . wptexturize($attachment->post_excerpt) . '</h4>';
} else {
$image_output .= '<figcaption><div class="thumb-info thumb-info-alt">';
}
$image_output .= '<i class="ss-search"></i>';
$image_output .= '</div></figcaption>';
$image_output .= '</figure>';
$orientation = '';
if (isset($image_meta['height'], $image_meta['width'])) {
$orientation = $image_meta['height'] > $image_meta['width'] ? 'portrait' : 'landscape';
}
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "\n\t\t\t<{$icontag} class='gallery-icon {$orientation}'>\n\t\t\t{$image_output}\n\t\t\t</{$icontag}>";
//.........这里部分代码省略.........
开发者ID:roycocup,项目名称:enclothed,代码行数:101,代码来源:shortcodes.php
示例13: hybrid_site_description
/**
* Dynamic element to wrap the site description in. If it is the front page, wrap it in an <h2> element.
* On other pages, wrap it in a <div> element.
*
* @since 0.1.0
* @access public
* @return void
*/
function hybrid_site_description()
{
/* If viewing the front page of the site, use an <h2> tag. Otherwise, use a <div> tag. */
$tag = is_front_page() ? 'h2' : 'div';
/* Get the site description. If it's not empty, wrap it with the appropriate HTML. */
if ($desc = get_bloginfo('description')) {
$desc = sprintf('<%1$s id="site-description"><span>%2$s</span></%1$s>', tag_escape($tag), $desc);
}
/* Display the site description and apply filters for developers to overwrite. */
echo apply_atomic('site_description', $desc);
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:19,代码来源:utility.php
示例14: trail
/**
* Formats and outputs the breadcrumb trail.
*
* @since 0.6.0
* @access public
* @return string
*/
public function trail()
{
$breadcrumb = '';
/* Connect the breadcrumb trail if there are items in the trail. */
if (!empty($this->items) && is_array($this->items)) {
/* Make sure we have a unique array of items. */
$this->items = array_unique($this->items);
/* Open the breadcrumb trail containers. */
$breadcrumb = "\n\t\t" . '<' . tag_escape($this->args['container']) . ' class="breadcrumb-trail breadcrumb">';
// xmlns:v="http://rdf.data-vocabulary.org/#" itemprop="breadcrumb"
/* If $before was set, wrap it in a container. */
$breadcrumb .= !empty($this->args['before']) ? "\n\t\t\t" . '<span class="trail-before">' . $this->args['before'] . '</span> ' . "\n\t\t\t" : '';
/* Add 'browse' label if it should be shown. */
if (true === $this->args['show_browse']) {
$breadcrumb .= "\n\t\t\t" . '<span class="trail-browse">' . $this->args['labels']['browse'] . '</span> ';
}
/* Adds the 'trail-begin' class around first item if there's more than one item. */
if (1 < count($this->items)) {
array_unshift($this->items, '<span class="trail-begin">' . array_shift($this->items) . '</span>');
}
/* Adds the 'trail-end' class around last item. */
array_push($this->items, '<span class="trail-end">' . array_pop($this->items) . '</span>');
/* Format the separator. */
$separator = !empty($this->args['separator']) ? '<span class="sep navigation-pipe">' . $this->args['separator'] . '</span>' : '<span class="navigation-pipe">/</span>';
/* Join the individual trail items into a single string. */
$breadcrumb .= join("\n\t\t\t {$separator} ", $this->items);
/* If $after was set, wrap it in a container. */
$breadcrumb .= !empty($this->args['after']) ? "\n\t\t\t" . ' <span class="trail-after">' . $this->args['after'] . '</span>' : '';
/* Close the breadcrumb trail containers. */
$breadcrumb .= "\n\t\t" . '</' . tag_escape($this->args['container']) . '>';
}
/* Allow developers to filter the breadcrumb trail HTML. */
$breadcrumb = apply_filters('breadcrumb_trail', $breadcrumb, $this->args);
if (true === $this->args['echo']) {
echo balanceTags($breadcrumb);
} else {
return balanceTags($breadcrumb);
}
}
开发者ID:ngocthangict,项目名称:kutetheme-wp,代码行数:46,代码来源:breadcrumbs.php
示例15: roots_gallery_shortcode
function roots_gallery_shortcode($attr)
{
global $post, $wp_locale;
static $instance = 0;
$instance++;
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ($output != '') {
return $output;
}
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'icontag' => 'figure', 'captiontag' => 'figcaption', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr));
$id = intval($id);
if ('RAND' == $order) {
$orderby = 'none';
}
if (!empty($include)) {
$include = preg_replace('/[^0-9,]+/', '', $include);
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
$attachments = array();
foreach ($_attachments as $key => $val) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif (!empty($exclude)) {
$exclude = preg_replace('/[^0-9,]+/', '', $exclude);
$attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
} else {
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
}
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $att_id => $attachment) {
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
}
return $output;
}
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
$gallery_style = $gallery_div = '';
if (apply_filters('use_default_gallery_style', true)) {
$gallery_style = "";
}
$size_class = sanitize_html_class($size);
$gallery_div = "<section id='{$selector}' class='clearfix gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
$output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div);
$i = 0;
foreach ($attachments as $id => $attachment) {
// make the gallery link to the file by default instead of the attachment
// thanks to Matt Price (countingrows.com)
switch ($attr['link']) {
case 'file':
$link = wp_get_attachment_link($id, $size, false, false);
break;
case 'attachment':
$link = wp_get_attachment_link($id, $size, true, false);
break;
default:
$link = wp_get_attachment_link($id, $size, false, false);
break;
}
$output .= "\n\t\t\t<{$icontag} class=\"gallery-item\">\n\t\t\t\t{$link}\n\t\t\t";
if ($captiontag && trim($attachment->post_excerpt)) {
$output .= "\n\t\t\t\t<{$captiontag} class=\"gallery-caption\">\n\t\t\t\t" . wptexturize($attachment->post_excerpt) . "\n\t\t\t\t</{$captiontag}>";
}
$output .= "</{$icontag}>";
if ($columns > 0 && ++$i % $columns == 0) {
$output .= '';
}
}
$output .= "</section>\n";
return $output;
}
开发者ID:herrhaase,项目名称:roots,代码行数:84,代码来源:roots-cleanup.php
示例16: cleaner_gallery
/**
* Overwrites the default WordPress [gallery] shortcode's output. This function removes the invalid
* HTML and inline styles. It adds the number of columns used as a class attribute, which allows
* developers to style the gallery more easily.
*
* @since 0.9.0
* @access private
* @param string $output
* @param array $attr
* @return string $output
*/
function cleaner_gallery($output, $attr)
{
static $cleaner_gallery_instance = 0;
$cleaner_gallery_instance++;
/* We're not worried abut galleries in feeds, so just return the output here. */
if (is_feed()) {
return $output;
}
/* Orderby. */
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
/* Default gallery settings. */
$defaults = array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => get_the_ID(), 'link' => '', 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'numberposts' => -1, 'offset' => '');
/* Ap
|
请发表评论