/** * @author ThemePunch <*****@*****.**> * @link http://www.themepunch.com/ * @copyright 2015 ThemePunch */ if (!defined('ABSPATH')) { exit; } $_width = $slider->getParam('width', 1280); $_height = $slider->getParam('height', 868); $the_slidertype = $slider->getParam('slider-type', 'standard'); if ($the_slidertype == 'hero') { $active_slide = $slider->getParam('hero_active', -1); //check if this id is still existing $exists = RevSliderSlide::isSlideByID($active_slide); if ($exists == false) { $active_slide = -1; } } ?> <input type="hidden" value="<?php echo $_width; ?> " name="rs-grid-width" /> <input type="hidden" value="<?php echo $_height; ?> " name="rs-grid-height" /> <div id="slide_selector" class="slide_selector editor_buttons_wrapper postbox unite-postbox" style="max-width:100% !important;">
/** * * init slide by post data */ public function initByPostData($postData, RevSliderSlide $slideTemplate, $sliderID) { $this->postData = apply_filters('revslider_slide_initByPostData', $postData, $slideTemplate, $sliderID, $this); $postID = $postData["ID"]; $slideTemplateID = get_post_meta($postID, 'slide_template', true); if ($slideTemplateID == '') { $slideTemplateID = 'default'; } if (!empty($slideTemplateID) && is_numeric($slideTemplateID)) { //init by local template, if fail, init by global (slider) template try { //check if slide exists $slideTemplateLocal = new RevSliderSlide(); if ($slideTemplateLocal->isSlideByID($slideTemplateID)) { $slideTemplateLocal->initByID($slideTemplateID); $this->initBySlide($slideTemplateLocal); } else { $this->initBySlide($slideTemplate); } } catch (Exception $e) { $this->initBySlide($slideTemplate); } } else { //init by global template $this->initBySlide($slideTemplate); } //set some slide params $this->id = $postID; $this->params["title"] = RevSliderFunctions::getVal($postData, "post_title"); if (isset($this->params['enable_link']) && $this->params['enable_link'] == "true" && isset($this->params['link_type']) && $this->params['link_type'] == "regular") { $link = get_permalink($postID); $this->params["link"] = str_replace(array("%link%", '{{link}}'), $link, $this->params["link"]); $this->params["link"] = str_replace('-', '_REVSLIDER_', $this->params["link"]); //process meta tags: $arrMatches = array(); preg_match('/%meta:\\w+%/', $this->params["link"], $arrMatches); foreach ($arrMatches as $match) { $meta = str_replace("%meta:", "", $match); $meta = str_replace("%", "", $meta); $meta = str_replace('_REVSLIDER_', '-', $meta); $metaValue = get_post_meta($postID, $meta, true); $this->params["link"] = str_replace($match, $metaValue, $this->params["link"]); } $arrMatches = array(); preg_match('/{{meta:\\w+}}/', $this->params["link"], $arrMatches); foreach ($arrMatches as $match) { $meta = str_replace("{{meta:", "", $match); $meta = str_replace("}}", "", $meta); $meta = str_replace('_REVSLIDER_', '-', $meta); $metaValue = get_post_meta($postID, $meta, true); $this->params["link"] = str_replace($match, $metaValue, $this->params["link"]); } $this->params["link"] = str_replace('_REVSLIDER_', '-', $this->params["link"]); } $status = $postData["post_status"]; if ($status == "publish") { $this->params["state"] = "published"; } else { $this->params["state"] = "unpublished"; } if ($this->params["background_type"] == 'image') { //if image is choosen, use featured image as background //set image $thumbID = RevSliderFunctionsWP::getPostThumbID($postID); if (!empty($thumbID)) { $this->setImageByImageID($thumbID); } } //replace placeholders in layers: $this->setLayersByPostData($postData, $sliderID); }