本文整理匯總了PHP中is_pro_site函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_pro_site函數的具體用法?PHP is_pro_site怎麽用?PHP is_pro_site使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_pro_site函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct()
{
add_action('psts_settings_page', array(&$this, 'settings'));
if (is_pro_site()) {
add_action('widgets_init', create_function('', 'return register_widget("ProSites_Pro_Widget");'));
}
}
示例2: force_roles_on_free_sites
function force_roles_on_free_sites($roles)
{
if (!class_exists('ProSites')) {
return $roles;
}
// Doesn't apply if we don't have ProSites
if (current_user_can('manage_network_options')) {
return $roles;
}
// Doesn't affect Super Admins
if (!function_exists('is_pro_site')) {
return $roles;
}
// Erm... should never happen.
$values = get_site_option('wdeb_pro');
$force = @$values['force_on_free'];
if (!$force) {
return $roles;
}
// No forcing, nothing to do
if (is_pro_site()) {
return $roles;
}
// Pro site, no forcing;
// Force on ALL roles
return array('administrator' => 'administrator', 'editor' => 'editor', 'author' => 'author', 'contributor' => 'contributor', 'subscriber' => 'subscriber');
}
示例3: force_redirect
function force_redirect($value)
{
global $psts;
if (is_pro_site(false, 1)) {
return 0;
} else {
return 1;
}
}
示例4: __construct
function __construct()
{
// add_action( 'psts_settings_page', array( &$this, 'settings' ) );
self::$user_label = __('Pro Widget', 'psts');
self::$user_description = __('Brag about your Pro Level with a widget', 'psts');
if (is_pro_site()) {
add_action('widgets_init', create_function('', 'return register_widget("ProSites_Pro_Widget");'));
}
}
示例5: prosites_filter_blogs
/**
* Prevents Buddypress from displaying non-pro sites in activities or anything
* If third parameter is null, the funcion has been called via bp_blogs_is_blog_recordable_for_user filter
* otherwise via bp_blogs_is_blog_recordable
*
* @uses is_pro_site()
*
* @param int $recordable_globally previous value for recorded globally
* @param int $blog_id ID of the blog being checked.
* @param int $user_id (Optional) ID of the user for whom access is being checked.
*
* @return bool True if site is pro or originally was recorable False if filtering is on plus it's a non-pro site
**/
function prosites_filter_blogs($recordable_globally = null, $blog_id = false, $user_id = null)
{
global $bp, $psts;
// If related feature is off simply return original value
if (!$psts->get_setting('bp_hide_unpaid')) {
return $recordable_globally;
}
// Otherwise check if site is pro
return is_pro_site($blog_id);
}
示例6: message
function message()
{
global $psts, $current_screen, $blog_id;
if (is_pro_site(false, $psts->get_setting('xmlrpc_level', 1)) || $this->ads_xmlrpc()) {
return;
}
if ($current_screen->id == 'options-writing') {
$notice = str_replace('LEVEL', $psts->get_level_setting($psts->get_setting('xmlrpc_level', 1), 'name'), $psts->get_setting('xmlrpc_message'));
echo '<div class="error"><p><a href="' . $psts->checkout_url($blog_id) . '">' . $notice . '</a></p></div>';
}
}
示例7: network_pro_posts_cb
public function network_pro_posts_cb($atts)
{
if (!is_main_site() && !ALLOW_SUBSITE_PRO_POSTS) {
return 'Sorry! This shortcode is only available for main site.';
}
$defaults = array('posts_per_page' => 10, 'post_type' => 'post', 'randomize' => false, 'include_main_site' => false, 'pro_level' => 'all');
extract(shortcode_atts($defaults, $atts));
$posts = $sites = array();
if ($pro_level == 'all') {
$levels = get_site_option('psts_levels');
} else {
$levels = array($pro_level => 1);
}
foreach ($levels as $key => $value) {
$sql = 'SELECT * from ' . $this->db->base_prefix . "pro_sites where level = '" . $key . "'";
$sites = $this->db->get_results($sql, OBJECT);
}
if ($include_main_site) {
$main_site = new stdClass();
$main_site->blog_ID = 1;
array_unshift($sites, $main_site);
}
foreach ($sites as $site) {
if ($site->blog_ID == 0) {
continue;
}
if (!is_pro_site($site->blog_ID)) {
continue;
}
$sql = "SELECT * from " . $this->db->base_prefix . "network_posts where BLOG_ID = '" . $site->blog_ID . "' AND post_type = '" . $post_type . "' LIMIT 0, " . $posts_per_page;
$subsite_posts = $this->db->get_results($sql, OBJECT);
foreach ($subsite_posts as $subsite_post) {
array_push($posts, $subsite_post);
}
}
if ($randomize) {
shuffle($posts);
}
$html = '<div class="pro_sites_posts">';
$html .= '<ul>';
foreach ($posts as $post) {
$html .= '<li>';
$html .= '<h3><a href="' . network_get_permalink($post->BLOG_ID, $post->ID) . '">' . $post->post_title . '</a></h3>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</div>';
return $html;
}
開發者ID:bappi-d-great,項目名稱:Show-posts-from-Pro-Sites-WPMU-sites,代碼行數:49,代碼來源:Show-posts-from-Pro-Sites-WPMU-sites.php
示例8: admin_menu
function admin_menu()
{
global $submenu, $psts;
$blog_id = get_current_blog_id();
$menu_items = $psts->get_setting('ual', array());
foreach ($menu_items as $id => $options) {
if ($options['name'] && !is_pro_site($blog_id, $options['level'])) {
if (!$options['parent']) {
add_menu_page($options['name'], $options['name'], 'manage_options', 'upgrade_redirect&source=test', array(&$this, 'redirect'), '', $options['priority']);
} else {
$redirect_url = $psts->checkout_url($blog_id, 'Menu - ' . $options['name']);
$submenu[$options['parent']] = $this->magic_insert($options['priority'] - 1, array($options['name'], 'manage_options', $redirect_url), $submenu[$options['parent']]);
}
}
}
}
示例9: filter
function filter($space)
{
global $psts;
//don't filter on network settings page to avoid confusion
if (is_network_admin()) {
return $space;
}
$quota = $psts->get_level_setting($psts->get_level(), 'quota');
if ($quota && is_pro_site(false, $psts->get_level())) {
return $quota;
} else {
if (function_exists('psts_hide_ads') && psts_hide_ads() && ($quota = $psts->get_setting("quota_upgraded_space"))) {
return $quota;
} else {
return $space;
}
}
}
示例10: force_roles_on_free_sites
function force_roles_on_free_sites($roles)
{
if (!class_exists('ProSites')) {
return $roles;
}
// Doesn't apply if we don't have ProSites
if (current_user_can('manage_network_options')) {
return $roles;
}
// Doesn't affect Super Admins
if (!function_exists('is_pro_site')) {
return $roles;
}
// Erm... should never happen.
$values = get_site_option('wdeb_pro');
$force = @$values['force_on_free'];
if (!$force) {
return $roles;
}
// No forcing, nothing to do
if (is_pro_site()) {
return $roles;
}
// Pro site, no forcing;
// Force on ALL roles
global $wp_roles;
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
$all_roles = array_keys($wp_roles->get_names());
return array_combine($all_roles, $all_roles);
/*
// Just WP default roles...
return array (
'administrator' => 'administrator',
'editor' => 'editor',
'author' => 'author',
'contributor' => 'contributor',
'subscriber' => 'subscriber',
);
*/
}
示例11: blogs_directory_hide_some_blogs
function blogs_directory_hide_some_blogs($blog_id)
{
$blogs_directory_hide_blogs = get_site_option('blogs_directory_hide_blogs');
/*Hide Pro Site blogs */
if (isset($blogs_directory_hide_blogs['pro_site']) && 1 == $blogs_directory_hide_blogs['pro_site']) {
global $ProSites_Module_PayToBlog, $psts;
//don't show unpaid blogs
if (is_object($ProSites_Module_PayToBlog) && $psts->get_setting('ptb_front_disable') && !is_pro_site($blog_id, 1)) {
return true;
}
}
/*Hide Private blogs */
if (isset($blogs_directory_hide_blogs['private']) && 1 == $blogs_directory_hide_blogs['private']) {
//don't show private blogs
$privacy = get_blog_option($blog_id, 'blog_public');
if (is_numeric($privacy) && 1 != $privacy) {
return true;
}
}
return false;
}
示例12: network_info_cb
public function network_info_cb($atts)
{
$html = '';
$sites = wp_get_sites();
$html .= __('Total Sites: ', 'ni') . count($sites);
$users = $this->_db->get_var("SELECT COUNT(1) FROM {$this->_db->users}");
$html .= '<br>' . __('Total Users: ', 'ni') . $users;
if ($this->is_pro_site_active) {
$pro_sites = 0;
foreach ($sites as $site) {
if (is_pro_site($site['blog_id'])) {
$pro_sites++;
}
}
$html .= '<br>' . __('Total Pro Sites: ', 'ni') . $pro_sites;
}
if (is_main_site() || defined('ALLOW_NI_IN_SUBSITE') && ALLOW_NI_IN_SUBSITE) {
return $html;
}
return __('You are not allowed to use this shortcode!', 'ni');
}
示例13: checkout_output
function checkout_output($content)
{
//make sure we are in the loop and on current page loop item
if (!in_the_loop() || get_queried_object_id() != get_the_ID()) {
return $content;
}
//make sure logged in
if (!is_user_logged_in()) {
$content .= '<p>' . __('You must first login before you can choose a site to upgrade:', 'psts') . '</p>';
$content .= wp_login_form(array('echo' => false));
return $content;
}
//set blog_id
if (isset($_POST['bid'])) {
$blog_id = intval($_POST['bid']);
} else {
if (isset($_GET['bid'])) {
$blog_id = intval($_GET['bid']);
} else {
$blog_id = false;
}
}
if ($blog_id) {
//check for admin permissions for this blog
switch_to_blog($blog_id);
$permission = current_user_can('edit_pages');
restore_current_blog();
if (!$permission) {
$content = '<p>' . __('Sorry, but you do not have permission to upgrade this site. Only the site administrator can upgrade their site.', 'psts') . '</p>';
$content .= '<p><a href="' . $this->checkout_url() . '">« ' . __('Choose a different site', 'psts') . '</a></p>';
return $content;
}
if ($this->get_expire($blog_id) > 2147483647) {
$level = $this->get_level_setting($this->get_level($blog_id), 'name');
$content = '<p>' . sprintf(__('This site has been permanently given %s status.', 'psts'), $level) . '</p>';
$content .= '<p><a href="' . $this->checkout_url() . '">« ' . __('Choose a different site', 'psts') . '</a></p>';
return $content;
}
//this is the main hook for gateways to add all their code
$content = apply_filters('psts_checkout_output', $content, $blog_id);
} else {
//blogid not set
$blogs = get_blogs_of_user(get_current_user_id());
if ($blogs) {
$content .= '<h3>' . __('Please choose a site to Upgrade or Modify:', 'psts') . '</h3>';
$content .= '<ul>';
foreach ($blogs as $blog) {
//check for permission
switch_to_blog($blog->userblog_id);
$permission = current_user_can('edit_pages');
restore_current_blog();
if (!$permission) {
continue;
}
$has_blog = true;
$level = $this->get_level($blog->userblog_id);
$level_label = $level ? $this->get_level_setting($level, 'name') : sprintf(__('Not %s', 'psts'), $this->get_setting('rebrand'));
$upgrade_label = is_pro_site($blog->userblog_id) ? sprintf(__('Modify "%s"', 'psts'), $blog->blogname) : sprintf(__('Upgrade "%s"', 'psts'), $blog->blogname);
$content .= '<li><a href="' . $this->checkout_url($blog->userblog_id) . '">' . $upgrade_label . '</a> (<em>' . $blog->siteurl . '</em>) - ' . $level_label . '</li>';
}
$content .= '</ul>';
}
//show message if no valid blogs
if (!$has_blog) {
$content .= '<strong>' . __('Sorry, but it appears you are not an administrator for any sites.', 'psts') . '</strong>';
}
}
return '<div id="psts-checkout-output">' . $content . '</div>';
//div wrap
}
示例14: is_modifying
/**
* Check if user is upgrading or downgrading
*
* @param $blog_id
* @param $post
*/
private static function is_modifying($blog_id, $post, $initAmount)
{
global $psts;
$modify = false;
$level = !empty($post['level']) ? $post['level'] : '';
$period = !empty($post['period']) ? $post['period'] : '';
if (empty($blog_id) || empty($level) || empty($period)) {
return false;
}
//Check if there is existing profile id
$profile_id = self::get_profile_id($blog_id);
if (!empty($profile_id)) {
//Get details from Paypal
$profile_details = PaypalApiHelper::GetRecurringPaymentsProfileDetails($profile_id);
//Check if there is any profile reference
$profile_ref = !empty($profile_details['PROFILEREFERENCE']) ? $profile_details['PROFILEREFERENCE'] : '';
if (!empty($profile_ref)) {
//Get Existing plan details from reference
list($pre, $blog_id, $prev_level, $prev_period, $amount, $currency, $timestamp, $activation_key) = explode('_', $profile_ref);
}
if ($period != $prev_period || $level != $prev_level) {
$modify = true;
}
}
if ($modify) {
//check for modifying
if (!empty($blog_id) && is_pro_site($blog_id) && !is_pro_trial($blog_id)) {
$modify = $psts->calc_upgrade($blog_id, $initAmount, $level, $period);
$modify = $modify ? $modify : $psts->get_expire($blog_id);
} else {
$modify = false;
}
}
return $modify;
}
示例15: admin_page
//.........這裏部分代碼省略.........
<h2><?php
_e('Payment Settings', 'mp');
?>
</h2>
<div id="poststuff" class="metabox-holder mp-settings">
<form id="mp-gateways-form" method="post" action="edit.php?post_type=product&page=marketpress&tab=gateways">
<input type="hidden" name="gateway_settings" value="1" />
<?php
if (!$this->global_cart) {
?>
<div id="mp_gateways" class="postbox">
<h3 class='hndle'><span><?php
_e('General Settings', 'mp');
?>
</span></h3>
<div class="inside">
<table class="form-table">
<tr>
<th scope="row"><?php
_e('Select Payment Gateway(s)', 'mp');
?>
</th>
<td>
<?php
//check network permissions
if (is_multisite() && !is_main_site()) {
$network_settings = get_site_option('mp_network_settings');
foreach ((array) $mp_gateway_plugins as $code => $plugin) {
if ($network_settings['allowed_gateways'][$code] == 'full') {
$allowed_plugins[$code] = $plugin;
} else {
if ($network_settings['allowed_gateways'][$code] == 'supporter' && function_exists('is_pro_site') && is_pro_site(false, $network_settings['gateways_pro_level'][$code])) {
$allowed_plugins[$code] = $plugin;
}
}
}
$mp_gateway_plugins = $allowed_plugins;
}
foreach ((array) $mp_gateway_plugins as $code => $plugin) {
if ($plugin[3]) {
//if demo
?>
<label><input type="checkbox" class="mp_allowed_gateways" name="mp[gateways][allowed][]" value="<?php
echo $code;
?>
" disabled="disabled" /> <?php
echo esc_attr($plugin[1]);
?>
</label> <a class="mp-pro-update" href="http://premium.wpmudev.org/project/e-commerce" title="<?php
_e('Upgrade', 'mp');
?>
»"><?php
_e('Pro Only »', 'mp');
?>
</a><br /><?php
} else {
?>
<label><input type="checkbox" class="mp_allowed_gateways" name="mp[gateways][allowed][]" value="<?php
echo $code;
?>
"<?php
echo in_array($code, $this->get_setting('gateways->allowed', array())) ? ' checked="checked"' : '';
?>
/> <?php