예제 #1
0
function uppsite_get_comment_member()
{
    $avatar = get_avatar(get_comment_author_email());
    return array('name' => get_comment_author(), 'avatar' => uppsite_extract_src_url($avatar));
}
예제 #2
0
function mysiteapp_print_facebook_comments(&$comment_counter)
{
    $permalink = get_permalink();
    $comments_url = MYSITEAPP_FACEBOOK_COMMENTS_URL . $permalink;
    $res = '';
    $comment_counter = 0;
    $comment_json = wp_remote_get($comments_url);
    $avatar_url = htmlspecialchars_decode(uppsite_extract_src_url(get_avatar(0)));
    if ($comment_json) {
        $comments_arr = json_decode($comment_json['body'], true);
        if ($comments_arr == NULL || !array_key_exists($permalink, $comments_arr) || !array_key_exists('data', $comments_arr[$permalink])) {
            return;
        }
        $comments_list = $comments_arr[$permalink]['data'];
        foreach ($comments_list as $comment) {
            $res .= mysiteapp_print_single_facebook_comment($comment, $avatar_url);
            if (array_key_exists('comments', $comment)) {
                foreach ($comment['comments']['data'] as $inner_comment) {
                    $res .= mysiteapp_print_single_facebook_comment($inner_comment);
                    $comment_counter++;
                }
            }
            $comment_counter++;
        }
    }
    return $res;
}
예제 #3
0
 function mysiteapp_extract_thumbnail(&$content = null)
 {
     $thumb_url = null;
     $imageAlgos = uppsite_get_image_algos();
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::NATIVE_FUNC) && function_exists('has_post_thumbnail') && has_post_thumbnail()) {
         $thumb_url = get_the_post_thumbnail();
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::THE_ATTACHED_IMAGE) && empty($thumb_url) && function_exists('the_attached_image')) {
         $temp_thumb = the_attached_image('img_size=thumb&echo=false');
         if (!empty($temp_thumb)) {
             $thumb_url = $temp_thumb;
         }
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::GET_THE_IMAGE) && empty($thumb_url) && function_exists('get_the_image')) {
         $temp_thumb = get_the_image(array('size' => 'thumbnail', 'echo' => false, 'link_to_post' => false));
         if (!empty($temp_thumb)) {
             $thumb_url = $temp_thumb;
         }
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::CUSTOM_FIELD) && empty($thumb_url) && !is_null($imageAlgos['extra'])) {
         $thumb_url = get_post_meta(get_the_ID(), $imageAlgos['extra'], true);
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::FIRST_IMAGE) && empty($thumb_url)) {
         if (mysiteapp_is_fresh_wordpress_installation()) {
             $thumb_url = MYSITEAPP_HOMEPAGE_FRESH_COVER;
         } else {
             if (is_null($content)) {
                 ob_start();
                 the_content();
                 $content = ob_get_contents();
                 ob_get_clean();
             }
             $thumb_url = uppsite_extract_image_from_post_content($content);
         }
     }
     if (!empty($thumb_url)) {
         $thumb_url = uppsite_extract_src_url($thumb_url);
         if (!is_null($content)) {
             uppsite_nullify_thumb($content, $thumb_url);
         }
     }
     return $thumb_url;
 }
예제 #4
0
<?php

$user = get_query_var('mysiteapp_user');
wp_set_auth_cookie($user->ID);
if (function_exists('get_the_author_meta')) {
    $avatar = get_avatar($user->user_email);
} elseif (function_exists('get_the_author_id')) {
    $avatar = get_avatar($user->ID);
} else {
    $avatar = null;
}
$avatar_url = uppsite_extract_src_url($avatar);
?>
<mysiteapp>
	<user ID="<?php 
echo $user->ID;
?>
" user_level="<?php 
echo $user->wp_user_level;
?>
">
	<login><![CDATA[<?php 
echo $user->user_login;
?>
]]></login>
	<name><![CDATA[<?php 
echo $user->display_name;
?>
]]></name>
    <nickname><![CDATA[<?php 
echo $user->user_nicename;