Exemplo n.º 1
0
 function widget_lmee_notice($args)
 {
     extract($args);
     echo $before_widget;
     $lmee_popular_options = get_option('widget_lmee_popular');
     $title = '小家伙说的话(NOTICE)';
     //设置默认的标题
     echo $before_title . $title . $after_title;
     $page_ID = 515;
     //用来作为公告栏的页面或者文章id
     $num = 2;
     //显示公告的条数
     echo '<ul class="notice" style="padding: 1em 1.4em;">';
     $announcement = '';
     $comments = get_comments("number={$num}&post_id={$page_ID}");
     if (!empty($comments)) {
         foreach ($comments as $comment) {
             $announcement .= '<li>' . convert_smilies($comment->comment_content) . ' <span style="color:#999;">(' . get_comment_date('y/m/d', $comment->comment_ID) . ')</span></li>';
         }
     }
     if (empty($announcement)) {
         $announcement = '<li>欢迎来到 LMEE!</li>';
     }
     echo $announcement;
     echo '</ul>';
     if (is_user_logged_in()) {
         echo '<p style="text-align:right;"><a href="' . get_page_link($page_ID) . '#respond" rel="nofollow">发表公告</a></p>';
     }
     echo $after_widget;
 }
Exemplo n.º 2
0
function mirana_recent_comments($show_comments = 6)
{
    $my_email = get_bloginfo('admin_email');
    $i = 1;
    $comments = get_comments('number=50&status=approve&type=comment');
    foreach ($comments as $rc_comment) {
        if ($rc_comment->comment_author_email != $my_email) {
            ?>
				<li class="sidcomment">
					<a href="<?php 
            echo get_permalink($rc_comment->comment_post_ID);
            ?>
#comment-<?php 
            echo $rc_comment->comment_ID;
            ?>
" title="查看完整评论">
						<?php 
            echo get_avatar($rc_comment->comment_author_email, 28);
            ?>
						<?php 
            echo mb_strimwidth(strip_tags(apply_filters('the_content', convert_smilies($rc_comment->comment_content))), 0, 27, "...");
            ?>
					</a>
				</li>
				<?php 
            if ($i == $show_comments) {
                break;
            }
            $i++;
        }
    }
}
function the_excerpt_rereloaded($words = 40, $link_text = 'Leia Mais', $allowed_tags = '', $container = 'p', $smileys = 'no' )
{
	global $post;
        
    if ( $allowed_tags == 'all' ) $allowed_tags = '<h3>,<br>,<p>,<i>,<em>,<b>,<strong>,<ul>,<ol>,<li>,<span>,<blockquote>,<img>';
    
    $text = preg_replace('/\[.*\]/', '', strip_tags($post->post_content, $allowed_tags));

    $text = explode(' ', $text);
    $tot = count($text);
    
    for ( $i=0; $i<$words; $i++ ) : $output .= $text[$i] . ' '; endfor;
    
    if ( $smileys == "yes" ) $output = convert_smilies($output);
 
    ?><p><?php echo force_balance_tags($output) ?><?php if ( $i < $tot ) : ?> ...<?php else : ?></p><?php endif; ?>
    <?php if ( $i < $tot ) : 
        if ( $container == 'p' || $container == 'div' ) : ?></p><?php endif; 
            if ( $container != 'plain' ) : ?><<?php echo $container; ?> class="more"><?php if ( $container == 'div' ) : ?><p><?php endif; endif; ?>
            
    <a href="<?php the_permalink(); ?>" title="<?php echo $link_text; ?>"><?php echo $link_text; ?></a><?php
    
            if ( $container == 'div' ) : ?></p><?php endif; if ( $container != 'plain' ) : ?></<?php echo $container; ?>><?php endif;
        if ( $container == 'plain' || $container == 'span' ) : ?></p><?php endif; 
        endif;
        
}
Exemplo n.º 4
0
/**
 * Display the testimonial content.
 *
 * @param null $length
 *
 * @since 1.24.0
 * @since 2.4.0 Run content through selected filters only, instead
 *              of all filters added to the_excerpt() or the_content().
 *
 * @todo Use native auto-excerpt and trim_words instead.
 */
function wpmtst_the_content($length = null)
{
    if ($length) {
        $excerpt = false;
    } else {
        $excerpt = WPMST()->atts('excerpt');
        $length = WPMST()->atts('length');
    }
    // In View settings, {excerpt} overrides {length} overrides {full content}.
    if ($excerpt) {
        $content = get_the_excerpt();
        $content = apply_filters('the_excerpt', $content);
    } else {
        if ($length) {
            $content = wpmtst_get_field('truncated', array('char_limit' => $length));
        } else {
            $content = get_the_content();
        }
        // Applying all content filters breaks POS NextGEN Gallery.
        // So need to find a way to select which additional filters, if any, to apply.
        // For instance, All In One Rich Snippets.
        //$content = apply_filters( 'the_content', $content );
        $content = wptexturize($content);
        $content = convert_smilies($content);
        $content = wpautop($content);
        $content = shortcode_unautop($content);
        $content = do_shortcode($content);
    }
    echo $content;
}
Exemplo n.º 5
0
 function widget_lmee_by_talk($args)
 {
     extract($args);
     echo $before_widget;
     $lmee_popular_options = get_option('widget_lmee_popular');
     $title = '灌水区-这里很热闹';
     //设置默认的标题
     echo $before_title . $title . $after_title;
     $page_ID = 789;
     //用来作为公告栏的页面或者文章id
     $num = 5;
     //显示公告的条数
     echo '<ul class="by_talk">';
     $announcement = '';
     $comments = get_comments("number={$num}&post_id={$page_ID}");
     if (!empty($comments)) {
         $flg = 1;
         foreach ($comments as $comment) {
             if ($flg == 1) {
                 $li_title = $comment->comment_content;
                 if (similar_text($li_title, "<") > 0) {
                     //echo "is";
                     $start = stripos($li_title, "<");
                     //从前往后查找
                     $__li_title = strrev($li_title);
                     //反转字符串
                     $length = strlen($li_title) - $start - stripos($__li_title, ">");
                     $_li_title = substr_replace($li_title, "含引用", $start, $length);
                     $_li_html = substr_replace($li_title, "", $start, $length);
                     $announcement .= '<li class="by-talk-first"><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $_li_title . '" rel="nofollow" target="_blank">' . $_li_html . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 } else {
                     //echo "un";
                     $announcement .= '<li class="by-talk-first"><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $li_title . '" rel="nofollow" target="_blank">' . convert_smilies($comment->comment_content) . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 }
                 $flg++;
             } else {
                 $li_title = $comment->comment_content;
                 if (similar_text($li_title, "<") > 0) {
                     //echo "is";
                     $start = stripos($li_title, "<");
                     //从前往后查找
                     $__li_title = strrev($li_title);
                     //反转字符串
                     $length = strlen($li_title) - $start - stripos($__li_title, ">");
                     $_li_title = substr_replace($li_title, "含引用", $start, $length);
                     $_li_html = substr_replace($li_title, "", $start, $length);
                     $announcement .= '<li><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $_li_title . '" rel="nofollow" target="_blank">' . $_li_html . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 } else {
                     //echo "un";
                     $announcement .= '<li><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $li_title . '" rel="nofollow" target="_blank">' . convert_smilies($comment->comment_content) . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 }
             }
         }
     }
     //if ( empty($announcement) ) $announcement = '<li>还没有人灌水奥!</li>';
     echo $announcement;
     echo '</ul>';
     echo "<p style='text-align:right;'>[<a href='" . get_page_link($page_ID) . "#respond' rel='nofollow'>说两句</a>]</p>";
     echo $after_widget;
 }
Exemplo n.º 6
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $number = strip_tags($instance['number']) ? absint($instance['number']) : 5;
        ?>
 

<div id="message" class="message-widget">
	<ul>
		<?php 
        $show_comments = $number;
        $my_email = get_bloginfo('admin_email');
        $i = 1;
        $comments = get_comments('number=200&status=approve&type=comment');
        foreach ($comments as $my_comment) {
            if ($my_comment->comment_author_email != $my_email) {
                ?>
					<li>
						<a href="<?php 
                echo get_permalink($my_comment->comment_post_ID);
                ?>
#comment-<?php 
                echo $my_comment->comment_ID;
                ?>
" title="发表在 > <?php 
                echo get_the_title($my_comment->comment_post_ID);
                ?>
" >
							<?php 
                echo '<img class="avatar" src="' . get_bloginfo('template_directory') . '/img/gravatar.png" alt="avatar" data-original="' . preg_replace(array('/^.+(src=)(\\"|\')/i', '/(\\"|\')\\sclass=(\\"|\').+$/i'), array('', ''), get_avatar($my_comment->comment_author_email, 64)) . '" />';
                ?>
							<strong><div class="comment_author"><?php 
                echo $my_comment->comment_author;
                ?>
</div></strong>
							<?php 
                echo convert_smilies($my_comment->comment_content);
                ?>
						</a>
					</li>
					<?php 
                if ($i == $show_comments) {
                    break;
                }
                $i++;
            }
        }
        ?>
	</ul>
</div>

<?php 
        echo $after_widget;
    }
Exemplo n.º 7
0
 function wpsight_format_content($content)
 {
     if (!$content) {
         return;
     }
     $content = do_shortcode(shortcode_unautop(wpautop(convert_chars(convert_smilies(wptexturize($content))))));
     return apply_filters('wpsight_format_content', $content);
 }
Exemplo n.º 8
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $number = strip_tags($instance['number']) ? absint($instance['number']) : 5;
        ?>

<div id="message" class="message-widget">
	<ul>
		<?php 
        $show_comments = $number;
        $my_email = get_bloginfo('admin_email');
        $i = 1;
        $comments = get_comments('number=200&status=approve&type=comment');
        foreach ($comments as $my_comment) {
            if ($my_comment->comment_author_email != $my_email) {
                ?>
				<li>
					<a href="<?php 
                echo get_permalink($my_comment->comment_post_ID);
                ?>
#comment-<?php 
                echo $my_comment->comment_ID;
                ?>
" title="发表在 > <?php 
                echo get_the_title($my_comment->comment_post_ID);
                ?>
" >
						<?php 
                echo get_avatar($my_comment->comment_author_email, 64);
                ?>
						<span class="comment_author"><strong><?php 
                echo $my_comment->comment_author;
                ?>
</strong></span>
						<?php 
                echo convert_smilies($my_comment->comment_content);
                ?>
					</a>
				</li>
				<?php 
                if ($i == $show_comments) {
                    break;
                }
                $i++;
            }
        }
        ?>
	</ul>
</div>

<?php 
        echo $after_widget;
    }
Exemplo n.º 9
0
/**
 * Output the 404 entry title.
 *
 * @since  1.0.0
 * @access public
 * @return string $content The modified content.
 */
function carelib_get_404_content()
{
    $content = wpautop(esc_attr__('It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'carelib'));
    $content .= get_search_form(false);
    $content .= carelib_get_the_widget('WP_Widget_Recent_Posts');
    // Translators: %1$s is a smile emoji.
    $after_title = wpautop(sprintf(__('Try looking in the monthly archives. %1$s', 'carelib'), convert_smilies(':)')));
    $content .= carelib_get_the_widget('WP_Widget_Archives', 'dropdown=1', 'after_title=</h2> ' . $after_title);
    $content .= carelib_get_the_widget('WP_Widget_Tag_Cloud');
    return apply_filters("{$GLOBALS['carelib_prefix']}_404_content", $content);
}
Exemplo n.º 10
0
 function wp_footer()
 {
     if (!is_admin() && !is_feed() && !is_robots() && !is_trackback()) {
         $text = get_option('shfs_insert_footer', '');
         $text = convert_smilies($text);
         $text = do_shortcode($text);
         if ($text != '') {
             echo $text, "\n";
         }
     }
 }
Exemplo n.º 11
0
 /**
  * 小工具的渲染方法,这里就是输出评论
  */
 function widget($args, $instance)
 {
     global $wpdb, $comments, $comment;
     $cache = wp_cache_get('f_comment', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     extract($args, EXTR_SKIP);
     $output = '';
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title'], $instance, $this->id_base);
     if (empty($instance['number']) || !($number = absint($instance['number']))) {
         $number = 5;
     }
     //获取评论,过滤掉管理员自己
     $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE user_id !=1 and comment_approved = '1' and comment_type not in ('pingback','trackback') ORDER BY comment_date_gmt DESC LIMIT {$number}");
     $output .= $before_widget;
     if ($title) {
         $output .= $before_title . $title . $after_title;
     }
     $output .= '<div class="all-comments">';
     if ($comments) {
         // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
         $post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID'));
         _prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false);
         foreach ((array) $comments as $comment) {
             if ($comment->comment_author_email != $my_email) {
                 //头像
                 $avatar = get_avatar($comment, 36);
                 //作者名称
                 $author = get_comment_author();
                 //评论内容
                 $content = apply_filters('get_comment_text', $comment->comment_content);
                 $content = mb_strimwidth(strip_tags($content), 0, '65', '...', 'UTF-8');
                 $content = convert_smilies($content);
                 //评论的文章
                 $post = '<a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . $avatar . $author . '<span class="muted">' . timeago($comment->comment_date_gmt) . ':<br>' . $content . '</span></a>';
                 //这里就是输出的html,可以根据需要自行修改
                 $output .= $post;
             }
         }
     }
     $output .= '</div>';
     $output .= $after_widget;
     echo $output;
     $cache[$args['widget_id']] = $output;
     wp_cache_set('my_widget_recent_comments', $cache, 'widget');
 }
    function widget($args, $instance)
    {
        extract($args);
        ?>
		<?php 
        echo $before_widget;
        ?>
		<?php 
        echo $before_title . $instance['title'] . $after_title;
        ?>
		<ul>
		<?php 
        $show_comments = $instance['num'];
        //评论数量
        $my_email = get_bloginfo('admin_email');
        //获取博主自己的email
        $i = 1;
        $comments = get_comments('number=50&status=approve&type=comment');
        foreach ($comments as $rc_comment) {
            //只显示非博主的评论
            if ($rc_comment->comment_author_email != $my_email) {
                ?>
                <li><?php 
                echo get_avatar($rc_comment->comment_author_email, 32);
                ?>
<a href="<?php 
                echo get_permalink($rc_comment->comment_post_ID);
                ?>
#comment-<?php 
                echo $rc_comment->comment_ID;
                ?>
"><?php 
                echo $rc_comment->comment_author;
                ?>
: </br><?php 
                echo convert_smilies($rc_comment->comment_content);
                ?>
</a></li>
                <?php 
                if ($i == $show_comments) {
                    break;
                }
                //评论数量达到退出遍历
                $i++;
            }
        }
        ?>
</ul>
		<?php 
        echo $after_widget;
        ?>
		<?php 
    }
function list_most_recent_comments($args = null)
{
    // These are in addition to the args of get_most_recent_comments() and get_comments()
    $defaults = array('excerpt_words' => 0, 'excerpt_chars' => 0, 'comment_format' => 0);
    $r = wp_parse_args($args, $defaults);
    $comments = get_most_recent_comments($r);
    $output = "<ul>\n";
    if ($comments) {
        $idx = 0;
        foreach ($comments as $comment) {
            $comment_author = stripslashes($comment->comment_author);
            if (empty($comment_author)) {
                $comment_author = __('anonymous');
            }
            $comment_content = strip_tags($comment->comment_content);
            $comment_content = stripslashes($comment_content);
            if (0 != $r['excerpt_words']) {
                $words = explode(' ', $comment_content);
                $comment_content = implode(' ', array_slice($words, 0, $r['excerpt_words']));
            } elseif (0 != $r['excerpt_chars']) {
                $comment_content = substr($comment_content, 0, $r['excerpt_chars']);
            }
            $comment_permalink = get_comment_link($comment->comment_ID);
            if (1 == $r['comment_format']) {
                $post_title = stripslashes($comment->post_title);
                $post_id = stripslashes($comment->post_id);
                $url = $comment->comment_author_url;
                $idx++;
                if (1 == $idx % 2) {
                    $before = '<li class="statsclass1">';
                } else {
                    $before = '<li class="statsclass2">';
                }
                $output .= "{$before}<a href='{$comment_permalink}'>{$comment_author}</a> on <a href='" . get_permalink($comment->ID) . "'>{$post_title}</a>{$after}";
            } else {
                $idx++;
                if (1 == $idx % 2) {
                    $before = "<li class='statsclass1'>";
                } else {
                    $before = "<li class='statsclass2'>";
                }
                $output .= "{$before}<strong>{$comment_author}:</strong> <a href='{$comment_permalink}' title='" . sprintf(__('View the entire comment by %s'), $comment_author) . "'>{$comment_content}</a>{$after}";
            }
        }
        $output = convert_smilies($output);
    } else {
        $output .= '<li>' . __('None Found') . '</li>';
    }
    $output .= "</ul>\n";
    echo $output;
}
function sdm_get_item_description_output($id)
{
    $item_description = get_post_meta($id, 'sdm_description', true);
    $isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : '';
    //$isset_item_description = apply_filters('the_content', $isset_item_description);
    $isset_item_description = do_shortcode($isset_item_description);
    $isset_item_description = wptexturize($isset_item_description);
    $isset_item_description = convert_smilies($isset_item_description);
    $isset_item_description = convert_chars($isset_item_description);
    $isset_item_description = wpautop($isset_item_description);
    $isset_item_description = shortcode_unautop($isset_item_description);
    $isset_item_description = prepend_attachment($isset_item_description);
    return $isset_item_description;
}
 function the_content_rss($more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0, $echo = true)
 {
     if (!empty($GLOBALS['post']->post_password)) {
         // if there's a password
         $output = "<p>This post is a password protected content.</p>";
         return _echo($output, $echo);
     }
     $content = get_the_content($more_link_text, $stripteaser, $more_file);
     $content = apply_filters('the_content', $content);
     $content = preg_replace('/<style.*?>.*?<\\/style.*?>/ms', '', $content);
     if ($cut && !$encode_html) {
         $encode_html = 2;
     }
     if ($encode_html == 1) {
         $content = htmlspecialchars($content);
         $cut = 0;
     } elseif ($encode_html == 0) {
         $content = preg_replace('/(<br .*?>|<\\/tr>|<\\/table>|<\\/li>|<\\/h\\d>|<\\/p>)/ms', "_rss_cr_", $content);
         $content = htmlspecialchars(make_url_footnote($content));
         $content = preg_replace('/_rss_cr_/ms', '&lt;br /&gt;', $content);
     } elseif ($encode_html == 2) {
         $content = preg_replace('/(<br .*?>|<\\/tr>|<\\/table>|<\\/li>|<\\/h\\d>|<\\/p>)/ms', "_rss_cr_", $content);
         $content = htmlspecialchars(strip_tags($content));
         $content = preg_replace('/_rss_cr_/ms', '&lt;br /&gt;', $content);
     } elseif ($encode_html == 3) {
         $content = convert_smilies($content);
         $cut = 0;
     }
     $excerpt = '';
     if ($cut) {
         $blah = explode(' ', $content);
         if (count($blah) > $cut) {
             $k = $cut;
             $use_dotdotdot = 1;
         } else {
             $k = count($blah);
             $use_dotdotdot = 0;
         }
         for ($i = 0; $i < $k; $i++) {
             $excerpt .= $blah[$i] . ' ';
         }
         $excerpt .= $use_dotdotdot ? '...' : '';
         $content = $excerpt;
     }
     $content = str_replace(']]>', ']]&gt;', $content);
     return _echo(wp_convert_rss_charset($content), $echo);
 }
 function panel_entry($items)
 {
     global $wpsmiliestrans;
     if (get_option('use_smilies')) {
         $item['action'] = 'switch_panel';
         $item['inside_anchor'] = str_replace("class='wp-smiley' ", 'title="Smilies"', convert_smilies(':)'));
         $item['data'] = "";
         // Allow duplicate codes to be parsed but not have buttons for those duplicates.
         $smilies_array = array_flip($wpsmiliestrans);
         foreach ($smilies_array as $name => $code) {
             $js = "insert_smiley('" . addslashes($code) . "');";
             $item['data'] .= '<a class="smiley" onclick="' . $js . '">' . str_replace("class='wp-smiley' ", 'title="' . $code . '" ', convert_smilies($code)) . '</a>';
         }
         $items[] = $item;
     }
     return $items;
 }
Exemplo n.º 17
0
    function get_LatestComments($LatestComments)
    {
        ?>
<section id="sidebar-comments">
				<h3>近期评论</h3>
				<div class="sidebar-comments__list">
<?php 
        $show_comments = $LatestComments;
        //评论数量
        $my_email = get_bloginfo('admin_email');
        //获取博主自己的email
        $i = 1;
        $comments = get_comments('number=100&status=approve&type=comment');
        //取得前200个评论,如果你每天的回复量超过200可以适量加大
        foreach ($comments as $rc_comment) {
            if ($rc_comment->comment_author_email != $my_email) {
                ?>
		<div class="comment-1">
      <div class="postmeta"><a href="<?php 
                echo get_permalink($rc_comment->comment_post_ID);
                ?>
#comment" class="uname user_u1398846746" data-name="<?php 
                echo $rc_comment->comment_author;
                ?>
" target="_blank"><?php 
                echo $rc_comment->comment_author;
                ?>
</a></div>
      <div class="sidebar-comments__comment">
        <?php 
                echo convert_smilies($rc_comment->comment_content);
                ?>
      </div>
      <div class="sidebar-comments__title">
        <p>评论于<a href="<?php 
                echo get_permalink($rc_comment->comment_post_ID);
                ?>
"><?php 
                echo get_the_title($rc_comment->comment_post_ID);
                ?>
</a></p>
      </div>
		</div>
		<?php 
                if ($i == $show_comments) {
Exemplo n.º 18
0
function wkc_recent_comments($args = '')
{
    $defaults = array('number' => 5, 'before' => '<li>', 'after' => '</li>', 'showpass' => 0, 'length' => 50, 'skipuser' => 'admin', 'avatarsize' => 16, 'xformat' => '<a class="commentor" href="%comment_author_url%" >%comment_author%</a> : <a class="comment_content" href="%permalink%" title="View the entire comment by %comment_author%" >%comment_excerpt%</a>', 'getrawdata' => 0, 'postid' => false, 'offset' => 0, 'echo' => 1);
    $r = wp_parse_args($args, $defaults);
    global $ct_wp_kit_cn;
    $comments = $ct_wp_kit_cn->get_recent_comments($r['number'], $r['showpass'], $r['skipuser'], $r['offset'], $r['postid']);
    if ($r['getrawdata']) {
        return $comments;
    }
    $output = '';
    foreach ($comments as $comment) {
        $post_title = stripslashes($comment->post_title);
        $comment_author = stripslashes($comment->comment_author);
        $comment_content = strip_tags($comment->comment_content);
        $comment_content = stripslashes($comment_content);
        if ($r['length'] > 0) {
            $comment_excerpt = $ct_wp_kit_cn->cut_str($comment_content, $r['length']);
        }
        if (function_exists('convert_smilies')) {
            $comment_excerpt = convert_smilies($comment_excerpt);
        }
        $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
        //	if ($comment->comment_author_url)
        //          $output .= $r['before'] . '<a class="commentor" href="' .$comment->comment_author_url .'">' . $comment_author . '</a> : ' .  '<a class="comment-content" href="' . $permalink . '" title="View the entire comment by ' . $comment_author . '">' . $comment_excerpt . '</a>'. $r['after'] . "\n";
        //	else
        //          $output .= $r['before'] . '<span class="commentor">' . $comment_author ."</span> : ". '<a class="comment-content" href="' . $permalink . '" title="View the entire comment by ' . $comment_author . '">' . $comment_excerpt . '</a>'. $r['after'] . "\n";
        $output .= $r['before'];
        $element_loop = $r['xformat'];
        $element_loop = str_replace('%gravatar%', get_avatar($comment->comment_author_email, $r['avatarsize']), $element_loop);
        $element_loop = str_replace('%comment_author_url%', $comment->comment_author_url, $element_loop);
        $element_loop = str_replace('%comment_author%', $comment_author, $element_loop);
        $element_loop = str_replace('%permalink%', $permalink, $element_loop);
        $element_loop = str_replace('%comment_excerpt%', $comment_excerpt, $element_loop);
        $element_loop = str_replace('%post_title%', $post_title, $element_loop);
        $element_loop = str_replace('%comment_count%', $comment->comment_count, $element_loop);
        $output .= $element_loop;
        $output .= $r['after'] . "\n";
    }
    if ($r['echo']) {
        echo $output;
    } else {
        return $output;
    }
}
Exemplo n.º 19
0
function xmt_replace_vars($str, $acc)
{
    if (trim($str) == '') {
        return $str;
    }
    $str = convert_smilies(html_entity_decode($str));
    if (strpos($str, '@') === false) {
        return $str;
    }
    $det = xmt_prf_get($acc);
    $str = str_replace('@followers_count', intval($det['followers_count']), $str);
    $str = str_replace('@friends_count', intval($det['friends_count']), $str);
    $str = str_replace('@favourites_count', intval($det['favourites_count']), $str);
    $str = str_replace('@statuses_count', intval($det['statuses_count']), $str);
    $str = str_replace('@avatar', $det['avatar'], $str);
    $str = str_replace('@name', $det['name'], $str);
    $str = str_replace('@screen_name', $det['screen_name'], $str);
    return $str;
}
function the_content_rss($more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0)
{
    $content = get_the_content($more_link_text, $stripteaser, $more_file);
    $content = apply_filters('the_content', $content);
    $content = preg_replace('/<style.*?>.*?<\\/style.*?>/ms', '', $content);
    if ($cut && !$encode_html) {
        $encode_html = 2;
    }
    if ($encode_html == 1) {
        $content = htmlspecialchars($content);
        $cut = 0;
    } elseif ($encode_html == 0) {
        $content = preg_replace('/(<br .*?>|<\\/tr>|<\\/table>|<\\/li>|<\\/h\\d>|<\\/p>)/ms', "_rss_cr_", $content);
        $content = htmlspecialchars(make_url_footnote($content));
        $content = preg_replace('/_rss_cr_/ms', '&lt;br /&gt;', $content);
    } elseif ($encode_html == 2) {
        $content = preg_replace('/(<br .*?>|<\\/tr>|<\\/table>|<\\/li>|<\\/h\\d>|<\\/p>)/ms', "_rss_cr_", $content);
        $content = htmlspecialchars(strip_tags($content));
        $content = preg_replace('/_rss_cr_/ms', '&lt;br /&gt;', $content);
    } elseif ($encode_html == 3) {
        $content = convert_smilies($content);
        $cut = 0;
    }
    $excerpt = '';
    if ($cut) {
        $blah = explode(' ', $content);
        if (count($blah) > $cut) {
            $k = $cut;
            $use_dotdotdot = 1;
        } else {
            $k = count($blah);
            $use_dotdotdot = 0;
        }
        for ($i = 0; $i < $k; $i++) {
            $excerpt .= $blah[$i] . ' ';
        }
        $excerpt .= $use_dotdotdot ? '...' : '';
        $content = $excerpt;
    }
    $content = str_replace(']]>', ']]&gt;', $content);
    echo wp_convert_rss_charset($content);
}
Exemplo n.º 21
0
 function widget($args, $instance)
 {
     extract($args);
     global $wpdb;
     $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url,comment_author_email, SUBSTRING(comment_content,1,42) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 5";
     $comments = $wpdb->get_results($sql);
     $output = $pre_HTML;
     foreach ($comments as $comment) {
         $output .= "<li><div class='img'>" . get_avatar(get_comment_author_email(), 50) . "</div><div class=\"author\"><a href=\"" . get_comment_link($comment->comment_ID) . "\" title=\"" . $comment->post_title . "\"><strong>" . strip_tags($comment->comment_author) . "</strong> : " . stripslashes(convert_smilies($comment->com_excerpt)) . "...</a></div></li>";
     }
     $output .= $post_HTML;
     echo $before_widget;
     if ($instance['title']) {
         echo $before_title . $instance['title'] . $after_title;
     }
     echo '<ul class="spy">';
     echo $output;
     echo '</ul>';
     echo $after_widget;
 }
Exemplo n.º 22
0
 function mdv_recent_comments($no_comments = 10, $comment_lenth = 5, $before = '<li class="off" onmouseover=this.className="on"; onmouseout=this.className="off";>', $after = '</li>', $show_pass_post = false, $comment_style = 0)
 {
     global $wpdb;
     $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title FROM {$wpdb->comments} LEFT JOIN {$wpdb->posts} ON {$wpdb->posts}.ID={$wpdb->comments}.comment_post_ID WHERE post_status IN ('publish','static') ";
     if (!$show_pass_post) {
         $request .= "AND post_password ='' ";
     }
     $request .= "AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT {$no_comments}";
     $comments = $wpdb->get_results($request);
     $output = '';
     if ($comments) {
         foreach ($comments as $comment) {
             $comment_author = stripslashes($comment->comment_author);
             if ($comment_author == "") {
                 $comment_author = "anonymous";
             }
             $comment_content = strip_tags($comment->comment_content);
             $comment_content = stripslashes($comment_content);
             $words = split(" ", $comment_content);
             $comment_excerpt = join(" ", array_slice($words, 0, $comment_lenth));
             $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
             if ($comment_style == 1) {
                 $post_title = stripslashes($comment->post_title);
                 $url = $comment->comment_author_url;
                 if (empty($url)) {
                     $output .= $before . $comment_author . ' on ' . $post_title . '.' . $after;
                 } else {
                     $output .= $before . "<a href='{$url}' rel='external'>{$comment_author}</a>" . ' on ' . $post_title . '.' . $after;
                 }
             } else {
                 $output .= $before . '' . $comment_author . ':  <a href="' . $permalink;
                 $output .= '" title="View the entire comment by ' . $comment_author . '">' . $comment_excerpt . '</a>' . $after;
             }
         }
         $output = convert_smilies($output);
     } else {
         $output .= $before . "None found" . $after;
     }
     echo $output;
 }
Exemplo n.º 23
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_name', $instance['title']);
     $limit = $instance['limit'];
     $outer = $instance['outer'];
     if (!$outer) {
         $outer = -1;
     }
     echo $before_widget;
     echo $before_title . $title . $after_title;
     echo '<ul>';
     global $wpdb;
     $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved,comment_author_email, comment_type,comment_author_url, SUBSTRING(comment_content,1,60) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE user_id!='" . $outer . "' AND comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$limit}";
     $comments = $wpdb->get_results($sql);
     foreach ($comments as $comment) {
         $output .= $comment->user_id . '<li><a' . hui_target_blank() . ' href="' . get_permalink($comment->ID) . '#comment-' . $comment->comment_ID . '" title="' . $comment->post_title . __('上的评论', 'haoui') . '">' . hui_get_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email) . strip_tags($comment->comment_author) . ' <span class="text-muted">' . timeago($comment->comment_date_gmt) . __('说:', 'haoui') . '<br>' . str_replace(' src=', ' data-original=', convert_smilies(strip_tags($comment->com_excerpt))) . '</span></a></li>';
     }
     echo $output;
     echo '</ul>';
     echo $after_widget;
 }
Exemplo n.º 24
0
function cfct_about_text()
{
    $about_text = get_option('cfct_about_text');
    if (!empty($about_text)) {
        $about_text = wptexturize($about_text);
        $about_text = convert_smilies($about_text);
        $about_text = convert_chars($about_text);
        $about_text = wpautop($about_text);
    } else {
        global $post;
        remove_filter('the_excerpt', 'st_add_widget');
        $about_query = new WP_Query('pagename=about');
        while ($about_query->have_posts()) {
            $about_query->the_post();
            $about_text = get_the_excerpt() . sprintf(__('<a class="more" href="%s">more &rarr;</a>', 'carrington'), get_permalink());
        }
    }
    if (function_exists('st_add_widget')) {
        add_filter('the_excerpt', 'st_add_widget');
    }
    return $about_text;
}
Exemplo n.º 25
0
?>
</p>
			<?php 
get_search_form();
the_widget('WP_Widget_Recent_Posts');
/** Only show the widget if site has multiple categories */
if (mqsecurity2016_categorized_blog()) {
    ?>
	<div>
		<h2 class="widget"><?php 
    esc_html_e('Most Used Categories', 'mqsecurity2016');
    ?>
		</h2>
		<ul>
			<?php 
    wp_list_categories(array('orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10));
    ?>
		</ul>
	</div>
<?php 
}
/** translators: %1$s: smiley */
$archive_content = '<p>' . sprintf(esc_html__('Try looking in the monthly archives. %1$s', 'mqsecurity2016'), convert_smilies(':)') . '</p>');
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>{$archive_content}");
the_widget('WP_Widget_Tag_Cloud');
?>
		</div>
	</article>
</section>
<?php 
get_footer();
Exemplo n.º 26
0
if (evolution_categorized_blog()) {
    ?>

					<div class="widget widget_categories">
						<h2 class="widget-title"><?php 
    esc_html_e('Most Used Categories', 'evolution');
    ?>
</h2>
						<ul>
						<?php 
    wp_list_categories(array('orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10));
    ?>
						</ul>
					</div><!-- .widget -->

					<?php 
}
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf(esc_html__('Try looking in the monthly archives. %1$s', 'evolution'), convert_smilies(':)')) . '</p>';
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>{$archive_content}");
the_widget('WP_Widget_Tag_Cloud');
?>

				</div><!-- .page-content -->
			</section><!-- .error-404 -->

		</main><!-- #main -->
	</div><!-- #primary -->

<?php 
get_footer();
Exemplo n.º 27
0
    _e('Most Used Categories', '_s');
    ?>
</h2>
								<ul>
								<?php 
    wp_list_categories(array('orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10));
    ?>
								</ul>
							</div><!-- .widget -->
							<?php 
}
?>

							<?php 
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf(__('Try looking in the monthly archives. %1$s', '_s'), convert_smilies(':)')) . '</p>';
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>{$archive_content}");
?>

							<?php 
the_widget('WP_Widget_Tag_Cloud');
?>

						</article><!-- .page-content -->
					</section><!-- .error-404 -->

				</div><!-- /col -->
		

			<?php 
get_sidebar();
Exemplo n.º 28
0
if (bootstrap_to_wordpress_categorized_blog()) {
    ?>

					<div class="widget widget_categories">
						<h2 class="widget-title"><?php 
    esc_html_e('Most Used Categories', 'bootstrap-to-wordpress');
    ?>
</h2>
						<ul>
						<?php 
    wp_list_categories(array('orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10));
    ?>
						</ul>
					</div><!-- .widget -->

					<?php 
}
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf(esc_html__('Try looking in the monthly archives. %1$s', 'bootstrap-to-wordpress'), convert_smilies(':)')) . '</p>';
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>{$archive_content}");
the_widget('WP_Widget_Tag_Cloud');
?>

				</div><!-- .page-content -->
			</section><!-- .error-404 -->

		</main><!-- #main -->
	</div><!-- #primary -->

<?php 
get_footer();
Exemplo n.º 29
0
    ?>
</h2>
						<ul>
							<?php 
    wp_list_categories(array('orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10));
    ?>
						</ul>
					</div>
					<!-- .widget -->
					<?php 
}
?>

					<?php 
/* translators: %1$s: smilie */
$archive_content = '<p>' . sprintf(__('Try looking in the monthly archives. %1$s', 'independent-publisher'), convert_smilies(':)')) . '</p>';
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>{$archive_content}");
?>

					<?php 
the_widget('WP_Widget_Tag_Cloud');
?>

				</div>
				<!-- .entry-content -->
			</section>
			<!-- .error-404 -->

		</main>
		<!-- #main -->
	</div><!-- #primary .content-area -->
Exemplo n.º 30
0
    esc_html_e('Most Used Categories', 'opengamer_theme');
    ?>
</h2>
						<ul>
						<?php 
    wp_list_categories(array('orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10));
    ?>
						</ul>
					</div><!-- .widget -->
					<?php 
}
?>

					<?php 
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf(esc_html__('Try looking in the monthly archives. %1$s', 'opengamer_theme'), convert_smilies(':)')) . '</p>';
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>{$archive_content}");
?>

					<?php 
the_widget('WP_Widget_Tag_Cloud');
?>

				</div><!-- .page-content -->
			</section><!-- .error-404 -->

		</main><!-- #main -->
	</div><!-- #primary -->

<?php 
get_footer();