本文整理汇总了PHP中sp_forum_api_support函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_forum_api_support函数的具体用法?PHP sp_forum_api_support怎么用?PHP sp_forum_api_support使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_forum_api_support函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sp_check_api_support
function sp_check_api_support()
{
global $spIsForum;
if (!$spIsForum) {
sp_forum_api_support();
}
}
示例2: sp_do_sp_ProfileLinkTag
function sp_do_sp_ProfileLinkTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
global $spThisUser;
sp_forum_api_support();
if ($spThisUser->ID == 0 && $spThisUser->ID == '') {
return;
}
$defs = array('linkText' => __('Your Profile', 'sp-ttags'), 'beforeLink' => '', 'afterLink' => '', 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_ProfileLinkTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$linkText = sp_filter_title_display($linkText);
$beforeLink = sp_filter_title_display($beforeLink);
$afterLink = sp_filter_title_display($afterLink);
$echo = (int) $echo;
if (!empty($beforeLink)) {
$beforeLink = trim($beforeLink) . ' ';
}
if (!empty($afterLink)) {
$afterLink = ' ' . trim($afterLink);
}
$out = '';
$out .= "<span>{$beforeLink}<a href='" . sp_url('profile') . "'>{$linkText}</a>{$afterLink}</span>\n";
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例3: sp_do_sp_GroupLinkTag
function sp_do_sp_GroupLinkTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('groupId' => '', 'linkText' => '%GROUPNAME%', 'beforeLink' => '', 'afterLink' => '', 'listTags' => 0, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_GroupLinkTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$groupId = (int) $groupId;
$linkText = esc_attr($linkText);
$beforeLink = sp_filter_title_display($beforeLink);
$afterLink = sp_filter_title_display($afterLink);
$listTags = (int) $listTags;
$echo = (int) $echo;
if (empty($groupId)) {
return '';
}
sp_forum_api_support();
if (!empty($beforeLink)) {
$beforeLink = trim($beforeLink) . ' ';
}
if (!empty($afterLink)) {
$afterLink = ' ' . trim($afterLink);
}
# check user has access to at kleast ine forum in group
$canview = false;
$forums = spdb_table(SFFORUMS, "group_id={$groupId}");
if ($forums) {
foreach ($forums as $forum) {
if (sp_can_view($forum->forum_id, 'forum-title')) {
$canview = true;
}
}
}
if ($forums && $canview) {
$grouprec = spdb_table(SFGROUPS, "group_id={$groupId}", 'row');
$out = '';
$linkText = str_replace("%GROUPNAME%", sp_filter_title_display($grouprec->group_name), $linkText);
if (empty($linkText)) {
$linkText = sp_filter_title_display($grouprec->group_name);
}
if ($listTags) {
$out .= '<li>';
}
$out .= '<span>' . $beforeLink . '<a href="' . add_query_arg(array('group' => $groupId), sp_url()) . '">' . $linkText . '</a>' . $afterLink . '</span>';
if ($listTags) {
$out .= '</li>';
}
}
$out = apply_filters('sph_GroupLinkTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例4: sp_do_sp_TopicLinkTag
function sp_do_sp_TopicLinkTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('topicId' => '', 'linkText' => '%TOPICNAME%', 'beforeLink' => '', 'afterLink' => '', 'listTags' => 0, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_TopicLinkTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$topicId = (int) $topicId;
$linkText = esc_attr($linkText);
$beforeLink = sp_filter_title_display($beforeLink);
$afterLink = sp_filter_title_display($afterLink);
$listTags = (int) $listTags;
$echo = (int) $echo;
if (empty($topicId)) {
return '';
}
sp_forum_api_support();
if (!empty($beforeLink)) {
$beforeLink = trim($beforeLink) . ' ';
}
if (!empty($afterLink)) {
$afterLink = ' ' . trim($afterLink);
}
$spdb = new spdbComplex();
$spdb->table = SFTOPICS;
$spdb->fields = SFTOPICS . '.topic_id, ' . SFTOPICS . '.forum_id, topic_slug, topic_name, forum_name, forum_slug';
$spdb->join = array(SFFORUMS . ' ON ' . SFTOPICS . '.forum_id = ' . SFFORUMS . '.forum_id');
$spdb->where = SFTOPICS . '.topic_id=' . $topicId;
$thistopic = $spdb->select();
$out = '';
if ($thistopic) {
if (sp_can_view($thistopic[0]->forum_id, 'topic-title')) {
$out = '';
$linkText = str_replace("%TOPICNAME%", sp_filter_title_display($thistopic[0]->topic_name), $linkText);
if (empty($linkText)) {
$linkText = sp_filter_title_display($thistopic[0]->topic_name);
}
if ($listTags) {
$out .= '<li>';
}
$out .= '<span>' . $beforeLink . '<a href="' . sp_build_url($thistopic[0]->forum_slug, $thistopic[0]->topic_slug, 0, 0) . '">' . $linkText . '</a>' . $afterLink . '</span>';
if ($listTags) {
$out .= '</li>';
}
}
} else {
$out = sprintf(__('Topic %s not found', 'sp-ttags'), $topicId);
}
$out = apply_filters('sph_TopicLinkTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例5: sp_do_sp_ForumLinkTag
function sp_do_sp_ForumLinkTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('forumId' => '', 'linkText' => '%FORUMNAME%', 'beforeLink' => '', 'afterLink' => '', 'listTags' => 0, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_ForumLinkTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$forumId = (int) $forumId;
$linkText = esc_attr($linkText);
$beforeLink = sp_filter_title_display($beforeLink);
$afterLink = sp_filter_title_display($afterLink);
$listTags = (int) $listTags;
$echo = (int) $echo;
if (empty($forumId)) {
return '';
}
sp_forum_api_support();
if (!empty($beforeLink)) {
$beforeLink = trim($beforeLink) . ' ';
}
if (!empty($afterLink)) {
$afterLink = ' ' . trim($afterLink);
}
if (sp_can_view($forumId, 'forum-title')) {
$forumrec = spdb_table(SFFORUMS, "forum_id={$forumId}", 'row');
if ($forumrec) {
$out = '';
$linkText = str_replace("%FORUMNAME%", sp_filter_title_display($forumrec->forum_name), $linkText);
if (empty($linkText)) {
$linkText = sp_filter_title_display($forumrec->forum_name);
}
if ($listTags) {
$out .= '<li>';
}
$out .= '<span>' . $beforeLink . '<a href="' . sp_build_url($forumrec->forum_slug, '', 0, 0) . '">' . $linkText . '</a>' . $afterLink . '</span>';
if ($listTags) {
$out .= '</li>';
}
} else {
$out = sprintf(__('Forum %s not found', 'sp-ttags'), $forumId);
}
}
$out = apply_filters('sph_ForumLinkTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例6: sp_logout_redirect
function sp_logout_redirect()
{
sp_forum_api_support();
global $spThisUser;
$sflogin = sp_get_option('sflogin');
if (!empty($sflogin['sflogouturl'])) {
$sfadminoptions = sp_get_member_item($spThisUser->ID, 'admin_options');
if ($spThisUser->moderator && $sfadminoptions['bypasslogout']) {
$_REQUEST['redirect_to'] = esc_url(wp_login_url());
} else {
$_REQUEST['redirect_to'] = $sflogin['sflogouturl'];
}
}
$redirect = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
$_REQUEST['redirect_to'] = apply_filters('sph_logout_redirect', $redirect);
}
示例7: sp_do_sp_AddNewTopicLinkTag
function sp_do_sp_AddNewTopicLinkTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('tagId' => 'spAddNewTopicLinkTag', 'tagClass' => 'spLinkTag', 'forumId' => '', 'linkText' => '%FORUMNAME%', 'beforeLink' => __('Add new topic in the ', 'sp-ttags'), 'afterLink' => __(' forum', 'sp-ttags'), 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_AddNewTopicLinkTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$forumId = (int) $forumId;
$linkText = esc_attr($linkText);
$beforeLink = sp_filter_title_display($beforeLink);
$afterLink = sp_filter_title_display($afterLink);
$echo = (int) $echo;
if (!$forumId) {
return;
}
if (!empty($beforeLink)) {
$beforeLink = trim($beforeLink) . ' ';
}
if (!empty($afterLink)) {
$afterLink = ' ' . trim($afterLink);
}
sp_forum_api_support();
if (sp_get_auth('start_topics', $forumId)) {
$forum = spdb_table(SFFORUMS, "forum_id={$forumId}", 'row');
$linkText = str_replace("%FORUMNAME%", sp_filter_title_display($forum->forum_name), $linkText);
$url = sp_build_url($forum->forum_slug, '', 0, 0);
$url = sp_get_sfqurl($url) . 'new=topic';
$out = "<span id='{$tagId}' class='{$tagClass}'>";
$out .= $beforeLink . '<a href="' . $url . '">' . $linkText . '</a>' . $afterLink;
$out .= '</span>';
$out = apply_filters('sph_AddNewTopicLinkTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
}
示例8: die
<?php
/*
Simple:Press
Admin Bar plugin ahah routine for new post list
$LastChangedDate: 2013-02-17 11:59:36 -0800 (Sun, 17 Feb 2013) $
$Rev: 9855 $
*/
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
die('Access denied - you cannot directly call this file');
}
sp_forum_api_support();
global $spThisUser;
if ($spThisUser->admin || $spThisUser->moderator) {
include_once SPABLIBDIR . 'sp-admin-bar-components.php';
# must be loading up the new post list
$newposts = sp_GetAdminsQueuedPosts();
sp_NewPostListAdmin($newposts);
} else {
if (!is_user_logged_in()) {
_e('Access denied - are you logged in?', 'spab');
} else {
_e('Access denied - you do not have permission', 'spab');
}
}
die;
示例9: sp_do_sp_UnansweredPostsTag
function sp_do_sp_UnansweredPostsTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('tagId' => 'spUnansweredPostsTag', 'tagClass' => 'spListTag', 'listId' => 'spListItemTag%ID%', 'listClass' => 'spListItemTag', 'linkClass' => 'spLinkTag', 'textClass' => 'spTextTag', 'avatarClass' => 'spAvatarTag', 'listTags' => 1, 'forumIds' => '', 'limit' => 5, 'itemOrder' => 'FTUD', 'linkScope' => 'forum', 'beforeForum' => __('Forum: ', 'sp-ttags'), 'afterForum' => '<br />', 'beforeTopic' => __('Topic: ', 'sp-ttags'), 'afterTopic' => '<br />', 'beforeUser' => __('By: ', 'sp-ttags'), 'afterUser' => '', 'beforeDate' => ' -', 'afterDate' => '', 'avatarSize' => 25, 'niceDate' => 1, 'postTip' => 1, 'truncate' => 0, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_UnansweredPostsTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$listClass = esc_attr($listClass);
$listId = esc_attr($listId);
$linkClass = esc_attr($linkClass);
$textClass = esc_attr($textClass);
$avatarClass = esc_attr($avatarClass);
$listTags = (int) $listTags;
$forumIds = esc_attr($forumIds);
$limit = (int) $limit;
$itemOrder = esc_attr($itemOrder);
$linkScope = esc_attr($linkScope);
$beforeForum = sp_filter_title_display($beforeForum);
$afterForum = sp_filter_title_display($afterForum);
$beforeTopic = sp_filter_title_display($beforeTopic);
$afterTopic = sp_filter_title_display($afterTopic);
$beforeUser = sp_filter_title_display($beforeUser);
$afterUser = sp_filter_title_display($afterUser);
$beforeDate = sp_filter_title_display($beforeDate);
$afterDate = sp_filter_title_display($afterDate);
$avatarSize = (int) $avatarSize;
$niceDate = (int) $niceDate;
$postTip = (int) $postTip;
$truncate = (int) $truncate;
$echo = (int) $echo;
sp_forum_api_support();
global $spPostList, $spThisPostList;
$where = SFTOPICS . '.post_count=1';
# do we have forum ids specified?
$where .= !empty($forumIds) ? ' AND ' . SFPOSTS . '.forum_id IN (' . $forumIds . ')' : '';
$spPostList = new spPostList($where, SFPOSTS . '.post_id DESC', $limit);
if (empty($spPostList)) {
return;
}
if (!empty($beforeForum)) {
$beforeForum = trim($beforeForum) . ' ';
}
if (!empty($beforeTopic)) {
$beforeTopic = trim($beforeTopic) . ' ';
}
if (!empty($beforeUser)) {
$beforeUser = trim($beforeUser) . ' ';
}
if (!empty($beforeDate)) {
$beforeDate = trim($beforeDate) . ' ';
}
if (!empty($afterForum)) {
$afterForum = ' ' . trim($afterForum);
}
if (!empty($afterTopic)) {
$afterTopic = ' ' . trim($afterTopic);
}
if (!empty($afterUser)) {
$afterUser = ' ' . trim($afterUser);
}
if (!empty($afterDate)) {
$afterDate = ' ' . trim($afterDate);
}
$fLink = $tLink = $aLink = false;
if ($linkScope == 'forum') {
$fLink = $tLink = true;
}
if ($linkScope == 'all') {
$aLink = true;
}
# Start building dislay
$out = $listTags ? "<ul id='{$tagId}' class='{$tagClass}'>" : "<div id='{$tagId}' class='{$tagClass}'>";
# start the loop
if (sp_has_postlist()) {
while (sp_loop_postlist()) {
sp_the_postlist();
$thisId = str_ireplace('%ID%', $spThisPostList->topic_id, $listId);
$out .= $listTags ? "<li id='{$thisId}' class='{$listClass}'>" : "<div id='{$thisId}' class='{$listClass}'>";
$title = $postTip ? "title='{$spThisPostList->post_tip}'" : '';
if ($aLink) {
$out .= "<a class='{$linkClass}' {$title} href='{$spThisPostList->post_permalink}'>";
}
for ($x = 0; $x < strlen($itemOrder); $x++) {
switch (substr($itemOrder, $x, 1)) {
case 'F':
# Forum
$out .= $beforeForum;
if ($fLink) {
$out .= "<a class='{$linkClass}' href='{$spThisPostList->forum_permalink}'>";
}
$out .= sp_truncate($spThisPostList->forum_name, $truncate);
if ($fLink) {
$out .= '</a>';
}
//.........这里部分代码省略.........
示例10: sp_wp_avatar
function sp_wp_avatar($avatar, $id_or_email, $size)
{
include_once SF_PLUGIN_DIR . '/forum/content/sp-common-view-functions.php';
sp_forum_api_support();
# this could be user id, email or comment object
# if comment object want a user id or email address
# pass other two striaght through
if (is_object($id_or_email)) {
# comment object passed in
if (!empty($id_or_email->user_id)) {
$id = (int) $id_or_email->user_id;
$user = get_userdata($id);
$arg = $user ? $id : '';
} else {
if (!empty($id_or_email->comment_author_email)) {
$arg = $id_or_email->comment_author_email;
}
}
} else {
$arg = $id_or_email;
}
# replace the wp avatar image src with our spf img src
$pattern = '/<img[^>]+src[\\s=\'"]+([^"\'>\\s]+)/is';
$sfavatar = sp_UserAvatar("echo=0&link=none&size={$size}&context=user&wp={$avatar}", $arg);
preg_match($pattern, $sfavatar, $sfmatch);
preg_match($pattern, $avatar, $wpmatch);
$avatar = str_replace($wpmatch[1], $sfmatch[1], $avatar);
return $avatar;
}
示例11: sp_do_sp_ForumDropdownTag
function sp_do_sp_ForumDropdownTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('tagId' => 'spForumDropdownTag', 'tagClass' => 'spLinkTag', 'selectClass' => 'spSelectTag', 'forumList' => 0, 'label' => __("Select forum", 'sp-ttags'), 'length' => 30, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_ForumDropdownTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$selectClass = esc_attr($selectClass);
$forumList = esc_attr($forumList);
$label = sp_filter_title_display($label);
$length = (int) $length;
$echo = (int) $echo;
global $spThisUser;
sp_forum_api_support();
$forum_ids = array();
if ($forumList == 0) {
$forum_ids = sp_get_forum_memberships($spThisUser->ID);
} else {
$allforums = explode(',', $forumList);
foreach ($allforums as $thisforum) {
if (sp_can_view($thisforum, 'forum-title')) {
$forum_ids[] = $thisforum;
}
}
}
if (empty($forum_ids)) {
return;
}
# create where clause based on forums that current user can view
$where = "forum_id IN (" . implode(",", $forum_ids) . ")";
$spdb = new spdbComplex();
$spdb->table = SFFORUMS;
$spdb->fields = 'forum_slug, forum_name';
$spdb->join = array(SFGROUPS . ' ON ' . SFFORUMS . '.group_id = ' . SFGROUPS . '.group_id');
$spdb->where = $where;
$spdb->orderby = 'group_seq, forum_seq';
$forums = $spdb->select();
$out = "<div id='{$tagId}' class='{$tagClass}'>";
$out .= '<select name="forumselect" class="' . $selectClass . '" onChange="javascript:spjChangeForumURL(this)">' . "\n";
$out .= '<option>' . $label . '</option>' . "\n";
foreach ($forums as $forum) {
$out .= '<option value="' . sp_build_url($forum->forum_slug, '', 0, 0) . '"> ' . sp_create_name_extract(sp_filter_title_display($forum->forum_name), $length) . '</option>' . "\n";
}
$out .= '</select>' . "\n";
$out .= '</div>';
$out .= '<script type="text/javascript">';
$out .= 'function spjChangeForumURL(menuObj) {';
$out .= 'var i = menuObj.selectedIndex;';
$out .= 'if(i > 0) {';
$out .= 'if(menuObj.options[i].value != "#") {';
$out .= 'window.location = menuObj.options[i].value;';
$out .= '}}}';
$out .= '</script>';
$out = apply_filters('sph_ForumDropdownTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例12: sp_do_sp_AdminModeratorOnlineTag
function sp_do_sp_AdminModeratorOnlineTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('tagId' => 'spAdminModeratorOnlineTag', 'tagClass' => 'spListTag', 'moderator' => 1, 'custom' => 1, 'customClass' => 'spAdminMessageTag', 'listTags' => 1, 'listClass' => 'spListItemTag', 'onToolTip' => __('Online', 'sp-ttags'), 'onIcon' => 'sp_UserOnlineSmall.png', 'offIcon' => 'sp_UserOfflineSmall.png', 'offToolTip' => __('Offline', 'sp-ttags'), 'useAvatar' => 0, 'avatarSize' => 25, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_AdminModeratorOnlineTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$moderator = (int) $moderator;
$custom = (int) $custom;
$customClass = esc_attr($customClass);
$listTags = (int) $listTags;
$listClass = esc_attr($listClass);
$onToolTip = sp_filter_title_display($onToolTip);
$offToolTip = sp_filter_title_display($offToolTip);
$onIcon = sp_filter_filename_save($onIcon);
$offIcon = sp_filter_filename_save($offIcon);
$useAvatar = (int) $useAvatar;
$avatarSize = (int) $avatarSize;
$echo = (int) $echo;
sp_forum_api_support();
$where = 'admin=1';
if ($moderator) {
$where .= ' OR moderator = 1';
}
$spdb = new spdbComplex();
$spdb->table = SFMEMBERS;
$spdb->fields = 'user_id AS ID, user_email, ' . SFMEMBERS . '.display_name, admin, user_options, admin_options, ' . SFTRACK . '.id AS online';
$spdb->left_join = array(SFTRACK . ' ON ' . SFMEMBERS . '.user_id = ' . SFTRACK . '.trackuserid', SFUSERS . ' ON ' . SFMEMBERS . '.user_id = ' . SFUSERS . '.ID');
$spdb->where = $where;
$spdb->orderby = 'online DESC';
$admins = $spdb->select();
$out = '';
if ($admins) {
$out .= $listTags ? "<ul id='{$tagId}' class='{$tagClass}'>" : "<div id='{$tagId}' class='{$tagClass}'>";
foreach ($admins as $admin) {
$noAvatar = '';
$msg = '';
$userOpts = unserialize($admin->user_options);
if (!$userOpts['hidestatus']) {
$userName = sp_build_name_display($admin->ID, sp_filter_name_display($admin->display_name));
$icon = $admin->online ? $onIcon : $offIcon;
$tip = $admin->online ? $onToolTip : $offToolTip;
if (!$useAvatar) {
$noAvatar .= "<img src='" . sp_find_icon(SPTHEMEICONSURL, "{$icon}") . "' alt='' title='{$tip}' />";
}
if (!$admin->online && $custom) {
$userOpts = unserialize($admin->admin_options);
if (isset($userOpts['offline_message'])) {
$msg = sp_filter_text_display($userOpts['offline_message']);
if ($msg != '') {
$msg = "<div class='{$customClass}'>{$msg}</div>";
}
}
}
# begin loop display
if ($listTags ? $out .= "<li class='{$listClass}'>" : ($out .= "<div class='{$listClass}'>")) {
}
# Avatar or Icon
if ($useAvatar) {
$admin->avatar = '';
$out .= sp_UserAvatar("tagClass=spAvatar&imgClass=spAvatar&size={$avatarSize}&context=user&echo=0", $admin);
} else {
$out .= $noAvatar;
}
# User name and current online status
$out .= "<span class='spOnlineAdmin'><span class='spOnlineUser'>{$userName}</span> is <span class='admin{$tip}'>{$tip}</span>";
# display offline message is set
$out .= $msg;
$out .= '</span>';
# end loop display
if ($listTags ? $out .= '<div style="clear:both;"></div></li>' : ($out .= '</div><div style="clear:both;"></div>')) {
}
}
}
$out .= $listTags ? '</ul>' : '</div>';
}
$out = apply_filters('sph_AdminModeratorOnlineTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例13: sp_do_sp_AuthorPostsTag
function sp_do_sp_AuthorPostsTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('tagId' => 'spAuthorPostsTag', 'tagClass' => 'spLinkTag', 'authorId' => '', 'showForum' => 1, 'showDate' => 1, 'limit' => 5, 'listTags' => 0, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_AuthorPostsTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$authorId = (int) $authorId;
$showForum = (int) $showForum;
$showDate = (int) $showDate;
$limit = (int) $limit;
$listTags = (int) $listTags;
$echo = (int) $echo;
if (empty($authorId)) {
return;
}
sp_forum_api_support();
if ($limit == 0) {
$limit = '';
}
# limit to viewable forums based on permissions
$where = SFPOSTS . '.user_id = ' . $authorId . ' AND ' . SFPOSTS . '.post_status=0 ';
$forum_ids = sp_get_forum_memberships();
# create where clause based on forums that current user can view
if ($forum_ids != '') {
$where .= "AND " . SFPOSTS . ".forum_id IN (" . implode(",", $forum_ids) . ")";
} else {
return '';
}
$spdb = new spdbComplex();
$spdb->table = SFPOSTS;
$spdb->distinct = true;
$spdb->fields = SFPOSTS . '.post_id, ' . SFPOSTS . '.forum_id, ' . SFPOSTS . '.topic_id, ' . spdb_zone_datetime('post_date') . ',
post_index, forum_slug, forum_name, topic_slug, topic_name';
$spdb->join = array(SFTOPICS . ' ON ' . SFPOSTS . '.topic_id = ' . SFTOPICS . '.topic_id', SFFORUMS . ' ON ' . SFPOSTS . '.forum_id = ' . SFFORUMS . '.forum_id');
$spdb->where = $where;
$spdb->orderby = 'post_date DESC';
$spdb->limits = $limit;
$sfposts = $spdb->select();
if (!$listTags) {
$out = "<div id='{$tagId}' class='{$tagClass}'>";
$open = '<div>';
$close = '</div>';
} else {
$out = "<ul id='{$tagId}' class='{$tagClass}'>";
$open = '<li>';
$close = '</li>';
}
if ($sfposts) {
foreach ($sfposts as $sfpost) {
$out .= $open;
if ($showForum) {
$out .= sp_filter_title_display($sfpost->forum_name) . '<br />';
}
$out .= '<a href="' . sp_build_url($sfpost->forum_slug, $sfpost->topic_slug, 0, $sfpost->post_id, $sfpost->post_index) . '">' . sp_filter_title_display($sfpost->topic_name) . '</a><br />' . "\n";
if ($showDate) {
$out .= sp_date('d', $sfpost->post_date) . '<br />';
}
$out .= $close;
}
} else {
$out .= $open . __('No posts by this author', 'sp-ttags') . $close;
}
if (!$listTags) {
$out .= '</div>';
} else {
$out .= '</ul>';
}
$out = apply_filters('sph_AuthorPostsTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例14: sp_do_sp_SideDashTag
function sp_do_sp_SideDashTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
global $spThisUser, $spGlobals;
$defs = array('tagId' => 'spSideDashTag', 'tagClass' => 'spSideDashTag', 'showAvatar' => 1, 'avatarSize' => 25, 'avatarClass' => 'spAvatar', 'showAdminLink' => 1, 'showLogin' => 1, 'loginLink' => esc_url(wp_login_url()), 'showLogout' => 1, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_SideDashTag_args', $a);
extract($a, EXTR_SKIP);
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$showAvatar = (int) $showAvatar;
$avatarSize = (int) $avatarSize;
$avatarClass = esc_attr($avatarClass);
$showAdminLink = (int) $showAdminLink;
$showLogin = (int) $showLogin;
$loginLink = sp_filter_title_display($loginLink);
$showLogout = (int) $showLogout;
$echo = (int) $echo;
sp_forum_api_support();
$out = '';
$sflogin = sp_get_option('sflogin');
if ($spThisUser->guest) {
if (!empty($showLogin)) {
# show any login links?
if ($showLogin == 1) {
# showing login form
# display login form
$out .= '<form action="' . esc_url(wp_login_url()) . '" method="post">';
$out .= '<p class="spSideDashUser"><label for="spTagLog">' . __('Username: ', 'sp-ttags') . '<input type="text" name="log" id="spTagLog" value="" size="15" /></label></p>';
$out .= '<p class="spSideDashPw"><label for="spTagPwd">' . __('Password: ', 'sp-ttags') . '<input type="password" name="pwd" id="spTagPwd" value="" size="15" /></label></p>';
$out .= '<p class="spSideDashRemember"><input type="checkbox" id="rememberme" name="rememberme" value="forever" /><label for="rememberme">' . __('Remember me', 'sp-ttags') . '</label></p>';
$out .= '<input type="hidden" name="redirect_to" value="' . esc_attr($sflogin['sfloginurl']) . '" />';
$out .= '<p><input type="submit" name="submit" id="submit" value="' . esc_attr(__('Log in', 'sp-ttags')) . '" /></p>';
$out .= '</form>';
} else {
if ($showLogin == 2) {
# showing wp login link
$out .= '<a href="' . esc_url(wp_login_url($sflogin['sfloginurl'], 'login')) . '">' . __('Log In', 'sp-ttags') . '</a></p>';
} else {
if ($showLogin == 3) {
# showing custom login link
$out .= '<a href="' . esc_attr($loginLink) . '">' . __('Log In', 'sp-ttags') . '</a></p>';
}
}
}
# if registrations allowed, display register link
$started = false;
if (get_option('users_can_register') && !$spGlobals['lockdown']) {
$started = true;
$out .= '<p class="spSideDashLinks"><a href="' . esc_url(site_url('wp-login.php?action=register&redirect_to=' . $sflogin['sfregisterurl'], 'login')) . '">' . __('Register', 'sp-ttags') . '</a>';
}
if ($started) {
$out .= ' | ';
} else {
$out .= '<p class="spSideDashGuest">';
}
# display lost password link
$out .= '<a href="' . esc_url(wp_lostpassword_url()) . '">' . __('Lost password', 'sp-ttags') . '</a></p>';
}
$out = apply_filters('sph_SideDashTagUser', $out);
} else {
if ($showAvatar) {
$out .= sp_UserAvatar("tagClass={$avatarClass}&size={$avatarSize}&echo=0");
}
$out .= '<p class="spSideDashLoggedIn">' . __('Logged in as', 'sp-ttags') . ' <strong>' . sp_filter_name_display($spThisUser->display_name) . '</strong></p>';
if ($showAdminLink) {
$out .= '<p class="spSideDashAdminLink"><a href="' . SFHOMEURL . 'wp-admin' . '">' . __('Dashboard', 'sp-ttags') . '</a></p>';
}
if ($showLogout) {
$out .= '<p class="spSideDashLogout"><a href="' . esc_url(wp_logout_url($sflogin['sflogouturl'])) . '">' . __('Log out', 'sp-ttags') . '</a></p>';
}
$out = apply_filters('sph_SideDashTagGuest', $out);
}
$out = apply_filters('sph_SideDashTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例15: sp_do_sp_HotTopicsTag
function sp_do_sp_HotTopicsTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
global $spThisUser;
$defs = array('tagId' => 'spHotTopicsTag', 'tagClass' => 'spHotTopicsTag', 'listClass' => 'spListItemTag', 'textClass' => 'spHotTopicTextTag', 'listTags' => 1, 'forumIds' => 0, 'limit' => 5, 'days' => 30, 'showForum' => 1, 'textForum' => __('posted in', 'sp-ttags'), 'showCount' => 1, 'textCount' => __('recent posts', 'sp-ttags'), 'showHotness' => 1, 'textHotness' => __('hotness', 'sp-ttags'), 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_HotTopicsTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$listClass = esc_attr($listClass);
$textClass = esc_attr($textClass);
$listTags = (int) $listTags;
$forumIds = sp_filter_title_display($forumIds);
$limit = (int) $limit;
$days = (int) $days;
$showForum = (int) $showForum;
$textForum = sp_filter_title_display($textForum);
$showCount = (int) $showCount;
$textCount = sp_filter_title_display($textCount);
$showHotness = (int) $showHotness;
$textHotness = sp_filter_title_display($textHotness);
$echo = (int) $echo;
sp_forum_api_support();
$forumList = '';
if (!empty($forumIds)) {
# are we passing forum ID's?
$flist = explode(',', $forumIds);
foreach ($flist as $id) {
if (sp_can_view($id, 'topic-title')) {
$forumList[] = $id;
}
}
} else {
global $spThisUser;
$allForums = sp_get_forum_memberships($spThisUser->ID);
if ($allForums) {
foreach ($allForums as $id) {
if (sp_can_view($id, 'topic-title')) {
$forumList[] = $id;
}
}
}
}
if (!empty($forumList)) {
$where = ' AND ' . SFPOSTS . '.forum_id IN (' . implode(',', $forumList) . ')';
} else {
return '';
}
# get any posts that meeet date criteria
$spdb = new spdbComplex();
$spdb->table = SFPOSTS;
$spdb->fields = SFPOSTS . '.topic_id, DATEDIFF(CURDATE(), post_date) AS delta, ' . SFPOSTS . '.forum_id, forum_name, forum_slug, forum_slug, topic_name, topic_slug';
$spdb->join = array(SFTOPICS . ' ON ' . SFTOPICS . '.topic_id = ' . SFPOSTS . '.topic_id', SFFORUMS . ' ON ' . SFFORUMS . '.forum_id = ' . SFPOSTS . '.forum_id');
$spdb->where = 'DATE_SUB(CURDATE(),INTERVAL ' . $days . ' DAY) <= post_date' . $where;
$spdb = apply_filters('sph_HotTopicsTagQuery', $spdb);
$posts = $spdb->select();
$out = '';
$out = $listTags ? "<ul id='{$tagId}' class='{$tagClass}'>" : "<div id='{$tagId}' class='{$tagClass}'>";
if ($posts) {
# give each topic with posts a score - currently ln(cur date - post date) for each post
$score = $count = $forum_name = $forum_slug = $topic_slug = $topic_name = array();
foreach ($posts as $post) {
if ($post->delta != $days) {
$value = apply_filters('sph_HotTopicTagScore', log($days - $post->delta), $post, $a);
# let plugins modify the hotness algorithm
$score[$post->topic_id] = isset($score[$post->topic_id]) ? $score[$post->topic_id] + $value : $value;
$count[$post->topic_id] = isset($count[$post->topic_id]) ? $count[$post->topic_id] + 1 : 1;
$forum_name[$post->topic_id] = sp_filter_title_display($post->forum_name);
$forum_slug[$post->topic_id] = $post->forum_slug;
$topic_slug[$post->topic_id] = $post->topic_slug;
$topic_name[$post->topic_id] = sp_filter_title_display($post->topic_name);
}
}
# reverse sort the posts and limit to number to display
arsort($score);
$topics = array_slice($score, 0, $limit, true);
# now output the popular topics
foreach ($topics as $id => $topic) {
$out .= $listTags ? "<li class='{$listClass}'>" : "<div class='{$textClass}'>";
$out .= sp_get_topic_url($forum_slug[$id], $topic_slug[$id], $topic_name[$id]);
if ($showForum) {
$out .= " {$textForum} {$forum_name[$id]}";
}
if ($showCount) {
$out .= ' (' . $count[$id] . " {$textCount})";
}
if ($showHotness) {
$out .= ' (' . round($score[$id], 2) . " {$textHotness})";
}
$out .= $listTags ? '</li>' : '</div>';
}
} else {
$out .= "<div class='{$textClass}'>" . __('No current hot topics to display', 'sp-ttags') . '</div>';
}
$out .= $listTags ? '</ul>' : '</div>';
//.........这里部分代码省略.........