Esempio n. 1
0
 /**
  * Calculate tax.
  */
 public static function ajax_calculate_tax()
 {
     if (!isset($_GET['country']) || !isset($_GET['object_id'])) {
         exit;
     }
     $object = get_post(intval($_GET['object_id']));
     if (!$object || !in_array($object->post_type, array('ib_educator_course', 'ib_edu_membership'))) {
         exit;
     }
     $args = array();
     $args['country'] = $_GET['country'];
     $args['state'] = isset($_GET['state']) ? $_GET['state'] : '';
     echo Edr_StudentAccount::payment_info($object, $args);
     exit;
 }
        // Get state.
        if (isset($_POST['billing_state'])) {
            $args['state'] = $_POST['billing_state'];
        } elseif (!empty($billing['state'])) {
            $args['state'] = $billing['state'];
        } else {
            $args['state'] = ib_edu_get_location('state');
        }
        // Get price.
        if ('ib_educator_course' == $post->post_type) {
            $args['price'] = ib_edu_get_course_price($post->ID);
        } elseif ('ib_edu_membership' == $post->post_type) {
            $args['price'] = Edr_Memberships::get_instance()->get_price($post->ID);
        }
        // Output payment summary.
        echo '<div id="edu-payment-info" class="edu-payment-info">' . Edr_StudentAccount::payment_info($post, $args) . '</div>';
        // Payment gateways.
        $gateways = IB_Educator_Main::get_gateways();
        ?>

				<?php 
        if ($args['price'] && !empty($gateways)) {
            ?>
					<div class="ib-edu-form-field<?php 
            if (in_array('empty_payment_method', $error_codes)) {
                echo ' error';
            }
            ?>
">
						<label><?php 
            esc_html_e('Payment Method', 'training');
Esempio n. 3
0
// Register the quizzes service.
function edr_get_quizzes_service()
{
    return new Edr_Quizzes();
}
Edr_Manager::add('edr_quizzes', 'edr_get_quizzes_service');
// Setup the memberships feature.
Edr_MembershipsRun::init();
// Setup the post types and taxonomies.
Edr_PostTypes::init();
// Setup Educator.
IB_Educator_Main::init();
// Ajax actions.
Edr_AjaxActions::init();
// Setup account processing (e.g. payment form).
Edr_StudentAccount::init();
// Parse incoming requests (e.g. PayPal IPN).
Edr_RequestDispatcher::init();
if (is_admin()) {
    // Setup the Educator's admin.
    Edr_Admin::init();
    // Check whether to run the update script or not.
    function ib_edu_update_check()
    {
        if (get_option('ib_educator_version') != IBEDUCATOR_VERSION) {
            $install = new Edr_Install();
            $install->activate(false, false);
        }
    }
    add_action('init', 'ib_edu_update_check', 9);
}