/**
 * Get other templates  passing attributes and including the file.
 *
 * @since 1.6
 * @access public
 *
 * @param string $template_name
 * @param array $args (default: array())
 * @param string $template_path (default: '')
 * @param string $default_path (default: '')
 */
function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '')
{
    if (!empty($args) && is_array($args)) {
        extract($args);
    }
    $template_names = array($template_name . '.php');
    $located = give_locate_template($template_names, $template_path, $default_path);
    if (!file_exists($located)) {
        give_output_error(sprintf(__('Error: %s template does not find.', 'give'), $located), true);
        return;
    }
    // Allow 3rd party plugin filter template file from their plugin.
    $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
    do_action('give_before_template_part', $template_name, $template_path, $located, $args);
    include $located;
    do_action('give_after_template_part', $template_name, $template_path, $located, $args);
}
" />
				<input type="hidden" name="give_action" value="user_login" />
				<input id="give_login_submit" type="submit" class="give_submit" value="<?php 
    _e('Log In', 'give');
    ?>
" />
			</div>

			<div class="give-lost-password give-login">
				<a href="<?php 
    echo wp_lostpassword_url();
    ?>
" title="<?php 
    _e('Lost Password', 'give');
    ?>
"><?php 
    _e('Lost Password?', 'give');
    ?>
</a>
			</div>
			<?php 
    do_action('give_login_fields_after');
    ?>
		</fieldset>
	</form>
<?php 
} else {
    ?>
	<?php 
    give_output_error(__('You are already logged in', 'give'), true, 'success');
}
Beispiel #3
0
/**
 * Receipt Shortcode.
 *
 * Shows a donation receipt.
 *
 * @since 1.0
 *
 * @param array  $atts    Shortcode attributes.
 * @param string $content
 *
 * @return string
 */
function give_receipt_shortcode($atts, $content = null)
{
    global $give_receipt_args, $payment;
    $give_receipt_args = shortcode_atts(array('error' => esc_html__('Sorry, you are missing the payment key to view this donation receipt.', 'give'), 'price' => true, 'donor' => true, 'date' => true, 'payment_key' => false, 'payment_method' => true, 'payment_id' => true), $atts, 'give_receipt');
    //set $session var
    $session = give_get_purchase_session();
    //set payment key var
    if (isset($_GET['payment_key'])) {
        $payment_key = urldecode($_GET['payment_key']);
    } elseif ($session) {
        $payment_key = $session['purchase_key'];
    } elseif ($give_receipt_args['payment_key']) {
        $payment_key = $give_receipt_args['payment_key'];
    }
    $email_access = give_get_option('email_access');
    // No payment_key found & Email Access is Turned on:
    if (!isset($payment_key) && $email_access == 'on' && !Give()->email_access->token_exists) {
        ob_start();
        give_get_template_part('email-login-form');
        return ob_get_clean();
    } elseif (!isset($payment_key)) {
        return give_output_error($give_receipt_args['error'], false, 'error');
    }
    $payment_id = give_get_purchase_id_by_key($payment_key);
    $user_can_view = give_can_view_receipt($payment_key);
    // Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
    if (!$user_can_view && $email_access == 'on' && !Give()->email_access->token_exists) {
        ob_start();
        give_get_template_part('email-login-form');
        return ob_get_clean();
    } elseif (!$user_can_view) {
        global $give_login_redirect;
        $give_login_redirect = give_get_current_page_url();
        ob_start();
        give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation payment receipt.', 'give')));
        give_get_template_part('shortcode', 'login');
        $login_form = ob_get_clean();
        return $login_form;
    }
    /*
     * Check if the user has permission to view the receipt.
     *
     * If user is logged in, user ID is compared to user ID of ID stored in payment meta
     * or if user is logged out and purchase was made as a guest, the purchase session is checked for
     * or if user is logged in and the user can view sensitive shop data.
     *
     */
    if (!apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
        return give_output_error($give_receipt_args['error'], false, 'error');
    }
    ob_start();
    give_get_template_part('shortcode', 'receipt');
    $display = ob_get_clean();
    return $display;
}
<?php

/**
 * This template is used to display the purchase summary with [give_receipt]
 */
global $give_receipt_args, $give_options, $payment;
//Validation: Ensure $payment var is set
if (empty($payment) && isset($give_receipt_args['id'])) {
    $payment = get_post($give_receipt_args['id']);
}
//Double-Validation: Check for $payment global
if (empty($payment)) {
    give_output_error(__('The specified receipt ID appears to be invalid', 'give'));
    return;
}
$meta = give_get_payment_meta($payment->ID);
$donation = $meta['form_title'];
$user = give_get_payment_meta_user_info($payment->ID);
$email = give_get_payment_user_email($payment->ID);
$status = give_get_payment_status($payment, true);
?>

<?php 
do_action('give_payment_receipt_before_table', $payment, $give_receipt_args);
?>

	<table id="give_donation_receipt" class="give-table">
		<thead>
		<?php 
do_action('give_payment_receipt_before', $payment, $give_receipt_args);
?>
Beispiel #5
0
						});
					})(jQuery);
				</script>

				<script src='https://www.google.com/recaptcha/api.js'></script>
				<div class="g-recaptcha" data-sitekey="<?php 
        echo $recaptcha_key;
        ?>
"></div>
				<input type="hidden" name="give_ip" class="give_ip" value=""/>
			<?php 
    }
    ?>

			<input type="submit" class="give-submit" value="<?php 
    _e('Email access token', 'give');
    ?>
"/>
		</form>
	</div>

<?php 
} else {
    ?>

	<?php 
    give_output_error(sprintf(__('An email with an access link has been sent to %1$s', 'give'), $email), true, 'success');
    ?>

<?php 
}
Beispiel #6
0
/**
 * Donation Form Goal Shortcode
 *
 * @description Show the Give donation form goals.
 *
 * @since       1.0
 *
 * @param array  $atts Shortcode attributes
 * @param string $content
 *
 * @return string
 */
function give_goal_shortcode($atts, $content = null)
{
    $atts = shortcode_atts(array('id' => '', 'show_text' => true, 'show_bar' => true), $atts, 'give_goal');
    //get the Give Form
    ob_start();
    //Sanity check 1: ensure there is an ID Provided
    if (empty($atts['id'])) {
        give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true);
    }
    //Sanity check 2: Check that this form even has Goals enabled
    $goal_option = get_post_meta($atts['id'], '_give_goal_option', true);
    if (empty($goal_option) || $goal_option !== 'yes') {
        give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true);
    } else {
        //Passed all sanity checks: output Goal
        give_show_goal_progress($atts['id'], $atts);
    }
    $final_output = ob_get_clean();
    return apply_filters('give_goal_shortcode_output', $final_output, $atts);
}
<?php

/**
 * Give Payment Processing Message
 */
?>
<div id="give-payment-processing">
	<?php 
give_output_error(sprintf(__('Your donation is processing. This page will reload automatically in 8 seconds. If it does not, click <a href="%s">here</a>.', 'give'), give_get_success_page_uri()), true, 'success');
?>
	<span class="give-loading-animation"></span>
	<script type="text/javascript">setTimeout(function () {
			window.location = '<?php 
echo give_get_success_page_uri();
?>
';
		}, 9000);
	</script>
</div>
Beispiel #8
0
    ?>
" title="<?php 
    esc_attr_e('Lost Password', 'give');
    ?>
"><?php 
    esc_html_e('Lost Password?', 'give');
    ?>
</a>
			</div>
			<?php 
    /**
     * Fires in the login shortcode, after the login fields.
     *
     * Allows you to add new fields after the default fields.
     *
     * @since 1.0
     */
    do_action('give_login_fields_after');
    ?>
		</fieldset>
	</form>
<?php 
} elseif (isset($_GET['give-login-success']) && $_GET['give-login-success'] == true) {
    ?>
	<?php 
    give_output_error(apply_filters('give_successful_login_message', esc_html__('Login successful. Welcome!', 'give')), true, 'success');
} else {
    ?>
	<?php 
    give_output_error(apply_filters('give_already_logged_in_message', sprintf(__('You are already logged in to the site. <a href="%s">Click here</a> to logout.', 'give'), esc_url($give_logout_redirect))), true, 'warning');
}
Beispiel #9
0
/**
 * Members-only Form
 *
 * If "Disable Guest Donations" and "Display Register / Login" is set to none
 *
 * @since  1.4.1
 *
 * @param  string $final_output
 * @param  array  $args
 *
 * @return string
 */
function give_members_only_form($final_output, $args)
{
    $form_id = isset($args['form_id']) ? $args['form_id'] : 0;
    //Sanity Check: Must have form_id & not be logged in
    if (empty($form_id) || is_user_logged_in()) {
        return $final_output;
    }
    //Logged in only and Register / Login set to none
    if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
        $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
        return apply_filters('give_members_only_output', $final_output, $form_id);
    }
    return $final_output;
}
Beispiel #10
0
            echo esc_url(add_query_arg('payment_key', give_get_payment_key($post->ID), give_get_success_page_uri()));
            ?>
"><?php 
            _e('View Details', 'give');
            ?>
&raquo;</a>
					<?php 
        }
        ?>
				</td>
				<?php 
        do_action('give_purchase_history_row_end', $post->ID, $donation_data);
        ?>
			</tr>
		<?php 
    }
    ?>
	</table>
	<div id="give_purchase_history_pagination" class="give_pagination navigation">
		<?php 
    $big = 999999;
    echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => ceil(give_count_purchases_of_customer() / 20)));
    ?>
	</div>
	<?php 
    wp_reset_postdata();
} else {
    ?>
	<?php 
    give_output_error(__('It looks like you haven\'t made any donations', 'give'), true, 'success');
}
Beispiel #11
0
    ?>
" />
			</div>

			<div class="give-lost-password give-login">
				<a href="<?php 
    echo wp_lostpassword_url();
    ?>
" title="<?php 
    _e('Lost Password', 'give');
    ?>
"><?php 
    _e('Lost Password?', 'give');
    ?>
</a>
			</div>
			<?php 
    do_action('give_login_fields_after');
    ?>
		</fieldset>
	</form>
<?php 
} elseif (isset($_GET['give-login-success']) && $_GET['give-login-success'] == true) {
    ?>
	<?php 
    give_output_error(apply_filters('give_successful_login_message', __('Login successful. Welcome!', 'give')), true, 'success');
} else {
    ?>
	<?php 
    give_output_error(apply_filters('give_already_logged_in_message', __('You are already logged in to the site.', 'give')), true, 'warning');
}