本文整理汇总了PHP中theme_ob_get_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_ob_get_clean函数的具体用法?PHP theme_ob_get_clean怎么用?PHP theme_ob_get_clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme_ob_get_clean函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_post_wrapper
function theme_post_wrapper($args = '')
{
$args = wp_parse_args($args, array('id' => '', 'class' => '', 'title' => '', 'heading' => 'h2', 'thumbnail' => '', 'before' => '', 'content' => '', 'after' => ''));
extract($args);
if (theme_is_empty_html($title) && theme_is_empty_html($content)) {
return;
}
if ($id) {
$id = ' id="' . $id . '" ';
}
if ($class) {
$class = ' ' . $class;
}
?>
<article<?php
echo $id;
?>
class="art-post art-article <?php
echo $class;
?>
">
<?php
theme_ob_start();
?>
<?php
if (!theme_is_empty_html($title)) {
echo '<' . $heading . ' class="art-postheader"><span class="art-postheadericon">' . $title . '</span></' . $heading . '>';
}
?>
<?php
echo $before;
?>
<?php
$meta = trim(theme_ob_get_clean());
if (strlen($meta) > 0) {
echo '<div class="art-postmetadataheader">' . $meta . '</div>';
}
?>
<?php
echo $thumbnail;
?>
<div class="art-postcontent clearfix"><?php
echo $content;
?>
</div>
<?php
theme_ob_start();
?>
<?php
echo $after;
?>
<?php
$meta = trim(theme_ob_get_clean());
if (strlen($meta) > 0) {
echo '<div class="art-postmetadatafooter">' . $meta . '</div>';
}
?>
</article>
<?php
}
示例2: theme_get_dynamic_sidebar_data
function theme_get_dynamic_sidebar_data($sidebar_id)
{
global $theme_widget_args, $theme_sidebars;
$sidebar_style = theme_get_option('theme_sidebars_style_' . $theme_sidebars[$sidebar_id]['group']);
theme_ob_start();
$success = dynamic_sidebar($sidebar_id);
$content = theme_ob_get_clean();
if (!$success) {
return false;
}
extract($theme_widget_args);
$data = explode($after_widget, $content);
$widgets = array();
$heading = theme_get_option('theme_' . (is_home() ? 'posts' : 'single') . '_widget_title_tag');
for ($i = 0; $i < count($data); $i++) {
$widget = $data[$i];
if (theme_is_empty_html($widget)) {
continue;
}
$id = null;
$name = null;
$class = null;
$style = $sidebar_style;
$title = null;
if (preg_match('/<widget(.*?)>/', $widget, $matches)) {
if (preg_match('/id="(.*?)"/', $matches[1], $ids)) {
$id = $ids[1];
}
if (preg_match('/name="(.*?)"/', $matches[1], $names)) {
$name = $names[1];
}
if (preg_match('/class="(.*?)"/', $matches[1], $classes)) {
$class = $classes[1];
}
if ($name) {
$style = theme_get_widget_style($name, $style);
}
$widget = preg_replace('/<widget[^>]+>/', '', $widget);
if (preg_match('/<title>(.*)<\\/title>/', $widget, $matches)) {
$title = $matches[1];
$widget = preg_replace('/<title>.*?<\\/title>/', '', $widget);
}
}
$widgets[] = array('id' => $id, 'name' => $name, 'class' => $class, 'style' => $style, 'title' => $title, 'heading' => $heading, 'content' => $widget);
}
return array_filter($widgets, 'theme_is_displayed_widget');
}
示例3: theme_get_smilies_js
/**
*
* smiley.php
*
* Used to add custom shortcodes.
*
* The smilies template. Used to output smilies in post comments.
* To enable Smilies please go to the WordPress Admin panel -> Appearance -> Theme Options -> Comments -> Use smilies in comments.
*
* More detailed information about smilies: http://codex.wordpress.org/Using_Smilies
*
*/
function theme_get_smilies_js()
{
theme_ob_start();
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
function grin(tag) {
var myField;
tag = ' ' + tag + ' ';
if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
myField = document.getElementById('comment');
} else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = tag;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}
/* ]]> */
</script>
<?php
return theme_ob_get_clean();
}
示例4: wp_get_attachment_url
// filterable image width with, essentially, no limit for image height.
?>
</a>
</p>
<?php
} else {
?>
<p class="attachment center">
<a href="<?php
echo wp_get_attachment_url();
?>
" title="<?php
echo esc_attr(strip_tags(get_the_title()));
?>
" rel="attachment">
<?php
echo basename(get_permalink());
?>
</a>
</p>
<?php
}
echo theme_get_content();
if (wp_attachment_is_image()) {
$metadata = wp_get_attachment_metadata();
echo '<p class="center">' . sprintf(__('Full size is %s pixels', THEME_NS), sprintf('<a href="%1$s" title="%2$s">%3$s × %4$s</a>', wp_get_attachment_url(), esc_attr(__('Link to full-size image', THEME_NS)), $metadata['width'], $metadata['height'])) . '</p>';
}
/* Display navigation to next/previous pages when applicable */
theme_post_navigation(array('wrap' => false, 'prev_link' => theme_get_next_image_link(false), 'next_link' => theme_get_previous_image_link(false)));
theme_post_wrapper(array('id' => theme_get_post_id(), 'class' => theme_get_post_class(), 'title' => '<a href="' . get_permalink($post->ID) . '" rel="bookmark" title="' . strip_tags(get_the_title()) . '">' . get_the_title() . '</a>', 'heading' => theme_get_option('theme_' . (is_home() ? 'posts' : 'single') . '_article_title_tag'), 'before' => theme_get_metadata_icons('date,author,edit', 'header'), 'content' => theme_ob_get_clean()));
示例5: theme_stylize_pagination
$pagination = theme_stylize_pagination(theme_ob_get_clean());
echo $pagination;
?>
<ul id="comments-list">
<?php
wp_list_comments('type=all&callback=theme_comment');
?>
</ul>
<?php
echo $pagination;
?>
</div>
<?php
}
if (!comments_open()) {
return;
}
/* comment form */
theme_ob_start();
$args = array();
if (theme_get_option('theme_comment_use_smilies')) {
function theme_comment_form_field_comment($form_field)
{
theme_include_lib('smiley.php');
return theme_get_smilies_js() . '<p class="smilies">' . theme_get_smilies() . '</p>' . $form_field;
}
add_filter('comment_form_field_comment', 'theme_comment_form_field_comment');
}
comment_form();
echo str_replace(array('id="respond"', '<h3', 'id="reply-title"', '</h3>', 'logged-in-as', 'type="submit"'), array('id="respond" class="cleantheme-commentsform"', '<h2', 'id="reply-title" class="cleantheme-postheader"', '</h2>', 'cleantheme-postcontent logged-in-as', 'class="cleantheme-button" type="submit"'), theme_ob_get_clean());
示例6: die
die('Please do not load this page directly. Thanks!');
}
if (post_password_required()) {
theme_post_wrapper(array('content' => '<p class="nocomments">' . __('This post is password protected. Enter the password to view any comments.', THEME_NS) . '</p>'));
return;
}
if (have_comments()) {
theme_ob_start();
printf(_n('One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), THEME_NS), number_format_i18n(get_comments_number()), '<em>' . get_the_title() . '</em>');
theme_post_wrapper(array('content' => '<h4 id="comments">' . theme_ob_get_clean() . '</h4>'));
$prev_link = get_previous_comments_link(__('<span class="meta-nav">←</span> Older Comments', THEME_NS));
$next_link = get_next_comments_link(__('Newer Comments <span class="meta-nav">→</span>', THEME_NS));
theme_page_navigation(array('prev_link' => $prev_link, 'next_link' => $next_link));
echo '<ul id="comments-list">';
wp_list_comments('type=all&callback=theme_comment');
echo '</ul>';
theme_page_navigation(array('prev_link' => $prev_link, 'next_link' => $next_link));
}
theme_ob_start();
$args = array();
if (theme_get_option('theme_comment_use_smilies')) {
function theme_comment_form_field_comment($form_field)
{
theme_include_lib('smiley.php');
return theme_get_smilies_js() . '<p class="smilies">' . theme_get_smilies() . '</p>' . $form_field;
}
add_filter('comment_form_field_comment', 'theme_comment_form_field_comment');
}
comment_form();
theme_post_wrapper(array('content' => str_replace(array(' id="respond"', 'type="submit"'), array('', 'class="art-button" type="submit"'), theme_ob_get_clean()), 'id' => 'respond'));
示例7: theme_comment
function theme_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
switch ($comment->comment_type) {
case '':
?>
<li <?php
comment_class();
?>
id="li-comment-<?php
comment_ID();
?>
">
<?php
theme_ob_start();
?>
<div class="comment-author vcard">
<?php
echo theme_get_avatar(array('id' => $comment, 'size' => 48));
?>
<?php
printf(__('%s <span class="says">says:</span>', THEME_NS), sprintf('<cite class="fn">%s</cite>', get_comment_author_link()));
?>
</div>
<?php
if ($comment->comment_approved == '0') {
?>
<em><?php
_e('Your comment is awaiting moderation.', THEME_NS);
?>
</em>
<br />
<?php
}
?>
<div class="comment-meta commentmetadata"><a href="<?php
echo esc_url(get_comment_link($comment->comment_ID));
?>
">
<?php
printf(__('%1$s at %2$s', THEME_NS), get_comment_date(), get_comment_time());
?>
</a><?php
edit_comment_link(__('(Edit)', THEME_NS), ' ');
?>
</div>
<div class="comment-body"><?php
comment_text();
?>
</div>
<div class="reply">
<?php
comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
?>
</div>
<?php
theme_post_wrapper(array('content' => theme_ob_get_clean(), 'id' => 'comment-' . get_comment_ID()));
?>
<?php
break;
case 'pingback':
case 'trackback':
?>
<li class="post pingback">
<?php
theme_ob_start();
?>
<p><?php
_e('Pingback:', THEME_NS);
?>
<?php
comment_author_link();
edit_comment_link(__('(Edit)', THEME_NS), ' ');
?>
</p>
<?php
theme_post_wrapper(array('content' => theme_ob_get_clean(), 'class' => $comment->comment_type));
break;
}
}
示例8: sprintf
echo '<h4>' . sprintf(__('Monthly Archives: <span>%s</span>', THEME_NS), get_the_date('F Y')) . '</h4>';
} elseif (is_year()) {
echo '<h4>' . sprintf(__('Yearly Archives: <span>%s</span>', THEME_NS), get_the_date('Y')) . '</h4>';
} elseif (is_author()) {
the_post();
echo theme_get_avatar(array('id' => get_the_author_meta('user_email')));
echo '<h4>' . get_the_author() . '</h4>';
$desc = get_the_author_meta('description');
if ($desc) {
echo '<div class="author-description">' . $desc . '</div>';
}
rewind_posts();
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
echo '<h4>' . __('Blog Archives', THEME_NS) . '</h4>';
}
theme_post_wrapper(array('content' => theme_ob_get_clean(), 'class' => 'breadcrumbs'));
/* Display navigation to next/previous pages when applicable */
if (theme_get_option('theme_top_posts_navigation')) {
theme_page_navigation();
}
/* Start the Loop */
while (have_posts()) {
the_post();
get_template_part('content', get_post_format());
}
/* Display navigation to next/previous pages when applicable */
if (theme_get_option('theme_bottom_posts_navigation')) {
theme_page_navigation();
}
} else {
theme_404_content();
示例9: do_shortcode
<?php
}
}
if ($needLayout) {
?>
</div>
</div>
<?php
}
}
?>
<div class="bdls-footer-text">
<?php
global $theme_default_options;
echo do_shortcode(theme_get_option('theme_override_default_footer_content') ? theme_get_option('theme_footer_content') : theme_get_array_value($theme_default_options, 'theme_footer_content'));
} else {
?>
<div class="bdls-footer-text">
<?php
theme_ob_start();
?>
<p>Copyright © 2015. All Rights Reserved.<br /></p>
<?php
echo do_shortcode(theme_ob_get_clean());
}
?>
</div>
示例10: theme_get_comments
function theme_get_comments()
{
if (!theme_get_option('theme_allow_comments')) {
return '';
}
theme_ob_start();
comments_template();
return theme_ob_get_clean();
}
示例11: theme_search
function theme_search()
{
theme_ob_start();
get_search_form();
return theme_ob_get_clean();
}
示例12: theme_get_metadata_icons
function theme_get_metadata_icons($icons = '', $class = '')
{
global $post;
if (!is_string($icons) || theme_strlen($icons) == 0) {
return;
}
$icons = explode(",", str_replace(' ', '', $icons));
if (!is_array($icons) || count($icons) == 0) {
return;
}
$result = array();
for ($i = 0; $i < count($icons); $i++) {
$icon = $icons[$i];
switch ($icon) {
case 'date':
$result[] = '<span class="mmb-postdateicon">' . sprintf(__('<span class="%1$s"></span> %2$s', THEME_NS), 'date', sprintf('<span class="entry-date" title="%1$s">%2$s</span>', esc_attr(get_the_time()), get_the_date())) . '</span>';
break;
case 'author':
$result[] = '<span class="mmb-postauthoricon">' . sprintf(__('<span class="%1$s">By</span> %2$s', THEME_NS), 'author', sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url(get_the_author_meta('ID')), sprintf(esc_attr(__('View all posts by %s', THEME_NS)), get_the_author()), get_the_author())) . '</span>';
break;
case 'category':
$categories = get_the_category_list(', ');
if (theme_strlen($categories) == 0) {
break;
}
$result[] = '<span class="mmb-postcategoryicon">' . sprintf(__('<span class="%1$s">Posted in</span> %2$s', THEME_NS), 'categories', get_the_category_list(', ')) . '</span>';
break;
case 'tag':
$tags_list = get_the_tag_list('', ', ');
if (!$tags_list) {
break;
}
$result[] = '<span class="mmb-posttagicon">' . sprintf(__('<span class="%1$s">Tagged</span> %2$s', THEME_NS), 'tags', $tags_list) . '</span>';
break;
case 'comments':
if (!comments_open() || !theme_get_option('theme_allow_comments')) {
break;
}
theme_ob_start();
comments_popup_link(__('Leave a comment', THEME_NS), __('1 Comment', THEME_NS), __('% Comments', THEME_NS));
$result[] = '<span class="mmb-postcommentsicon">' . theme_ob_get_clean() . '</span>';
break;
case 'edit':
if (!current_user_can('edit_post', $post->ID)) {
break;
}
theme_ob_start();
edit_post_link(__('Edit', THEME_NS), '');
$result[] = '<span class="mmb-postediticon">' . theme_ob_get_clean() . '</span>';
break;
}
}
$result = implode(theme_get_option('theme_metadata_separator'), $result);
if (theme_is_empty_html($result)) {
return;
}
return "<div class=\"mmb-post{$class}icons mmb-metadata-icons\">{$result}</div>";
}