本文整理汇总了PHP中UniteFunctionsWPRev::import_media方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsWPRev::import_media方法的具体用法?PHP UniteFunctionsWPRev::import_media怎么用?PHP UniteFunctionsWPRev::import_media使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsWPRev
的用法示例。
在下文中一共展示了UniteFunctionsWPRev::import_media方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importSliderFromPost
//.........这里部分代码省略.........
$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"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
//update slider or craete new
if ($sliderExists) {
$arrUpdate = array("params" => $json_params);
$this->db->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id" => $sliderID));
} else {
//new slider
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $this->db->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
}
//-------- Slides Handle -----------
//delete current slides
if ($sliderExists) {
$this->deleteAllSlides();
}
//create all slides
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
//import if exists in zip folder
if (trim($params["image"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo $params["image"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
}
}
}
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$this->db->insert(GlobalsRevSlider::$table_slides, $arrCreate);
}
} catch (Exception $e) {
$errorMessage = $e->getMessage();
return array("success" => false, "error" => $errorMessage, "sliderID" => $sliderID);
}
//update dynamic-captions.css
RevOperations::updateDynamicCaptions();
return array("success" => true, "sliderID" => $sliderID);
}
示例2: hb_importer
//.........这里部分代码省略.........
} else {
//insert
$arrInsert["handle"] = $class;
$db->insert(GlobalsRevSlider::$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
$arrSlider = @unserialize($content);
$sliderParams = $arrSlider["params"];
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
//new slider
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
$sliderID = $wpdb->insert_id;
//-------- Slides Handle -----------
//create all slides
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
//import if exists in zip folder
if (trim($params["image"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo $params["image"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
}
}
}
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$wpdb->insert(GlobalsRevSlider::$table_slides, $arrCreate);
//}
}
}
}
// finally redirect to success page
wp_redirect(admin_url('themes.php?page=highend_options&imported=success#_hb_general_settings'));
}
}
}
示例3: cmo_import_sliders_ajax
//.........这里部分代码省略.........
$arrInsert = array();
$arrInsert["hover"] = json_encode($styles);
$arrInsert["settings"] = json_encode(array('hover' => 'true'));
} else {
$arrInsert = array();
$arrInsert["params"] = json_encode($styles);
}
//check if class exists
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
$db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
} else {
//insert
$arrInsert["handle"] = $class;
$db->insert(GlobalsRevSlider::$table_css, $arrInsert);
}
}
} else {
}
}
$content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
//clear errors in string
$arrSlider = @unserialize($content);
$sliderParams = $arrSlider["params"];
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
$sliderID = $wpdb->insert_id;
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
if (isset($params["image"])) {
if (trim($params["image"]) !== '') {
if ($importZip === true) {
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo esc_html($params["image"]) . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo esc_html($layer["image_url"]) . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
}
}
}
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
// create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$wpdb->insert(GlobalsRevSlider::$table_slides, $arrCreate);
}
}
ajax_finish(true, "done");
}
}
示例4: fusion_importer
//.........这里部分代码省略.........
$content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
//clear errors in string
$arrSlider = @unserialize($content);
$sliderParams = $arrSlider["params"];
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
//new slider
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
$sliderID = $wpdb->insert_id;
//-------- Slides Handle -----------
//create all slides
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
//import if exists in zip folder
if (trim($params["image"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo $params["image"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
示例5: royal_revslider_import
//.........这里部分代码省略.........
$arrInsert = array();
$arrInsert["params"] = json_encode($styles);
}
//check if class exists
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
$db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
} else {
//insert
$arrInsert["handle"] = $class;
$db->insert(GlobalsRevSlider::$table_css, $arrInsert);
}
}
}
}
$content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
//clear errors in string
$arrSlider = @unserialize($content);
$sliderParams = $arrSlider["params"];
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
//new slider
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
$sliderID = $wpdb->insert_id;
//-------- Slides Handle -----------
//create all slides
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
//import if exists in zip folder
if (trim($params["image"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
// echo 'Not Found';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
// echo 'Not Found';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
}
}
}
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$wpdb->insert(GlobalsRevSlider::$table_slides, $arrCreate);
}
}
}
}
示例6: foreach
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
}
}
}
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
示例7: importSliderFromPost
//.........这里部分代码省略.........
}
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
if ($sliderExists) {
$arrUpdate = array("params" => $json_params);
$this->db->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id" => $sliderID));
} else {
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $this->db->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
}
if ($sliderExists) {
$this->deleteAllSlides();
}
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
if (isset($params["image"])) {
if (strpos($params["image"], 'http') !== false) {
} else {
if (trim($params["image"]) !== '') {
if ($importZip === true) {
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo $params["image"] . __(' not found!<br>');
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
}
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
if (trim($layer["image_url"]) !== '') {
if (strpos($layer["image_url"], 'http') !== false) {
} else {
if ($importZip === true) {
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . __(' not found!<br>');
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
示例8: import_revolution_slider
//.........这里部分代码省略.........
$class = trim($class);
if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
continue;
}
if (strpos($class, ':hover') !== false) {
$class = trim(str_replace(':hover', '', $class));
$arrInsert = array();
$arrInsert["hover"] = json_encode($styles);
$arrInsert["settings"] = json_encode(array('hover' => 'true'));
} else {
$arrInsert = array();
$arrInsert["params"] = json_encode($styles);
}
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
$db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
} else {
$arrInsert["handle"] = $class;
$db->insert(GlobalsRevSlider::$table_css, $arrInsert);
}
}
} else {
}
}
$content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
//clear errors in string
$arrSlider = @unserialize($content);
$sliderParams = $arrSlider["params"];
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
$sliderID = $wpdb->insert_id;
/* create all slides */
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
if (isset($params["image"])) {
if (trim($params["image"]) !== '') {
if ($importZip === true) {
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo $params["image"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
}
}
}
}
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
/* create new slide */
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$wpdb->insert(GlobalsRevSlider::$table_slides, $arrCreate);
}
}
}
}