get_header(); ?> <div id="content" class="narrowcolumn"> <!-- This sets the $curauth & $authid variables --> <?php if (get_query_var('author_name')) { $curauth = get_userdatabylogin(get_query_var('author_name')); } else { $curauth = get_userdata(get_query_var('author')); } $authid = $curauth->ID; ?> <div id="profilebox" style="min-height: <?php author_image_dimensions(author_image_path($authid, false, 'absolute'), 'height', true); ?> px;"> <!-- old school method <?php author_image_tag($authid, 'align=right'); ?> <h2><?php _e($curauth->first_name); ?> <?php _e($curauth->last_name); ?> </h2>
the_ID(); ?> "> <h2><a href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent Link to <?php the_title(); ?> "><?php the_title(); ?> </a></h2> <p class="post-info"> <img src='<?php author_image_path(get_the_author_ID()); ?> ' width='16px' height='16px'> <?php the_time('l j \\d\\e F \\d\\e Y'); ?> por <a href="<?php echo get_the_author_url(); ?> "><?php the_author_firstname(); ?> <?php the_author_lastname(); ?> </a>
<div id="sidebar"> <h3 class="site-subtitle">Mi perfil</h3> <?php if (!isset($url)) { $url = get_option('home'); } ?> <?php $c_user = wp_get_current_user(); echo '<p><img src="' . author_image_path($c_user->ID, $display = false) . '" /></p><p><a href="' . $url . '/?id=' . $c_user->ID . '" >Ver mi perfil</a><p>'; ?> <br /> <h3 class="site-subtitle">Buscar</h3> <?php include TEMPLATEPATH . '/searchform.php'; ?> </div>
/** * Update blog avatar on feevy * Parameters: * - $user_id: user to fech metadata from */ function feevy_update_avatar() { if (!API_KEY) { return null; } global $user_ID; $avatar_url = author_image_path($user_ID, false); // Check if user has an avatar if (strlen($avatar_url) > 0) { // Get list of user blogs $blogs = get_blogs_of_user($user_ID); // Set avatar for each blog foreach ($blogs as $blog) { $user_count = count(get_users_of_blog($blog->userblog_id)); // Verify blog url if ($user_count == 1 and strlen($blog->siteurl) > 0) { // Set request to Feevy API $api = new feevySoup(); $api->api_key = API_KEY; $api->type = 'edit_avatar'; $api->params = array('feed_url' => "{$blog->siteurl}/feed/", 'avatar_url' => $avatar_url); // Execute request $api->get_content(); } } } }
function get_recent_avatar_list($count = 20) { global $image_dir; $directory = ABSPATH . '/' . $image_dir . '/'; // create an array to hold directory list $result = array(); // create a handler for the directory $handler = opendir($directory); // keep going until all files in directory have been read while ($file = readdir($handler)) { // if $file is a picture, and not the default one if ((strpos($file, '.gif', 1) || strpos($file, '.jpg', 1) || strpos($file, '.png', 1)) && strcmp($file, 'default.png') != 0) { // Only keep avatar number $result[] = substr($file, 0, -4); } } // tidy up: close the handler closedir($handler); // Sort result rsort($result); // And keep only $count result $result = array_slice($result, 0, $count); $list = ""; // Produce list of $count avatars foreach ($result as $user_id) { // Get user display name $user = get_userdata($user_id); // Get user active blog $blog = get_active_blog_for_user($user_id); // User avatar url $avatar = author_image_path($user_id, $display = false); // Create element $list .= "<li><a href='{$blog->siteurl}' title='{$user->display_name}'>"; $list .= "<img src='{$avatar}' alt='{$user->display_name}' width='48px' height='48px'/></a></li>"; } echo "<ul class='clearfix'>{$list}</ul>"; }
echo '<p>No hay ninguna entrada en el blog todavía.</p>'; } ?> </div> <div class="related-contacts"> <h3 class="site-subtitle">Mis Contactos</h3> <?php $contacts = get_friends($_GET['id']); if (count($contacts) == 0) { echo '<p>Todavía no tengo ningún contacto</p>'; } else { $result = "<ul>"; foreach ($contacts as $contact_id => $rel) { $contact_data = get_userdata((int) $contact_id); $result .= '<li><img src="' . author_image_path($contact_id, $display = false) . '" width=25 height=25 /> <a href="?id=' . $contact_id . '">' . $contact_data->display_name . '</a>. -> ' . $rel . '</li>'; if ($userdata->ID == $_GET['id']) { $result .= '<span class="elim"><a href="?id=' . $_GET['id'] . '&elim=' . $contact_id . '">Eliminar este contacto</a></span>'; } } $result .= "</ul>"; echo $result; } ?> </div> <div class="contact-tags"><?php the_tags('<span>TAGS: </span>', ', ', ''); ?> </div>
function blogsfera_widget_tag_results() { $title = __('Resultados de la tag'); ?> <li id="search-results" class="clearfix"> <h2><?php echo $title; ?> </h2> <p class="query">Estos son los resultados con el tag "<?php current_tag(); ?> ":</p> <ul> <?php if ($result = tag_results()) { global $post; $result = array_slice($result, 0, 12); $list = ""; $last = count($result) - 1; $i = 0; foreach ($result as $post) { $list .= "<li"; if ($i == $last) { $list .= " class='last clearfix'"; } $list .= "><a class='avatar' href='{$post->guid}'><img src='" . author_image_path($post->post_author, $display = false) . "' alt='avatar' width='48px' height='48px'/></a><h3><a href='{$post->guid}'>{$post->post_title}</a></h3><p>hace " . get_time_difference($post->post_date_gmt, $display = true) . "</p></li>"; $i++; } echo $list; } else { ?> <li>Not Found</li> <?php } ?> </ul> </li> <?php }
function kjgrc_get_comments2($requested_comment_type, $caller) { // kjgrc_log("kjgrc_get_comments2 $caller"); // echo "kjgrc_get_comments2 $requested_comment_type $caller<br>"; if (function_exists("mb_regex_encoding")) { mb_regex_encoding(mb_internal_encoding()); } global $wpdb; $batch_number = 0; $number_of_comments = 0; $requested_number_of_comments = kjgrc_get_option($requested_comment_type, "max_comments"); $chars_per_comment = kjgrc_get_option($requested_comment_type, "chars_per_comment"); $chars_per_word = kjgrc_get_option($requested_comment_type, "chars_per_word"); $format = stripslashes(kjgrc_get_option($requested_comment_type, "format")); $batch_size = $requested_number_of_comments * 3; // grc //x// $max_comments = kjgrc_get_option("grc","max_comments"); //x// $chars_per_comment = kjgrc_get_option("grc","chars_per_comment"); //x// $chars_per_word = kjgrc_get_option("grc","chars_per_word"); //x// $format = stripslashes(kjgrc_get_option("grc","format")); //x// $sql_comment_type = "AND comment_type = '' "; //x// if (kjgrc_get_option("grc","show_trackbacks") == 1) { //x// $sql_comment_type = ''; //x// } // grt //// $max_comments = kjgrc_get_option("grt","max_comments"); //// $chars_per_comment = kjgrc_get_option("grt","chars_per_comment"); //// $chars_per_word = kjgrc_get_option("grt","chars_per_word"); //// $format = stripslashes(kjgrc_get_option("grt","format")); //// $query = "SELECT DISTINCT $wpdb->comments.* FROM $wpdb->comments ". //// "LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID ". //// $sql_join_post2cat . //// "WHERE (post_status = 'publish' OR post_status = 'static') AND comment_approved= '1' AND post_password = '' ". //// $sql_exlude_cat . //// "AND ( comment_type = 'trackback' OR comment_type = 'pingback' ) ". //// $sql_ignore_ip . //// "ORDER BY comment_date DESC LIMIT $max_comments"; $sql_ignore_ip = ''; $sql_exclude_owner = ''; $grouped_by_post = 0; if ($requested_comment_type == 'grt') { if (kjgrc_get_option("grt", "ignore_ip") != '') { $sql_ignore_ip = "AND comment_author_IP != '" . kjgrc_get_option("grt", "ignore_ip") . "' "; } $sql_comment_type = "( comment_type = 'trackback' OR comment_type = 'pingback' ) "; } if ($requested_comment_type == 'grc') { $sql_comment_type = "comment_type = '' "; if (kjgrc_get_option("grc", "show_trackbacks") == 1) { $sql_comment_type = '1 '; } if (kjgrc_get_option("grc", "exclude_blog_owner") == 1) { $sql_exclude_owner = "AND user_id = '0' "; } if (kjgrc_get_option("grc", "grouped_by_post")) { $grouped_by_post = 1; } } while ($comments_number < $requested_number_of_comments) { $query = "SELECT * from {$wpdb->comments} WHERE comment_approved= '1' AND " . $sql_comment_type . $sql_exclude_owner . $sql_ignore_ip . "ORDER BY comment_date DESC LIMIT " . $batch_number * $batch_size . ",{$batch_size}"; // echo "$query<br><br>"; $comments = $wpdb->get_results($query); if (!$comments) { $result .= "none"; break; } unset($missing_post); foreach ($comments as $comment) { if ($post_cache == NULL || !array_key_exists($comment->comment_post_ID, $post_cache)) { $missing_post[$comment->comment_post_ID] = 1; } } if ($missing_post != NULL) { unset($comma_separated); $comma_separated = implode(",", array_keys($missing_post)); if (empty($wpdb->term_relationships)) { $query = "SELECT * from {$wpdb->posts} JOIN {$wpdb->post2cat} ON ID = post_id WHERE ID IN ({$comma_separated});"; } else { $query = "SELECT * from {$wpdb->posts} JOIN {$wpdb->term_relationships} ON ({$wpdb->term_relationships}.object_id=ID) WHERE ID IN ({$comma_separated});"; } // echo "$query<br>"; $posts = $wpdb->get_results($query); foreach ($posts as $post) { // echo "p: $post->ID "; $post_cache[$post->ID] = $post; if (empty($wpdb->term_relationships)) { $cat_cache[$post->ID][$post->category_id] = 1; } else { $cat_cache[$post->ID][$post->term_taxonomy_id] = 1; } } } // echo "-------<br>"; // drop comments: // 1. comment_approved = 1 -> in select // 2. post_status = 'publish' OR post_status = 'static' // 3. post_password = '' // 4. AND user_id = '0' -> in select // 5. AND comment_author_IP != '1.2.3.4' -> in select // 6. "AND category_id != '$cat' // 7. limit_comments_per_post foreach ($comments as $comment) { if ($post_cache[$comment->comment_post_ID]->post_status != 'publish' && $post_cache[$comment->comment_post_ID]->post_status != 'static') { // echo "drop $comment->comment_ID (". $post_cache[$comment->comment_post_ID]->post_status .")<br>"; continue; } if ($post_cache[$comment->comment_post_ID]->post_password != '') { // echo "drop $comment->comment_ID (protected)<br>"; continue; } /* Optional additional check for wordpress users who are not logged in */ if (kjgrc_get_option("grc", "exclude_blog_owner") == 1 && kjgrc_get_option("grc", "exclude_blog_owner2") == 1) { if (kjgrc_is_wordpress_user($comment)) { // echo "drop $comment->comment_ID (is_wordpress_user)<br>"; continue; } } $exclude_cat = kjgrc_get_exclude_cat(); $is_in_excluded_cat = 0; if (kjgrc_get_option("misc", "exclude_cat_reverse") == 1) { $is_in_excluded_cat = 1; } if ($exclude_cat) { foreach ($exclude_cat as $cat) { if ($cat_cache[$comment->comment_post_ID][$cat] == 1) { $is_in_excluded_cat = 1; if (kjgrc_get_option("misc", "exclude_cat_reverse") == 1) { $is_in_excluded_cat = 0; } // echo "drop $comment->comment_ID (is in excluded cat $cat)<br>"; } } if ($is_in_excluded_cat) { continue; } } // nur !trackbacks? if ($grouped_by_post && kjgrc_get_option("grc", "limit_comments_per_post") == 1) { if ($comments_per_post_counter[$comment->comment_post_ID] >= kjgrc_get_option("grc", "comments_per_post")) { // echo "drop $comment->comment_ID (max nr cmt/post reached)<br>"; continue; } } $comments_per_post_counter[$comment->comment_post_ID]++; $comments_number++; // $result .= "$comments_number [$batch_number] $comment->comment_ID ($comment->comment_content)<br>"; $fetched_comments[] = $comment; if ($comments_number >= $requested_number_of_comments) { break; } } $batch_number++; } // comments are selected. now format them if (!(strpos($format, "%gravatar") !== false)) { $has_gravatar = 0; } else { $has_gravatar = 1; $gravatar_alt_url = kjgrc_get_option('gravatar', 'alt_url'); $gravatar_size = kjgrc_get_option('gravatar', 'size'); $gravatar_rating = kjgrc_get_option('gravatar', 'rating'); $gravatar_mpaa[0] = 'G'; $gravatar_mpaa[1] = 'PG'; $gravatar_mpaa[2] = 'R'; $gravatar_mpaa[3] = 'X'; $gravatar_options .= "&size={$gravatar_size}"; $gravatar_options .= "&rating=" . $gravatar_mpaa[$gravatar_rating]; if (kjgrc_get_option('gravatar', 'alt_url') != '') { $gravatar_options .= "&default=" . urlencode($gravatar_alt_url); } } if (!$fetched_comments) { return "<li><!-- no comments yet --></li>"; } foreach ($fetched_comments as $comment) { $trackback_title = ''; if (function_exists("polyglot_init")) { // This looks like the wrong filter, but the_content deletes smileys when called from here $comment_excerpt = apply_filters('single_post_title', $comment->comment_content); } else { $comment_excerpt = $comment->comment_content; } // comment_author, $comment_type = "Comment"; if ($comment->comment_type == 'pingback') { $comment_type = "Pingback"; list($comment_author, $trackback_title) = kjgrc_parse_pingback($comment->comment_author); if (strpos($comment_excerpt, '[...]') == 0) { $comment_excerpt = trim(substr($comment_excerpt, 5)); } if (strpos($comment_excerpt, '[...]') == strlen($comment_excerpt) - 5) { $comment_excerpt = trim(substr($comment_excerpt, 0, strlen($comment_excerpt) - 5)); } } elseif ($comment->comment_type == 'trackback') { $comment_type = "Trackback"; $trackback_title = preg_replace("/^<strong>(.+?)<\\/strong>.*/s", "\$1", $comment->comment_content); $trackback_title = strip_tags($trackback_title); $trackback_title = preg_replace("/[\n\t\r]/", " ", $trackback_title); if (function_exists("mb_ereg_replace")) { $trackback_title = mb_ereg_replace('([^\\s]{' . $chars_per_word . '})', '\\1 ', $trackback_title); // split long words $trackback_title = preg_replace("/\\s{2,}/", " ", $trackback_title); } else { $trackback_title = preg_replace("/\\s{2,}/", " ", $trackback_title); $trackback_title = wordwrap($trackback_title, $chars_per_word, ' ', 1); } $comment_excerpt = preg_replace("/^<strong>.+?<\\/strong>/", "", $comment->comment_content, 1); $comment_author = $comment->comment_author; } else { $comment_author = $comment->comment_author; if (!$comment_author) { $comment_author = "Anonymous"; } } $comment_excerpt = strip_tags(wptexturize($comment_excerpt)); $comment_excerpt = preg_replace("/[\n\t\r]/", " ", $comment_excerpt); // whitespace into 1 blank if (function_exists("mb_ereg_replace")) { $comment_excerpt = mb_ereg_replace('([^\\s]{' . $chars_per_word . '})', '\\1 ', $comment_excerpt); // split long words $comment_excerpt = preg_replace("/\\s{2,}/", " ", $comment_excerpt); // whitespace into 1 blank } else { $comment_excerpt = preg_replace("/\\s{2,}/", " ", $comment_excerpt); // whitespace into 1 blank $comment_excerpt = wordwrap($comment_excerpt, $chars_per_word, ' ', 1); } if ($trackback_title == '') { $trackback_title = $comment_excerpt; } $post_link = get_permalink($comment->comment_post_ID); $comment_link = $post_link . "#comment-{$comment->comment_ID}"; /* Does not work - polyglot uses global variables to access the comment/post data if (function_exists("polyglot_init")) { $comment_date = apply_filters('the_date',$comment->comment_date); } else { $comment_date = mysql2date(get_settings('date_format'),$comment->comment_date); } if (function_exists("polyglot_init")) { $comment_time = apply_filters('the_time',$comment->comment_date); } else { //$comment_time = substr($comment->comment_date,11,5); // 2005-03-09 22:23:53 $comment_time = mysql2date(get_settings('time_format'),$comment->comment_date); // Thanks to Keith } */ $comment_date = mysql2date(get_settings('date_format'), $comment->comment_date); $comment_time = mysql2date(get_settings('time_format'), $comment->comment_date); // Thanks to Keith if ($has_gravatar && $comment_author != '') { if ($md5_cache && array_key_exists($comment->comment_author, $md5_cache)) { $gravatar_md5 = $md5_cache[$comment->comment_author]; } else { $gravatar_md5 = md5(strtolower($comment->comment_author_email)); $md5_cache[$comment->comment_author_email] = $gravatar_md5; } $comment_gravatar_url = "http://www.gravatar.com/avatar.php?" . "gravatar_id={$gravatar_md5}" . $gravatar_options; $comment_gravatar = "<img src=\"" . $comment_gravatar_url . "\" alt=\"\" width=\"{$gravatar_size}\" height=\"{$gravatar_size}\" class=\"kjgrcGravatar\" />"; } #$post = get_postdata($comment->comment_post_ID); #$post_date = mysql2date(get_settings('date_format'),$post['Date']); #$post_title = trim(htmlspecialchars(stripslashes($post['Title']))); #$post = get_postdata($comment->comment_post_ID); // *** insert cache for post data here // $post = $wpdb->get_row("SELECT * from $wpdb->posts WHERE ID = $comment->comment_post_ID"); $post = $post_cache[$comment->comment_post_ID]; if (function_exists("polyglot_init")) { $post_date = apply_filters('the_date', $post->post_date); } else { $post_date = mysql2date(get_settings('date_format'), $post->post_date); } // $post_title = trim(htmlspecialchars(stripslashes($post->post_title))); $post_title = strip_tags(wptexturize($post->post_title)); if (function_exists("polyglot_init")) { $post_title = apply_filters('single_post_title', $post_title); } $post_counter = $post->comment_count; $author_url = $comment->comment_author_url; $author_url_href = "a href=\"{$comment->comment_author_url}\""; if ($author_url == "http://") { $author_url = ""; } if (empty($author_url) || $author_url == "http://") { $author_url_href = ""; } $output = $format; // Replace tags by values $output = str_replace("%comment_link", $comment_link, $output); $output = str_replace("%author_url_href", $author_url_href, $output); $output = str_replace("%author_url", $author_url, $output); $output = str_replace("%userid", $comment->user_id, $output); $output = str_replace("%gravatar_url", $comment_gravatar_url, $output); $output = str_replace("%gravatar", $comment_gravatar, $output); // function author_image_path($authorID, $display = true, $type = 'url') if (function_exists("author_image_path")) { $profile_pict = author_image_path($comment->user_id, false, 'url'); $output = str_replace("%profile_picture", $profile_pict, $output); } else { $output = str_replace("%profile_picture", '', $output); } $output = str_replace("%comment_author", $comment_author, $output); $output = str_replace("%comment_date", $comment_date, $output); $output = str_replace("%comment_time", $comment_time, $output); //$output = str_replace("%time_since", 'time_since_' . $comment->unixdate . ' - ' . gmdate('U') .' = '. ($comment->unixdate-gmdate('U')), $output); $utc_time = kjgrc_utc2unixtime($comment->comment_date_gmt); //2006-12-30 17:05:59 $output = str_replace("%time_since", "<%time_since:{$utc_time}>", $output); $output = str_replace("%comment_type", $comment_type, $output); $output = str_replace("%post_title", $post_title, $output); $output = str_replace("%post_link", $post_link, $output); $output = str_replace("%post_date", $post_date, $output); $output = str_replace("%post_counter", $post_counter, $output); /* // Nice idea, but confuses users //strip title or content? $visible = strip_tags($output); if (strpos($visible,'%comment_excerpt') !== false) { $comment_excerpt = kjgrc_excerpt($comment_excerpt,$chars_per_comment,$chars_per_word,'%comment_excerpt',$output); } elseif (strpos($visible,'%trackback_title') !== false) { $trackback_title = kjgrc_excerpt($trackback_title,$chars_per_comment,$chars_per_word,'%trackback_title',$output); } */ $comment_excerpt = kjgrc_excerpt($comment_excerpt, $chars_per_comment, $chars_per_word, '%comment_excerpt', $output); if (kjgrc_get_option("misc", "convert_smileys")) { if (function_exists("csm_convert")) { $comment_excerpt = csm_convert($comment_excerpt); } else { if (get_settings('use_smilies')) { $comment_excerpt = convert_smilies($comment_excerpt); } } } $trackback_title = kjgrc_excerpt($trackback_title, $chars_per_comment, $chars_per_word, '%trackback_title', $output); $output = str_replace("%comment_excerpt", $comment_excerpt, $output); $output = str_replace("%trackback_title", $trackback_title, $output); // Replacement done //$len = strlen(strip_tags($output)); //$output .= " [$comment_time]"; // . " (" . time_since(strtotime($comment->comment_date_gmt." GMT")) ." ago)"; // *** Das aber nur bei recent comments, nicht bei trackbacks! // if (kjgrc_get_option("grc","limit_comments_per_post") == 1) { // if (count($comment_list[$comment->comment_post_ID]) < kjgrc_get_option("grc","comments_per_post")) { // $comment_list[$comment->comment_post_ID][] = $output; // } // } else { // $comment_list[$comment->comment_post_ID][] = $output; // } $comment_list[$comment->comment_post_ID][] = $output; if ($post_list == NULL || !array_key_exists($comment->comment_post_ID, $post_list)) { $post_output = stripslashes(kjgrc_get_option("grc", "grouped_by_post_a")); $post_output = str_replace("%post_title", $post_title, $post_output); $post_output = str_replace("%post_link", $post_link, $post_output); $post_output = str_replace("%post_date", $post_date, $post_output); $post_output = str_replace("%post_counter", $post_counter, $post_output); $post_list[$comment->comment_post_ID] = $post_output; } $all_entries .= "\t{$output}\n"; if ($caller == 'grc_sample' || $caller == 'grt_sample') { break; } } // foreach comments if ($grouped_by_post == 1) { $all_entries = ''; foreach (array_keys($post_list) as $post_id) { $all_entries .= $post_list[$post_id] . "\n"; foreach ($comment_list[$post_id] as $tmp) { $all_entries .= $tmp . "\n"; } $all_entries .= kjgrc_get_option("grc", "grouped_by_post_b") . "\n"; } } return $all_entries; }
function show_group_blog_form_options() { global $current_user; $result = ''; $friends = get_friends($current_user->ID); if (count($friends) != 0) { $i = 0; $results .= _e('Agrega si lo deseas a tus contactos como editores del nuevo blog: <br />'); foreach ($friends as $id => $rel) { $i++; $friend = get_userdata((int) $id); $result .= '<img src="' . author_image_path($id, $display = false) . '" width=25 height=25 /> ' . $friend->display_name . ' <input type="checkbox" name="' . $i . '" value="' . $id . '" /> <br />'; } $result .= '<input type="hidden" name="count_friends" value="' . $i . '">'; } echo $result; }