Exemplo n.º 1
0
    function widget($args, $instance)
    {
        extract($args);
        ?>
		<?php 
        echo $before_widget;
        ?>
        <?php 
        if ($instance['title']) {
            echo $before_title . $instance['title'] . $after_title;
        }
        ?>
		<div class="joinus">如果您有不错的资源想发布至本站,您可以
		<?php 
        if (is_user_logged_in()) {
            ?>
			<a href="<?php 
            echo fun_get_user_url('post') . '&action=new';
            ?>
" target="_blank" title="投稿">点击投稿</a>
		<?php 
        } else {
            ?>
			<a href="#" class="user-login" title="登录后投稿">点击投稿</a>
		<?php 
        }
        ?>
。我们强烈推荐您注册本站账户或通过QQ、新浪微博登陆本站,使用投稿功能,畅享丰富资源以及积分服务。
		</div>
		<h3><span>站务合作</span></h3>
		<div class="sitecooperate">如果您有站务合作方面的需求,请通过以下方式联系我。<br>QQ: <?php 
        echo ot_get_option('tin_qq');
        ?>
<br>Email: <?php 
        $email = get_option('admin_email');
        echo str_replace('@', '#', $email);
        ?>
(#换成@)</div>
		<?php 
        echo $after_widget;
        ?>

	<?php 
    }
Exemplo n.º 2
0
function fun_new_user_notification($user_id, $plaintext_pass = '')
{
    $user = get_userdata($user_id);
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $message = sprintf(__('您的站点「%s」有新用户注册 :'), $blogname) . "<br></br>";
    $message .= sprintf(__('用户名: %s'), $user->user_login) . "<br>";
    $message .= sprintf(__('E-mail: %s'), $user->user_email) . "<br>";
    @fun_basic_mail('', get_option('admin_email'), sprintf(__('[%s] 有新用户注册'), $blogname), $message);
    if (empty($plaintext_pass)) {
        return;
    }
    $message = sprintf(__('用户名: %s'), $user->user_login) . "<br>";
    $message .= sprintf(__('密码: %s'), $plaintext_pass) . "<br>";
    $message .= fun_get_user_url('profile', $user->ID) . "<br>";
    @fun_basic_mail('', $user->user_email, sprintf(__('[%s] 您的注册用户名和密码'), $blogname), $message);
}
Exemplo n.º 3
0
        echo '(' . $unread . ')';
    }
    ?>
</a></span>
					<span><i class="fa fa-cny"></i>&nbsp;<a href="<?php 
    echo fun_get_user_url('credit');
    ?>
" title="<?php 
    _e('我的积分', 'xiapistudio');
    ?>
"><?php 
    _e('积分查询', 'xiapistudio');
    ?>
</a></span>
					<span><i class="fa fa-cog"></i>&nbsp;<a href="<?php 
    echo fun_get_user_url('profile');
    ?>
" title="<?php 
    _e('编辑资料', 'xiapistudio');
    ?>
"><?php 
    _e('编辑资料', 'xiapistudio');
    ?>
</a></span>
					<span><i class="fa fa-sign-out"></i>&nbsp;<a href="<?php 
    if (is_singular()) {
        echo wp_logout_url(get_permalink());
    } else {
        echo wp_logout_url(get_bloginfo('url'));
    }
    ?>
Exemplo n.º 4
0
function fun_user_profile_widget()
{
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        $li_output = '';
        $li_output .= '<li style="line-height:36px;clear: both;">' . fun_get_avatar($current_user->ID, '36', fun_get_avatar_type($current_user->ID), false) . sprintf(__('登录者 <a href="%1$s">%2$s</a>', 'tinection'), get_edit_profile_url($current_user->ID), $current_user->display_name) . '<a href="' . wp_logout_url(fun_get_current_page_url()) . '" title="' . esc_attr__('登出本帐号') . '">' . __('登出 &raquo;') . '</a></li>';
        if (!filter_var($current_user->user_email, FILTER_VALIDATE_EMAIL)) {
            $li_output .= '<li><a href="' . fun_get_user_url('profile') . '#pass">' . __('【重要】请添加正确的邮箱以保证账户安全', 'tinection') . '</a></li>';
        }
        $shorcut_links[] = array('title' => __('个人主页', 'tinection'), 'url' => get_author_posts_url($current_user->ID));
        if (current_user_can('manage_options')) {
            $shorcut_links[] = array('title' => __('管理后台', 'tinection'), 'url' => admin_url());
        }
        $can_post_cat = ot_get_option('fun_can_post_cat');
        if (count($can_post_cat)) {
            $shorcut_links[] = array('title' => __('文章投稿', 'tinection'), 'url' => add_query_arg('action', 'new', fun_get_user_url('post')));
        }
        $shorcut_html = '<li class="active">';
        foreach ($shorcut_links as $shorcut) {
            $shorcut_html .= '<a href="' . $shorcut['url'] . '">' . $shorcut['title'] . ' &raquo;</a>';
        }
        $shorcut_html .= '</li>';
        $credit = intval(get_user_meta($current_user->ID, 'fun_credit', true));
        $credit_void = intval(get_user_meta($current_user->ID, 'fun_credit_void', true));
        $unread_count = intval(get_fun_message($current_user->ID, 'count', "( msg_type='unread' OR msg_type='unrepm' )"));
        $collects = get_user_meta($current_user->ID, 'fun_collect', true) ? get_user_meta($current_user->ID, 'fun_collect', true) : 0;
        $collects_array = explode(',', $collects);
        $collects_count = $collects != 0 ? count($collects_array) : 0;
        $info_array = array(array('title' => __('文章', 'tinection'), 'url' => fun_get_user_url('post'), 'count' => count_user_posts($current_user->ID)), array('title' => __('评论', 'tinection'), 'url' => fun_get_user_url('comment'), 'count' => get_comments(array('status' => '1', 'user_id' => $current_user->ID, 'count' => true))), array('title' => __('收藏', 'tinection'), 'url' => fun_get_user_url('collect'), 'count' => intval($collects_count)));
        if ($unread_count) {
            $info_array[] = array('title' => __('未读', 'tinection'), 'url' => fun_get_user_url('message'), 'count' => $unread_count);
        }
        $info_array[] = array('title' => __('积分', 'tinection'), 'url' => fun_get_user_url('credit'), 'count' => $credit);
        $info_html = '<li>';
        foreach ($info_array as $info) {
            $info_html .= $info['title'] . '<a href="' . $info['url'] . '"> ' . $info['count'] . '</a>';
        }
        $info_html .= fun_whether_signed($current_user->ID);
        $info_html .= '</li>';
        $friend_html = '
	<li>
		<div class="input-group">
			<span class="input-group-addon">' . __('本页推广链接', 'tinection') . '</span>
			<input class="fun_aff_url form-control" type="text" class="form-control" value="' . add_query_arg('aff', $current_user->ID, fun_canonical_url()) . '">
		</div>
	</li>
	';
        return $li_output . $shorcut_html . $info_html . $friend_html;
    } else {
        $html = '<li><span class="local-account"><a data-sign="0" class="btn btn-primary user-login"><i class="fa fa-wordpress"></i>' . __('本地帐号', 'tinection') . '</a></span>';
        if (ot_get_option('fun_open_qq') == 'on') {
            $html .= '<span class="other-sign"><a class="qqlogin btn" href="' . home_url('/?connect=qq&action=login&redirect=' . urlencode(fun_get_redirect_uri())) . '"><i class="fa fa-qq"></i><span>' . __('QQ 登 录', 'tinection') . '</span></a></span>';
        }
        if (ot_get_option('fun_open_weibo') == 'on') {
            $html .= '<span class="other-sign"><a class="weibologin btn" href="' . home_url('/?connect=weibo&action=login&redirect=' . urlencode(fun_get_redirect_uri())) . '"><i class="fa fa-weibo"></i><span>' . __('微博登录', 'tinection') . '</span></a></span>';
        }
        $html .= '</li>';
        return $html;
    }
}
" class="title"><?php 
    bloginfo('name');
    ?>
</a>
		<a href="<?php 
    echo fun_get_user_url('profile');
    ?>
" class="name">@&nbsp;<?php 
    echo $current_user->display_name;
    ?>
</a>
		<?php 
    $unread = intval(fun_get_message($current_user->ID, 'count', "msg_type='unread' OR msg_type='unrepm'"));
    if ($unread > 0) {
        ?>
<a href="<?php 
        echo fun_get_user_url('message');
        ?>
" title="<?php 
        _e('新消息', 'xiapistudio');
        ?>
" class="new-message-notify"></a><?php 
    }
    ?>
		</div>
		<div class="clr"></div>
	</div>
<?php 
}
?>
</div>