• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_pro_site函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_pro_site函数的典型用法代码示例。如果您正苦于以下问题:PHP is_pro_site函数的具体用法?PHP is_pro_site怎么用?PHP is_pro_site使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了is_pro_site函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");'));
     }
 }
开发者ID:hscale,项目名称:webento,代码行数:7,代码来源:badge-widget.php


示例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');
 }
开发者ID:hscale,项目名称:webento,代码行数:27,代码来源:wdeb-pro-force_free.php


示例3: force_redirect

 function force_redirect($value)
 {
     global $psts;
     if (is_pro_site(false, 1)) {
         return 0;
     } else {
         return 1;
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:9,代码来源:pay-to-blog.php


示例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");'));
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:9,代码来源:badge-widget.php


示例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);
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:23,代码来源:buddypress.php


示例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>';
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:11,代码来源:xmlrpc.php


示例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']]);
             }
         }
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:16,代码来源:upgrade-admin-links.php


示例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;
         }
     }
 }
开发者ID:hscale,项目名称:webento,代码行数:18,代码来源:quota.php


示例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',
     );
     */
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:42,代码来源:wdeb-pro-force_free.php


示例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;
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:21,代码来源:blogs-directory.php


示例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');
 }
开发者ID:bappi-d-great,项目名称:show-network-information,代码行数:21,代码来源:code.php


示例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() . '">&laquo; ' . __('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() . '">&laquo; ' . __('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
 }
开发者ID:hscale,项目名称:webento,代码行数:70,代码来源:pro-sites.php


示例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;
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:41,代码来源:gateway-paypal-express-pro.php


示例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&amp;page=marketpress&amp;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');
                            ?>
 &raquo;"><?php 
                            _e('Pro Only &raquo;', '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 
开发者ID:hscale,项目名称:webento,代码行数:67,代码来源:marketpress.php


示例16: apply_no_prosite

 /**
  * Apply the rule-logic to the specified popup
  *
  * @since  4.6
  * @param  mixed $data Rule-data which was saved via the save_() handler.
  * @return bool Decission to display popup or not.
  */
 protected function apply_no_prosite($data)
 {
     $prosite = function_exists('is_pro_site') && is_pro_site();
     return !$prosite;
 }
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:12,代码来源:class-popup-rule-prosite.php


示例17: selective_message_display

 function selective_message_display()
 {
     if (function_exists('get_site_option') && defined('PO_GLOBAL') && PO_GLOBAL == true) {
         $updateoption = 'update_site_option';
         $getoption = 'get_site_option';
     } else {
         $updateoption = 'update_option';
         $getoption = 'get_option';
     }
     $popovers = $this->get_active_popovers();
     if (!empty($popovers)) {
         foreach ((array) $popovers as $popover) {
             // We have an active popover so extract the information and test it
             $popover_title = stripslashes($popover->popover_title);
             $popover_content = stripslashes($popover->popover_content);
             $popover->popover_settings = unserialize($popover->popover_settings);
             $popover_size = $popover->popover_settings['popover_size'];
             $popover_location = $popover->popover_settings['popover_location'];
             $popover_colour = $popover->popover_settings['popover_colour'];
             $popover_margin = $popover->popover_settings['popover_margin'];
             $popover_size = $this->sanitise_array($popover_size);
             $popover_location = $this->sanitise_array($popover_location);
             $popover_colour = $this->sanitise_array($popover_colour);
             $popover_margin = $this->sanitise_array($popover_margin);
             $popover_check = $popover->popover_settings['popover_check'];
             $popover_ereg = $popover->popover_settings['popover_ereg'];
             $popover_count = $popover->popover_settings['popover_count'];
             $popover_usejs = $popover->popover_settings['popover_usejs'];
             $popoverstyle = isset($popover->popover_settings['popover_style']) ? $popover->popover_settings['popover_style'] : '';
             $popover_hideforever = isset($popover->popover_settings['popoverhideforeverlink']) ? $popover->popover_settings['popoverhideforeverlink'] : '';
             $popover_delay = isset($popover->popover_settings['popoverdelay']) ? $popover->popover_settings['popoverdelay'] : '';
             $popover_onurl = isset($popover->popover_settings['onurl']) ? $popover->popover_settings['onurl'] : '';
             $popover_notonurl = isset($popover->popover_settings['notonurl']) ? $popover->popover_settings['notonurl'] : '';
             $popover_incountry = isset($popover->popover_settings['incountry']) ? $popover->popover_settings['incountry'] : '';
             $popover_notincountry = isset($popover->popover_settings['notincountry']) ? $popover->popover_settings['notincountry'] : '';
             $popover_onurl = $this->sanitise_array($popover_onurl);
             $popover_notonurl = $this->sanitise_array($popover_notonurl);
             $show = true;
             if (!empty($popover_check)) {
                 $order = explode(',', $popover_check['order']);
                 foreach ($order as $key) {
                     switch ($key) {
                         case "supporter":
                             if (function_exists('is_pro_site') && is_pro_site()) {
                                 $show = false;
                             }
                             break;
                         case "loggedin":
                             if ($this->is_loggedin()) {
                                 $show = false;
                             }
                             break;
                         case "isloggedin":
                             if (!$this->is_loggedin()) {
                                 $show = false;
                             }
                             break;
                         case "commented":
                             if ($this->has_commented()) {
                                 $show = false;
                             }
                             break;
                         case "searchengine":
                             if (!$this->is_fromsearchengine($_REQUEST['thereferrer'])) {
                                 $show = false;
                             }
                             break;
                         case "internal":
                             $internal = str_replace('^http://', '', get_option('home'));
                             if ($this->referrer_matches($internal, $_REQUEST['thereferrer'])) {
                                 $show = false;
                             }
                             break;
                         case "referrer":
                             $match = $popover_ereg;
                             if (!$this->referrer_matches($match, $_REQUEST['thereferrer'])) {
                                 $show = false;
                             }
                             break;
                         case "count":
                             if ($this->has_reached_limit($popover_count)) {
                                 $show = false;
                             }
                             break;
                         case 'onurl':
                             if (!$this->onurl($popover_onurl, $_REQUEST['thefrom'])) {
                                 $show = false;
                             }
                             break;
                         case 'notonurl':
                             if ($this->onurl($popover_notonurl, $_REQUEST['thefrom'])) {
                                 $show = false;
                             }
                             break;
                         case 'incountry':
                             $incountry = $this->incountry($popover_incountry);
                             if (!$incountry || $incountry === 'XX') {
                                 $show = false;
                             }
                             break;
//.........这里部分代码省略.........
开发者ID:newmight2015,项目名称:psmpsm,代码行数:101,代码来源:popoverajax.php


示例18: new_blog

 function new_blog($blog_id)
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     global $psts;
     $psts_plugins = (array) $psts->get_setting('pp_plugins');
     $auto_activate = array();
     switch_to_blog($blog_id);
     //look for valid plugins with anyone access
     foreach ($psts_plugins as $plugin_file => $data) {
         if ($data['auto'] && is_numeric($data['level']) && (is_pro_site($blog_id, $data['level']) || $data['level'] == 0) && !is_plugin_active($plugin_file)) {
             $auto_activate[] = $plugin_file;
         }
     }
     //if any activate them
     if (count($auto_activate)) {
         activate_plugins($auto_activate, '', false);
         //silently activate any plugins
     }
     restore_current_blog();
 }
开发者ID:hscale,项目名称:webento,代码行数:20,代码来源:premium-plugins.php


示例19: get_existing_user_information


//.........这里部分代码省略.........
        if (self::$complete_message) {
            // @todo: Hook psts_blog_info_complete_message
            $args['complete_message'] = '<div id="psts-complete-msg">' . self::$complete_message . '</div>';
            // @todo: Hook psts_blog_info_thanks_message
            $args['thanks_message'] = '<p>' . $psts->get_setting('stripe_thankyou') . '</p>';
            //If Checking out on signup, there wouldn't be a blogid probably
            //			if ( ! empty ( $domain ) ) {
            //				//Hardcoded, TODO: Search for alternative
            //				$admin_url = is_ssl() ? trailingslashit( "https://$domain" ) . 'wp-admin/' : trailingslashit( "http://$domain" ) . 'wp-admin/';
            //				$args['visit_site_message'] = '<p><a href="' . $admin_url . '">' . __( 'Visit your newly upgraded site &raquo;', 'psts' ) . '</a></p>';
            //			} else {
            $args['visit_site_message'] = '<p><a href="' . get_admin_url($blog_id, '', 'http') . '">' . __('Go to your site &raquo;', 'psts') . '</a></p>';
            //			}
            self::$complete_message = false;
        }
        // Cancellation message
        if (self::$cancel_message) {
            $args['cancel'] = true;
            $args['cancellation_message'] = self::$cancel_message;
            self::$cancel_message = false;
        }
        // Existing customer information --- only if $get_all is true (default)
        $customer_id = self::get_customer_data($blog_id)->customer_id;
        if (!empty($customer_id) && $get_all) {
            try {
                $customer_object = Stripe_Customer::retrieve($customer_id);
            } catch (Exception $e) {
                $error = $e->getMessage();
            }
            // Move to render info class
            $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id));
            $level = $psts->get_level_setting($psts->get_level($blog_id), 'name');
            $is_recurring = $psts->is_blog_recurring($blog_id);
            $args['recurring'] = $is_recurring;
            // If invoice cant be created, its not looking good. Cancel.
            try {
                $invoice_object = Stripe_Invoice::upcoming(array("customer" => $customer_id));
            } catch (Exception $e) {
                if ($is_recurring) {
                    $args['cancel'] = true;
                    $args['cancellation_message'] = '<div class="psts-cancel-notification">
													<p class="label"><strong>' . __('Your subscription has been canceled', 'psts') . '</strong></p>
													<p>' . sprintf(__('This site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>';
                }
            }
            $args['level'] = $level;
            $args['expires'] = $end_date;
            // All good, keep populating the array.
            if (!isset($args['cancel'])) {
                // Get the last valid card
                if (isset($customer_object->cards->data[0]) && isset($customer_object->default_card)) {
                    foreach ($customer_object->cards->data as $tmpcard) {
                        if ($tmpcard->id == $customer_object->default_card) {
                            $card = $tmpcard;
                            break;
                        }
                    }
                } elseif (isset($customer_object->active_card)) {
                    //for API pre 2013-07-25
                    $card = $customer_object->active_card;
                }
                $args['card_type'] = $card->brand;
                $args['card_reminder'] = $card->last4;
                $args['card_digit_location'] = 'end';
                $args['card_expire_month'] = $card->exp_month;
                $args['card_expire_year'] = $card->exp_year;
                // Get the period
                $plan_parts = explode('_', $customer_object->subscriptions->data[0]->plan->id);
                $period = array_pop($plan_parts);
                $args['period'] = $period;
                // Get last payment date
                try {
                    $existing_invoice_object = Stripe_Invoice::all(array("customer" => $customer_id, "count" => 1));
                } catch (Exception $e) {
                    $error = $e->getMessage();
                }
                if (isset($existing_invoice_object->data[0]) && $customer_object->subscriptions->data[0]->status != 'trialing') {
                    $args['last_payment_date'] = $existing_invoice_object->data[0]->date;
                }
                // Get next payment date
                if (isset($invoice_object->next_payment_attempt)) {
                    $args['next_payment_date'] = $invoice_object->next_payment_attempt;
                }
                // Cancellation link
                if ($is_recurring) {
                    if (is_pro_site($blog_id)) {
                        $args['cancel_info'] = '<p class="prosites-cancel-description">' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>';
                        $cancel_label = __('Cancel Your Subscription', 'psts');
                        // CSS class of <a> is important to handle confirmations
                        $args['cancel_link'] = '<p class="prosites-cancel-link"><a class="cancel-prosites-plan button" href="' . wp_nonce_url($psts->checkout_url($blog_id) . '&action=cancel', 'psts-cancel') . '" title="' . esc_attr($cancel_label) . '">' . esc_html($cancel_label) . '</a></p>';
                    }
                }
                // Receipt form
                $args['receipt_form'] = $psts->receipt_form($blog_id);
            }
            // Show all is true
            $args['all_fields'] = true;
        }
        return empty($args) ? array() : $args;
    }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:101,代码来源:gateway-stripe.php


示例20: checkout_screen

        /**
         * Displays the checkout screen
         *
         * @param $content
         * @param $blog_id
         * @param string $domain
         *
         * @return string
         */
        function checkout_screen($content, $blog_id, $domain = '')
        {
            global $psts, $wpdb, $current_site, $current_user;
            if (!$blog_id && !$domain) {
                return $content;
            }
            $img_base = $psts->plugin_url . 'images/';
            $twocheckout_active = false;
            //hide top part of content if its a pro blog
            if (is_pro_site($blog_id) || $psts->errors->get_error_message('coupon')) {
                $content = '';
            }
            if ($errmsg = $psts->errors->get_error_message('general')) {
                $content = '<div id="psts-general-error" class="psts-error">' . $errmsg . '</div>';
                //hide top part of content if theres an error
            }
            //display the complete message if having
            if ($this->complete_message) {
                $content = '<div id="psts-complete-msg">' . $this->complete_message . '</div>';
                $content .= '<p>' . $psts->get_setting('2co_thankyou') . '</p>';
                $content .= '<p><a href="' . get_admin_url($blog_id, '', 'http') . '">' . __('Visit your newly upgraded site &raquo;', 'psts') . '</a></p>';
                //remove session
                return $content;
            }
            //check if pro/express user
            if ($profile_id = $this->get_profile_id($blog_id)) {
                $content .= '<div id="psts_existing_info">';
                $cancel_content = '';
                $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id));
                $level = $psts->get_level_setting($psts->get_level($blog_id), 'name');
                //cancel subscription
                if (isset($_GET['action']) && $_GET['action'] == 'cancel' && wp_verify_nonce($_GET['_wpnonce'], 'psts-cancel')) {
                    $resArray = $this->tcheckout_cancel_subscription($profile_id);
                    if ($resArray['response_code'] == 'OK') {
                        $content .= '<div id="message" class="updated fade"><p>' . sprintf(__('Your %1$s subscription has been canceled. You should continue to have access until %2$s.', 'psts'), $current_site->site_name . ' ' . $psts->get_setting('rebrand'), $end_date) . '</p></div>';
                        //record stat
                        $psts->record_stat($blog_id, 'cancel');
                        $psts->email_notification($blog_id, 'canceled');
                        $psts->log_action($blog_id, sprintf(__('Subscription successfully canceled by the user. They should continue to have access until %s', 'psts'), $end_date));
                    } else {
                        $content .= '<div id="message" class="error fade"><p>' . __('There was a problem canceling your subscription, please contact us for help: ', 'psts') . $resArray2['errors'][0]['message'] . '</p></div>';
                    }
                }
                //show sub detail
                $resArray = $this->tcheckout_get_profile_detail($profile_id);
                $active_recurring = $this->get_recurring_lineitems($resArray);
                $lineitem = $active_recurring[0];
                if ($resArray['response_code'] == 'OK' && isset($lineitem)) {
                    if (isset($lineitem['date_placed'])) {
                        $prev_billing = date_i18n(get_option('date_format'), strtotime($lineitem['date_placed']));
                    } else {
                        if ($last_payment = $psts->last_transaction($blog_id)) {
                            $prev_billing = date_i18n(get_option('date_format'), $last_payment['timestamp']);
                        } else {
                            $prev_billing = __("None yet with this subscription <small>(only initial separate single payment has been made, or you've recently modified your subscription)</small>", 'psts');
                        }
                    }
                    if (isset($lineitem['date_next'])) {
                        $next_billing = date_i18n(get_option('date_format'), strtotime($lineitem['date_next']));
                    } els 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_process_running函数代码示例发布时间:2022-05-15
下一篇:
PHP is_pro函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap