本文整理匯總了PHP中wpshop_tools::forceDownload方法的典型用法代碼示例。如果您正苦於以下問題:PHP wpshop_tools::forceDownload方法的具體用法?PHP wpshop_tools::forceDownload怎麽用?PHP wpshop_tools::forceDownload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wpshop_tools
的用法示例。
在下文中一共展示了wpshop_tools::forceDownload方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wp_upload_dir
if (get_post_type($downloadable_product_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
$parent_def = wpshop_products::get_parent_variation($downloadable_product_id);
if (!empty($parent_def) && !empty($parent_def['parent_post'])) {
$parent_post = $parent_def['parent_post'];
$variation_id = $downloadable_product_id;
$downloadable_product_id = $parent_post->ID;
}
}
$link = wpshop_attributes::get_attribute_option_output(array('item_id' => $downloadable_product_id, 'item_is_downloadable_' => 'yes'), 'is_downloadable_', 'file_url', $order);
if ($link !== false) {
$uploads = wp_upload_dir();
$basedir = $uploads['basedir'];
$pos = strpos($link, 'uploads');
$link = $basedir . substr($link, $pos + 7);
/** If plugin is encrypted **/
$encrypted_plugin_path = get_post_meta($_GET['oid'], '_download_file_path_' . $_GET['oid'] . '_' . (!empty($variation_id) && get_post_type($variation_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ? $variation_id : $downloadable_product_id), true);
if (!empty($encrypted_plugin_path)) {
$link = WPSHOP_UPLOAD_DIR . $encrypted_plugin_path;
$is_encrypted = true;
}
wpshop_tools::forceDownload($link, $is_encrypted);
}
}
}
}
}
} else {
wp_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))));
}
}
echo __('Impossible to download the file you requested', 'wpshop');