本文整理汇总了PHP中Cart66Common::downloadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::downloadFile方法的具体用法?PHP Cart66Common::downloadFile怎么用?PHP Cart66Common::downloadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::downloadFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
}
if ($okToDownload) {
$data = array('duid' => $duid, 'downloaded_on' => date('Y-m-d H:i:s'), 'ip' => $_SERVER['REMOTE_ADDR'], 'order_item_id' => $product->loadItemIdByDuid($duid));
$downloadsTable = Cart66Common::getTableName('downloads');
$wpdb->insert($downloadsTable, $data, array('%s', '%s', '%s', '%s'));
$setting = new Cart66Setting();
if (!empty($product->s3Bucket) && !empty($product->s3File)) {
require_once CART66_PATH . '/models/Cart66AmazonS3.php';
$link = Cart66AmazonS3::prepareS3Url($product->s3Bucket, $product->s3File, '1 minute');
wp_redirect($link);
exit;
} else {
$dir = Cart66Setting::getValue('product_folder');
$path = $dir . DIRECTORY_SEPARATOR . $product->download_path;
Cart66Common::downloadFile($path);
}
exit;
} else {
echo '<p>' . __("You have exceeded the maximum number of downloads for this product", "cart66") . '.</p>';
$order = new Cart66Order();
$order->loadByDuid($_GET['duid']);
if (empty($order->id)) {
echo "<h2>This order is no longer in the system</h2>";
exit;
}
}
}
}
if (!$ajaxRefresh) {
if (Cart66Setting::getValue('enable_google_analytics') == 1 && !Cart66Setting::getValue('use_other_analytics_plugin')) {
示例2: init
//.........这里部分代码省略.........
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);
}
}
}