Digitalraindrops

members-functions.php

Mar 23rd, 2011
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 19.15 KB | None | 0 0
  1. <?php
  2. define('THEME_NAME',"Untitled");
  3. global $wp_version;
  4. define('WP_VERSION', $wp_version);
  5. define('BR', "\n");
  6. define('THEME_NS', 'twentyten');
  7. define('THEME_LANGS_FOLDER','/languages');
  8. if (class_exists('xili_language')) {
  9.     define('THEME_TEXTDOMAIN',THEME_NS);
  10. } else {
  11.     load_theme_textdomain(THEME_NS, TEMPLATEPATH . THEME_LANGS_FOLDER);
  12. }
  13.  
  14. if (WP_VERSION < 3.0){
  15.     require_once(TEMPLATEPATH . '/library/legacy.php');
  16. }
  17.  
  18. art_include_lib('defaults.php');
  19. art_include_lib('misc.php');
  20. art_include_lib('wrappers.php');
  21. art_include_lib('sidebars.php');
  22. art_include_lib('navigation.php');
  23. art_include_lib('shortcodes.php');
  24. if (WP_VERSION >= 3.0) {
  25.     art_include_lib('widgets.php');
  26. }
  27.  
  28. if (!function_exists('art_favicon')) {
  29.     function art_favicon() {
  30.         if (is_file(TEMPLATEPATH .'/favicon.ico')):?>
  31. <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
  32.         <?php endif;
  33.     }
  34. }
  35. add_action('wp_head', 'art_favicon');
  36. add_action('admin_head', 'art_favicon');
  37. add_action('login_head', 'art_favicon');
  38.  
  39. if ( function_exists('add_theme_support') ) {
  40.     add_theme_support('post-thumbnails');
  41.     add_theme_support('nav-menus');
  42.     add_theme_support('automatic-feed-links');
  43. }
  44. //Add Support for Members Menu
  45. if (function_exists('register_nav_menus')) {
  46.     register_nav_menus(array(
  47.         'primary-menu'  =>  __( 'Primary Navigation', THEME_NS),
  48.         'members-menu'  =>  __( 'Members Navigation', THEME_NS),
  49.         )
  50.     );
  51. }
  52.  
  53.  
  54. if(is_admin()){
  55.     art_include_lib('options.php');
  56.     art_include_lib('admins.php');
  57.     function art_add_option_page() {
  58.         add_theme_page(__('Theme Options', THEME_NS), __('Theme Options', THEME_NS), 'edit_themes', basename(__FILE__), 'art_print_options');
  59.     }
  60.     add_action('admin_menu', 'art_add_option_page');
  61.     if (WP_VERSION >= 3.0) {
  62.         /* Add widgets extra option */
  63.         add_action('sidebar_admin_setup', 'art_widget_process_control');
  64.        
  65.         /* Define the art page title box */
  66.         add_action('add_meta_boxes', 'art_add_meta_boxes');
  67.  
  68.         /* Save art page title show status */
  69.         add_action('save_post', 'art_save_post');
  70.     }
  71.     return;
  72. }
  73.  
  74.  
  75. function art_get_option($name){
  76.     global $art_default_options;
  77.     $result = get_option($name);
  78.     if ($result === false) {
  79.         $result = art_get_array_value($art_default_options, $name);
  80.     }
  81.     return $result;
  82. }
  83.  
  84.  
  85.  
  86. function art_get_meta_option($id, $name){
  87.     global $art_default_meta_options;
  88.     return art_get_array_value(get_option($name), $id, art_get_array_value($art_default_meta_options, $name));
  89. }
  90.  
  91.  
  92.  
  93. function art_set_meta_option($id, $name, $value){
  94.     $meta_option = get_option($name);
  95.     if (!$meta_option || !is_array($meta_option)) {
  96.         $meta_option = array();
  97.     }
  98.     $meta_option[$id] = $value;
  99.     update_option($name, $meta_option);
  100. }
  101.  
  102.  
  103.  
  104. function art_get_post_id(){
  105.     $post_id = get_the_ID();
  106.     if($post_id != ''){
  107.         $post_id = 'post-' . $post_id;
  108.     }
  109.     return $post_id;
  110. }
  111.  
  112.  
  113.  
  114. function art_get_post_class(){
  115.     if (!function_exists('get_post_class')) return '';
  116.     return implode(' ', get_post_class());
  117. }
  118.  
  119.  
  120. function art_include_lib($name){
  121.     locate_template(array('library/'.$name), true);
  122. }
  123.  
  124.  
  125. if (!function_exists('art_get_meta_icon')){
  126.     function art_get_meta_icon($icon, $width, $height){
  127.         return '<img src="'.get_bloginfo('template_url').'/images/'.$icon.'.png" width="'.$width.'" height="'.$height.'" alt="" />';
  128.     }
  129. }
  130.  
  131. if (!function_exists('art_get_metadata_icons')){
  132.     function art_get_metadata_icons($icons = '', $class=''){
  133.         global $post;
  134.         if (!is_string($icons) || strlen($icons) == 0) return;
  135.         $icons = explode(",", str_replace(' ', '', $icons));
  136.         if (!is_array($icons) || count($icons) == 0) return;
  137.         $result = array();
  138.         for($i = 0; $i < count($icons); $i++){
  139.             $icon = $icons[$i];
  140.             switch($icon){
  141.                 case 'date':
  142.                     $result[] = sprintf( __('<span class="%1$s">Published</span> %2$s', THEME_NS),
  143.                                     'date',
  144.                                     sprintf( '<span class="entry-date" title="%1$s">%2$s</span>',
  145.                                         esc_attr( get_the_time() ),
  146.                                         get_the_date()
  147.                                     )
  148.                                 );
  149.                 break;
  150.                 case 'author':
  151.                     $result[] = sprintf(__('<span class="%1$s">By</span> %2$s', THEME_NS),
  152.                                     'author',
  153.                                     sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  154.                                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
  155.                                         sprintf( esc_attr(__( 'View all posts by %s', THEME_NS )), get_the_author() ),
  156.                                         get_the_author()
  157.                                     )
  158.                                 );
  159.                 break;
  160.                 case 'category':
  161.                     $categories = get_the_category_list(', ');
  162.                     if(strlen($categories) == 0) break;
  163.                     $result[] = sprintf(__('<span class="%1$s">Posted in</span> %2$s', THEME_NS), 'categories', get_the_category_list(', '));
  164.                 break;
  165.                 case 'tag':
  166.                     $tags_list = get_the_tag_list( '', ', ' );
  167.                     if(!$tags_list) break;
  168.                     $result[] = sprintf( __( '<span class="%1$s">Tagged</span> %2$s', THEME_NS ), 'tags', $tags_list );
  169.                 break;
  170.                 case 'comments':
  171.                     if(!comments_open()) break;
  172.                     ob_start();
  173.                     comments_popup_link( __( 'Leave a comment', THEME_NS ), __( '1 Comment', THEME_NS ), __( '% Comments', THEME_NS ) );
  174.                     $result[] = ob_get_clean();
  175.                 break;
  176.                 case 'edit':
  177.                     if (!current_user_can('edit_post', $post->ID)) break;
  178.                     ob_start();
  179.                     edit_post_link(__('Edit', THEME_NS), '');
  180.                     $result[] = ob_get_clean();
  181.                 break;
  182.             }
  183.         }
  184.         $result = implode(art_get_option('art_metadata_separator'), $result);
  185.         if (art_is_empty_html($result)) return;
  186.         return "<div class=\"art-post{$class}icons art-metadata-icons\">{$result}</div>";
  187.     }
  188. }
  189.  
  190. if (!function_exists('art_get_post_thumbnail')){
  191.     function art_get_post_thumbnail($args = array()){
  192.         global $post;
  193.         $size = art_get_array_value($args, 'size', array(art_get_option('art_metadata_thumbnail_width'), art_get_option('art_metadata_thumbnail_height')));
  194.         $auto = art_get_array_value($args, 'auto', art_get_option('art_metadata_thumbnail_auto'));
  195.         $title = art_get_array_value($args, 'title', get_the_title());
  196.  
  197.         $result = '';
  198.  
  199.         if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) {
  200.             ob_start();
  201.             the_post_thumbnail($size, array('alt'   =>  '', 'title' =>  $title));
  202.             $result = ob_get_clean();
  203.         } elseif ($auto) {
  204.             $attachments = get_children(array('post_parent' =>  $post->ID, 'post_status'    =>  'inherit', 'post_type'  =>  'attachment', 'post_mime_type'  =>  'image', 'order'    =>  'ASC', 'orderby'    =>  'menu_order ID'));
  205.             if($attachments) {
  206.                 $attachment = array_shift($attachments);
  207.                 $img = wp_get_attachment_image_src($attachment->ID, $size);
  208.                 if (isset($img[0])) {
  209.                     $result = '<img src="'.$img[0].'" alt="" width="'.$img[1].'" height="'.$img[2].'" title="'.$title.'" class="wp-post-image" />';
  210.                 }
  211.             }
  212.         }  
  213.         if($result !== ''){
  214.             $result = '<div class="avatar alignleft"><a href="'.get_permalink($post->ID).'" title="'.$title.'">'.$result.'</a></div>';
  215.         }
  216.         return $result;
  217.     }
  218. }
  219.  
  220. function art_apply_the_content($content){
  221.     // hack for badly written plugins
  222.     ob_start();
  223.     echo apply_filters('the_content', $content);
  224.     return ob_get_clean();
  225. }
  226.  
  227. if (!function_exists('art_get_content')){
  228.     function art_get_content($args = array()) {
  229.         $more_tag = art_get_array_value($args, 'more_tag', __('Continue reading <span class="meta-nav">&rarr;</span>', THEME_NS));
  230.         $content = get_the_content($more_tag);
  231.         $content = art_apply_the_content($content);
  232.         return $content . wp_link_pages(array(
  233.         'before' => '<p><span class="page-navi-outer page-navi-caption"><span class="page-navi-inner">' . __('Pages', THEME_NS) . ': </span></span>',
  234.         'after' => '</p>',
  235.         'link_before' => '<span class="page-navi-outer"><span class="page-navi-inner">',
  236.         'link_after' => '</span></span>',
  237.         'echo' => 0
  238.         ));
  239.     }
  240. }
  241.  
  242. if (!function_exists('art_get_excerpt')){
  243.     function art_get_excerpt($args = array()) {
  244.         global $post;
  245.         $more_tag = art_get_array_value($args, 'more_tag', __('Continue reading <span class="meta-nav">&rarr;</span>', THEME_NS));
  246.         $auto = art_get_array_value($args, 'auto', art_get_option('art_metadata_excerpt_auto'));
  247.         $all_words = art_get_array_value($args, 'all_words', art_get_option('art_metadata_excerpt_words'));
  248.         $min_remainder = art_get_array_value($args, 'min_remainder', art_get_option('art_metadata_excerpt_min_remainder'));
  249.         $allowed_tags = art_get_array_value($args, 'allowed_tags',
  250.             (art_get_option('art_metadata_excerpt_use_tag_filter')
  251.                 ? explode(',',str_replace(' ', '', art_get_option('art_metadata_excerpt_allowed_tags')))
  252.                 : null));
  253.         $perma_link = get_permalink($post->ID);
  254.         $more_token = '%%art_more%%';
  255.         $show_more_tag = false;
  256.         $tag_disbalance = false;
  257.         if (function_exists('post_password_required') && post_password_required($post)){
  258.             return get_the_excerpt();
  259.         }
  260.         if ($auto && has_excerpt($post->ID)) {
  261.             $the_contents = get_the_excerpt();
  262.             $show_more_tag = strlen($post->post_content) > 0;
  263.         } else {
  264.             $the_contents = get_the_content($more_token);
  265.             $the_contents = art_apply_the_content($the_contents);
  266.             if(art_is_empty_html($the_contents)) return $the_contents;
  267.             if ($allowed_tags !== null) {
  268.                 $allowed_tags = '<' .implode('><',$allowed_tags).'>';
  269.                 $the_contents = strip_tags($the_contents, $allowed_tags);
  270.             }
  271.             $the_contents = strip_shortcodes($the_contents);
  272.             if (strpos($the_contents, $more_token) !== false) {
  273.                 $the_contents = str_replace($more_token, $more_tag, $the_contents);
  274.             } elseif($auto && is_numeric($all_words)) {
  275.                 $token = "%art_tag_token%";
  276.                 $content_parts = explode($token, str_replace(array('<', '>'), array($token.'<', '>'.$token), $the_contents));
  277.                 $content = array();
  278.                 $word_count = 0;
  279.                 foreach($content_parts as $part)
  280.                 {
  281.                     if (strpos($part, '<') !== false || strpos($part, '>') !== false){
  282.                         $content[] = array('type'=>'tag', 'content'=>$part);
  283.                     } else {
  284.                         $all_chunks = preg_split('/([\s])/u', $part, -1, PREG_SPLIT_DELIM_CAPTURE);
  285.                         foreach($all_chunks as $chunk) {
  286.                             if('' != trim($chunk)) {
  287.                                 $content[] = array('type'=>'word', 'content'=>$chunk);
  288.                                 $word_count += 1;
  289.                             } elseif($chunk != '') {
  290.                                 $content[] = array('type'=>'space', 'content'=>$chunk);
  291.                             }
  292.                         }
  293.                     }
  294.                 }
  295.  
  296.                 if(($all_words < $word_count) && ($all_words + $min_remainder) <= $word_count) {
  297.                     $show_more_tag = true;
  298.                     $tag_disbalance = true;
  299.                     $current_count = 0;
  300.                     $the_contents = '';
  301.                     foreach($content as $node) {
  302.                         if($node['type'] == 'word') {
  303.                             $current_count++;
  304.                         }
  305.                         $the_contents .= $node['content'];
  306.                         if ($current_count == $all_words){
  307.                             break;
  308.                         }
  309.                     }
  310.                     $the_contents .= '&hellip;'; // ...
  311.                 }
  312.             }
  313.         }
  314.         if ($show_more_tag) {
  315.             $the_contents = $the_contents.' <a class="more-link" href="'.$perma_link.'">'.$more_tag.'</a>';
  316.         }
  317.         if ($tag_disbalance) {
  318.             $the_contents = force_balance_tags($the_contents);
  319.         }
  320.         $the_contents = art_apply_the_content($the_contents);
  321.         return $the_contents;
  322.     }
  323. }
  324.  
  325. if (!function_exists('art_get_search')){
  326.     function art_get_search(){
  327.         ob_start();
  328.         get_search_form();
  329.         return ob_get_clean();
  330.     }
  331. }
  332.  
  333.  
  334. function art_is_home(){
  335.     return (is_home() && !is_paged());
  336. }
  337.  
  338.  
  339. if (!function_exists('art_404_content')){
  340.     function art_404_content() {
  341.         $error_message = __( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', THEME_NS);
  342.         art_post_wrapper(
  343.             array(
  344.                     'title' => __('Not Found', THEME_NS),
  345.                     'content' => '<p class="center">'
  346.                     . $error_message
  347.                     . '</p>' . BR . art_get_search()
  348.             )
  349.         );
  350.         if (art_get_option('art_show_random_posts_on_404_page')){
  351.             ob_start();
  352.             echo '<h4 class="box-title">' . art_get_option('art_show_random_posts_title_on_404_page') . '</h4>'; ?>
  353.             <ul>
  354.                 <?php
  355.                     global $post;
  356.                     $rand_posts = get_posts('numberposts=5&orderby=rand');
  357.                     foreach( $rand_posts as $post ) :
  358.                 ?>
  359.                 <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  360.                 <?php endforeach; ?>
  361.             </ul>
  362.             <?php art_post_wrapper(array('content' => ob_get_clean()));
  363.         }
  364.         if (art_get_option('art_show_tags_on_404_page')){
  365.             ob_start();
  366.             echo '<h4 class="box-title">' . art_get_option('art_show_tags_title_on_404_page') . '</h4>';
  367.             wp_tag_cloud('smallest=9&largest=22&unit=pt&number=200&format=flat&orderby=name&order=ASC');
  368.             art_post_wrapper(array('content' => ob_get_clean()));
  369.         }
  370.     }
  371. }
  372.  
  373. if (!function_exists('art_page_navigation')){
  374.     function art_page_navigation($args = '') {
  375.         $args = wp_parse_args($args, array('wrap' => true, 'prev_link' => false, 'next_link' => false));
  376.         $prev_link = $args['prev_link'];
  377.         $next_link = $args['next_link'];
  378.         $wrap = $args['wrap'];
  379.         if (!$prev_link && !$next_link) {
  380.             if (function_exists('wp_page_numbers')) { // http://wordpress.org/extend/plugins/wp-page-numbers/
  381.                 ob_start();
  382.                 wp_page_numbers();
  383.                 art_post_wrapper(array('content' => ob_get_clean()));
  384.                 return;
  385.             }
  386.             if (function_exists('wp_pagenavi')) { // http://wordpress.org/extend/plugins/wp-pagenavi/
  387.                 ob_start();
  388.                 wp_pagenavi();
  389.                 art_post_wrapper(array('content' => ob_get_clean()));
  390.                 return;
  391.             }
  392.             //posts
  393.             $prev_link = get_previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', THEME_NS));
  394.             $next_link = get_next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', THEME_NS));
  395.         }
  396.         $content = '';
  397.         if ($prev_link || $next_link) {
  398.  
  399.             $content = <<<EOL
  400.     <div class="navigation">
  401.         <div class="alignleft">{$next_link}</div>
  402.         <div class="alignright">{$prev_link}</div>
  403.      </div>
  404. EOL;
  405.         }
  406.         if ($wrap) {
  407.             art_post_wrapper(array('content' => $content));
  408.         } else {
  409.             echo $content;
  410.         }
  411.     }
  412. }
  413.  
  414. if (!function_exists('art_get_previous_post_link')){
  415.  
  416.     function art_get_previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
  417.         return art_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
  418.     }
  419. }
  420.  
  421. if (!function_exists('art_get_next_post_link')){
  422.     function art_get_next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
  423.         return art_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
  424.     }
  425. }
  426.  
  427. if (!function_exists('art_get_adjacent_image_link')){
  428.     function art_get_adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
  429.         global $post;
  430.         $post = get_post($post);
  431.         $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
  432.  
  433.         foreach ( $attachments as $k => $attachment )
  434.             if ( $attachment->ID == $post->ID )
  435.                 break;
  436.  
  437.         $k = $prev ? $k - 1 : $k + 1;
  438.  
  439.         if ( isset($attachments[$k]) )
  440.             return wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);
  441.     }
  442. }
  443.  
  444. if (!function_exists('art_get_previous_image_link')){
  445.     function art_get_previous_image_link($size = 'thumbnail', $text = false) {
  446.         $result = art_get_adjacent_image_link(true, $size, $text);
  447.         if ($result) $result = '&laquo; ' . $result;
  448.         return $result;
  449.     }
  450. }
  451.    
  452. if (!function_exists('art_get_next_image_link')){
  453.     function art_get_next_image_link($size = 'thumbnail', $text = false) {
  454.         $result = art_get_adjacent_image_link(false, $size, $text);
  455.         if ($result) $result .= ' &raquo;';
  456.         return $result;
  457.     }
  458. }
  459.  
  460. if (!function_exists('art_get_adjacent_post_link')){
  461.     function art_get_adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
  462.         if ( $previous && is_attachment() )
  463.             $post = & get_post($GLOBALS['post']->post_parent);
  464.         else
  465.             $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous);
  466.  
  467.         if ( !$post )
  468.             return;
  469.  
  470.         $title = $post->post_title;
  471.  
  472.         if ( empty($post->post_title) )
  473.             $title = $previous ? __('Previous Post', THEME_NS) : __('Next Post', THEME_NS);
  474.  
  475.         $title = apply_filters('the_title', $title, $post->ID);
  476.         $short_title = $title;
  477.         if (art_get_option('art_single_navigation_trim_title')) {
  478.             $short_title = art_trim_long_str($title, art_get_option('art_single_navigation_trim_len'));
  479.         }
  480.         $date = mysql2date(get_option('date_format'), $post->post_date);
  481.         $rel = $previous ? 'prev' : 'next';
  482.  
  483.         $string = '<a href="'.get_permalink($post).'" title="'.esc_attr($title).'" rel="'.$rel.'">';
  484.         $link = str_replace('%title', $short_title, $link);
  485.         $link = str_replace('%date', $date, $link);
  486.         $link = $string . $link . '</a>';
  487.  
  488.         $format = str_replace('%link', $link, $format);
  489.  
  490.         $adjacent = $previous ? 'previous' : 'next';
  491.         return apply_filters( "{$adjacent}_post_link", $format, $link );
  492.     }
  493. }
  494.  
  495. if (!function_exists('get_previous_comments_link')) {
  496.     function get_previous_comments_link($label)
  497.     {
  498.         ob_start();
  499.         previous_comments_link($label);
  500.         return ob_get_clean();
  501.     }
  502. }
  503.  
  504. if (!function_exists('get_next_comments_link')) {
  505.     function get_next_comments_link($label)
  506.     {
  507.         ob_start();
  508.         next_comments_link($label);
  509.         return ob_get_clean();
  510.     }
  511. }
  512.  
  513. if (!function_exists('art_comment')){
  514.     function art_comment( $comment, $args, $depth ) {
  515.         $GLOBALS['comment'] = $comment;
  516.        
  517.        
  518.         switch ( $comment->comment_type ) :
  519.        
  520.             case '' :
  521.         ?>
  522.         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  523.             <?php ob_start(); ?>
  524.             <div class="comment-author vcard">
  525.                 <?php echo art_get_avatar(array('id' => $comment, 'size' => 48)); ?>
  526.                 <?php printf( __( '%s <span class="says">says:</span>', THEME_NS ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  527.             </div>
  528.             <?php if ( $comment->comment_approved == '0' ) : ?>
  529.                 <em><?php _e( 'Your comment is awaiting moderation.', THEME_NS); ?></em>
  530.                 <br />
  531.             <?php endif; ?>
  532.  
  533.             <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  534.                 <?php
  535.                     printf( __( '%1$s at %2$s', THEME_NS ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', THEME_NS), ' ' );
  536.                 ?>
  537.             </div>
  538.  
  539.             <div class="comment-body"><?php comment_text(); ?></div>
  540.  
  541.             <div class="reply">
  542.                 <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  543.             </div>
  544.             <?php art_post_wrapper(array('content' => ob_get_clean(), 'id' => 'comment-'.get_comment_ID())); ?>
  545.  
  546.  
  547.         <?php
  548.                 break;
  549.             case 'pingback'  :
  550.             case 'trackback' :
  551.         ?>
  552.         <li class="post pingback">
  553.         <?php ob_start(); ?>
  554.             <p><?php _e( 'Pingback:', THEME_NS ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', THEME_NS), ' ' ); ?></p>
  555.         <?php art_post_wrapper(array('content' => ob_get_clean(), 'class' => $comment->comment_type));
  556.                 break;
  557.         endswitch;
  558.     }
  559. }
  560.  
  561. if (!function_exists('art_get_avatar')){
  562.     function art_get_avatar($args = ''){
  563.     $args = wp_parse_args($args, array('id' => false, 'size' => 96, 'default' => '', 'alt' => false, 'url' => false));
  564.     extract($args);
  565.         $result = get_avatar($id, $size, $default, $alt);
  566.         if ($result) {
  567.             if ($url){
  568.                 $result = '<a href="'.esc_url($url).'">' . $result . '</a>';
  569.             }
  570.             $result = '<div class="avatar">' . $result . '</div>';
  571.         }
  572.         return $result;
  573.     }
  574. }
Advertisement
Add Comment
Please, Sign In to add comment