コード例 #1
0
            <input class="Cart66CheckoutButton" type="image" src='<?php 
        echo $continueImg;
        ?>
' value="<?php 
        _e('Continue', 'cart66');
        ?>
" name="Complete Order"/>
          <?php 
    } else {
        ?>
            <input id="Cart66CheckoutButton" class="Cart66ButtonPrimary Cart66CompleteOrderButton Cart66ContinueButton" type="submit"  value="<?php 
        _e('Continue', 'cart66');
        ?>
" name="Complete Order"/>
          <?php 
    }
    ?>
        </li>
    
      </ul>
  
    </form>
<?php 
} else {
    ?>
  <?php 
    // TODO: Handle account generation for membership stuff
    $total = Cart66Session::get('Cart66Cart')->getGrandTotal();
    $gateway = new Cart66Mijireh();
    $gateway->initCheckout($total);
}
コード例 #2
0
ファイル: Cart66.php プロジェクト: rbredow/allyzabbacart
 public function init()
 {
     global $cart66Settings, $cart66Objects;
     $this->loadCoreModels();
     $this->initCurrencySymbols();
     $this->setDefaultPageRoles();
     // Allow override for sending email receipts
     define("CART66_EMAILS", apply_filters('cart66_send_default_emails', true));
     // Verify that upgrade has been run
     if (IS_ADMIN) {
         $dbVersion = Cart66Setting::getValue('version');
         if (version_compare(CART66_VERSION_NUMBER, $dbVersion)) {
             $this->install();
         }
     }
     // Define debugging and testing info
     $cart66Logging = Cart66Setting::getValue('enable_logging') ? true : false;
     $sandbox = Cart66Setting::getValue('paypal_sandbox') ? true : false;
     define("CART66_DEBUG", $cart66Logging);
     define("SANDBOX", $sandbox);
     // Handle dynamic JS requests
     // See: http://ottopress.com/2010/dont-include-wp-load-please/ for why
     add_filter('query_vars', array($this, 'addAjaxTrigger'));
     add_action('template_redirect', array($this, 'ajaxTriggerCheck'));
     // Scheduled events
     if (CART66_PRO) {
         add_action('daily_subscription_reminder_emails', array('Cart66MembershipReminders', 'dailySubscriptionEmailReminderCheck'));
         add_action('daily_followup_emails', array('Cart66AdvancedNotifications', 'dailyFollowupEmailCheck'));
         add_action('daily_gravity_forms_entry_removal', array('Cart66GravityReader', 'dailyGravityFormsOrphanedEntryRemoval'));
         $order = new Cart66Order();
         add_action('daily_prune_pending_orders', array($order, 'dailyPrunePendingPayPalOrders'));
     }
     // Notification shortcodes
     $sc = new Cart66ShortcodeManager();
     add_shortcode('email_shortcodes', array($sc, 'emailShortcodes'));
     // add Cart66 to the admin bar
     if (Cart66Common::cart66UserCan('orders')) {
         add_action('admin_bar_menu', array($this, 'cart66_admin_bar_menu'), 35);
     }
     if (IS_ADMIN) {
         if (Cart66Setting::getValue('capost_merchant_id')) {
             add_action('admin_notices', array($this, 'cart66_canada_post_upgrade'));
         }
         //add_action( 'admin_notices', 'cart66_data_collection' );
         add_action('admin_head', array($this, 'registerBasicScripts'));
         add_action('admin_enqueue_scripts', array($this, 'registerAdminScripts'));
         add_action('admin_init', array($this, 'registerCustomScripts'));
         add_action('admin_print_styles', array($this, 'registerAdminStyles'));
         add_action('admin_menu', array($this, 'buildAdminMenu'));
         // we dont use this button anymore
         //add_action('admin_init', array($this, 'addEditorButtons'));
         add_action('admin_init', array($this, 'forceDownload'));
         add_action('wp_ajax_save_settings', array('Cart66Ajax', 'saveSettings'));
         add_action('wp_ajax_force_plugin_update', array('Cart66Ajax', 'forcePluginUpdate'));
         add_action('wp_ajax_promotionProductSearch', array('Cart66Ajax', 'promotionProductSearch'));
         add_action('wp_ajax_loadPromotionProducts', array('Cart66Ajax', 'loadPromotionProducts'));
         add_action('wp_ajax_send_test_email', array('Cart66Ajax', 'sendTestEmail'));
         add_action('wp_ajax_resend_email_from_log', array('Cart66Ajax', 'resendEmailFromLog'));
         add_action('wp_ajax_promotions_table', array('Cart66DataTables', 'promotionsTable'));
         add_action('wp_ajax_products_table', array('Cart66DataTables', 'productsTable'));
         add_action('wp_ajax_orders_table', array('Cart66DataTables', 'ordersTable'));
         add_action('wp_ajax_print_view', array('Cart66Ajax', 'ajaxReceipt'));
         add_action('wp_ajax_view_email', array('Cart66Ajax', 'viewLoggedEmail'));
         add_action('wp_ajax_dashboard_products_table', array('Cart66DataTables', 'dashboardProductsTable'));
         add_action('wp_ajax_shortcode_products_table', array('Cart66Ajax', 'shortcodeProductsTable'));
         add_action('wp_ajax_page_slurp', array('Cart66Ajax', 'pageSlurp'));
         add_action('wp_ajax_dismiss_mijireh_notice', array('Cart66Ajax', 'dismissMijirehNotice'));
         add_action('wp_ajax_cart66_page_check', array('Cart66Ajax', 'checkPages'));
         if (CART66_PRO) {
             add_action('wp_ajax_spreedly_table', array('Cart66DataTables', 'spreedlyTable'));
             add_action('wp_ajax_paypal_subscriptions_table', array('Cart66DataTables', 'paypalSubscriptionsTable'));
             add_action('wp_ajax_accounts_table', array('Cart66DataTables', 'accountsTable'));
             add_action('wp_ajax_inventory_table', array('Cart66DataTables', 'inventoryTable'));
         }
         // Load Dialog Box in editor
         add_action('media_buttons', array('Cart66Dialog', 'cart66_dialog_box'), 11);
         add_action('admin_footer', array('Cart66Dialog', 'add_shortcode_popup'));
         // Load Page Slurp Button on checkout page
         add_action('add_meta_boxes', array($this, 'addPageSlurpButtonMeta'));
         add_action('media_buttons', array($this, 'addPageSlurpButton'), 12);
         // Load Dashboard Widget
         add_action('wp_dashboard_setup', array('Cart66Dashboard', 'cart66_add_dashboard_widgets'));
         if (CART66_PRO) {
             add_action('wp_ajax_update_gravity_product_quantity_field', array('Cart66Ajax', 'updateGravityProductQuantityField'));
         }
         if (class_exists('SpreedlySubscription') || true) {
             add_action('save_post', array($this, 'saveFeatureLevelMetaBoxData'));
             add_action('add_meta_boxes', array($this, 'addFeatureLevelMetaBox'));
         }
         //Plugin update actions
         if (CART66_PRO) {
             add_action('update_option__transient_update_plugins', array('Cart66ProCommon', 'checkUpdate'));
             //used by WP 2.8
             add_filter('pre_set_site_transient_update_plugins', array('Cart66ProCommon', 'getUpdatePluginsOption'));
             //used by WP 3.0
             add_action('install_plugins_pre_plugin-information', array('Cart66ProCommon', 'showChangelog'));
         }
         add_action('save_post', array($this, 'check_cart66_pages_on_inline_edit'));
         add_action('admin_notices', array($this, 'cart66_page_check'));
     } else {
         $this->initShortcodes();
         $this->initCart();
         $this->checkIPN();
         $order = new Cart66Order();
         add_action('wp_enqueue_scripts', array('Cart66', 'enqueueScripts'));
         if (CART66_PRO) {
             add_action('template_redirect', array($this, 'checkInventoryOnCheckout'), 0);
             add_action('template_redirect', array($this, 'checkShippingMethodOnCheckout'), 0);
             add_action('template_redirect', array($this, 'checkZipOnCheckout'), 0);
             add_action('template_redirect', array($this, 'checkTermsOnCheckout'), 0);
             add_action('template_redirect', array($this, 'checkMinAmountOnCheckout'), 0);
             add_action('template_redirect', array($this, 'checkCustomFieldsOnCheckout'), 0);
             add_action('template_redirect', array($this, 'protectSubscriptionPages'), 0);
             add_filter('wp_list_pages_excludes', array($this, 'hideStorePages'));
             add_filter('wp_list_pages_excludes', array($this, 'hidePrivatePages'));
             add_filter('wp_nav_menu_objects', array($this, 'filter_private_menu_items'), 10, 2);
         }
         add_action('wp_head', array('Cart66Common', 'displayVersionInfo'));
         add_action('template_redirect', array($this, 'dontCacheMeBro'));
         add_action('shutdown', array('Cart66Session', 'touch'));
         add_action('wp_footer', array($order, 'updateViewed'));
         if (!Cart66Setting::getValue('use_other_analytics_plugin')) {
             add_action('wp_footer', array($order, 'addTrackingCode'));
         }
     }
     // ================================================================
     // = Intercept query string cart66 tasks                          =
     // ================================================================
     // Logout the logged in user
     $isLoggedIn = Cart66Common::isLoggedIn();
     if (isset($_REQUEST['cart66-task']) && $_REQUEST['cart66-task'] == 'logout' && $isLoggedIn) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Intercepting Cart66 Logout task");
         $url = Cart66ProCommon::getLogoutUrl();
         Cart66Account::logout($url);
     }
     if ($_SERVER['REQUEST_METHOD'] == 'GET' && Cart66Common::getVal('task') == 'member_download') {
         if (Cart66Common::isLoggedIn()) {
             $path = str_replace(array('../', './'), '', $_GET['path']);
             // don't allow folder traversing
             Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Attempting a member download file request: {$path}");
             Cart66Common::downloadFile($path);
         }
     } elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && Cart66Common::getVal('task') == 'add-to-cart-anchor') {
         $options = null;
         if (isset($_GET['options'])) {
             $options = Cart66Common::getVal('options');
         }
         $productUrl = null;
         if (isset($_GET['product_url'])) {
             $productUrl = $_GET['product_url'];
         }
         Cart66Session::get('Cart66Cart')->addItem(Cart66Common::getVal('cart66ItemId'), 1, $options, null, $productUrl);
         $promotion_var_name = Cart66Setting::getValue('promotion_get_varname') ? Cart66Setting::getValue('promotion_get_varname') : 'promotion';
         if (isset($_GET[$promotion_var_name])) {
             Cart66Session::get('Cart66Cart')->applyPromotion(strtoupper($_GET[$promotion_var_name]), true);
         }
         wp_redirect(remove_query_arg(array('cart66ItemId', 'product_url', 'task', $promotion_var_name), Cart66Common::getCurrentPageUrl()));
         exit;
     } elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && Cart66Common::getVal('task') == 'mijireh_notification') {
         require_once CART66_PATH . "/gateways/Cart66Mijireh.php";
         $order_number = Cart66Common::getVal('order_number');
         $mijireh = new Cart66Mijireh();
         $mijireh->saveMijirehOrder($order_number);
     } elseif (isset($_GET['task']) && Cart66Common::getVal('task') == 'mijireh_page_slurp') {
         $access_key = Cart66Setting::getValue('mijireh_access_key');
         if (isset($_POST['access_key']) && isset($_POST['page_id']) && $_POST['access_key'] == $access_key) {
             wp_update_post(array('ID' => $_POST['page_id'], 'post_status' => 'private'));
         }
     } else {
         $promotion_var_name = Cart66Setting::getValue('promotion_get_varname') ? Cart66Setting::getValue('promotion_get_varname') : 'promotion';
         if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET[$promotion_var_name])) {
             Cart66Session::get('Cart66Cart')->applyPromotion(strtoupper($_GET[$promotion_var_name]), true);
         }
     }
 }