Ejemplo n.º 1
0
function rcp_admin_scripts($hook)
{
    global $rcp_options, $rcp_members_page, $rcp_subscriptions_page, $rcp_discounts_page, $rcp_payments_page, $rcp_reports_page, $rcp_settings_page, $rcp_export_page, $rcp_help_page;
    $pages = array($rcp_members_page, $rcp_subscriptions_page, $rcp_discounts_page, $rcp_payments_page, $rcp_reports_page, $rcp_settings_page, $rcp_export_page, $rcp_help_page);
    if (in_array($hook, $pages)) {
        wp_enqueue_script('jquery-ui-sortable');
        wp_enqueue_script('jquery-ui-datepicker');
        wp_enqueue_script('bbq', RCP_PLUGIN_URL . 'includes/js/jquery.ba-bbq.min.js');
        wp_enqueue_script('rcp-admin-scripts', RCP_PLUGIN_URL . 'includes/js/admin-scripts.js', array('jquery'), RCP_PLUGIN_VERSION);
    }
    if ($rcp_reports_page == $hook) {
        wp_enqueue_script('jquery-flot', RCP_PLUGIN_URL . 'includes/js/jquery.flot.min.js');
    }
    if ($hook == $rcp_help_page) {
        wp_enqueue_style('jquery-snippet', RCP_PLUGIN_URL . 'includes/css/jquery.snippet.min.css');
        wp_enqueue_script('jquery-snippet', RCP_PLUGIN_URL . 'includes/js/jquery.snippet.min.js');
    }
    if (in_array($hook, $pages)) {
        wp_localize_script('rcp-admin-scripts', 'rcp_vars', array('rcp_member_nonce' => wp_create_nonce('rcp_member_nonce'), 'deactivate_user' => __('Are you sure you wish to cancel this member\'s subscription?', 'rcp'), 'delete_subscription' => __('If you delete this subscription, all members registered with this level will be canceled. Proceed?', 'rcp'), 'delete_payment' => __('Are you sure you want to delete this payment? This action is irreversible. Proceed?', 'rcp'), 'missing_username' => __('You must choose a username', 'rcp'), 'currency_sign' => rcp_currency_filter(''), 'currency_pos' => isset($rcp_options['currency_position']) ? $rcp_options['currency_position'] : 'before', 'use_as_logo' => __('Use as Logo', 'rcp'), 'choose_logo' => __('Choose a Logo', 'rcp')));
    }
}
								<option value="<?php echo esc_attr( $key ); ?>" data-supports-recurring="<?php echo esc_attr( $recurring ); ?>"><?php echo esc_html( $gateway ); ?></option>
							<?php endforeach; ?>
						</select>
						<label for="rcp_gateway"><?php _e( 'Choose Your Payment Method', 'rcp' ); ?></label>
					</p>
				</fieldset>
			<?php else: ?>
				<?php foreach( $gateways as $key => $gateway ) : $recurring = rcp_gateway_supports( $key, 'recurring' ) ? 'yes' : 'no'; ?>
					<input type="hidden" name="rcp_gateway" value="<?php echo esc_attr( $key ); ?>" data-supports-recurring="<?php echo esc_attr( $recurring ); ?>"/>
				<?php endforeach; ?>
			<?php endif; ?>
		</div>

		<fieldset class="rcp_level_details_fieldset">
			<p id="rcp_level_details_wrap" class="rcp_level" rel="<?php echo esc_attr( $level->price ); ?>">
				<span class="rcp_price"><?php echo rcp_currency_filter( $level->price ); ?></span>
				<span class="rcp_sep">&nbsp;/&nbsp;</span>
				<span class="rcp_duration"><?php echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit( $level->duration_unit, $level->duration ) : __( 'unlimited', 'rcp' ); ?></span>
			</p>
		</fieldset>

	<?php endif; ?>

	<?php do_action( 'rcp_before_registration_submit_field' ); ?>

	<p id="rcp_submit_wrap">
		<input type="hidden" name="rcp_level" value="<?php echo absint( $rcp_level ); ?>"/>
		<input type="hidden" name="rcp_register_nonce" value="<?php echo wp_create_nonce('rcp-register-nonce' ); ?>"/>
		<input type="submit" name="rcp_submit_registration" id="rcp_submit" value="<?php echo apply_filters ( 'rcp_registration_register_button', __( 'Register', 'rcp' ) ); ?>"/>
	</p>
</form>
/**
 * Generate PDF Invoice
 *
 * Loads and stores all of the data for the payment.  The HTML2PDF class is
 * instantiated and do_action() is used to call the invoice template which goes
 * ahead and renders the invoice.
 *
 * @since 2.0
 * @uses HTML2PDF
 * @uses wp_is_mobile()
*/
function rcp_generate_pdf_invoice($payment_id = 0)
{
    global $rcp_options;
    include_once RCP_PLUGIN_DIR . '/includes/libraries/tcpdf/tcpdf.php';
    include_once RCP_PLUGIN_DIR . '/includes/class-rcp-pdf-invoice.php';
    if (empty($payment_id)) {
        return;
    }
    $payments_db = new RCP_Payments();
    $payment = $payments_db->get_payment($payment_id);
    if (!$payment) {
        wp_die(__('This payment record does not exist', 'rcp'));
    }
    if ($payment->user_id != get_current_user_id() && !current_user_can('manage_options')) {
        wp_die(__('You do not have permission to download this invoice', 'rcp'));
    }
    $userdata = get_userdata($payment->user_id);
    $company_name = isset($rcp_options['invoice_company']) ? $rcp_options['invoice_company'] : '';
    $payment_date = date_i18n(get_option('date_format'), strtotime($payment->date));
    $pdf = new RCP_PDF_Invoice('P', 'mm', 'A4', true, 'UTF-8', false);
    $pdf->SetDisplayMode('real');
    $pdf->setJPEGQuality(100);
    $pdf->SetTitle(sprintf(__('Invoice #%d', 'rcp'), $payment->id));
    $pdf->SetCreator(__('Restrict Content Pro', 'rcp'));
    $pdf->SetAuthor(get_option('blogname'));
    $pdf->SetMargins(8, 8, 8);
    $pdf->SetX(8);
    $pdf->AddPage();
    $font = isset($rcp_options['invoice_enable_char_support']) ? 'freesans' : 'Helvetica';
    $pdf->Ln(5);
    if (isset($rcp_options['invoice_logo']) && !empty($rcp_options['invoice_logo'])) {
        $pdf->Image($rcp_options['invoice_logo'], 8, 20, '', '11', '', false, 'LTR', false, 96);
    } else {
        $pdf->SetFont($font, '', 22);
        $pdf->SetTextColor(50, 50, 50);
        $pdf->Cell(0, 0, $company_name, 0, 2, 'L', false);
    }
    $pdf->SetFont($font, '', 18);
    $pdf->SetY(45);
    $pdf->Cell(0, 0, __('Invoice', 'rcp'), 0, 2, 'L', false);
    $pdf->SetXY(8, 60);
    $pdf->SetFont($font, 'B', 10);
    $pdf->Cell(0, 6, __('From', 'rcp'), 0, 2, 'L', false);
    $pdf->SetFont($font, '', 10);
    if (!empty($rcp_options['invoice_name'])) {
        $pdf->Cell(0, $pdf->calculate_line_height($rcp_options['invoice_name']), $rcp_options['invoice_name'], 0, 2, 'L', false);
    }
    if (!empty($rcp_options['invoice_address'])) {
        $pdf->Cell(0, $pdf->calculate_line_height($rcp_options['invoice_address']), $rcp_options['invoice_address'], 0, 2, 'L', false);
    }
    if (!empty($rcp_options['invoice_address_2'])) {
        $pdf->Cell(0, $pdf->calculate_line_height($rcp_options['invoice_address_2']), $rcp_options['invoice_address_2'], 0, 2, 'L', false);
    }
    if (!empty($rcp_options['invoice_city_state_zip'])) {
        $pdf->Cell(0, $pdf->calculate_line_height($rcp_options['invoice_city_state_zip']), $rcp_options['invoice_city_state_zip'], 0, 2, 'L', false);
    }
    if (!empty($rcp_options['invoice_email'])) {
        $pdf->SetTextColor(41, 102, 152);
        $pdf->Cell(0, $pdf->calculate_line_height($rcp_options['invoice_email']), $rcp_options['invoice_email'], 0, 2, 'L', false);
    }
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Ln(12);
    $pdf->Ln();
    $pdf->SetXY(60, 60);
    $pdf->SetFont($font, 'B', 10);
    $pdf->Cell(0, 6, __('To', 'rcp'), 0, 2, 'L', false);
    $pdf->SetFont($font, '', 10);
    $pdf->Cell(0, $pdf->calculate_line_height($userdata->display_name), $userdata->display_name, 0, 2, 'L', false);
    $pdf->SetTextColor(41, 102, 152);
    $pdf->Cell(0, 6, $userdata->user_email, 0, 2, 'L', false);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Ln(5);
    $pdf->SetX(60);
    $pdf->SetTextColor(110, 110, 110);
    $pdf->Cell(30, 6, __('Invoice Date', 'rcp'), 0, 0, 'L', false);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Cell(0, 6, $payment_date, 0, 2, 'L', false);
    $pdf->SetX(60);
    $pdf->SetTextColor(110, 110, 110);
    $pdf->Cell(30, 6, __('Invoice ID', 'rcp'), 0, 0, 'L', false);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Cell(0, 6, '#' . $payment->id, 0, 2, 'L', false);
    $pdf->SetX(60);
    $pdf->SetTextColor(110, 110, 110);
    $pdf->Cell(30, 6, __('Subscription Key', 'rcp'), 0, 0, 'L', false);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Cell(0, 6, $payment->subscription_key, 0, 2, 'L', false);
    $pdf->SetX(60);
    $pdf->SetX(60);
    $pdf->SetTextColor(110, 110, 110);
    $pdf->Cell(30, 6, __('Payment Method', 'rcp'), 0, 0, 'L', false);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Cell(0, 6, $payment->payment_type, 0, 2, 'L', false);
    $pdf->SetX(60);
    $pdf->SetTextColor(110, 110, 110);
    $pdf->Cell(30, 6, __('Transaction ID', 'rcp'), 0, 0, 'L', false);
    $pdf->SetTextColor(50, 50, 50);
    $pdf->Cell(0, 6, $payment->transaction_id, 0, 2, 'L', false);
    $pdf->Ln(5);
    $pdf->SetX(61);
    $pdf->SetFillColor(224, 224, 224);
    $pdf->SetDrawColor(209, 209, 209);
    $pdf->SetFont($font, 'B', 10);
    $pdf->Cell(140, 8, __('Invoice Items', 'rcp'), 1, 2, 'C', true);
    $pdf->Ln(0.2);
    $pdf->SetX(61);
    $pdf->SetDrawColor(194, 221, 231);
    $pdf->SetFillColor(238, 238, 238);
    $pdf->SetFont($font, '', 9);
    $pdf->Cell(102, 7, __('Subscription', 'rcp'), 'BL', 0, 'C', false);
    $pdf->Cell(38, 7, __('Amount', 'rcp'), 'BR', 0, 'C', false);
    $pdf->Ln(0.2);
    $pdf->Ln();
    $pdf->SetX(61);
    $pdf->SetDrawColor(238, 238, 238);
    $pdf->SetX(61);
    $pdf->SetFont($font, '', 10);
    $amount = utf8_encode(html_entity_decode(rcp_currency_filter($payment->amount), ENT_COMPAT, 'UTF-8'));
    if (function_exists('iconv')) {
        // Ensure characters like euro; are properly converted. See GithuB issue #472 and #1570
        $amount = iconv('UTF-8', 'windows-1252', $amount);
    }
    $pdf->Cell(102, 8, html_entity_decode($payment->subscription), 'B', 0, 'L', false);
    $pdf->SetFillColor(250, 250, 250);
    $pdf->Cell(38, 8, $amount, 'B', 2, 'R', true);
    $pdf->Ln(5);
    $pdf->SetX(61);
    $pdf->SetFillColor(224, 224, 224);
    $pdf->SetDrawColor(209, 209, 209);
    $pdf->SetFont($font, 'B', 10);
    $pdf->Cell(140, 8, __('Invoice Totals', 'rcp'), 1, 2, 'C', true);
    $pdf->Ln(0.2);
    $pdf->SetDrawColor(238, 238, 238);
    $pdf->SetFillColor(250, 250, 250);
    $pdf->SetX(61);
    $pdf->SetFont($font, 'B', 11);
    $pdf->Cell(102, 10, __('Total', 'rcp'), 'B', 0, 'L', false);
    $pdf->Cell(38, 10, $amount, 'B', 2, 'R', true);
    $pdf->Ln(10);
    if (!empty($rcp_options['invoice_notes'])) {
        $pdf->SetX(60);
        $pdf->SetFont($font, '', 13);
        $pdf->Cell(0, 6, __('Additional Notes', 'rcp'), 0, 2, 'L', false);
        $pdf->Ln(2);
        $pdf->SetX(60);
        $pdf->SetFont($font, '', 10);
        $pdf->MultiCell(0, 6, $rcp_options['invoice_notes'], 0, 'L', false);
    }
    if (wp_is_mobile()) {
        $pdf->Output(apply_filters('rcp_invoice_filename_prefix', 'Invoice-') . $payment->id . '.pdf', 'I');
    } else {
        $pdf->Output(apply_filters('rcp_invoice_filename_prefix', 'Invoice-') . $payment->id . '.pdf', 'D');
    }
    die;
    // Stop the rest of the page from processsing and being sent to the browser
}
            echo esc_attr(absint($level->id));
            ?>
" <?php 
            if ($level->duration == 0) {
                echo 'data-duration="forever"';
            }
            ?>
/>&nbsp;
						<span class="rcp_subscription_level_name"><?php 
            echo rcp_get_subscription_name($level->id);
            ?>
</span><span class="rcp_separator">&nbsp;-&nbsp;</span><span class="rcp_price" rel="<?php 
            echo esc_attr($level->price);
            ?>
"><?php 
            echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'rcp');
            ?>
<span class="rcp_separator">&nbsp;-&nbsp;</span></span>
						<span class="rcp_level_duration"><?php 
            echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'rcp');
            ?>
</span>
						<div class="rcp_level_description"> <?php 
            echo rcp_get_subscription_description($level->id);
            ?>
</div>
					</li>
					<?php 
        }
        ?>
				<?php 
        // Fees
        ?>
				<?php 
        if (rcp_get_registration()->get_fees()) {
            foreach (rcp_get_registration()->get_fees() as $fee) {
                $sign = $fee['amount'] < 0 ? '-' : '';
                $fee['amount'] = abs($fee['amount']);
                $fee['amount'] = number_format($fee['amount'], rcp_currency_decimal_filter());
                ?>
					<tr class="rcp-fee">
						<td><?php 
                echo esc_html($fee['description']);
                ?>
</td>
						<td><?php 
                echo esc_html($sign . rcp_currency_filter($fee['amount']));
                ?>
</td>
					</tr>
				<?php 
            }
        }
        ?>

			<?php 
    }
    ?>
		<?php 
}
?>
function rcp_print_user_payments( $user_id ) {
	$payments = new RCP_Payments;
	$user_payments = $payments->get_payments( array( 'user_id' => $user_id ) );
	$payments_list = '';
	if( $user_payments ) :
		foreach( $user_payments as $payment ) :
			$transaction_id = ! empty( $payment->transaction_id ) ? $payment->transaction_id : '';
			$payments_list .= '<ul class="rcp_payment_details">';
				$payments_list .= '<li>' . __( 'Date', 'rcp' ) . ': ' . $payment->date . '</li>';
				$payments_list .= '<li>' . __( 'Subscription', 'rcp' ) . ': ' . $payment->subscription . '</li>';
				$payments_list .= '<li>' . __( 'Payment Type', 'rcp' ) . ': ' . $payment->payment_type . '</li>';
				$payments_list .= '<li>' . __( 'Subscription Key', 'rcp' ) . ': ' . $payment->subscription_key . '</li>';
				$payments_list .= '<li>' . __( 'Transaction ID', 'rcp' ) . ': ' . $transaction_id . '</li>';
				if( $payment->amount != '' ) {
					$payments_list .= '<li>' . __( 'Amount', 'rcp' ) . ': ' . rcp_currency_filter( $payment->amount ) . '</li>';
				} else {
					$payments_list .= '<li>' . __( 'Amount', 'rcp' ) . ': ' . rcp_currency_filter( $payment->amount2 ) . '</li>';
				}
			$payments_list .= '</ul>';
		endforeach;
	else :
		$payments_list = '<p class="rcp-no-payments">' . __( 'No payments recorded', 'rcp' ) . '</p>';
	endif;
	return $payments_list;
}
function rcp_filter_email_tags($message, $user_id, $display_name)
{
    $user = get_userdata($user_id);
    $site_name = stripslashes_deep(html_entity_decode(get_bloginfo('name'), ENT_COMPAT, 'UTF-8'));
    $rcp_payments = new RCP_Payments();
    $message = str_replace('%blogname%', $site_name, $message);
    $message = str_replace('%username%', $user->user_login, $message);
    $message = str_replace('%useremail%', $user->user_email, $message);
    $message = str_replace('%firstname%', html_entity_decode($user->user_firstname, ENT_COMPAT, 'UTF-8'), $message);
    $message = str_replace('%lastname%', html_entity_decode($user->user_lastname, ENT_COMPAT, 'UTF-8'), $message);
    $message = str_replace('%displayname%', html_entity_decode($display_name, ENT_COMPAT, 'UTF-8'), $message);
    $message = str_replace('%expiration%', rcp_get_expiration_date($user_id), $message);
    $message = str_replace('%subscription_name%', html_entity_decode(rcp_get_subscription($user_id), ENT_COMPAT, 'UTF-8'), $message);
    $message = str_replace('%subscription_key%', rcp_get_subscription_key($user_id), $message);
    $message = str_replace('%amount%', html_entity_decode(rcp_currency_filter($rcp_payments->last_payment_of_user($user_id)), ENT_COMPAT, 'UTF-8'), $message);
    return apply_filters('rcp_email_tags', $message, $user_id);
}
function rcp_member_levels_page()
{
    global $rcp_options, $rcp_db_name, $wpdb;
    $page = admin_url('/admin.php?page=rcp-member-levels');
    ?>
	<div class="wrap">
		<?php 
    if (isset($_GET['edit_subscription'])) {
        include 'edit-subscription.php';
    } else {
        ?>
			<h2><?php 
        _e('Subscription Levels', 'rcp');
        ?>
</h2>
			<table class="wp-list-table widefat fixed posts rcp-subscriptions">
				<thead>
					<tr>
						<th scope="col" class="rcp-sub-name-col column-primary"><?php 
        _e('Name', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-desc-col"><?php 
        _e('Description', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-level-col"><?php 
        _e('Access Level', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-duration-col"><?php 
        _e('Duration', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-price-col"><?php 
        _e('Price', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-subs-col"><?php 
        _e('Subscribers', 'rcp');
        ?>
</th>
						<?php 
        do_action('rcp_levels_page_table_header');
        ?>
						<th scope="col" class="rcp-sub-order-col"><?php 
        _e('Order', 'rcp');
        ?>
</th>
					</tr>
				</thead>
				<tbody id="the-list">
				<?php 
        $levels = rcp_get_subscription_levels('all');
        ?>
				<?php 
        if ($levels) {
            $i = 1;
            foreach ($levels as $key => $level) {
                ?>
						<tr id="recordsArray_<?php 
                echo $level->id;
                ?>
" class="rcp-subscription rcp_row <?php 
                if (rcp_is_odd($i)) {
                    echo 'alternate';
                }
                ?>
">
							<td class="rcp-sub-name-col column-primary has-row-actions" data-colname="<?php 
                _e('Name', 'rcp');
                ?>
">
								<strong><a href="<?php 
                echo esc_url(add_query_arg('edit_subscription', $level->id, $page));
                ?>
"><?php 
                echo stripslashes($level->name);
                ?>
</a></strong>
								<?php 
                if (current_user_can('rcp_manage_levels')) {
                    ?>
									<div class="row-actions">
										<span class="rcp-sub-id-col" data-colname="<?php 
                    _e('ID:', 'rcp');
                    ?>
"> <?php 
                    echo __('ID:', 'rcp') . ' ' . $level->id;
                    ?>
 | </span>
										<a href="<?php 
                    echo esc_url(add_query_arg('edit_subscription', $level->id, $page));
                    ?>
"><?php 
                    _e('Edit', 'rcp');
                    ?>
</a> |
										<?php 
                    if ($level->status != 'inactive') {
                        ?>
											<a href="<?php 
                        echo esc_url(add_query_arg('deactivate_subscription', $level->id, $page));
                        ?>
"><?php 
                        _e('Deactivate', 'rcp');
                        ?>
</a> |
										<?php 
                    } else {
                        ?>
											<a href="<?php 
                        echo esc_url(add_query_arg('activate_subscription', $level->id, $page));
                        ?>
"><?php 
                        _e('Activate', 'rcp');
                        ?>
</a> |
										<?php 
                    }
                    ?>
										<a href="<?php 
                    echo esc_url(add_query_arg('delete_subscription', $level->id, $page));
                    ?>
" class="rcp_delete_subscription"><?php 
                    _e('Delete', 'rcp');
                    ?>
</a>
									</div>
								<?php 
                }
                ?>
								<button type="button" class="toggle-row"><span class="screen-reader-text"><?php 
                _e('Show more details', 'rcp');
                ?>
</span></button>
							</td>
							<td class="rcp-sub-desc-col" data-colname="<?php 
                _e('Description', 'rcp');
                ?>
"><?php 
                echo stripslashes($level->description);
                ?>
</td>
							<td class="rcp-sub-level-col" data-colname="<?php 
                _e('Access Level', 'rcp');
                ?>
"><?php 
                echo $level->level != '' ? $level->level : __('none', 'rcp');
                ?>
</td>
							<td class="rcp-sub-duration-col" data-colname="<?php 
                _e('Duration', 'rcp');
                ?>
">
								<?php 
                if ($level->duration > 0) {
                    echo $level->duration . ' ' . rcp_filter_duration_unit($level->duration_unit, $level->duration);
                } else {
                    echo __('unlimited', 'rcp');
                }
                ?>
							</td>
							<td class="rcp-sub-price-col" data-colname="<?php 
                _e('Price', 'rcp');
                ?>
">
								<?php 
                $price = rcp_get_subscription_price($level->id);
                if (!$price) {
                    echo __('Free', 'rcp');
                } else {
                    echo rcp_currency_filter($price);
                }
                ?>
							</td>
							<td class="rcp-sub-subs-col" data-colname="<?php 
                _e('Subscribers', 'rcp');
                ?>
">
								<?php 
                if ($price || $level->duration > 0) {
                    echo rcp_get_subscription_member_count($level->id, 'active');
                } else {
                    echo rcp_get_subscription_member_count($level->id, 'free');
                }
                ?>
							</td>
							<?php 
                do_action('rcp_levels_page_table_column', $level->id);
                ?>
							<td class="rcp-sub-order-col"><a href="#" class="dragHandle"></a></td>
						</tr>
					<?php 
                $i++;
            }
        } else {
            ?>
					<tr><td colspan="9"><?php 
            _e('No subscription levels added yet.', 'rcp');
            ?>
</td></tr>
				<?php 
        }
        ?>
				</tbody>
				<tfoot>
					<tr>
						<th scope="col" class="rcp-sub-name-col column-primary"><?php 
        _e('Name', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-desc-col"><?php 
        _e('Description', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-level-col"><?php 
        _e('Access Level', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-duration-col"><?php 
        _e('Duration', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-price-col"><?php 
        _e('Price', 'rcp');
        ?>
</th>
						<th scope="col" class="rcp-sub-subs-col"><?php 
        _e('Subscribers', 'rcp');
        ?>
</th>
						<?php 
        do_action('rcp_levels_page_table_footer');
        ?>
						<th scope="col" class="rcp-sub-order-col"><?php 
        _e('Order', 'rcp');
        ?>
</th>
					</tr>
				</tfoot>
			</table>
			<?php 
        do_action('rcp_levels_below_table');
        ?>
			<?php 
        if (current_user_can('rcp_manage_levels')) {
            ?>
				<h3><?php 
            _e('Add New Level', 'rcp');
            ?>
</h3>
				<form id="rcp-member-levels" action="" method="post">
					<table class="form-table">
						<tbody>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-name"><?php 
            _e('Name', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-name" name="name" value="" style="width: 300px;"/>
									<p class="description"><?php 
            _e('The name of the membership level.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-description"><?php 
            _e('Description', 'rcp');
            ?>
</label>
								</th>
								<td>
									<textarea id="rcp-description" name="description" style="width: 300px;"></textarea>
									<p class="description"><?php 
            _e('Membership level description. This is shown on the registration form.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-level"><?php 
            _e('Access Level', 'rcp');
            ?>
</label>
								</th>
								<td>
									<select id="rcp-level" name="level">
										<?php 
            $access_levels = rcp_get_access_levels();
            foreach ($access_levels as $access) {
                echo '<option value="' . $access . '">' . $access . '</option>';
            }
            ?>
									</select>
									<p class="description">
										<?php 
            _e('Level of access this subscription gives. Leave None for default or you are unsure what this is.', 'rcp');
            ?>
										<span alt="f223" class="rcp-help-tip dashicons dashicons-editor-help" title="<?php 
            _e('<strong>Access Level</strong>: refers to a tiered system where a member\'s ability to view content is determined by the access level assigned to their account. A member with an access level of 5 can view content assigned to access levels of 5 and lower, whereas a member with an access level of 4 can only view content assigned to levels of 4 and lower.', 'rcp');
            ?>
"></span>
									</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-duration"><?php 
            _e('Duration', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-duration" style="width: 40px;" name="duration" value="0"/>
									<select name="duration_unit" id="rcp-duration-unit">
										<option value="day"><?php 
            _e('Day(s)', 'rcp');
            ?>
</option>
										<option value="month"><?php 
            _e('Month(s)', 'rcp');
            ?>
</option>
										<option value="year"><?php 
            _e('Year(s)', 'rcp');
            ?>
</option>
									</select>
									<p class="description">
										<?php 
            _e('Length of time for this membership level. Enter 0 for unlimited.', 'rcp');
            ?>
										<span alt="f223" class="rcp-help-tip dashicons dashicons-editor-help" title="<?php 
            _e('<strong>Example</strong>: setting this to 1 month would make memberships last 1 month, after which they will renew automatically or be marked as expired.', 'rcp');
            ?>
"></span>
									</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-price"><?php 
            _e('Price', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-price" name="price" value="0" pattern="^(\d+\.\d{2})|(\d+)$" style="width: 40px;"/>
									<select name="rcp-price-select" id="rcp-price-select">
										<option value="normal"><?php 
            echo rcp_get_currency();
            ?>
</option>
										<option value="free"><?php 
            _e('Free', 'rcp');
            ?>
</option>
									</select>
									<p class="description">
										<?php 
            _e('The price of this membership level. Enter 0 for free.', 'rcp');
            ?>
										<span alt="f223" class="rcp-help-tip dashicons dashicons-editor-help" title="<?php 
            _e('This price refers to the amount paid per duration period. For example, if duration period is set to 1 month, this would be the amount charged each month.', 'rcp');
            ?>
"></span>
									</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-fee"><?php 
            _e('Signup Fee', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-fee" name="fee" value="0" style="width: 40px;"/>
									<p class="description"><?php 
            _e('Optional signup fee to charge subscribers for the first billing cycle. Enter a negative number to give a discount on the first payment.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-status"><?php 
            _e('Status', 'rcp');
            ?>
</label>
								</th>
								<td>
									<select name="status" id="rcp-status">
										<option value="active"><?php 
            _e('Active', 'rcp');
            ?>
</option>
										<option value="inactive"><?php 
            _e('Inactive', 'rcp');
            ?>
</option>
									</select>
									<p class="description"><?php 
            _e('Members may only sign up for active subscription levels.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-role"><?php 
            _e('User Role', 'rcp');
            ?>
</label>
								</th>
								<td>
									<select name="role" id="rcp-role">
										<?php 
            wp_dropdown_roles('subscriber');
            ?>
									</select>
									<p class="description"><?php 
            _e('The user role given to the member after signing up.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<?php 
            do_action('rcp_add_subscription_form');
            ?>
						</tbody>
					</table>
					<p class="submit">
						<input type="hidden" name="rcp-action" value="add-level"/>
						<input type="submit" value="<?php 
            _e('Add Membership Level', 'rcp');
            ?>
" class="button-primary"/>
					</p>
					<?php 
            wp_nonce_field('rcp_add_level_nonce', 'rcp_add_level_nonce');
            ?>
				</form>
			<?php 
        }
        ?>
		<?php 
    }
    ?>
	</div><!--end wrap-->

	<?php 
}
Ejemplo n.º 9
0
	</fieldset>
	<?php } ?>

	<?php do_action( 'rcp_before_subscription_form_fields' ); ?>

	<fieldset class="rcp_subscription_fieldset">
	<?php $levels = rcp_get_subscription_levels( 'active' );
	if( $levels ) : ?>
		<p class="rcp_subscription_message"><?php echo apply_filters ( 'rcp_registration_choose_subscription', __( 'Choose your subscription level', 'rcp' ) ); ?></p>
		<ul id="rcp_subscription_levels">
			<?php foreach( $levels as $key => $level ) : ?>
				<?php if( rcp_show_subscription_level( $level->id ) ) : ?>
				<li id="rcp_subscription_level_<?php echo $level->id; ?>" class="rcp_subscription_level">
					<input type="radio" class="required rcp_level" <?php if( $key == 0 || ( isset( $_GET['level'] ) && $_GET['level'] == $key ) ) { echo 'checked="checked"'; } ?> name="rcp_level" rel="<?php echo esc_attr( $level->price ); ?>" value="<?php echo esc_attr( absint( $level->id ) ); ?>" <?php if( $level->duration == 0 ) { echo 'data-duration="forever"'; } ?>/>&nbsp;
					<span class="rcp_subscription_level_name"><?php echo rcp_get_subscription_name( $level->id ); ?></span><span class="rcp_separator">&nbsp;-&nbsp;</span><span class="rcp_price" rel="<?php echo esc_attr( $level->price ); ?>"><?php echo $level->price > 0 ? rcp_currency_filter( $level->price ) : __( 'free', 'rcp' ); ?><span class="rcp_separator">&nbsp;-&nbsp;</span></span>
					<span class="rcp_level_duration"><?php echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit( $level->duration_unit, $level->duration ) : __( 'unlimited', 'rcp' ); ?></span>
					<div class="rcp_level_description"> <?php echo rcp_get_subscription_description( $level->id ); ?></div>
				</li>
				<?php endif; ?>
			<?php endforeach; ?>
		</ul>
	<?php else : ?>
		<p><strong><?php _e( 'You have not created any subscription levels yet', 'rcp' ); ?></strong></p>
	<?php endif; ?>
	</fieldset>

	<?php if( rcp_has_discounts() ) : ?>
	<fieldset class="rcp_discounts_fieldset">
		<p id="rcp_discount_code_wrap">
			<label for="rcp_discount_code">
Ejemplo n.º 10
0
function rcp_discount_sign_filter($amount, $type)
{
    $discount = '';
    if ($type == '%') {
        $discount = $amount . '%';
    } elseif ($type == 'flat') {
        $discount = rcp_currency_filter($amount);
    }
    return $discount;
}
function rcp_member_levels_page()
{
    global $rcp_options, $rcp_db_name, $wpdb;
    $page = admin_url('/admin.php?page=rcp-member-levels');
    ?>
	<div class="wrap">
		<?php 
    if (isset($_GET['edit_subscription'])) {
        include 'edit-subscription.php';
    } else {
        ?>
			<h2><?php 
        _e('Subscription Levels', 'rcp');
        ?>
</h2>

			<table class="wp-list-table widefat fixed posts rcp-subscriptions">
				<thead>
					<tr>
						<th class="rcp-sub-order-col"><?php 
        _e('Order', 'rcp');
        ?>
</th>
						<th class="rcp-sub-id-col"><?php 
        _e('ID', 'rcp');
        ?>
</th>
						<th class="rcp-sub-name-col"><?php 
        _e('Name', 'rcp');
        ?>
</th>
						<th class="rcp-sub-desc-col"><?php 
        _e('Description', 'rcp');
        ?>
</th>
						<th class="rcp-sub-level-col"><?php 
        _e('Access Level', 'rcp');
        ?>
</th>
						<th class="rcp-sub-duration-col"><?php 
        _e('Duration', 'rcp');
        ?>
</th>
						<th class="rcp-sub-price-col"><?php 
        _e('Price', 'rcp');
        ?>
</th>
						<th class="rcp-sub-subs-col"><?php 
        _e('Subscribers', 'rcp');
        ?>
</th>
						<?php 
        do_action('rcp_levels_page_table_header');
        ?>
						<?php 
        if (current_user_can('rcp_manage_levels')) {
            ?>
							<th class="rcp-sub-actions-col"><?php 
            _e('Actions', 'rcp');
            ?>
</th>
						<?php 
        }
        ?>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<th class="rcp-sub-order-col"><?php 
        _e('Order', 'rcp');
        ?>
</th>
						<th class="rcp-sub-id-col"><?php 
        _e('ID', 'rcp');
        ?>
</th>
						<th class="rcp-sub-name-col"><?php 
        _e('Name', 'rcp');
        ?>
</th>
						<th class="rcp-sub-desc-col" style="width: 300px;"><?php 
        _e('Description', 'rcp');
        ?>
</th>
						<th class="rcp-sub-level-col"><?php 
        _e('Access Level', 'rcp');
        ?>
</th>
						<th class="rcp-sub-duration-col"><?php 
        _e('Duration', 'rcp');
        ?>
</th>
						<th class="rcp-sub-price-col"><?php 
        _e('Price', 'rcp');
        ?>
</th>
						<th class="rcp-sub-subs-col"><?php 
        _e('Subscribers', 'rcp');
        ?>
</th>
						<?php 
        do_action('rcp_levels_page_table_footer');
        ?>
						<?php 
        if (current_user_can('rcp_manage_levels')) {
            ?>
							<th class="rcp-sub-actions-col"><?php 
            _e('Actions', 'rcp');
            ?>
</th>
						<?php 
        }
        ?>
					</tr>
				</tfoot>
				<tbody>
				<?php 
        $levels = rcp_get_subscription_levels('all');
        ?>
				<?php 
        if ($levels) {
            $i = 1;
            foreach ($levels as $key => $level) {
                ?>
						<tr id="recordsArray_<?php 
                echo $level->id;
                ?>
" class="rcp-subscription rcp_row <?php 
                if (rcp_is_odd($i)) {
                    echo 'alternate';
                }
                ?>
">
							<td class="rcp-sub-order-col"><a href="#" class="dragHandle"></a></td>
							<td class="rcp-sub-id-col"><?php 
                echo $level->id;
                ?>
</td>
							<td class="rcp-sub-name-col"><?php 
                echo stripslashes($level->name);
                ?>
</td>
							<td class="rcp-sub-desc-col"><?php 
                echo stripslashes($level->description);
                ?>
</td>
							<td class="rcp-sub-level-col"><?php 
                echo $level->level != '' ? $level->level : __('none', 'rcp');
                ?>
</td>
							<td class="rcp-sub-duration-col">
								<?php 
                if ($level->duration > 0) {
                    echo $level->duration . ' ' . rcp_filter_duration_unit($level->duration_unit, $level->duration);
                } else {
                    echo __('unlimited', 'rcp');
                }
                ?>
							</td>
							<td class="rcp-sub-price-col">
								<?php 
                $price = rcp_get_subscription_price($level->id);
                if (!$price) {
                    echo __('Free', 'rcp');
                } else {
                    echo rcp_currency_filter($price);
                }
                ?>
							</td>
							<td class="rcp-sub-subs-col">
								<?php 
                if ($price || $level->duration > 0) {
                    echo rcp_count_members($level->id, 'active');
                } else {
                    echo rcp_count_members($level->id, 'free');
                }
                ?>
							</td>
							<?php 
                do_action('rcp_levels_page_table_column', $level->id);
                ?>
							<?php 
                if (current_user_can('rcp_manage_levels')) {
                    ?>
								<td class="rcp-sub-actions-col">
									<a href="<?php 
                    echo esc_url(add_query_arg('edit_subscription', $level->id, $page));
                    ?>
"><?php 
                    _e('Edit', 'rcp');
                    ?>
</a> |
									<?php 
                    if ($level->status != 'inactive') {
                        ?>
										<a href="<?php 
                        echo esc_url(add_query_arg('deactivate_subscription', $level->id, $page));
                        ?>
"><?php 
                        _e('Deactivate', 'rcp');
                        ?>
</a> |
									<?php 
                    } else {
                        ?>
										<a href="<?php 
                        echo esc_url(add_query_arg('activate_subscription', $level->id, $page));
                        ?>
"><?php 
                        _e('Activate', 'rcp');
                        ?>
</a> |
									<?php 
                    }
                    ?>
									<a href="<?php 
                    echo esc_url(add_query_arg('delete_subscription', $level->id, $page));
                    ?>
" class="rcp_delete_subscription"><?php 
                    _e('Delete', 'rcp');
                    ?>
</a>
								</td>
							<?php 
                }
                ?>
						</tr>
					<?php 
                $i++;
            }
        } else {
            ?>
					<tr><td colspan="9"><?php 
            _e('No subscription levels added yet.', 'rcp');
            ?>
</td>
				<?php 
        }
        ?>
			</table>
			<?php 
        do_action('rcp_levels_below_table');
        ?>
			<?php 
        if (current_user_can('rcp_manage_levels')) {
            ?>
				<h3><?php 
            _e('Add New Level', 'rcp');
            ?>
</h3>
				<form id="rcp-member-levels" action="" method="post">
					<table class="form-table">
						<tbody>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-name"><?php 
            _e('Name', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-name" name="name" value="" style="width: 300px;"/>
									<p class="description"><?php 
            _e('The name of the membership level.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-description"><?php 
            _e('Description', 'rcp');
            ?>
</label>
								</th>
								<td>
									<textarea id="rcp-description" name="description" style="width: 300px;"></textarea>
									<p class="description"><?php 
            _e('Membership level description. This is shown on the registration form.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-level"><?php 
            _e('Access Level', 'rcp');
            ?>
</label>
								</th>
								<td>
									<select id="rcp-level" name="level">
										<?php 
            $access_levels = rcp_get_access_levels();
            foreach ($access_levels as $access) {
                echo '<option value="' . $access . '">' . $access . '</option>';
            }
            ?>
									</select>
									<p class="description"><?php 
            _e('Level of access this subscription gives. Leave None for default or you are unsure what this is.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-duration"><?php 
            _e('Duration', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-duration" style="width: 40px;" name="duration" value=""/>
									<select name="duration_unit" id="rcp-duration-unit">
										<option value="day"><?php 
            _e('Day(s)', 'rcp');
            ?>
</option>
										<option value="month"><?php 
            _e('Month(s)', 'rcp');
            ?>
</option>
										<option value="year"><?php 
            _e('Year(s)', 'rcp');
            ?>
</option>
									</select>
									<p class="description"><?php 
            _e('Length of time for this membership level. Enter 0 for unlimited.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-price"><?php 
            _e('Price', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-price" name="price" value="" style="width: 40px;"/>
									<select name="rcp-price-select" id="rcp-price-select">
										<option value="normal"><?php 
            echo isset($rcp_options['currency']) ? $rcp_options['currency'] : 'USD';
            ?>
</option>
										<option value="free"><?php 
            _e('Free', 'rcp');
            ?>
</option>
									</select>
									<p class="description"><?php 
            _e('The price of this membership level. Enter 0 for free.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-fee"><?php 
            _e('Signup Fee', 'rcp');
            ?>
</label>
								</th>
								<td>
									<input type="text" id="rcp-fee" name="fee" value="" style="width: 40px;"/>
									<p class="description"><?php 
            _e('Optional signup fee to charge subscribers for the first billing cycle. Enter a negative number to give a discount on the first payment. This only applies to recurring subscriptions.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-status"><?php 
            _e('Status', 'rcp');
            ?>
</label>
								</th>
								<td>
									<select name="status" id="rcp-status">
										<option value="active"><?php 
            _e('Active', 'rcp');
            ?>
</option>
										<option value="inactive"><?php 
            _e('Inactive', 'rcp');
            ?>
</option>
									</select>
									<p class="description"><?php 
            _e('Members may only sign up for active subscription levels.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<tr class="form-field">
								<th scope="row" valign="top">
									<label for="rcp-role"><?php 
            _e('User Role', 'rcp');
            ?>
</label>
								</th>
								<td>
									<select name="role" id="rcp-role">
										<?php 
            wp_dropdown_roles('subscriber');
            ?>
									</select>
									<p class="description"><?php 
            _e('The user role given to the member after signing up.', 'rcp');
            ?>
</p>
								</td>
							</tr>
							<?php 
            do_action('rcp_add_subscription_form');
            ?>
						</tbody>
					</table>
					<p class="submit">
						<input type="hidden" name="rcp-action" value="add-level"/>
						<input type="submit" value="<?php 
            _e('Add Membership Level', 'rcp');
            ?>
" class="button-primary"/>
					</p>
				</form>
			<?php 
        }
        ?>
		<?php 
    }
    ?>
	</div><!--end wrap-->

	<?php 
}
Ejemplo n.º 12
0
/**
 * Displays the earnings graph.
 *
 * @access  public
 * @since   1.8
*/
function rcp_earnings_graph()
{
    global $rcp_options, $wpdb;
    // Retrieve the queried dates
    $dates = rcp_get_report_dates();
    // Determine graph options
    switch ($dates['range']) {
        case 'today':
            $time_format = '%d/%b';
            $tick_size = 'hour';
            $day_by_day = true;
            break;
        case 'last_year':
            $time_format = '%b';
            $tick_size = 'month';
            $day_by_day = false;
            break;
        case 'this_year':
            $time_format = '%b';
            $tick_size = 'month';
            $day_by_day = false;
            break;
        case 'last_quarter':
            $time_format = '%b';
            $tick_size = 'month';
            $day_by_day = false;
            break;
        case 'this_quarter':
            $time_format = '%b';
            $tick_size = 'month';
            $day_by_day = false;
            break;
        case 'other':
            if ($dates['m_end'] - $dates['m_start'] >= 2) {
                $time_format = '%b';
                $tick_size = 'month';
                $day_by_day = false;
            } else {
                $time_format = '%d/%b';
                $tick_size = 'day';
                $day_by_day = true;
            }
            break;
        default:
            $time_format = '%d/%b';
            // Show days by default
            $tick_size = 'day';
            // Default graph interval
            $day_by_day = true;
            break;
    }
    $time_format = apply_filters('rcp_graph_timeformat', $time_format);
    $tick_size = apply_filters('rcp_graph_ticksize', $tick_size);
    $earnings = (double) 0.0;
    // Total earnings for time period shown
    $subscription = isset($_GET['subscription']) ? absint($_GET['subscription']) : false;
    $payments_db = new RCP_Payments();
    $args = array('subscription' => rcp_get_subscription_name($subscription), 'date' => array());
    ob_start();
    ?>
	<script type="text/javascript">
	   jQuery( document ).ready( function($) {
	   		$.plot(
	   			$("#rcp_earnings_graph"),
	   			[{
   					data: [
	   					<?php 
    if ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
        //Day by day
        $day = $dates['day'];
        $day_end = $dates['day_end'];
        $month = $dates['m_start'];
        while ($day <= $day_end) {
            $args = array('date' => array('day' => $day, 'month' => $month, 'year' => $dates['year']), 'fields' => 'amount');
            $args['date'] = array('day' => $day, 'month' => $month, 'year' => $dates['year']);
            $payments = $payments_db->get_earnings($args);
            $earnings += $payments;
            $date = mktime(0, 0, 0, $month, $day, $dates['year']);
            ?>
								[<?php 
            echo $date * 1000;
            ?>
, <?php 
            echo $payments;
            ?>
],
								<?php 
            $day++;
        }
    } else {
        $y = $dates['year'];
        while ($y <= $dates['year_end']) {
            if ($dates['year'] == $dates['year_end']) {
                $month_start = $dates['m_start'];
                $month_end = $dates['m_end'];
            } elseif ($y == $dates['year']) {
                $month_start = $dates['m_start'];
                $month_end = 12;
            } else {
                $month_start = 1;
                $month_end = 12;
            }
            $i = $month_start;
            while ($i <= $month_end) {
                if ($day_by_day) {
                    $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
                    $d = 1;
                    while ($d <= $num_of_days) {
                        $args['date'] = array('day' => $d, 'month' => $i, 'year' => $y);
                        $payments = $payments_db->get_earnings($args);
                        $earnings += $payments;
                        $date = mktime(0, 0, 0, $i, $d, $y);
                        ?>
											[<?php 
                        echo $date * 1000;
                        ?>
, <?php 
                        echo $payments;
                        ?>
],
										<?php 
                        $d++;
                    }
                } else {
                    $args['date'] = array('day' => null, 'month' => $i, 'year' => $y);
                    $payments = $payments_db->get_earnings($args);
                    $earnings += $payments;
                    $date = mktime(0, 0, 0, $i, 1, $y);
                    ?>
										[<?php 
                    echo $date * 1000;
                    ?>
, <?php 
                    echo $payments;
                    ?>
],
									<?php 
                }
                $i++;
            }
            $y++;
        }
    }
    ?>
,
	   				],
	   				yaxis: 2,
   					label: "<?php 
    _e('Earnings', 'rcp');
    ?>
",
   					id: 'sales'
   				}],
	   		{
               	series: {
                   lines: { show: true },
                   points: { show: true }
            	},
            	grid: {
           			show: true,
					aboveData: false,
					color: '#ccc',
					backgroundColor: '#fff',
					borderWidth: 2,
					borderColor: '#ccc',
					clickable: false,
					hoverable: true
           		},
            	xaxis: {
	   				mode: "time",
	   				timeFormat: "<?php 
    echo $time_format;
    ?>
",
	   				minTickSize: [1, "<?php 
    echo $tick_size;
    ?>
"]
   				},
   				yaxis: {
   					min: 0,
   					minTickSize: 1,
   					tickDecimals: 0
   				}

            });

			function rcp_flot_tooltip(x, y, contents) {
		        $('<div id="rcp-flot-tooltip">' + contents + '</div>').css( {
		            position: 'absolute',
		            display: 'none',
		            top: y + 5,
		            left: x + 5,
		            border: '1px solid #fdd',
		            padding: '2px',
		            'background-color': '#fee',
		            opacity: 0.80
		        }).appendTo("body").fadeIn(200);
		    }

		    var previousPoint = null;
		    $("#rcp_earnings_graph").bind("plothover", function (event, pos, item) {
	            if (item) {
	                if (previousPoint != item.dataIndex) {
	                    previousPoint = item.dataIndex;
	                    $("#rcp-flot-tooltip").remove();
	                    var x = item.datapoint[0].toFixed(2),
                        y = item.datapoint[1].toFixed(2);
                    	if( rcp_vars.currency_pos == 'before' ) {
							rcp_flot_tooltip( item.pageX, item.pageY, item.series.label + ' ' + rcp_vars.currency_sign + y );
                    	} else {
							rcp_flot_tooltip( item.pageX, item.pageY, item.series.label + ' ' + y + rcp_vars.currency_sign );
                    	}
	                }
	            } else {
	                $("#rcp-flot-tooltip").remove();
	                previousPoint = null;
	            }
		    });
	   });
    </script>
	<h2><?php 
    _e('Earnings Report', 'rcp');
    ?>
</h2>
	<div class="metabox-holder" style="padding-top: 0;">
		<div class="postbox">
			<div class="inside">
				<?php 
    rcp_reports_graph_controls();
    ?>
				<div id="rcp_earnings_graph" style="height: 300px;"></div>
				<p class="rcp_graph_totals"><strong><?php 
    _e('Total earnings for period shown: ', 'rcp');
    echo rcp_currency_filter(number_format_i18n($earnings, 2));
    ?>
</strong></p>
			</div>
		</div>
	</div>
	<?php 
    echo ob_get_clean();
}
Ejemplo n.º 13
0
	</tbody>
</table>
<table class="rcp-table" id="rcp-payment-history">
	<thead>
		<tr>
			<th><?php _e( 'Invoice #', 'rcp' ); ?></th>
			<th><?php _e( 'Subscription', 'rcp' ); ?></th>
			<th><?php _e( 'Payment Method', 'rcp' ); ?></th>
			<th><?php _e( 'Amount', 'rcp' ); ?></th>
			<th><?php _e( 'Date', 'rcp' ); ?></th>
			<th><?php _e( 'Actions', 'rcp' ); ?></th>
		</tr>
	</thead>
	<tbody>
	<?php if( rcp_get_user_payments() ) : ?>
		<?php foreach( rcp_get_user_payments() as $payment ) : ?>
			<tr>
				<td><?php echo $payment->id; ?></td>
				<td><?php echo $payment->subscription; ?></td>
				<td><?php echo $payment->payment_type; ?></td>
				<td><?php echo rcp_currency_filter( $payment->amount ); ?></td>
				<td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->date ) ); ?></td>
				<td><a href="<?php echo rcp_get_pdf_download_url( $payment->id ); ?>"><?php _e( 'PDF Receipt', 'rcp' ); ?></td>
			</tr>
		<?php endforeach; ?>
	<?php else : ?>
		<tr><td colspan="6"><?php _e( 'You have not made any payments.', 'rcp' ); ?></td></tr>
	<?php endif; ?>
	</tbody>
</table>
<?php do_action( 'rcp_subscription_details_bottom' );
    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        if ($this->get_cached_widget($args)) {
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        $description = $instance['description'];
        $levels = rcp_get_subscription_levels('active');
        if (!$levels) {
            return;
        }
        $content = ob_get_clean();
        echo $before_widget;
        ?>

		<div class="container">

			<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

			<?php 
        if ($description) {
            ?>
				<p class="homepage-widget-description"><?php 
            echo $description;
            ?>
</p>
			<?php 
        }
        ?>

			<div class="job-packages row">

				<?php 
        foreach ($levels as $key => $level) {
            ?>
					<?php 
            if (rcp_show_subscription_level($level->id)) {
                ?>

					<div class="col-lg-4 col-md-6 col-sm-12 pricing-table-widget-wrapper">
						<div class="pricing-table-widget rcp_subscription_level rcp_subscription_level_fake" data-href="<?php 
                echo esc_url(get_permalink(jobify_find_page_with_shortcode(array('register_form'))));
                ?>
">
							<div class="pricing-table-widget-title">
								<span class="rcp_subscription_level_name"><?php 
                echo stripslashes($level->name);
                ?>
</span>
							</div>

							<div class="pricing-table-widget-description">
								<h2>
									<span class="rcp_price" rel="<?php 
                echo esc_attr($level->price);
                ?>
">
										<?php 
                if ($level->fee) {
                    ?>
											<?php 
                    $adjusted_price = $level->price + $level->fee;
                    ?>
											<?php 
                    echo $adjusted_price > 0 ? rcp_currency_filter($adjusted_price) : __('free', 'jobify');
                    ?>
											</h2>
											<small>
												<?php 
                    $promo_duration = sprintf(_n('%2$s', '%1$s %2$ss', $level->duration, 'jobify'), $level->duration, $level->duration_unit);
                    ?>
												<?php 
                    printf(__('* %s after first %s', 'jobify'), rcp_currency_filter($level->price), $promo_duration);
                    ?>
											</small>
										<?php 
                } else {
                    ?>
											<?php 
                    $adjusted_price = $level->price;
                    ?>
											<?php 
                    echo $adjusted_price > 0 ? rcp_currency_filter($adjusted_price) : __('free', 'jobify');
                    ?>
											</h2>
										<?php 
                }
                ?>
									</span>
								</h2>

								<p><span class="rcp_level_duration"><?php 
                echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
                ?>
</span></p>

								<?php 
                echo wpautop(wp_kses(stripslashes($level->description), rcp_allowed_html_tags()));
                ?>

								<p><a href="#" class="rcp-select button"><?php 
                _e('Get Started', 'jobify');
                ?>
</a></p>
							</div>
						</div>
					</div>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
			</div>

		</div>

		<?php 
        echo $after_widget;
        echo $content;
        $this->cache_widget($args, $content);
    }
Ejemplo n.º 15
0
										<small>
											<?php 
                $promo_duration = sprintf(_n('%2$s', '%1$s %2$ss', $level->duration, 'jobify'), $level->duration, $level->duration_unit);
                ?>
											<?php 
                printf(__('* %s after first %s', 'jobify'), rcp_currency_filter($level->price), $promo_duration);
                ?>
										</small>
									<?php 
            } else {
                ?>
										<?php 
                $adjusted_price = $level->price;
                ?>
										<?php 
                echo $adjusted_price > 0 ? rcp_currency_filter($adjusted_price) : __('free', 'jobify');
                ?>
										</h2>
									<?php 
            }
            ?>
								</span>
							</h2>

							<p><span class="rcp_level_duration"><?php 
            echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
            ?>
</span></p>

							<?php 
            echo wpautop(wp_kses(stripslashes($level->description), rcp_allowed_html_tags()));
/**
 * Add message to checkout specifying proration credit
 *
 * @since 2.5
 */
function rcp_add_prorate_message()
{
    if (!($amount = rcp_get_member_prorate_credit())) {
        return;
    }
    $prorate_message = sprintf('<p>%s</p>', __('If you upgrade or downgrade your account, the new subscription will be prorated up to %s for the first payment. Prorated prices are shown below.', 'rcp'));
    printf(apply_filters('rcp_registration_prorate_message', $prorate_message), esc_html(rcp_currency_filter($amount)));
}
 /**
  * Format the discount code
  *
  * @access  public
  * @since   1.5
  */
 public function format_discount($amount = '', $type = '')
 {
     if ($type == '%') {
         $discount = $amount . '%';
     } elseif ($type == 'flat') {
         $discount = rcp_currency_filter($amount);
     }
     return $discount;
 }
Ejemplo n.º 18
0
        ?>
			<tr>
				<td><?php 
        echo $payment->id;
        ?>
</td>
				<td><?php 
        echo $payment->subscription;
        ?>
</td>
				<td><?php 
        echo $payment->payment_type;
        ?>
</td>
				<td><?php 
        echo rcp_currency_filter($payment->amount);
        ?>
</td>
				<td><?php 
        echo date_i18n(get_option('date_format'), strtotime($payment->date));
        ?>
</td>
				<td><a href="<?php 
        echo rcp_get_pdf_download_url($payment->id);
        ?>
"><?php 
        _e('PDF Receipt', 'rcp');
        ?>
</td>
			</tr>
		<?php 
			<?php 
}
?>
			<?php 
if (!empty($_GET['rcp-recurring']) && !empty($rcp_checkout_details['subscription']['fee'])) {
    ?>
				<td>
					<?php 
    echo rcp_currency_filter($rcp_checkout_details['subscription']['fee']);
    ?>
				</td>
			<?php 
}
?>
			<td><?php 
echo rcp_currency_filter($rcp_checkout_details['PAYMENTREQUEST_0_AMT']);
?>
</td>
		</tr>
	</tbody>
</table>

<form action="<?php 
echo esc_url(add_query_arg('rcp-confirm', 'paypal_express'));
?>
" method="post">
	<input type="hidden" name="confirmation" value="yes" />
	<input type="hidden" name="token" value="<?php 
echo esc_attr($_GET['token']);
?>
" />
Ejemplo n.º 20
0
/**
 * Renders the Restrict > Payments page
 *
 * @since  1.0
 * @return void
*/
function rcp_payments_page()
{
    global $rcp_options;
    $current_page = admin_url('/admin.php?page=rcp-payments');
    ?>

	<div class="wrap">

		<?php 
    if (isset($_GET['view']) && 'new-payment' == $_GET['view']) {
        include 'new-payment.php';
    } elseif (isset($_GET['view']) && 'edit-payment' == $_GET['view']) {
        include 'edit-payment.php';
    } else {
        ?>
		<h2>
			<?php 
        _e('Payments', 'rcp');
        ?>
			<a href="<?php 
        echo admin_url('/admin.php?page=rcp-payments&view=new-payment');
        ?>
" class="add-new-h2">
				<?php 
        _e('Create Payment', 'rcp');
        ?>
			</a>
		</h2>

		<?php 
        do_action('rcp_payments_page_top');
        $rcp_payments = new RCP_Payments();
        $page = isset($_GET['p']) ? $_GET['p'] : 1;
        $per_page = 20;
        $search = !empty($_GET['s']) ? urldecode($_GET['s']) : '';
        $user = get_current_user_id();
        $screen = get_current_screen();
        $screen_option = $screen->get_option('per_page', 'option');
        $per_page = get_user_meta($user, $screen_option, true);
        if (empty($per_page) || $per_page < 1) {
            $per_page = $screen->get_option('per_page', 'default');
        }
        $total_pages = 1;
        $offset = $per_page * ($page - 1);
        $user_id = isset($_GET['user_id']) ? $_GET['user_id'] : 0;
        $payments = $rcp_payments->get_payments(array('offset' => $offset, 'number' => $per_page, 'user_id' => $user_id, 's' => $search));
        $payment_count = $rcp_payments->count(array('user_id' => $user_id));
        $total_pages = ceil($payment_count / $per_page);
        ?>
		<form id="rcp-member-search" method="get" action="<?php 
        menu_page_url('rcp-payments');
        ?>
">
			<label class="screen-reader-text" for="rcp-member-search-input"><?php 
        _e('Search Payments', 'rcp');
        ?>
</label>
			<input type="search" id="rcp-member-search-input" name="s" value="<?php 
        echo esc_attr($search);
        ?>
"/>
			<input type="hidden" name="page" value="rcp-payments"/>
			<input type="submit" name="" id="rcp-member-search-submit" class="button" value="<?php 
        _e('Search Payments', 'rcp');
        ?>
"/>
		</form>
		<p class="total"><strong><?php 
        _e('Total Earnings', 'rcp');
        ?>
: <?php 
        echo rcp_currency_filter(number_format_i18n($rcp_payments->get_earnings(), 2));
        ?>
</strong></p>
		<?php 
        if (!empty($user_id)) {
            ?>
		<p><a href="<?php 
            echo admin_url('admin.php?page=rcp-payments');
            ?>
" class="button-secondary" title="<?php 
            _e('View all payments', 'rcp');
            ?>
"><?php 
            _e('Reset User Filter', 'rcp');
            ?>
</a></p>
		<?php 
        }
        ?>
		<table class="wp-list-table widefat fixed posts rcp-payments">
			<thead>
				<tr>
					<th style="width: 40px;"><?php 
        _e('ID', 'rcp');
        ?>
</th>
					<th style="width: 90px;"><?php 
        _e('User', 'rcp');
        ?>
</th>
					<th style="width: 150px;"><?php 
        _e('Subscription', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Date', 'rcp');
        ?>
</th>
					<th style="width: 90px;"><?php 
        _e('Amount', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Type', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Transaction ID', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Status', 'rcp');
        ?>
</th>
					<?php 
        do_action('rcp_payments_page_table_header');
        ?>
					<?php 
        if (current_user_can('rcp_manage_payments')) {
            ?>
						<th><?php 
            _e('Actions', 'rcp');
            ?>
</th>
					<?php 
        }
        ?>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th style="width: 40px;"><?php 
        _e('ID', 'rcp');
        ?>
</th>
					<th><?php 
        _e('User', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Subscription', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Date', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Amount', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Type', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Transaction ID', 'rcp');
        ?>
</th>
					<th><?php 
        _e('Status', 'rcp');
        ?>
</th>
					<?php 
        do_action('rcp_payments_page_table_footer');
        ?>
					<?php 
        if (current_user_can('rcp_manage_payments')) {
            ?>
						<th><?php 
            _e('Actions', 'rcp');
            ?>
</th>
					<?php 
        }
        ?>
				</tr>
			</tfoot>
			<tbody>
				<?php 
        if ($payments) {
            $i = 0;
            $total_earnings = 0;
            foreach ($payments as $payment) {
                $user = get_userdata($payment->user_id);
                ?>
							<tr class="rcp_payment <?php 
                if (rcp_is_odd($i)) {
                    echo 'alternate';
                }
                ?>
">
								<td><?php 
                echo absint($payment->id);
                ?>
</td>
								<td>
									<a href="<?php 
                echo esc_url(add_query_arg('user_id', $payment->user_id, menu_page_url('rcp-payments', false)));
                ?>
" title="<?php 
                _e('View payments by this user', 'rcp');
                ?>
">
										<?php 
                echo isset($user->display_name) ? esc_html($user->display_name) : '';
                ?>
									</a>
								</td>
								<td><?php 
                echo esc_html($payment->subscription);
                ?>
</td>
								<td><?php 
                echo esc_html($payment->date);
                ?>
</td>
								<td><?php 
                echo rcp_currency_filter($payment->amount);
                ?>
</td>
								<td><?php 
                echo esc_html($payment->payment_type);
                ?>
</td>
								<td><?php 
                echo $payment->transaction_id;
                ?>
</td>
								<td><?php 
                echo rcp_get_payment_status_label($payment);
                ?>
</td>
								<?php 
                do_action('rcp_payments_page_table_column', $payment->id);
                ?>
								<?php 
                if (current_user_can('rcp_manage_payments')) {
                    ?>
									<td>
										<a href="<?php 
                    echo rcp_get_pdf_download_url($payment->id);
                    ?>
" class="rcp-payment-invoice"><?php 
                    _e('Download Invoice', 'rcp');
                    ?>
</a>
										<span>&nbsp;|&nbsp;</span>
										<a href="<?php 
                    echo esc_url(add_query_arg(array('payment_id' => $payment->id, 'view' => 'edit-payment'), admin_url('admin.php?page=rcp-payments')));
                    ?>
" class="rcp-edit-payment"><?php 
                    _e('Edit', 'rcp');
                    ?>
</a>
										<span>&nbsp;|&nbsp;</span>
										<a href="<?php 
                    echo wp_nonce_url(add_query_arg(array('payment_id' => $payment->id, 'rcp-action' => 'delete_payment'), admin_url('admin.php?page=rcp-payments')), 'rcp_delete_payment_nonce');
                    ?>
" class="rcp-delete-payment"><?php 
                    _e('Delete', 'rcp');
                    ?>
</a>
									</td>
								<?php 
                }
                ?>
							</tr>
						<?php 
                $i++;
                $total_earnings = $total_earnings + $payment->amount;
            }
        } else {
            ?>
					<tr><td colspan="8"><?php 
            _e('No payments recorded yet', 'rcp');
            ?>
</td></tr>
				<?php 
        }
        ?>
			</table>
			<?php 
        if ($total_pages > 1) {
            ?>
				<div class="tablenav">
					<div class="tablenav-pages alignright">
						<?php 
            $base = 'admin.php?' . remove_query_arg('p', $_SERVER['QUERY_STRING']) . '%_%';
            echo paginate_links(array('base' => $base, 'format' => '&p=%#%', 'prev_text' => __('&laquo; Previous'), 'next_text' => __('Next &raquo;'), 'total' => $total_pages, 'current' => $page, 'end_size' => 1, 'mid_size' => 5));
            ?>
				    </div>
				</div><!--end .tablenav-->
			<?php 
        }
        ?>
			<?php 
        do_action('rcp_payments_page_bottom');
        ?>
		<?php 
    }
    ?>
	</div><!--end wrap-->
	<?php 
}
Ejemplo n.º 21
0
/**
 * Prints payment history for the specific user in a formatted table
 *
 * @since 2.5
 * @param $user_id
 *
 * @return mixed|string|void
 */
function rcp_print_user_payments_formatted($user_id)
{
    $payments = new RCP_Payments();
    $user_payments = $payments->get_payments(array('user_id' => $user_id));
    $payments_list = '';
    if (!$user_payments) {
        return $payments_list;
    }
    ob_start();
    ?>

	<table class="wp-list-table widefat fixed posts rcp-table rcp_payment_details" style="display: block; width: 100%;">

		<thead>
			<tr>
				<th><?php 
    _e('Date', 'rcp');
    ?>
</th>
				<th><?php 
    _e('Subscription', 'rcp');
    ?>
</th>
				<th><?php 
    _e('Payment Type', 'rcp');
    ?>
</th>
				<th><?php 
    _e('Subscription Key', 'rcp');
    ?>
</th>
				<th><?php 
    _e('Transaction ID', 'rcp');
    ?>
</th>
				<th><?php 
    _e('Amount', 'rcp');
    ?>
</th>
			</tr>
		</thead>
		<tbody>
			<?php 
    foreach ($user_payments as $payment) {
        ?>

				<tr>
					<td><?php 
        echo esc_html($payment->date);
        ?>
</td>
					<td><?php 
        echo esc_html($payment->subscription);
        ?>
</td>
					<td><?php 
        echo esc_html($payment->payment_type);
        ?>
</td>
					<td><?php 
        echo esc_html($payment->subscription_key);
        ?>
</td>
					<td><a href="<?php 
        echo esc_url(add_query_arg(array('payment_id' => $payment->id, 'view' => 'edit-payment'), admin_url('admin.php?page=rcp-payments')));
        ?>
" class="rcp-edit-payment"><?php 
        echo empty($payment->transaction_id) ? '' : esc_html($payment->transaction_id);
        ?>
</a></td>
					<td><?php 
        echo '' == $payment->amount ? esc_html(rcp_currency_filter($payment->amount2)) : esc_html(rcp_currency_filter($payment->amount));
        ?>
</td>
				</tr>

			<?php 
    }
    ?>
		</tbody>

	</table>

	<?php 
    return apply_filters('rcp_print_user_payments_formatted', ob_get_clean(), $user_id);
}
function after_register()
{
    $_GET['level'] = get_usermeta($_GET['id'], 'reg_type');
    $levels = rcp_get_subscription_levels('active');
    $gateways = rcp_get_enabled_payment_gateways();
    rcp_show_error_messages('register');
    ?>


<form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php 
    echo esc_url(rcp_get_current_url());
    if (isset($_GET['id'])) {
        echo '?id=' . $_GET['id'];
    }
    ?>
">
<div class="saloginwrapper">
<h2 class="section-title"><span>Successful Registration!</span></h2>
<div class="clear"></div>

		<ul id="rcp_subscription_levels" style="display:none;">
			<?php 
    foreach ($levels as $key => $level) {
        ?>
				<?php 
        if (rcp_show_subscription_level($level->id)) {
            ?>
				<li id="rcp_subscription_level_<?php 
            echo $level->id;
            ?>
" class="rcp_subscription_level">
					<input type="radio" class="required rcp_level" <?php 
            if (isset($_GET['level']) && $_GET['level'] == $level->id) {
                echo 'checked="checked"';
            }
            ?>
 name="rcp_level" rel="<?php 
            echo esc_attr($level->price);
            ?>
" value="<?php 
            echo esc_attr(absint($level->id));
            ?>
" <?php 
            if ($level->duration == 0) {
                echo 'data-duration="forever"';
            }
            ?>
/>&nbsp;
					<span class="rcp_subscription_level_name"><?php 
            echo rcp_get_subscription_name($level->id);
            ?>
</span><span class="rcp_separator">&nbsp;-&nbsp;</span><span class="rcp_price" rel="<?php 
            echo esc_attr($level->price);
            ?>
"><?php 
            echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'rcp');
            ?>
<span class="rcp_separator">&nbsp;-&nbsp;</span></span>
					<span class="rcp_level_duration"><?php 
            echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'rcp');
            ?>
</span>
					<div class="rcp_level_description"> <?php 
            echo rcp_get_subscription_description($level->id);
            ?>
</div>
				</li>
				<?php 
        }
        ?>
			<?php 
    }
    ?>
		</ul>
    <?php 
    $gateways = rcp_get_enabled_payment_gateways();
    if (count($gateways) > 1) {
        $display = rcp_has_paid_levels() ? '' : ' style="display: none;"';
        ?>
		<fieldset class="rcp_gateways_fieldset">
            <p>
            <label><?php 
        _e('Choose Your Payment Method', 'rcp');
        ?>
</label>
            </p>
			<p id="rcp_payment_gateways"<?php 
        echo $display;
        ?>
>
				<select name="rcp_gateway" id="rcp_gateway" style="float:left; position:relative;">
					<?php 
        foreach ($gateways as $key => $gateway) {
            ?>
						<option value="<?php 
            echo esc_attr($key);
            ?>
"><?php 
            echo esc_html($gateway);
            ?>
</option>
					<?php 
        }
        ?>
				</select>
				
			</p>
		</fieldset>
	<?php 
    }
    ?>
    
<?php 
    do_action('rcp_before_registration_submit_field', $levels);
    ?>

	<p id="rcp_submit_wrap">
		<input type="hidden" name="rcp_register_nonce" value="<?php 
    echo wp_create_nonce('rcp-register-nonce');
    ?>
"/>
		<input type="submit" name="rcp_submit_registration" id="rcp_submit" value="<?php 
    echo apply_filters('rcp_registration_register_button', __('Register', 'rcp'));
    ?>
"/>
	</p>
<div class="clear"></div>
</div></form>
    <?php 
}
"/>
				<?php 
        }
        ?>
			<?php 
    }
    ?>
		</div>

		<fieldset class="rcp_level_details_fieldset">
			<p id="rcp_level_details_wrap" class="rcp_level" rel="<?php 
    echo esc_attr($level->price);
    ?>
">
				<span class="rcp_price"><?php 
    echo rcp_currency_filter($level->price);
    ?>
</span>
				<span class="rcp_sep">&nbsp;/&nbsp;</span>
				<span class="rcp_duration"><?php 
    echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'rcp');
    ?>
</span>
			</p>
		</fieldset>

	<?php 
}
?>

	<?php 
Ejemplo n.º 24
0
    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        if ($this->get_cached_widget($args)) {
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        $description = $instance['description'];
        $levels = rcp_get_subscription_levels('active');
        if (!$levels) {
            return;
        }
        $content = ob_get_clean();
        echo $before_widget;
        ?>

		<div class="container">

			<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

			<?php 
        if ($description) {
            ?>
				<p class="homepage-widget-description"><?php 
            echo $description;
            ?>
</p>
			<?php 
        }
        ?>

			<div class="pricing-table-widget-<?php 
        echo count($levels);
        ?>
">
				<?php 
        foreach ($levels as $key => $level) {
            ?>
					<?php 
            if (rcp_show_subscription_level($level->id)) {
                ?>
					<div id="rcp_subscription_level_<?php 
                echo $level->id;
                ?>
" class="pricing-table-widget rcp_subscription_level_fake" data-href="<?php 
                echo esc_url(get_permalink(jobify_find_page_with_shortcode(array('register_form'))));
                ?>
">
						<div class="pricing-table-widget-title" style="background-color: #01da90">
							<span class="rcp_subscription_level_name"><?php 
                echo stripslashes($level->name);
                ?>
</span>
						</div>

						<div class="pricing-table-widget-description">
							<h2><span class="rcp_price" rel="<?php 
                echo esc_attr($level->price);
                ?>
"><?php 
                echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'jobify');
                ?>
</h2>

							<p><span class="rcp_level_duration"><?php 
                echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
                ?>
</span></p>

							<?php 
                echo wpautop(wp_kses($level->description, rcp_allowed_html_tags()));
                ?>
						</div>
					</div>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
			</div>

		</div>

		<?php 
        echo $after_widget;
        echo $content;
        $this->cache_widget($args, $content);
    }