本文整理汇总了PHP中bbp_get_version函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_version函数的具体用法?PHP bbp_get_version怎么用?PHP bbp_get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: is_dependency_satisfied
/**
* Check if plugin dependencies are satisfied and add an admin notice if not
*
* @return bool
*/
public static function is_dependency_satisfied()
{
if (class_exists('bbPress') && version_compare(bbp_get_version(), self::PLUGIN_MIN_VERSION, '>=')) {
return true;
}
return false;
}
开发者ID:Magnacarter,项目名称:livinghope.com,代码行数:12,代码来源:class-wp-stream-connector-bbpress.php
示例2: sandwich_bbpress_enqueue_editor_styles
/**
* Adds the default bbPress styles into the editor
*
* @see bbp_default_styles filter
* @see BBP_Default->enqueue_styles()
*/
public function sandwich_bbpress_enqueue_editor_styles($styles)
{
foreach ($styles as $handle => $attributes) {
$styleUrl = bbp_enqueue_style($handle, $attributes['file'], $attributes['dependencies'], bbp_get_version(), 'screen');
add_editor_style($styleUrl);
}
return $styles;
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:14,代码来源:bbpress.php
示例3: setup_globals
/**
* Component global variables
*
* Note that this function is currently commented out in the constructor.
* It will only be used if you copy this file into your current theme and
* uncomment the line above.
*
* You'll want to customize the values in here, so they match whatever your
* needs are.
*
* @since bbPress (r3732)
* @access private
*/
private function setup_globals()
{
$bbp = bbpress();
$this->id = 'default';
$this->name = __('bbPress Default', 'bbpress');
$this->version = bbp_get_version();
$this->dir = trailingslashit($bbp->themes_dir . 'default');
$this->url = trailingslashit($bbp->themes_url . 'default');
}
开发者ID:philtrimble,项目名称:GCFB-Portal-Theme---Main,代码行数:22,代码来源:bbpress-functions.php
示例4: setup_globals
/**
* Component global variables
*
* @since bbPress (r2626)
* @access private
* @uses bbp_get_version() To get the bbPress version
* @uses get_stylesheet_directory() To get the stylesheet path
* @uses get_stylesheet_directory_uri() To get the stylesheet uri
*/
private function setup_globals()
{
$bbp = bbpress();
$this->id = 'bbp-twentyten';
$this->name = __('Twenty Ten (bbPress)', 'bbpress');
$this->version = bbp_get_version();
$this->dir = trailingslashit($bbp->themes_dir . 'bbp-twentyten');
$this->url = trailingslashit($bbp->themes_url . 'bbp-twentyten');
}
开发者ID:hscale,项目名称:webento,代码行数:18,代码来源:bbpress-functions.php
示例5: d4p_bbpress_version
/**
* Get version of the bbPress.
*
* @param string $ret what version format to return: code or version
* @return mixed version value
*/
function d4p_bbpress_version($ret = 'code')
{
if (!d4p_has_bbpress()) {
return null;
}
$version = bbp_get_version();
if (isset($version)) {
if ($ret == 'code') {
return substr(str_replace('.', '', $version), 0, 2);
} else {
return $version;
}
}
return null;
}
开发者ID:alvarpoon,项目名称:anbig,代码行数:21,代码来源:shared.php
示例6: get_remote_request_params
public static function get_remote_request_params()
{
$_key = pp_get_option('support_key');
if (is_array($_key) && isset($_key[1])) {
$key = $_key[1];
} else {
$key = '';
}
global $wpdb;
$data = array('call' => 'pp', 'key' => $key, 'core' => PPC_VERSION, 'wp' => get_bloginfo('version'), 'is_ms' => PP_MULTISITE, 'php' => phpversion(), 'mysql' => $wpdb->db_version());
$data['bp'] = defined('BP_VERSION') ? BP_VERSION : 0;
$data['bbp'] = function_exists('bbp_get_version') ? bbp_get_version() : 0;
$data['rvy'] = defined('RVY_VERSION') ? RVY_VERSION : 0;
$data['cme'] = defined('CAPSMAN_ENH_VERSION') ? CAPSMAN_ENH_VERSION : 0;
global $pp_extensions;
foreach ($pp_extensions as $slug => $ext) {
$data[$slug] = isset($ext->version) ? $ext->version : 0;
}
$data['beta_updates'] = pp_get_option('beta_updates');
return $data;
}
开发者ID:severnrescue,项目名称:web,代码行数:21,代码来源:plugin_pp.php
示例7: admin_head
/**
* Add some general styling to the admin area
*
* @since bbPress (r2464)
*
* @uses bbp_get_forum_post_type() To get the forum post type
* @uses bbp_get_topic_post_type() To get the topic post type
* @uses bbp_get_reply_post_type() To get the reply post type
* @uses sanitize_html_class() To sanitize the classes
*/
public function admin_head()
{
// Remove the individual recount and converter menus.
// They are grouped together by h2 tabs
remove_submenu_page('tools.php', 'bbp-repair');
remove_submenu_page('tools.php', 'bbp-converter');
remove_submenu_page('tools.php', 'bbp-reset');
// The /wp-admin/images/ folder
$wp_admin_url = admin_url('images/');
// Icons for top level admin menus
$version = bbp_get_version();
$menu_icon_url = $this->images_url . 'menu.png?ver=' . $version;
$icon32_url = $this->images_url . 'icons32.png?ver=' . $version;
$menu_icon_url_2x = $this->images_url . 'menu-2x.png?ver=' . $version;
$icon32_url_2x = $this->images_url . 'icons32-2x.png?ver=' . $version;
// Top level menu classes
$forum_class = sanitize_html_class(bbp_get_forum_post_type());
$topic_class = sanitize_html_class(bbp_get_topic_post_type());
$reply_class = sanitize_html_class(bbp_get_reply_post_type());
?>
<style type="text/css" media="screen">
/*<![CDATA[*/
#bbp-dashboard-right-now p.sub,
#bbp-dashboard-right-now .table,
#bbp-dashboard-right-now .versions {
margin: -12px;
}
#bbp-dashboard-right-now .inside {
font-size: 12px;
padding-top: 20px;
margin-bottom: 0;
}
#bbp-dashboard-right-now p.sub {
padding: 5px 0 15px;
color: #8f8f8f;
font-size: 14px;
position: absolute;
top: -17px;
left: 15px;
}
body.rtl #bbp-dashboard-right-now p.sub {
right: 15px;
left: 0;
}
#bbp-dashboard-right-now .table {
margin: 0;
padding: 0;
position: relative;
}
#bbp-dashboard-right-now .table_content {
float: left;
border-top: #ececec 1px solid;
width: 45%;
}
body.rtl #bbp-dashboard-right-now .table_content {
float: right;
}
#bbp-dashboard-right-now .table_discussion {
float: right;
border-top: #ececec 1px solid;
width: 45%;
}
body.rtl #bbp-dashboard-right-now .table_discussion {
float: left;
}
#bbp-dashboard-right-now table td {
padding: 3px 0;
white-space: nowrap;
}
#bbp-dashboard-right-now table tr.first td {
border-top: none;
}
#bbp-dashboard-right-now td.b {
padding-right: 6px;
text-align: right;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
font-size: 14px;
width: 1%;
}
body.rtl #bbp-dashboard-right-now td.b {
//.........这里部分代码省略.........
开发者ID:vsalx,项目名称:rattieinfo,代码行数:101,代码来源:bbp-admin.php
示例8: register_theme_packages
/**
* Register bundled theme packages
*
* Note that since we currently have complete control over bbp-themes and
* the bbp-theme-compat folders, it's fine to hardcode these here. If at a
* later date we need to automate this, and API will need to be built.
*
* @since bbPress (r3829)
*/
public function register_theme_packages()
{
/** Default Theme *****************************************************/
bbp_register_theme_package(array('id' => 'default', 'name' => __('bbPress Default', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit($this->plugin_dir . 'bbp-theme-compat'), 'url' => trailingslashit($this->plugin_url . 'bbp-theme-compat')));
/** Twenty Ten ********************************************************/
bbp_register_theme_package(array('id' => 'bbp-twentyten', 'name' => __('Twenty Ten (bbPress)', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit($this->themes_dir . 'bbp-twentyten'), 'url' => trailingslashit($this->themes_url . 'bbp-twentyten')));
}
开发者ID:rmccue,项目名称:bbPress,代码行数:16,代码来源:bbpress.php
示例9: bbp_version
/**
* Output the bbPress version
*
* @since 2.0.0 bbPress (r3468)
*
* @uses bbp_get_version() To get the bbPress version
*/
function bbp_version()
{
echo bbp_get_version();
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:11,代码来源:functions.php
示例10: credits_screen
/**
* Output the credits screen
*
* @since bbPress (r4159)
*/
public function credits_screen()
{
$display_version = bbp_get_version();
?>
<div class="wrap about-wrap">
<h1><?php
printf(__('Welcome to bbPress %s'), $display_version);
?>
</h1>
<div class="about-text"><?php
printf(__('Thank you for updating to the latest version! bbPress %s is ready to make your community a safer, faster, and better looking place to hang out!'), $display_version);
?>
</div>
<div class="bbp-badge"><?php
printf(__('Version %s'), $display_version);
?>
</div>
<h2 class="nav-tab-wrapper">
<a href="<?php
echo esc_url(admin_url(add_query_arg(array('page' => 'bbp-about'), 'index.php')));
?>
" class="nav-tab">
<?php
_e('What’s New');
?>
</a><a href="<?php
echo esc_url(admin_url(add_query_arg(array('page' => 'bbp-credits'), 'index.php')));
?>
" class="nav-tab nav-tab-active">
<?php
_e('Credits');
?>
</a>
</h2>
<div class="return-to-dashboard">
<a href="<?php
echo esc_url(admin_url(add_query_arg(array('page' => 'bbp-settings'), 'index.php')));
?>
"><?php
_e('Go to Forum Settings');
?>
</a>
</div>
</div>
<?php
}
开发者ID:rmccue,项目名称:bbPress,代码行数:56,代码来源:bbp-admin.php
示例11: ass_bbp_ready
/**
* Stuff to do when the bbPress plugin is ready.
*
* @since 3.4.1
*/
function ass_bbp_ready()
{
/**
* bbPress v2.5.4 changed how emails are sent out.
*
* They now send one BCC email to their subscribers, so we have to filter out
* the topic subscribers before their email is sent.
*/
if (version_compare(bbp_get_version(), '2.5.4') >= 0) {
add_filter('bbp_subscription_mail_title', 'ass_bbp_add_topic_subscribers_filter', 99);
add_action('bbp_pre_notify_subscribers', 'ass_bbp_remove_topic_subscribers_filter', 0);
// bbPress <= v2.5.3
} else {
add_filter('bbp_subscription_mail_message', 'ass_bbp_disable_email', 10, 4);
}
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:21,代码来源:bp-activity-subscription-functions.php
示例12: http_post
/**
* Submit data to Akismet service with unique bbPress User Agent
*
* This code is directly taken from the akismet_http_post() function and
* documented to bbPress 2.0 standard.
*
* @since 2.0.0 bbPress (r3466)
*
* @param string $request The request we are sending
* @param string $host The host to send our request to
* @param string $path The path from the host
* @param string $port The port to use
* @param string $ip Optional Override $host with an IP address
* @uses bbp_get_version() To get the current bbPress version
* @return mixed WP_Error on error, array on success, empty on failure
*/
private function http_post($request, $host, $path, $port = 80, $ip = '')
{
// Preload required variables
$bbp_version = bbp_get_version();
$http_host = $host;
$blog_charset = get_option('blog_charset');
$response = '';
// Untque User Agent
$akismet_ua = "bbPress/{$bbp_version} | ";
$akismet_ua .= 'Akismet/' . constant('AKISMET_VERSION');
// Use specific IP (if provided)
if (!empty($ip) && long2ip(ip2long($ip))) {
$http_host = $ip;
}
// Setup the arguments
$http_args = array('body' => $request, 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . $blog_charset, 'Host' => $host, 'User-Agent' => $akismet_ua), 'httpversion' => '1.0', 'timeout' => 15);
// Where we are sending our request
$akismet_url = 'http://' . $http_host . $path;
// Send the request
$response = wp_remote_post($akismet_url, $http_args);
// Bail if the response is an error
if (is_wp_error($response)) {
return '';
}
// No errors so return response
return array($response['headers'], $response['body']);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:43,代码来源:akismet.php
示例13: credits_screen
/**
* Output the credits screen
*
* Hardcoding this in here is pretty janky. It's fine for 2.2, but we'll
* want to leverage api.wordpress.org eventually.
*
* @since bbPress (r4159)
*/
public function credits_screen()
{
list($display_version) = explode('-', bbp_get_version());
?>
<div class="wrap about-wrap">
<h1><?php
printf(__('Welcome to bbPress %s'), $display_version);
?>
</h1>
<div class="about-text"><?php
printf(__('Thank you for updating to the latest version! bbPress %s is ready to make your community a safer, faster, and better looking place to hang out!'), $display_version);
?>
</div>
<div class="bbp-badge"><?php
printf(__('Version %s'), $display_version);
?>
</div>
<h2 class="nav-tab-wrapper">
<a href="<?php
echo esc_url(admin_url(add_query_arg(array('page' => 'bbp-about'), 'index.php')));
?>
" class="nav-tab">
<?php
_e('What’s New');
?>
</a><a href="<?php
echo esc_url(admin_url(add_query_arg(array('page' => 'bbp-credits'), 'index.php')));
?>
" class="nav-tab nav-tab-active">
<?php
_e('Credits');
?>
</a>
</h2>
<p class="about-description"><?php
_e('bbPress is created by a worldwide swarm of busy, busy bees.', 'bbpress');
?>
</p>
<h4 class="wp-people-group"><?php
_e('Project Leaders', 'bbpress');
?>
</h4>
<ul class="wp-people-group " id="wp-people-group-project-leaders">
<li class="wp-person" id="wp-person-matt">
<a href="http://profiles.wordpress.org/matt"><img src="http://0.gravatar.com/avatar/767fc9c115a1b989744c755db47feb60?s=60" class="gravatar" alt="Matt Mullenweg" /></a>
<a class="web" href="http://profiles.wordpress.org/matt">Matt Mullenweg</a>
<span class="title"><?php
_e('Founding Developer', 'bbpress');
?>
</span>
</li>
<li class="wp-person" id="wp-person-johnjamesjacoby">
<a href="http://profiles.wordpress.org/johnjamesjacoby"><img src="http://0.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=60" class="gravatar" alt="John James Jacoby" /></a>
<a class="web" href="http://profiles.wordpress.org/johnjamesjacoby">John James Jacoby</a>
<span class="title"><?php
_e('Lead Developer', 'bbpress');
?>
</span>
</li>
</ul>
<h4 class="wp-people-group"><?php
_e('Contributing Developers', 'bbpress');
?>
</h4>
<ul class="wp-people-group " id="wp-people-group-contributing-developers">
<li class="wp-person" id="wp-person-jmdodd">
<a href="http://profiles.wordpress.org/jmdodd"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Jennifer M. Dodd" /></a>
<a class="web" href="http://profiles.wordpress.org/jmdodd">Jennifer M. Dodd</a>
<span class="title"></span>
</li>
<li class="wp-person" id="wp-person-jaredatch">
<a href="http://profiles.wordpress.org/jaredatch"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Jared Atchison" /></a>
<a class="web" href="http://profiles.wordpress.org/jaredatch">Jared Atchison</a>
<span class="title"></span>
</li>
<li class="wp-person" id="wp-person-gautamgupta">
<a href="http://profiles.wordpress.org/gautamgupta"><img src="http://0.gravatar.com/avatar/b0810422cbe6e4eead4def5ae7a90b34?s=60" class="gravatar" alt="Gautam Gupta" /></a>
<a class="web" href="http://profiles.wordpress.org/gautamgupta">Gautam Gupta</a>
<span class="title"></span>
</li>
</ul>
<h4 class="wp-people-group"><?php
_e('Codex Rockstars', 'bbpress');
?>
</h4>
<ul class="wp-people-group " id="wp-people-group-codex-rockstars">
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:admin.php
示例14: __construct
/**
* The main bbPress (Default) Loader
*
* @since bbPress (r3732)
*
* @uses BBP_IOA::setup_globals()
* @uses BBP_IOA::setup_actions()
*/
public function __construct($properties = array())
{
parent::__construct(bbp_parse_args($properties, array('id' => 'IOA', 'name' => __('BBPress IOA', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit(get_template_directory() . '/external/bbpress'), 'url' => trailingslashit(get_template_directory_uri() . '/external/bbpress')), 'default_theme'));
$this->setup_actions();
}
开发者ID:severnrescue,项目名称:web,代码行数:13,代码来源:bbpress-functions.php
示例15: bbp_dashboard_widget_right_now
//.........这里部分代码省略.........
</td>
<td class="last t hidden-replies"><?php
echo $text;
?>
</td>
</tr>
<?php
}
?>
<?php
if (isset($r['reply_count_hidden'])) {
?>
<tr>
<?php
$num = $r['reply_count_hidden'];
$text = _n('Hidden Reply', 'Hidden Replies', $r['reply_count_hidden'], 'bbpress');
$link = add_query_arg(array('post_type' => bbp_get_reply_post_type()), get_admin_url(null, 'edit.php'));
if ('0' !== $num) {
$link = add_query_arg(array('post_status' => bbp_get_spam_status_id()), $link);
}
$num = '<a href="' . esc_url($link) . '" title="' . esc_attr($r['hidden_reply_title']) . '">' . $num . '</a>';
$text = '<a class="waiting" href="' . esc_url($link) . '" title="' . esc_attr($r['hidden_reply_title']) . '">' . $text . '</a>';
?>
<td class="b b-hidden-replies"><?php
echo $num;
?>
</td>
<td class="last t hidden-replies"><?php
echo $text;
?>
</td>
</tr>
<?php
}
?>
<?php
if (bbp_allow_topic_tags() && isset($r['empty_topic_tag_count'])) {
?>
<tr>
<?php
$num = $r['empty_topic_tag_count'];
$text = _n('Empty Topic Tag', 'Empty Topic Tags', $r['empty_topic_tag_count'], 'bbpress');
$link = add_query_arg(array('taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type()), get_admin_url(null, 'edit-tags.php'));
$num = '<a href="' . esc_url($link) . '">' . $num . '</a>';
$text = '<a class="waiting" href="' . esc_url($link) . '">' . $text . '</a>';
?>
<td class="b b-hidden-topic-tags"><?php
echo $num;
?>
</td>
<td class="last t hidden-topic-tags"><?php
echo $text;
?>
</td>
</tr>
<?php
}
?>
<?php
do_action('bbp_dashboard_widget_right_now_discussion_table_end');
?>
</table>
</div>
<?php
do_action('bbp_dashboard_widget_right_now_table_end');
?>
<div class="versions">
<span id="wp-version-message">
<?php
printf(__('You are using <span class="b">bbPress %s</span>.', 'bbpress'), bbp_get_version());
?>
</span>
</div>
<br class="clear" />
<?php
do_action('bbp_dashboard_widget_right_now_end');
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:101,代码来源:metaboxes.php
示例16: admin_head
/**
* Add some general styling to the admin area
*
* @since bbPress (r2464)
*
* @uses bbp_get_forum_post_type() To get the forum post type
* @uses bbp_get_topic_post_type() To get the topic post type
* @uses bbp_get_reply_post_type() To get the reply post type
* @uses sanitize_html_class() To sanitize the classes
*/
public function admin_head()
{
// Remove the individual recount and converter menus.
// They are grouped together by h2 tabs
remove_submenu_page('tools.php', 'bbp-repair');
remove_submenu_page('tools.php', 'bbp-converter');
remove_submenu_page('tools.php', 'bbp-reset');
// Icons for top level admin menus
$version = bbp_get_version();
$menu_icon_url = $this->images_url . 'menu.png?ver=' . $version;
$icon32_url = $this->images_url . 'icons32.png?ver=' . $version;
$menu_icon_url_2x = $this->images_url . 'menu-2x.png?ver=' . $version;
$icon32_url_2x = $this->images_url . 'icons32-2x.png?ver=' . $version;
// Top level menu classes
$forum_class = sanitize_html_class(bbp_get_forum_post_type());
$topic_class = sanitize_html_class(bbp_get_topic_post_type());
$reply_class = sanitize_html_class(bbp_get_reply_post_type());
?>
<style type="text/css" media="screen">
/*<![CDATA[*/
#bbp-dashboard-right-now p.sub,
#bbp-dashboard-right-now .table,
#bbp-dashboard-right-now .versions {
margin: -12px;
}
#bbp-dashboard-right-now .inside {
font-size: 12px;
padding-top: 20px;
margin-bottom: 0;
}
#bbp-dashboard-right-now p.sub {
padding: 5px 0 15px;
color: #8f8f8f;
font-size: 14px;
position: absolute;
top: -17px;
left: 15px;
}
body.rtl #bbp-dashboard-right-now p.sub {
right: 15px;
left: 0;
}
#bbp-dashboard-right-now .table {
margin: 0;
padding: 0;
position: relative;
}
#bbp-dashboard-right-now .table_content {
float: left;
border-top: #ececec 1px solid;
width: 45%;
}
body.rtl #bbp-dashboard-right-now .table_content {
float: right;
}
#bbp-dashboard-right-now .table_discussion {
float: right;
border-top: #ececec 1px solid;
width: 45%;
}
body.rtl #bbp-dashboard-right-now .table_discussion {
float: left;
}
#bbp-dashboard-right-now table td {
padding: 3px 0;
white-space: nowrap;
}
#bbp-dashboard-right-now table tr.first td {
border-top: none;
}
#bbp-dashboard-right-now td.b {
padding-right: 6px;
text-align: right;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
font-size: 14px;
width: 1%;
}
body.rtl #bbp-dashboard-right-now td.b {
padding-left: 6px;
padding-right: 0;
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:bbp-admin.php
示例17: http_post
/**
* Submit data to Akismet service with unique bbPress User Agent
*
* This code is directly taken from the akismet_http_post() function and
* documented to bbPress 2.0 standard.
*
* @since bbPress (r3466)
*
* @param string $request The request we are sending
* @param string $host The host to send our request to
* @param string $path The path from the host
* @param string $port The port to use
* @param string $ip Optional Override $host with an IP address
* @uses bbp_get_version() To get the current bbPress version
* @return mixed WP_Error on error, array on success, empty on failure
*/
private function http_post($request, $host, $path, $port = 80, $ip = '')
{
// Preload required variables
$bbp_version = bbp_get_version();
$content_length = strlen($request);
$http_host = $host;
$blog_charset = get_option('blog_charset');
$response = '';
$errno = null;
$errstr = null;
// Untque User Agent
$akismet_ua = "bbPress/{$bbp_version} | ";
$akismet_ua .= 'Akismet/' . constant('AKISMET_VERSION');
// Use specific IP (if provided)
if (!empty($ip) && long2ip(ip2long($ip))) {
$http_host = $ip;
}
// WP HTTP class is available
if (function_exists('wp_remote_post')) {
// Setup the arguments
$http_args = array('body' => $request, 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . $blog_charset, 'Host' => $host, 'User-Agent' => $akismet_ua), 'httpversion' => '1.0', 'timeout' => 15);
// Where we are sending our request
$akismet_url = 'http://' . $http_host . $path;
// Send the request
$response = wp_remote_post($akismet_url, $http_args);
// Bail if the response is an error
if (is_wp_error($response)) {
return '';
}
// No errors so return response
return array($response['headers'], $response['body']);
// WP HTTP class is not available (Why not?)
} else {
// Header info to use with our socket
$http_request = "POST {$path} HTTP/1.0\r\n";
$http_request .= "Host: {$host}\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset={$blog_charset}\r\n";
$http_request .= "Content-Length: {$content_length}\r\n";
$http_request .= "User-Agent: {$akismet_ua}\r\n";
$http_request .= "\r\n";
$http_request .= $request;
// Open a socket connection
if (false != ($fs = @fsockopen($http_host, $port, $errno, $errstr, 10))) {
// Write our request to the pointer
fwrite($fs, $http_request);
// Loop through pointer and compile a response
while (!feof($fs)) {
// One TCP-IP packet at a time
$response .= fgets($fs, 1160);
}
// Close our socket
fclose($fs);
// Explode the response into usable data
$response = explode("\r\n\r\n", $response, 2);
}
// Return the response ('' if error/empty)
return $response;
}
}
开发者ID:rmccue,项目名称:bbPress,代码行数:75,代码来源:bbp-extend-akismet.php
示例18: __construct
/**
* The main bbPress (Default) Loader
*
* @since bbPress (r3732)
*
* @uses BBP_Default::setup_globals()
* @uses BBP_Default::setup_actions()
*/
public function __construct($properties = array())
{
parent::__construct(bbp_parse_args($properties, array('id' => 'default', 'name' => __('bbPress Default', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit(bbpress()->themes_dir . 'default'), 'url' => trailingslashit(bbpress()->themes_url . 'default')), 'default_theme'));
$this->setup_actions();
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:13,代码来源:bbpress-functions.php
示例19: pp_refresh_options
function pp_refresh_options()
{
global $wpdb, $pp_site_options;
do_action('pp_refresh_options');
$pp_site_options = array();
foreach ($wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'pp_%'") as $row) {
$pp_site_options[$row->option_name] = $row->option_value;
}
// this would normally be handled in PPP, but leave here so bbp roles are never listed as WP role groups
if (function_exists('bbp_get_version') && version_compare(bbp_get_version(), '2.2', '>=')) {
$pp_only_roles = isset($pp_site_options['pp_supplemental_role_defs']) ? maybe_unserialize($pp_site_options['pp_supplemental_role_defs']) : array();
$pp_site_options['pp_supplemental_role_defs'] = serialize(array_merge($pp_only_roles, array('bbp_participant', 'bbp_moderator', 'bbp_keymaster', 'bbp_blocked', 'bbp_spectator')));
}
$pp_site_options = apply_filters('pp_options', $pp_site_options);
}
开发者ID:severnrescue,项目名称:web,代码行数:15,代码来源:pp_load.php
示例20: processAdminGeneral
function processAdminGeneral($post)
{
global $wp_roles;
// Create a new role.
if (!empty($post['CreateRole'])) {
if ($newrole = $this->createRole($post['create-name'])) {
ak_admin_notify(__('New role created.', $this->cm->ID));
$this->cm->current = $newrole;
} else {
if (empty($post['create-name']) && (!defined('WPLANG') || !WPLANG)) {
ak_admin_error('Error: No role name specified.', $this->cm->ID);
} else {
ak_admin_error(__('Error: Failed creating the new role.', $this->cm->ID));
}
}
// Copy current role to a new one.
} elseif (!empty($post['CopyRole'])) {
$current = get_role($post['current']);
if ($newrole = $this->createRole($post['copy-name'], $current->capabilities)) {
ak_admin_notify(__('New role created.', $this->cm->ID));
$this->cm->current = $newrole;
} else {
if (empty($post['copy-name']) && (!defined('WPLANG') || !WPLANG)) {
ak_admin_error('Error: No role name specified.', $this->cm->ID);
} else {
ak_admin_error(__('Error: Failed creating the new role.', $this->cm->ID));
}
}
// Save role changes. Already saved at start with self::saveRoleCapabilities().
} elseif (!empty($post['SaveRole'])) {
if (MULTISITE) {
global $wp_roles;
if (method_exists($wp_roles, 'reinit')) {
$wp_roles->reinit();
}
}
$this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
if (defined('PP_ACTIVE')) {
// log customized role caps for subsequent restoration
// for bbPress < 2.2, need to log customization of roles following bbPress activation
$plugins = function_exists('bbp_get_version') && version_compare(bbp_get_version(), '2.2', '<') ? array('bbpress.php') : array();
// back compat
if (!($customized_roles = get_option('pp_customized_roles'))) {
$customized_roles = array();
}
$customized_roles[$post['role']] = (object) array('caps' => array_map('boolval', $post['caps']), 'plugins' => $plugins);
update_option('pp_customized_roles', $customized_roles);
global $wpdb;
$wpdb->query("UPDATE {$wpdb->options} SET autoload = 'no' WHERE option_name = 'pp_customized_roles'");
}
// Create New Capability and adds it to current role.
} elseif (!empty($post['AddCap'])) {
if (MULTISITE) {
global $wp_roles;
if (method_exists($wp_roles, 'reinit')) {
$wp_roles->reinit();
}
}
$role = get_role($post['current']);
$role->name = $post['current'];
// bbPress workaround
if ($newname = $this->createNewName($post['capability-name'])) {
$role->add_cap($newname['name']);
$this->cm->message = __('New capability added to role.');
// for bbPress < 2.2, need to log customization of roles following bbPress activation
$plugins = function_exists('bbp_get_version') && version_compare(bbp_get_version(), '2.2', '<') ? array('bbpress.php') : array();
// back compat
if (!($customized_roles = get_option('pp_customized_roles'))) {
$customized_roles = array();
}
$customized_roles[$post['role']] = (object) array('caps' => array_merge($role->capabilities, array($newname['name'] => 1)), 'plugins' => $plugins);
update_option('pp_customized_roles', $customized_roles);
global $wpdb;
$wpdb->query("UPDATE {$wpdb->options} SET autoload = 'no' WHERE option_name = 'pp_customized_roles'");
} else {
$this->cm->message = __('Incorrect capability name.');
}
} elseif (!empty($post['update_filtered_types'])) {
if (cme_update_pp_usage()) {
ak_admin_notify(__('Capability settings saved.', $this->cm->ID));
} else {
ak_admin_error(__('Error saving capability settings.', $this->cm->ID));
}
} else {
// TODO: Implement exceptions. This must be a fatal error.
ak_admin_error(__('Bad form received.', $this->cm->ID));
}
if (!empty($newrole) && defined('PP_ACTIVE')) {
if (!empty($post['CreateRole']) && !empty($_REQUEST['new_role_pp_only']) || !empty($post['CopyRole']) && !empty($_REQUEST['copy_role_pp_only'])) {
$pp_only = (array) pp_get_option('supplemental_role_defs');
$pp_only[] = $newrole;
pp_update_option('supplemental_role_defs', $pp_only);
_cme_pp_default_pattern_role($newrole);
pp_refresh_options();
}
}
}
开发者ID:Bakerpedia,项目名称:Development_Site5,代码行数:97,代码来源:handler.php
注:本文中的bbp_get_version函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论