本文整理汇总了PHP中RevSliderFunctions::downloadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctions::downloadFile方法的具体用法?PHP RevSliderFunctions::downloadFile怎么用?PHP RevSliderFunctions::downloadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctions
的用法示例。
在下文中一共展示了RevSliderFunctions::downloadFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportSlider
//.........这里部分代码省略.........
$cap = RevSliderOperations::getCaptionsContentArray($class);
//set also advanced styles here...
if (!empty($cap)) {
$captions[] = $cap;
}
}
$styles = RevSliderCssParser::parseArrayToCss($captions, "\n", true);
}
$animations = '';
if (!empty($usedAnimations)) {
$animation = array();
foreach ($usedAnimations as $anim => $val) {
$anima = RevSliderOperations::getFullCustomAnimationByID($anim);
if ($anima !== false) {
$animation[] = RevSliderOperations::getFullCustomAnimationByID($anim);
}
}
if (!empty($animation)) {
$animations = serialize($animation);
}
}
$usedImages = array_merge($usedImages, $usedVideos);
//add images to zip
if (!empty($usedImages)) {
$upload_dir = RevSliderFunctionsWP::getPathUploads();
$upload_dir_multisiteless = wp_upload_dir();
$cont_url = $upload_dir_multisiteless['baseurl'];
$cont_url_no_www = str_replace('www.', '', $upload_dir_multisiteless['baseurl']);
$upload_dir_multisiteless = $upload_dir_multisiteless['basedir'] . '/';
foreach ($usedImages as $file => $val) {
if ($useDummy == "true") {
//only use dummy images
} else {
//use the real images
if (strpos($file, 'http') !== false) {
$remove = false;
$checkpath = str_replace(array($cont_url, $cont_url_no_www), '', $file);
if (is_file($upload_dir . $checkpath)) {
$zip->addFile($upload_dir . $checkpath, 'images/' . $checkpath);
$remove = true;
} elseif (is_file($upload_dir_multisiteless . $checkpath)) {
$zip->addFile($upload_dir_multisiteless . $checkpath, 'images/' . $checkpath);
$remove = true;
}
if ($remove) {
//as its http, remove this from strexport
$strExport = str_replace(array($cont_url . $checkpath, $cont_url_no_www . $checkpath), $checkpath, $strExport);
}
} else {
if (is_file($upload_dir . $file)) {
$zip->addFile($upload_dir . $file, 'images/' . $file);
} elseif (is_file($upload_dir_multisiteless . $file)) {
$zip->addFile($upload_dir_multisiteless . $file, 'images/' . $file);
}
}
}
}
}
$zip->addFromString("slider_export.txt", $strExport);
//add slider settings
if (strlen(trim($animations)) > 0) {
$zip->addFromString("custom_animations.txt", $animations);
}
//add custom animations
if (strlen(trim($styles)) > 0) {
$zip->addFromString("dynamic-captions.css", $styles);
}
//add dynamic styles
$static_css = RevSliderOperations::getStaticCss();
$zip->addFromString("static-captions.css", $static_css);
//add slider settings
$enable_slider_pack = apply_filters('revslider_slider_pack_export', false);
if ($enable_slider_pack) {
//allow for slider packs the automatic creation of the info.cfg
$zip->addFromString('info.cfg', md5($this->alias));
//add slider settings
}
$zip->close();
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=" . $exportname);
header("Pragma: no-cache");
header("Expires: 0");
readfile(RevSliderGlobals::$urlExportZip);
@unlink(RevSliderGlobals::$urlExportZip);
//delete file after sending it to user
} else {
//fallback, do old export
$this->validateInited();
$sliderParams = $this->getParamsForExport();
$arrSlides = $this->getSlidesForExport();
$arrSliderExport = array("params" => $sliderParams, "slides" => $arrSlides);
$strExport = serialize($arrSliderExport);
if (!empty($this->alias)) {
$filename = $this->alias . ".txt";
} else {
$filename = "slider_export.txt";
}
RevSliderFunctions::downloadFile($strExport, $filename);
}
}