本文整理汇总了PHP中RevSliderFunctionsWP::getImageUrlFromPath方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctionsWP::getImageUrlFromPath方法的具体用法?PHP RevSliderFunctionsWP::getImageUrlFromPath怎么用?PHP RevSliderFunctionsWP::getImageUrlFromPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctionsWP
的用法示例。
在下文中一共展示了RevSliderFunctionsWP::getImageUrlFromPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importSliderFromPost
//.........这里部分代码省略.........
$arrInsert["settings"] = '';
}
//check if class exists
$result = $db->fetch(RevSliderGlobals::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
$db->update(RevSliderGlobals::$table_css, $arrInsert, array('handle' => $class));
} else {
//insert
$arrInsert["handle"] = $class;
$db->insert(RevSliderGlobals::$table_css, $arrInsert);
}
}
dmp(__("dynamic styles imported!", REVSLIDER_TEXTDOMAIN));
} else {
dmp(__("no dynamic styles found, if slider uses dynamic styles, the provided export may be broken...", REVSLIDER_TEXTDOMAIN));
}
}
//$content = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $content); //clear errors in string //deprecated in newest php version
$content = preg_replace_callback('!s:(\\d+):"(.*?)";!', array('RevSlider', 'clear_error_in_string'), $content);
//clear errors in string
$arrSlider = @unserialize($content);
if (empty($arrSlider)) {
RevSliderFunctions::throwError("Wrong export slider file format! This could be caused because the ZipArchive extension is not enabled.");
}
//update slider params
$sliderParams = $arrSlider["params"];
if ($sliderExists) {
$sliderParams["title"] = $this->arrParams["title"];
$sliderParams["alias"] = $this->arrParams["alias"];
$sliderParams["shortcode"] = $this->arrParams["shortcode"];
}
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = RevSliderFunctionsWP::getImageUrlFromPath($sliderParams["background_image"]);
}
$import_statics = true;
if (isset($sliderParams['enable_static_layers'])) {
if ($sliderParams['enable_static_layers'] == 'off') {
$import_statics = false;
}
unset($sliderParams['enable_static_layers']);
}
$json_params = json_encode($sliderParams);
//update slider or create new
if ($sliderExists) {
$arrUpdate = array("params" => $json_params);
$this->db->update(RevSliderGlobals::$table_sliders, $arrUpdate, array("id" => $sliderID));
} else {
//new slider
$arrInsert = array();
$arrInsert['params'] = $json_params;
//check if Slider with title and/or alias exists, if yes change both to stay unique
$arrInsert['title'] = RevSliderFunctions::getVal($sliderParams, 'title', 'Slider1');
$arrInsert['alias'] = RevSliderFunctions::getVal($sliderParams, 'alias', 'slider1');
if ($is_template === false) {
//we want to stay at the given alias if we are a template
$talias = $arrInsert['alias'];
$ti = 1;
while ($this->isAliasExistsInDB($talias)) {
//set a new alias and title if its existing in database
$talias = $arrInsert['alias'] . $ti;
$ti++;
}
if ($talias !== $arrInsert['alias']) {
$arrInsert['title'] = $talias;
$arrInsert['alias'] = $talias;
示例2: importSliderFromPost
//.........这里部分代码省略.........
$navigation["name"] = $navigation['name'] . '-' . date('is');
$content = str_replace($rh . '"', $navigation["handle"] . '"', $content);
$navigation["css"] = str_replace('.' . $rh, '.' . $navigation["handle"], $navigation["css"]);
//change css class to the correct new class
$navi_id = $db->insert(RevSliderGlobals::$table_navigation, $navigation);
}
} else {
$navi_id = $db->insert(RevSliderGlobals::$table_navigation, $navigation);
}
}
dmp(__("navigations imported!", 'revslider'));
}
} else {
$message = $unzipfile->get_error_message();
$wp_filesystem->delete($d_path, true);
return array("success" => false, "error" => $message);
}
//$content = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $content); //clear errors in string //deprecated in newest php version
$content = preg_replace_callback('!s:(\\d+):"(.*?)";!', array('RevSliderSlider', 'clear_error_in_string'), $content);
//clear errors in string
$arrSlider = @unserialize($content);
if (empty($arrSlider)) {
$wp_filesystem->delete($d_path, true);
RevSliderFunctions::throwError(__('Wrong export slider file format! Please make sure that the uploaded file is either a zip file with a correct slider_export.txt in the root of it or an valid slider_export.txt file.', 'revslider'));
}
//update slider params
$sliderParams = $arrSlider["params"];
if ($sliderExists) {
$sliderParams["title"] = $this->arrParams["title"];
$sliderParams["alias"] = $this->arrParams["alias"];
$sliderParams["shortcode"] = $this->arrParams["shortcode"];
}
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = RevSliderFunctionsWP::getImageUrlFromPath($sliderParams["background_image"]);
}
$import_statics = true;
if (isset($sliderParams['enable_static_layers'])) {
if ($sliderParams['enable_static_layers'] == 'off') {
$import_statics = false;
}
unset($sliderParams['enable_static_layers']);
}
$sliderParams['version'] = $version_check;
$json_params = json_encode($sliderParams);
//update slider or create new
if ($sliderExists) {
$arrUpdate = array("params" => $json_params);
$this->db->update(RevSliderGlobals::$table_sliders, $arrUpdate, array("id" => $sliderID));
} else {
//new slider
$arrInsert = array();
$arrInsert['params'] = $json_params;
//check if Slider with title and/or alias exists, if yes change both to stay unique
$arrInsert['title'] = RevSliderFunctions::getVal($sliderParams, 'title', 'Slider1');
$arrInsert['alias'] = RevSliderFunctions::getVal($sliderParams, 'alias', 'slider1');
if ($is_template === false) {
//we want to stay at the given alias if we are a template
$talias = $arrInsert['alias'];
$ti = 1;
while ($this->isAliasExistsInDB($talias)) {
//set a new alias and title if its existing in database
$talias = $arrInsert['alias'] . $ti;
$ti++;
}
if ($talias !== $arrInsert['alias']) {
$sliderParams['title'] = $talias;