function topic_delete_link($args = '') { $defaults = array('id' => 0, 'before' => '[', 'after' => ']'); extract(wp_parse_args($args, $defaults), EXTR_SKIP); $id = (int) $id; $topic = get_topic(get_topic_id($id)); if (!$topic || !bb_current_user_can('delete_topic', $topic->topic_id)) { return; } if (0 == $topic->topic_status) { echo "{$before}<a href='" . attribute_escape(bb_nonce_url(bb_get_option('uri') . 'bb-admin/delete-topic.php?id=' . $topic->topic_id, 'delete-topic_' . $topic->topic_id)) . "' onclick=\"return confirm('" . js_escape(__('Are you sure you wanna delete that?')) . "')\"><img src=\"" . bb_get_active_theme_uri() . 'image/delete.png" width="16" height="16" alt="Delete"/></a>' . $after; } else { echo "{$before}<a href='" . attribute_escape(bb_nonce_url(bb_get_option('uri') . 'bb-admin/delete-topic.php?id=' . $topic->topic_id . '&view=all', 'delete-topic_' . $topic->topic_id)) . "' onclick=\"return confirm('" . js_escape(__('Are you sure you wanna undelete that?')) . "')\"><img src=\"" . bb_get_active_theme_uri() . 'image/delete.png" width="16" height="16" alt="Delete"/></a>' . $after; } }
function bb_ksd_post_delete_link($parts, $args) { if (!bb_current_user_can('moderate')) { return $parts; } $bb_post = bb_get_post(get_post_id($args['post_id'])); if (2 == $bb_post->post_status) { $query = array('id' => $bb_post->post_id, 'status' => 0, 'view' => 'all'); $display = __('Not Spam'); } else { $query = array('id' => $bb_post->post_id, 'status' => 2); $display = __('Spam'); } $uri = bb_get_uri('bb-admin/delete-post.php', $query, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN); $uri = esc_url(bb_nonce_url($uri, 'delete-post_' . $bb_post->post_id)); if (!is_array($parts)) { $parts = array(); $before = ''; $after = ''; } else { $before = $args['last_each']['before']; $after = $args['last_each']['after']; } // Make sure that the last tag in $before gets a class (if it's there) if (preg_match('/.*(<[^>]+>)[^<]*/', $before, $_node)) { if (preg_match('/class=(\'|")(.*)\\1/U', $_node[1], $_class)) { $before = str_replace($_class[0], 'class=' . $_class[1] . 'before-post-spam-link ' . $_class[2] . $_class[1], $before); } else { $before = preg_replace('/(.*)<([a-z0-9_-]+)(\\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-spam-link"$3$4>$5', $before, 1); } } $parts[] = $before . '<a class="post-spam-link" href="' . $uri . '" >' . $display . '</a>' . $after; return $parts; }
function socialit_hide_show($parts) { $topic = get_topic(get_topic_id()); if ($topic && bb_current_user_can('delete_topic', $topic->topic_id)) { if (bb_get_topicmeta($topic->topic_id, 'hide_socialit') == 'true') { $display = esc_html(__('Show Social It Menu', 'socialit')); $uri = socialit_get_current_url() . "?socialit_hide_show=1&shs_opt=1&tid=" . $topic->topic_id; } else { $display = esc_html(__('Hide Social It Menu', 'socialit')); $uri = socialit_get_current_url() . "?socialit_hide_show=1&shs_opt=2&tid=" . $topic->topic_id; } $uri = esc_url(bb_nonce_url($uri, 'socialit_hide_show_' . $topic->topic_id)); $parts[] = '[<a href="' . $uri . '">' . $display . '</a>]'; return $parts; } return $parts; }
function user_favorites_link($add = array(), $rem = array(), $user_id = 0) { global $topic, $bb_current_user; if (empty($add) || !is_array($add)) { $add = array('mid' => __('Add this topic to your favorites'), 'post' => __(' (%?%)')); } if (empty($rem) || !is_array($rem)) { $rem = array('pre' => __('This topic is one of your %favorites% ['), 'mid' => __('×'), 'post' => __(']')); } if ($user_id) { if (!bb_current_user_can('edit_favorites_of', (int) $user_id)) { return false; } if (!($user = bb_get_user(bb_get_user_id($user_id)))) { return false; } } else { if (!bb_current_user_can('edit_favorites')) { return false; } $user =& $bb_current_user->data; } $url = esc_url(get_favorites_link($user_id)); if ($is_fav = is_user_favorite($user->ID, $topic->topic_id)) { $rem = preg_replace('|%(.+)%|', "<a href='{$url}'>\$1</a>", $rem); $favs = array('fav' => '0', 'topic_id' => $topic->topic_id); $pre = is_array($rem) && isset($rem['pre']) ? $rem['pre'] : ''; $mid = is_array($rem) && isset($rem['mid']) ? $rem['mid'] : (is_string($rem) ? $rem : ''); $post = is_array($rem) && isset($rem['post']) ? $rem['post'] : ''; } elseif (false === $is_fav) { $add = preg_replace('|%(.+)%|', "<a href='{$url}'>\$1</a>", $add); $favs = array('fav' => '1', 'topic_id' => $topic->topic_id); $pre = is_array($add) && isset($add['pre']) ? $add['pre'] : ''; $mid = is_array($add) && isset($add['mid']) ? $add['mid'] : (is_string($add) ? $add : ''); $post = is_array($add) && isset($add['post']) ? $add['post'] : ''; } $url = esc_url(bb_nonce_url(add_query_arg($favs, get_favorites_link($user_id)), 'toggle-favorite_' . $topic->topic_id)); if (!is_null($is_fav)) { echo "<span id='favorite-{$topic->topic_id}'>{$pre}<a href='{$url}' class='dim:favorite-toggle:favorite-{$topic->topic_id}:is-favorite'>{$mid}</a>{$post}</span>"; } }
<?php foreach ($requested_plugins as $plugin => $plugin_data) { $class = ' class="inactive"'; $action = 'activate'; $action_class = 'edit'; $action_text = __('Activate'); if ($plugin_data['autoload']) { $class = ' class="autoload"'; } elseif (in_array($plugin, $active_plugins)) { $class = ' class="active"'; $action = 'deactivate'; $action_class = 'delete'; $action_text = __('Deactivate'); } $href = esc_attr(bb_nonce_url(bb_get_uri('bb-admin/plugins.php', array('plugin_request' => $plugin_request, 'action' => $action, 'plugin' => urlencode($plugin)), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN), $action . '-plugin_' . $plugin)); $meta = array(); if ($plugin_data['version']) { $meta[] = sprintf(__('Version %s'), $plugin_data['version']); } if ($plugin_data['author_link']) { $meta[] = sprintf(__('By %s'), $plugin_data['author_link']); } if ($plugin_data['uri']) { $meta[] = '<a href="' . $plugin_data['uri'] . '">' . esc_html__('Visit plugin site') . '</a>'; } if (count($meta)) { $meta = '<p class="meta">' . join(' | ', $meta) . '</p>'; } else { $meta = ''; }
/** * Outputs the subscribe/unsubscibe link. * * Checks if user is subscribed and outputs link based on status. * * @since 1.1 */ function bb_user_subscribe_link() { $topic_id = get_topic_id(); if (!bb_is_user_logged_in()) { return false; } if (bb_is_user_subscribed()) { echo '<li id="subscription-toggle"><a href="' . bb_nonce_url(bb_get_uri(null, array('doit' => 'bb-subscribe', 'topic_id' => $topic_id, 'and' => 'remove')), 'toggle-subscribe_' . $topic_id) . '">' . apply_filters('bb_user_subscribe_link_unsubscribe', __('Unsubscribe from Topic')) . '</a></li>'; } else { echo '<li id="subscription-toggle"><a href="' . bb_nonce_url(bb_get_uri(null, array('doit' => 'bb-subscribe', 'topic_id' => $topic_id, 'and' => 'add')), 'toggle-subscribe_' . $topic_id) . '">' . apply_filters('bb_user_subscribe_link_subscribe', __('Subscribe to Topic')) . '</a></li>'; } }
function bb_admin_theme_row($theme, $position) { $theme_directory = bb_get_theme_directory($theme); $theme_data = file_exists($theme_directory . 'style.css') ? bb_get_theme_data($theme) : false; $screen_shot = file_exists($theme_directory . 'screenshot.png') ? esc_url(bb_get_theme_uri($theme) . 'screenshot.png') : false; $activation_url = bb_get_uri('bb-admin/themes.php', array('theme' => urlencode($theme)), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN); $activation_url = esc_url(bb_nonce_url($activation_url, 'switch-theme')); if (1 === $position || 0 === $position) { echo '<tr>'; } ?> <td class="position-<?php echo (int) $position; ?> "> <div class="screen-shot"><?php if ($screen_shot) { ?> <a href="<?php echo $activation_url; ?> " title="<?php echo esc_attr(sprintf(__('Activate "%s"'), $theme_data['Title'])); ?> "><img alt="<?php echo esc_attr($theme_data['Title']); ?> " src="<?php echo $screen_shot; ?> " /></a><?php } ?> </div> <div class="description"> <h3 class="themes"> <?php printf(__('%1$s %2$s by <cite>%3$s</cite>'), $theme_data['Title'], $theme_data['Version'], $theme_data['Author']); ?> </h3> <?php if ($theme_data['Porter']) { ?> <p> <?php printf(__('Ported by <cite>%s</cite>'), $theme_data['Porter']); ?> </p> <?php } ?> <?php echo $theme_data['Description']; // Description is autop'ed if (0 !== $position) { ?> <div class="actions"> <a href="<?php echo $activation_url; ?> " title="<?php echo esc_attr(sprintf(__('Activate "%s"'), $theme_data['Title'])); ?> "><?php _e('Activate'); ?> </a> </div> <?php } ?> <p class="location"><?php printf(__('All of this theme\'s files are located in the "%s" themes directory.'), $theme_data['Location']); ?> </p> </div> </td> <?php if (3 === $position || 0 === $position) { echo '</tr>'; } }