/**
  * Ensure that only one instance of LPR_Gateways is loadded
  * @return LPR_Gateways|null
  */
 static function instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     // Define the url and path of plugin
     $this->plugin_file = __FILE__;
     $this->plugin_url = untrailingslashit(plugins_url('/', __FILE__));
     $this->plugin_path = untrailingslashit(plugin_dir_path(__FILE__));
     // defines const
     $this->define_const();
     // hooks
     $this->init_hooks();
     // includes
     $this->includes();
     // load core add ons
     //$this->load_core_add_ons();
     // load payment gateways
     LPR_Gateways::instance()->get_available_payment_gateways();
     // let third parties know that we're ready
     do_action('learn_press_loaded');
     do_action('learn_press_register_add_ons');
 }
Example #3
0
 /**
  * Constructor
  */
 public function __construct()
 {
     // Define the url and path of plugin
     $this->plugin_file = __FILE__;
     $this->plugin_url = untrailingslashit(plugins_url('/', __FILE__));
     $this->plugin_path = untrailingslashit(plugin_dir_path(__FILE__));
     // defines const
     $this->define_const();
     // hooks
     $this->init_hooks();
     // includes
     $this->includes();
     // load core add ons
     //$this->load_core_add_ons();
     // load payment gateways
     LPR_Gateways::instance()->get_available_payment_gateways();
     // let third parties know that we're ready
     do_action('learn_press_loaded');
     do_action('learn_press_register_add_ons');
     global $learn_press_add_ons;
     $learn_press_add_ons['bundle_activate'] = array('learnpress-course-review', 'learnpress-import-export', 'learnpress-prerequisites-courses', 'learnpress-wishlist');
     $learn_press_add_ons['more'] = array('learnpress-bbpress', 'learnpress-buddypress', 'learnpress-course-review', 'learnpress-import-export', 'learnpress-prerequisites-courses', 'learnpress-wishlist');
 }
Example #4
0
<form id="learn_press_payment_form" name="learn_press_payment_form" method="post">
    <?php 
if (!learn_press_is_free_course()) {
    $gateways = LPR_Gateways::instance()->get_available_payment_gateways();
    ?>
    <ul id="lpr-payment-tab" class="nav nav-tabs" role="tablist">
        <?php 
    do_action('learn_press_before_payment_loop');
    $i = 0;
    foreach ($gateways as $slug => $gateway) {
        $gateway = apply_filters('learn_press_print_payment_' . $slug, $gateway);
        if (!$gateway) {
            continue;
        }
        ?>
        <li>
            <label><input type="radio" name="payment_method" value="<?php 
        echo $slug;
        ?>
" /> <?php 
        echo $gateway;
        ?>
</label>
            <div class="learn_press_payment_form" id="learn_press_payment_form_<?php 
        echo $slug;
        ?>
">
            <?php 
        do_action('learn_press_payment_gateway_form_' . $slug);
        ?>
            </div>
function learn_press_handle_purchase_request()
{
    LPR_Gateways::instance()->get_available_payment_gateways();
    $method_var = 'learn-press-transaction-method';
    $requested_transaction_method = empty($_REQUEST[$method_var]) ? false : $_REQUEST[$method_var];
    learn_press_do_transaction($requested_transaction_method);
}