Example #1
0
 public static function last_gateway($blog_id)
 {
     // Try to avoid another load
     if (!empty(self::$last_site) && (self::$last_site->blog_ID = $blog_id)) {
         $site = self::$last_site;
     } else {
         $site = self::get_site($blog_id);
     }
     if (!empty($site)) {
         return ProSites_Helper_Gateway::convert_legacy($site->gateway);
     } else {
         return false;
     }
 }
        function modify_form($blog_id)
        {
            global $psts, $wpdb;
            if (!ProSites_Helper_Gateway::is_last_gateway_used($blog_id, self::get_slug())) {
                return false;
            }
            $active_member = false;
            $canceled_member = false;
            //get subscription info
            $profile_id = $this->get_profile_id($blog_id);
            if ($profile_id) {
                $resArray = $this->tcheckout_get_profile_detail($profile_id);
                $active_recurring = $this->get_recurring_lineitems($resArray);
                $lineitem = $active_recurring[0];
                if ($resArray['response_code'] == 'OK' && $lineitem['status'] == 'active') {
                    $active_member = true;
                    $next_payment_timestamp = strtotime($lineitem['date_next']);
                } else {
                    if ($resArray['response_code'] == 'OK' && empty($lineitem)) {
                        $canceled_member = true;
                    }
                }
            }
            $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id));
            if ($active_member) {
                ?>
				<h4><?php 
                _e('Cancelations:', 'psts');
                ?>
</h4>
				<label><input type="radio" name="twocheckout_mod_action"
				              value="cancel"/> <?php 
                _e('Cancel Subscription Only', 'psts');
                ?>
					<small>(<?php 
                printf(__('Their access will expire on %s', 'psts'), $end_date);
                ?>
)</small>
				</label><br/>
				<?php 
                if ($last_payment = $psts->last_transaction($blog_id)) {
                    $days_left = ($next_payment_timestamp - time()) / 60 / 60 / 24;
                    $period = $wpdb->get_var("SELECT term FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '{$blog_id}'");
                    $refund = intval($period) ? round($days_left / (intval($period) * 30.4166) * $last_payment['amount'], 2) : 0;
                    if ($refund > $last_payment['amount']) {
                        $refund = $last_payment['amount'];
                    }
                    ?>
					<label><input type="radio" name="twocheckout_mod_action"
					              value="cancel_refund"/> <?php 
                    printf(__('Cancel Subscription and Refund Full (%s) Last Payment', 'psts'), $psts->format_currency(false, $last_payment['amount']));
                    ?>
						<small>(<?php 
                    printf(__('Their access will expire on %s', 'psts'), $end_date);
                    ?>
)</small>
					</label><br/>
					<?php 
                    if ($refund) {
                        ?>
						<label><input type="radio" name="twocheckout_mod_action"
						              value="cancel_refund_pro"/> <?php 
                        printf(__('Cancel Subscription and Refund Prorated (%s) Last Payment', 'psts'), $psts->format_currency(false, $refund));
                        ?>
							<small>(<?php 
                        printf(__('Their access will expire on %s', 'psts'), $end_date);
                        ?>
)
							</small>
						</label><br/>
					<?php 
                    }
                    ?>

					<h4><?php 
                    _e('Refunds:', 'psts');
                    ?>
</h4>
					<label><input type="radio" name="twocheckout_mod_action"
					              value="refund"/> <?php 
                    printf(__('Refund Full (%s) Last Payment', 'psts'), $psts->format_currency(false, $last_payment['amount']));
                    ?>
						<small>(<?php 
                    _e('Their subscription and access will continue', 'psts');
                    ?>
)</small>
					</label><br/>
					<label><input type="radio" name="twocheckout_mod_action"
					              value="partial_refund"/> <?php 
                    printf(__('Refund a Partial %s Amount of Last Payment', 'psts'), $psts->format_currency() . '<input type="text" name="refund_amount" size="4" value="' . $last_payment['amount'] . '" />');
                    ?>
						<small>(<?php 
                    _e('Their subscription and access will continue', 'psts');
                    ?>
)</small>
					</label><br/>

				<?php 
                }
            } else {
                if ($canceled_member && ($last_payment = $psts->last_transaction($blog_id))) {
                    ?>
					<h4><?php 
                    _e('Refunds:', 'psts');
                    ?>
</h4>
					<label><input type="radio" name="twocheckout_mod_action"
					              value="refund"/> <?php 
                    printf(__('Refund Full (%s) Last Payment', 'psts'), $psts->format_currency(false, $last_payment['amount']));
                    ?>
						<small>(<?php 
                    _e('Their subscription and access will continue', 'psts');
                    ?>
)</small>
					</label><br/>
					<label><input type="radio" name="twocheckout_mod_action"
					              value="partial_refund"/> <?php 
                    printf(__('Refund a Partial %s Amount of Last Payment', 'psts'), $psts->format_currency() . '<input type="text" name="refund_amount" size="4" value="' . $last_payment['amount'] . '" />');
                    ?>
						<small>(<?php 
                    _e('Their subscription and access will continue', 'psts');
                    ?>
)</small>
					</label><br/>
				<?php 
                } else {
                    ?>
				<?php 
                }
            }
        }
 /**
  * Return Currency for Paypal
  * @return mixed|void
  */
 private static function currency()
 {
     global $psts;
     //Get the general currency set in Pro Sites
     $paypal_currency = $psts->get_setting('pypl_currency', 'USD');
     $currency = $psts->get_setting('currency', $paypal_currency);
     //Check if PayPal supports the selected currency
     $supported = ProSites_Helper_Gateway::supports_currency($currency, 'paypal');
     //Choose the selected currency
     $sel_currency = $supported ? $currency : $psts->get_setting('pypl_currency');
     return $sel_currency;
 }
Example #4
0
    /**
     * Renders the Modify Pro Site Status content for this gateway
     *
     * @param $blog_id
     *
     * @return bool
     */
    public static function modify_form($blog_id)
    {
        global $psts, $wpdb;
        if (!ProSites_Helper_Gateway::is_last_gateway_used($blog_id, self::get_slug())) {
            return false;
        }
        $active_member = false;
        $canceled_member = false;
        $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id));
        $customer_id = self::get_customer_data($blog_id)->customer_id;
        try {
            $existing_invoice_object = Stripe_Invoice::all(array("customer" => $customer_id, "count" => 1));
            $last_payment = isset($existing_invoice_object->data[0]->total) ? $existing_invoice_object->data[0]->total / 100 : '';
            $cancel_status = get_blog_option($blog_id, 'psts_stripe_canceled');
            if ($last_payment != '') {
                if ($cancel_status == 0 && $cancel_status != '') {
                    ?>
					<h4><?php 
                    _e('Cancelations:', 'psts');
                    ?>
</h4>
					<label><input type="radio" name="stripe_mod_action" value="cancel"/> <?php 
                    _e('Cancel Subscription Only', 'psts');
                    ?>
						<small>(<?php 
                    printf(__('Their access will expire on %s', 'psts'), $end_date);
                    ?>
)</small>
					</label><br/>

					<label><input type="radio" name="stripe_mod_action" value="cancel_refund"/> <?php 
                    printf(__('Cancel Subscription and Refund Full (%s) Last Payment', 'psts'), $psts->format_currency(false, $last_payment));
                    ?>
						<small>(<?php 
                    printf(__('Their access will expire on %s', 'psts'), $end_date);
                    ?>
)</small>
					</label><br/>
				<?php 
                }
                ?>

				<h4><?php 
                _e('Refunds:', 'psts');
                ?>
</h4>
				<label><input type="radio" name="stripe_mod_action" value="refund"/> <?php 
                printf(__('Refund Full (%s) Last Payment', 'psts'), $psts->format_currency(false, $last_payment));
                ?>
					<small>(<?php 
                _e('Their subscription and access will continue', 'psts');
                ?>
)</small>
				</label><br/>
				<label><input type="radio" name="stripe_mod_action" value="partial_refund"/> <?php 
                printf(__('Refund a Partial %s Amount of Last Payment', 'psts'), $psts->format_currency() . '<input type="text" name="refund_amount" size="4" value="' . $last_payment . '" />');
                ?>
					<small>(<?php 
                _e('Their subscription and access will continue', 'psts');
                ?>
)</small>
				</label><br/>
			<?php 
            }
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
Example #5
0
        /**
         * 'Payment Settings'
         *
         * @return string
         */
        public static function render_tab_payment()
        {
            global $psts;
            ProSites_Helper_Settings::settings_header(ProSites_Helper_Tabs_Settings::get_active_tab());
            ?>
			<div class="inside">
				<table class="form-table">
					<tr valign="top">
						<th scope="row"><?php 
            _e('Currency', 'psts');
            echo $psts->help_text(esc_html__('This is the currency that customers will be charged in. Your gateway currency is a fall-back option.', 'psts'), 'site-currency');
            ?>
</th>
						<td>
							<select id="psts-currency-select" name="psts[currency]" class="chosen" data-placeholder="<?php 
            echo esc_attr__('Enable gateways', 'psts');
            ?>
">
								<?php 
            $super = array('&#8304;', '&#185;', '&#178;', '&#179;', '&#8308;', '&#8309;', '&#8310;', '&#8311;', '&#8312;', '&#8313;');
            $gateways = ProSites_Helper_Gateway::get_gateways();
            $count = 0;
            $supported_key = '';
            foreach ($gateways as $key => $gateway) {
                if ('manual' == $key) {
                    continue;
                }
                $count++;
                $gateways[$key]['idx'] = $count;
                if ($count > 1) {
                    $supported_key .= '<sup> | </sup>';
                }
                $supported_key .= '<sup>' . $count . ' - ' . $gateway['name'] . '</sup>';
            }
            //								supports_currency
            //								foreach ( $psts->currencies as $key => $value ) {
            $all_currencies = ProSites_Model_Data::$currencies;
            ksort($all_currencies);
            foreach ($all_currencies as $key => $currency) {
                $supported_by = '';
                foreach ($gateways as $slug => $gateway) {
                    if (ProSites_Helper_Gateway::supports_currency($key, $slug)) {
                        if (strlen($supported_by) > 0) {
                            $supported_by .= '&#x207B;';
                        }
                        $supported_by .= $super[$gateway['idx']];
                    }
                }
                ?>
									<option value="<?php 
                echo $key;
                ?>
"<?php 
                selected($psts->get_setting('currency'), $key);
                ?>
><?php 
                echo esc_attr(strtoupper($key)) . '' . $supported_by . ' - ' . esc_attr($currency['name']) . ' - ' . $psts->format_currency($key);
                ?>
</option><?php 
            }
            ?>
							</select>
							<div>
								<?php 
            echo $supported_key;
            ?>
<br />
								<?php 
            echo sprintf('<sup>%s</sup>', esc_html__('Note: Where a currency is not supported by your gateway it may revert to your merchant account currency. (e.g. Stripe)', 'psts'));
            ?>
								<?php 
            echo sprintf('<sup><br />%s</sup>', esc_html__('Note: Updating your site currency might take time to load, please be patient.', 'psts'));
            ?>
							</div>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
            _e('Currency Symbol Position', 'psts');
            ?>
</th>
						<td>
							<label><input value="1" name="psts[curr_symbol_position]" type="radio"<?php 
            checked($psts->get_setting('curr_symbol_position', 1), 1);
            ?>
>
								<?php 
            echo $psts->format_currency();
            ?>
100</label><br/>
							<label><input value="2" name="psts[curr_symbol_position]" type="radio"<?php 
            checked($psts->get_setting('curr_symbol_position'), 2);
            ?>
>
								<?php 
            echo $psts->format_currency();
            ?>
 100</label><br/>
							<label><input value="3" name="psts[curr_symbol_position]" type="radio"<?php 
            checked($psts->get_setting('curr_symbol_position'), 3);
            ?>
>
								100<?php 
            echo $psts->format_currency();
            ?>
</label><br/>
							<label><input value="4" name="psts[curr_symbol_position]" type="radio"<?php 
            checked($psts->get_setting('curr_symbol_position'), 4);
            ?>
>
								100 <?php 
            echo $psts->format_currency();
            ?>
</label>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
            _e('Show Decimal in Prices', 'psts');
            ?>
</th>
						<td>
							<label><input value="1" name="psts[curr_decimal]" type="radio"<?php 
            checked($psts->get_setting('curr_decimal', 1), 1);
            ?>
>
								<?php 
            _e('Yes', 'psts');
            ?>
</label>
							<label><input value="0" name="psts[curr_decimal]" type="radio"<?php 
            checked($psts->get_setting('curr_decimal'), 0);
            ?>
>
								<?php 
            _e('No', 'psts');
            ?>
</label>
						</td>
					</tr>
				</table>
			</div>
			<?php 
        }
Example #6
0
	function admin_modify() {
		global $wpdb, $current_user;

		if ( ! is_super_admin() ) {
			echo "<p>" . __( 'Nice Try...', 'psts' ) . "</p>"; //If accessed properly, this message doesn't appear.
			return;
		}

		//add manual log entries
		if ( isset( $_POST['log_entry'] ) ) {
			$this->log_action( (int) $_GET['bid'], $current_user->display_name . ': "' . strip_tags( stripslashes( $_POST['log_entry'] ) ) . '"' );
			echo '<div id="message" class="updated fade"><p>' . __( 'Log entry added.', 'psts' ) . '</p></div>';
		}

		//extend blog
		if ( isset( $_POST['psts_extend'] ) ) {
			check_admin_referer( 'psts_extend' ); //check nonce

			if ( isset( $_POST['extend_permanent'] ) ) {
				$extend = 9999999999;
			} else {
				$months = $_POST['extend_months'];
				$days   = $_POST['extend_days'];
				$extend = strtotime( "+$months Months $days Days" ) - time();
			}
			$this->extend( (int) $_POST['bid'], $extend, __( 'Manual', 'psts' ), $_POST['extend_level'], false, false, true, true );
			echo '<div id="message" class="updated fade"><p>' . __( 'Site Extended.', 'psts' ) . '</p></div>';
		}

		if ( isset( $_POST['psts_transfer_pro'] ) ) {
			$new_bid     = (int) $_POST['new_bid'];
			$current_bid = (int) $_GET['bid'];
			if ( ! $new_bid ) {
				echo '<div id="message" class="error"><p>' . __( 'Please enter the Blog ID of a site to transfer to.', 'psts' ) . '</p></div>';
			} else if ( is_pro_site( $new_bid ) ) {
				echo '<div id="message" class="error"><p>' . __( 'Could not transfer Pro Status: The chosen site already is a Pro Site. You must remove Pro status and cancel any existing subscriptions tied to that site.', 'psts' ) . '</p></div>';
			} else {
				$current_level = $wpdb->get_row( "SELECT * FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '$current_bid'" );
				$new_expire    = $current_level->expire - time();
				$this->extend( $new_bid, $new_expire, $current_level->gateway, $current_level->level, $current_level->amount );
				$wpdb->query( "UPDATE {$wpdb->base_prefix}pro_sites SET term = '{$current_level->term}' WHERE blog_ID = '$new_bid'" );
				$this->withdraw( $current_bid );
				$this->log_action( $current_bid, sprintf( __( 'Pro Status transferred by %s to BlogID: %d', 'psts' ), $current_user->display_name, $new_bid ) );
				$this->log_action( $new_bid, sprintf( __( 'Pro Status transferred by %s from BlogID: %d', 'psts' ), $current_user->display_name, $current_bid ) );
				do_action( 'psts_transfer_pro', $current_bid, $new_bid ); //for gateways to hook into for api calls, etc.
				echo '<div id="message" class="updated fade"><p>' . sprintf( __( 'Pro Status transferred to BlogID: %d', 'psts' ), (int) $_POST['new_bid'] ) . '</p></div>';
			}
		}

		//remove blog
		if ( isset( $_POST['psts_modify'] ) ) {
			check_admin_referer( 'psts_modify' ); //check nonce

			do_action( 'psts_modify_process', (int) $_POST['bid'] );

			if ( isset( $_POST['psts_remove'] ) ) {
				$this->withdraw( (int) $_POST['bid'] );
				echo '<div id="message" class="updated fade"><p>' . __( 'Pro Site Status Removed.', 'psts' ) . '</p></div>';
			}

			if ( isset( $_POST['psts_receipt'] ) ) {
				$this->email_notification( (int) $_POST['bid'], 'receipt', $_POST['receipt_email'] );
				echo '<div id="message" class="updated fade"><p>' . __( 'Email receipt sent.', 'psts' ) . '</p></div>';
			}

		}

		//check blog_id
		if ( isset( $_GET['bid'] ) ) {
			$blog_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->base_prefix}blogs WHERE blog_ID = %d", (int) $_GET['bid'] ) );
			if ( ! $blog_count ) {
				echo '<div id="message" class="updated fade"><p>' . __( 'Invalid blog ID. Please try again.', 'psts' ) . '</p></div>';
				$blog_id = false;
			} else {
				$blog_id = (int) $_GET['bid'];
			}
		} else {
			$blog_id = false;
		}

		$activation_key = false;
		if ( isset( $_GET['activation_key'] ) ) {
			$activation_key = $_GET['activation_key'];
		}

		?>
		<div class="wrap">
		<script type="text/javascript">
			jQuery(document).ready(function () {
				jQuery('input.psts_confirm').click(function () {
					var answer = confirm("<?php _e('Are you sure you really want to do this?', 'psts'); ?>")
					if (answer) {
						return true;
					} else {
						return false;
					}
					;
				});
			});
		</script>
		<div class="icon32"><img src="<?php echo $this->plugin_url . 'images/modify.png'; ?>"/></div>
		<h2><?php _e( 'Pro Sites Management', 'psts' ); ?></h2>

		<?php
		if( $activation_key ) {
			$result = ProSites_Helper_Registration::activate_blog( $activation_key );
			$blog_id = $result;
		}

		if ( $blog_id ) { ?>
			<h3><?php _e( 'Manage Site', 'psts' ) ?>
			<?php
			if ( $name = get_blog_option( $blog_id, 'blogname' ) ) {
				echo ': ' . $name . ' (Blog ID: ' . $blog_id . ')';
			}

			echo '</h3>';

			$levels        = (array) get_site_option( 'psts_levels' );
			$current_level = $this->get_level( $blog_id );
			$expire        = $this->get_expire( $blog_id );
			$result        = $wpdb->get_row( "SELECT * FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '$blog_id'" );
			if ( $result ) {
				if ( $result->term == 1 || $result->term == 3 || $result->term == 12 ) {
					$term = sprintf( _n( '%s Month','%s Months', $result->term, 'psts' ), $result->term );
				} else {
					$term = $result->term;
				}
			} else {
				$term = 0;
			}

			if ( $expire && $expire > time() ) {
				echo '<p><strong>' . __( 'Current Pro Site', 'psts' ) . '</strong></p>';

				echo '<ul>';
				if ( $expire > 2147483647 ) {
					echo '<li>' . __( 'Pro Site privileges will expire: <strong>Never</strong>', 'psts' ) . '</li>';
				} else {
					$trialing = ProSites_Helper_Registration::is_trial( $blog_id );
					$active_trial = $trialing ? __( '(Active trial)', 'psts') : '';

					echo '<li>' . sprintf( __( 'Pro Site privileges will expire on: <strong>%s</strong>', 'psts' ), date_i18n( get_option( 'date_format' ), $expire ) ) . ' ' . $active_trial . '</li>';
				}

				echo '<li>' . sprintf( __( 'Level: <strong>%s</strong>', 'psts' ), $current_level . ' - ' . @$levels[ $current_level ]['name'] ) . '</li>';
				if ( $result->gateway ) {
					$nicename = ProSites_Helper_Gateway::get_nice_name( $result->gateway );
					echo '<li>' . sprintf( __( 'Payment Gateway: <strong>%s</strong>', 'psts' ), $nicename ) . '</li>';
				}
				if ( $term ) {
					echo '<li>' . sprintf( __( 'Payment Term: <strong>%s</strong>', 'psts' ), $term ) . '</li>';
				}
				echo '</ul>';

			} else if ( $expire && $expire <= time() ) {
				echo '<p><strong>' . __( 'Expired Pro Site', 'psts' ) . '</strong></p>';

				echo '<ul>';
				echo '<li>' . sprintf( __( 'Pro Site privileges expired on: <strong>%s</strong>', 'psts' ), date_i18n( get_option( 'date_format' ), $expire ) ) . '</li>';

				echo '<li>' . sprintf( __( 'Previous Level: <strong>%s</strong>', 'psts' ), $current_level . ' - ' . @$levels[ $current_level ]['name'] ) . '</li>';
				if ( $result->gateway ) {
					$nicename = ProSites_Helper_Gateway::get_nice_name( $result->gateway );
					echo '<li>' . sprintf( __( 'Previous Payment Gateway: <strong>%s</strong>', 'psts' ), $nicename ) . '</li>';
				}
				if ( $term ) {
					echo '<li>' . sprintf( __( 'Previous Payment Term: <strong>%s</strong>', 'psts' ), $term ) . '</li>';
				}
				echo '</ul>';

			} else {
				echo '<p><strong>"' . get_blog_option( $blog_id, 'blogname' ) . '" ' . __( 'has never been a Pro Site.', 'psts' ) . '</strong></p>';
			}

			//meta boxes hooked by gateway plugins
			if ( has_action( 'psts_subscription_info' ) || has_action( 'psts_subscriber_info' ) ) {
				?>
				<div class="metabox-holder">
					<?php if ( has_action( 'psts_subscription_info' ) ) { ?>
						<div style="width: 49%;" class="postbox-container">
							<div class="postbox">
								<h3 class="hndle" style="cursor:auto;">
									<span><?php _e( 'Subscription Information', 'psts' ); ?></span></h3>

								<div class="inside">
									<?php do_action( 'psts_subscription_info', $blog_id ); ?>
								</div>
							</div>
						</div>
					<?php } ?>

					<?php if ( has_action( 'psts_subscriber_info' ) ) { ?>
						<div style="width: 49%;margin-left: 2%;" class="postbox-container">
							<div class="postbox">
								<h3 class="hndle" style="cursor:auto;">
									<span><?php _e( 'Subscriber Information', 'psts' ); ?></span></h3>

								<div class="inside">
									<?php do_action( 'psts_subscriber_info', $blog_id ); ?>
								</div>
							</div>
						</div>
					<?php } ?>

					<div class="clear"></div>
				</div>
			<?php } ?>

			<div id="poststuff" class="metabox-holder">
				<div class="postbox">
					<h3 class="hndle" style="cursor:auto;"><span><?php _e( 'Account History', 'psts' ) ?></span></h3>

					<div class="inside">
						<span class="description"><?php _e( 'This logs basically every action done in the system regarding the site for an audit trail.', 'psts' ); ?></span>

						<div style="height:150px;overflow:auto;margin-top:5px;margin-bottom:5px;">
							<table class="widefat">
								<?php
								$log = get_blog_option( $blog_id, 'psts_action_log' );
								$time_offset = ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
								if ( is_array( $log ) && count( $log ) ) {
									$log = array_reverse( $log, true );
									foreach ( $log as $timestamp => $memo ) {
										$class = ( isset( $class ) && $class == 'alternate' ) ? '' : 'alternate';
										$localtime = $timestamp + $time_offset;
										echo '<tr class="'.$class.'"><td><strong>' . date_i18n( __('Y-m-d g:i:s a', 'psts'), $localtime ) . '</strong></td><td>' . esc_html($memo) . '</td></tr>';
									}
								} else {
									echo '<tr><td colspan="2">' . __( 'No history recorded for this site yet.', 'psts' ) . '</td></tr>';
								}
								?>
							</table>
						</div>
						<form method="post" action="">
							<input type="text" placeholder="<?php _e( 'Add a custom log entry...', 'psts' ); ?>" name="log_entry" style="width:91%;"/>
							<input type="submit" class="button-secondary" name="add_log_entry" value="<?php _e( 'Add &raquo;', 'psts' ) ?>" style="width:8%;float:right;"/>
						</form>
					</div>
				</div>
			</div>


			<div id="poststuff" class="metabox-holder">

				<div style="width: 49%;" class="postbox-container">
					<div class="postbox">
						<h3 class="hndle" style="cursor:auto;">
							<span><?php _e( 'Manually Extend Pro Site Status', 'psts' ) ?></span></h3>

						<div class="inside">
							<span class="description"><?php _e( 'Please note that these changes will not adjust the payment dates or level for any existing subscription.', 'psts' ); ?></span>

							<form method="post" action="">
								<table class="form-table">
									<?php wp_nonce_field( 'psts_extend' ) ?>
									<input type="hidden" name="bid" value="<?php echo $blog_id; ?>"/>
									<tr valign="top">
										<th scope="row"><?php _e( 'Period', 'psts' ) ?></th>
										<td><select name="extend_months">
												<?php
												for ( $counter = 0; $counter <= 36; $counter += 1 ) {
													echo '<option value="' . $counter . '">' . $counter . '</option>' . "\n";
												}
												?>
											</select><?php _e( 'Months', 'psts' ); ?>
											<select name="extend_days">
												<?php
												for ( $counter = 0; $counter <= 30; $counter += 1 ) {
													echo '<option value="' . $counter . '">' . $counter . '</option>' . "\n";
												}
												?>
											</select><?php _e( 'Days', 'psts' ); ?>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'or', 'psts' ); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label><input type="checkbox" name="extend_permanent" value="1"/> <?php _e( 'Permanent', 'psts' ); ?>
											</label>
											<br/><?php _e( 'Period you wish to extend the site. Leave at zero to only change the level.', 'psts' ); ?>
										</td>
									</tr>
									<tr valign="top">
										<th scope="row"><?php _e( 'Level', 'psts' ) ?></th>
										<td><select name="extend_level">
												<?php
												foreach ( $levels as $level => $value ) {
													?>
													<option value="<?php echo $level; ?>"<?php selected( $current_level, $level ) ?>><?php echo $level . ': ' . esc_attr( $value['name'] ); ?></option><?php
												}
												?>
											</select>
											<br/><?php _e( 'Choose what level the site should have access to.', 'psts' ); ?>
										</td>
									</tr>
									<tr valign="top">
										<td colspan="2" style="text-align:right;">
											<input class="button-primary" type="submit" name="psts_extend" value="<?php _e( 'Extend &raquo;', 'psts' ) ?>"/>
										</td>
									</tr>
								</table>
								<hr/>
								<table class="form-table">
									<tr valign="top">
										<td><label>Transfer Pro status to Blog ID:
												<input type="text" name="new_bid" size="3"/></label></td>
										<td style="text-align:right;">
											<input class="button-primary psts_confirm" type="submit" name="psts_transfer_pro" value="<?php _e( 'Transfer &raquo;', 'psts' ) ?>"/>
										</td>
									</tr>
								</table>
							</form>
						</div>
					</div>
				</div>

				<?php if ( is_pro_site( $blog_id ) || has_action( 'psts_modify_form' ) ) { ?>
					<div style="width: 49%;margin-left: 2%;" class="postbox-container">
						<div class="postbox">
							<h3 class="hndle" style="cursor:auto;">
								<span><?php _e( 'Modify Pro Site Status', 'psts' ) ?></span></h3>

							<div class="inside">
								<form method="post" action="">
									<?php wp_nonce_field( 'psts_modify' ) ?>
									<input type="hidden" name="bid" value="<?php echo $blog_id; ?>"/>

									<?php do_action( 'psts_modify_form', $blog_id ); ?>

									<?php if ( is_pro_site( $blog_id ) ) { ?>
										<p>
											<label><input type="checkbox" name="psts_remove" value="1"/> <?php _e( 'Remove Pro status from this site.', 'psts' ); ?>
											</label></p>
									<?php } ?>

									<?php if ( $last_payment = $this->last_transaction( $blog_id ) ) { ?>
										<p>
											<label><input type="checkbox" name="psts_receipt" value="1"/> <?php _e( 'Email a receipt copy for last payment to:', 'psts' ); ?>
												<input type="text" name="receipt_email" value="<?php echo get_blog_option( $blog_id, 'admin_email' ); ?>"/></label>
										</p>
									<?php } ?>

									<p class="submit">
										<input type="submit" name="psts_modify" class="button-primary psts_confirm" value="<?php _e( 'Modify &raquo;', 'psts' ) ?>"/>
									</p>
								</form>
							</div>
						</div>
					</div>
				<?php } ?>
			</div>
			<?php

			//show blog_id form
		} else {
			?>
			<div class="metabox-holder">
				<div class="postbox">
					<h3 class="hndle" style="cursor:auto;"><span><?php _e( 'Manage a Site', 'psts' ) ?></span></h3>

					<div class="inside">
						<form method="get" action="">
							<table class="form-table">
								<input type="hidden" name="page" value="psts"/>
								<tr valign="top">
									<th scope="row"><?php _e( 'Blog ID:', 'psts' ) ?></th>
									<td><input type="text" size="17" name="bid" value=""/>
										<input class="button-secondary" type="submit" value="<?php _e( 'Continue &raquo;', 'psts' ) ?>"/>
									</td>
								</tr>
							</table>
						</form>
						<hr />
						<form method="get" action="">
							<table class="form-table">
								<input type="hidden" name="page" value="psts"/>
								<tr valign="top">
									<th scope="row"><?php _e( 'Activation Key:', 'psts' ) ?></th>
									<td><input type="text" size="17" name="activation_key" value=""/>
										<input class="button-secondary" type="submit" value="<?php _e( 'Activate Blog &raquo;', 'psts' ) ?>"/>
									</td>
								</tr>
							</table>
						</form>
						<hr/>
						<form method="get" action="sites.php" name="searchform">
							<table class="form-table">
								<tr valign="top">
									<th scope="row"><?php _e( 'Or search for a site:<br /><small>By Blog ID, IP address or Path/Domain</small>', 'psts' ) ?></th>
									<td><input type="text" size="17" value="" name="s"/>
										<input class="button-secondary" type="submit" value="<?php _e( 'Search Sites &raquo;', 'psts' ) ?>" id="submit_sites" name="submit"/>
									</td>
								</tr>
							</table>
						</form>
					</div>
				</div>
			</div>
		<?php
		}
		echo '</div>';
	}
Example #7
0
 public static function load_gateway_currencies()
 {
     $gateways = ProSites_Helper_Gateway::get_gateways();
     foreach ($gateways as $key => $gateway) {
         ProSites_Model_Data::load_currencies($key, $gateway);
     }
 }
Example #8
0
 public static function prepend_plan_details($content, $blog_id, $domain)
 {
     global $psts;
     $plan_content = '';
     $gateways = ProSites_Helper_Gateway::get_gateways();
     $gateway_details = self::get_gateway_details($gateways);
     $is_pro_site = is_pro_site($blog_id);
     $session_data = array();
     $session_data['new_blog_details'] = ProSites_Helper_Session::session('new_blog_details');
     $session_data['upgraded_blog_details'] = ProSites_Helper_Session::session('upgraded_blog_details');
     // No existing details for a new signup
     if (!is_user_logged_in() || isset($session_data['new_blog_details'])) {
         $pre_content = '';
         if (isset($session_data['new_blog_details']) && isset($session_data['new_blog_details']['payment_success']) && true === $session_data['new_blog_details']['payment_success'] || isset($session_data['upgraded_blog_details']) && isset($session_data['upgraded_blog_details']['payment_success']) && true === $session_data['upgraded_blog_details']['payment_success']) {
             $pre_content .= self::render_payment_submitted();
         }
         // Check manual payments
         if (isset($session_data['new_blog_details']) && isset($session_data['new_blog_details']['manual_submitted']) && true === $session_data['new_blog_details']['manual_submitted']) {
             $pre_content .= self::render_manual_submitted();
         }
         if (!empty($pre_content)) {
             return $pre_content;
         } else {
             return $content;
         }
     }
     if ($is_pro_site && (!isset($_GET['action']) || $_GET['action'] == 'complete' && isset($_GET['token']))) {
         // EXISTING DETAILS
         if (isset($gateways) && isset($gateway_details)) {
             $gateway_order = isset($gateway_details['order']) ? $gateway_details['order'] : array();
             $plan_content = self::render_current_plan_information(array(), $blog_id, $domain, $gateways, $gateway_order);
             $plan_content .= '<h2>' . esc_html__('Change your plan', 'psts') . '</h2>';
         }
     } else {
         // NOTIFICATIONS ONLY
         $plan_content = self::render_notification_information(array(), $blog_id, $domain, $gateways, $gateway_details['order']);
     }
     return $plan_content . $content;
 }
Example #9
0
 function subscriber_info($blog_id)
 {
     global $psts;
     if (!ProSites_Helper_Gateway::is_last_gateway_used($blog_id, self::get_slug())) {
         return false;
     }
     $email = get_blog_option($blog_id, 'admin_email');
     $user = get_user_by('email', $email);
     $name = !empty($user->data) && !empty($user->data->display_name) ? $user->data->display_name : $user->data->user_nicename;
     if (!empty($name)) {
         echo '<p> <strong>' . $name . '</strong>';
         echo "<p>Email: <strong>" . $email . "</strong></p>";
     } else {
         echo __("Subscriber details not available.", 'psts');
     }
 }