/** * Remove Font */ public function remove_font_by_handle($handle) { $fonts = $this->get_all_fonts(); if (!empty($fonts)) { foreach ($fonts as $key => $font) { if ($font['handle'] == $handle) { unset($fonts[$key]); $do = update_option('tp-google-fonts', $fonts); return true; } } } return __ug('Font not found! Wrong handle given.', TP_TEXTDOMAIN); }
/** * * draw slider size */ protected function drawSliderSize($setting) { $width = UniteFunctionsRev::getVal($setting, "width"); $height = UniteFunctionsRev::getVal($setting, "height"); $sliderType = UniteFunctionsRev::getVal($setting, "slider_type"); $textNormalW = __ug("Grid Width:", REVSLIDER_TEXTDOMAIN); $textNormalH = __ug("Grid Height:", REVSLIDER_TEXTDOMAIN); $textFullWidthW = __ug("Grid Width:", REVSLIDER_TEXTDOMAIN); $textFullWidthH = __ug("Grid Height:", REVSLIDER_TEXTDOMAIN); $textFullScreenW = __ug("Grid Width:", REVSLIDER_TEXTDOMAIN); $textFullScreenH = __ug("Grid Height:", REVSLIDER_TEXTDOMAIN); //set default text (fixed, responsive) switch ($sliderType) { default: $textDefaultW = $textNormalW; $textDefaultH = $textNormalH; break; case "fullwidth": $textDefaultW = $textFullWidthW; $textDefaultH = $textFullWidthH; break; case "fullscreen": $textDefaultW = $textFullScreenW; $textDefaultH = $textFullScreenH; break; } ?> <table> <tr> <td id="cellWidth" data-textnormal="<?php echo $textNormalW; ?> " data-textfull="<?php echo $textFullWidthW; ?> " data-textscreen="<?php echo $textFullScreenW; ?> "> <?php echo $textDefaultW; ?> </td> <td id="cellWidthInput"> <input id="width" name="width" type="text" class="textbox-small" value="<?php echo $width; ?> "> </td> <td id="cellHeight" data-textnormal="<?php echo $textNormalH; ?> " data-textfull="<?php echo $textFullWidthH; ?> " data-textscreen="<?php echo $textFullScreenH; ?> "> <?php echo $textDefaultH; ?> </td> <td> <input id="height" name="height" type="text" class="textbox-small" value="<?php echo $height; ?> "> </td> </tr> </table> <?php }
/** * * onAjax action handler */ public static function onAjaxAction() { $actionIndicator = self::getPostGetVar("action"); if ($actionIndicator != "uniterevolution_ajax_action") { return false; } $action = self::getPostGetVar("client_action"); $data = self::getPostGetVar("data"); $nonce = self::getPostGetVar("nonce"); $slider = new RevSlider(); $slide = new RevSlide(); $operations = new RevOperations(); try { //verify the nonce $isVerified = wp_verify_nonce($nonce, "revslider_actions"); if ($isVerified == false) { UniteFunctionsRev::throwError("Wrong request"); } switch ($action) { case "export_slider": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); $sliderID = self::getGetVar("sliderid"); $dummy = self::getGetVar("dummy"); $slider->initByID($sliderID); $slider->exportSlider($dummy); break; case "import_slider": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); $updateAnim = self::getPostGetVar("update_animations"); $updateStatic = self::getPostGetVar("update_static_captions"); self::importSliderHandle(null, $updateAnim, $updateStatic); break; case "import_slider_slidersview": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); $viewBack = self::getViewUrl(self::VIEW_SLIDERS); $updateAnim = self::getPostGetVar("update_animations"); $updateStatic = self::getPostGetVar("update_static_captions"); self::importSliderHandle($viewBack, $updateAnim, $updateStatic); break; case "create_slider": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); self::requireSettings("slider_settings"); $settingsMain = self::getSettings("slider_main"); $settingsParams = self::getSettings("slider_params"); $data = $operations->modifyCustomSliderParams($data); $newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams); self::ajaxResponseSuccessRedirect(__ug("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders")); break; case "update_slider": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_SETTINGS); self::requireSettings("slider_settings"); $settingsMain = self::getSettings("slider_main"); $settingsParams = self::getSettings("slider_params"); $data = $operations->modifyCustomSliderParams($data); $slider->updateSliderFromOptions($data, $settingsMain, $settingsParams); self::ajaxResponseSuccess(__ug("Slider updated", REVSLIDER_TEXTDOMAIN)); break; case "delete_slider": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); $isDeleted = $slider->deleteSliderFromData($data); if (is_array($isDeleted)) { $isDeleted = implode(', ', $isDeleted); self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted); } else { self::ajaxResponseSuccessRedirect(__ug("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS)); } break; case "duplicate_slider": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); $slider->duplicateSliderFromData($data); self::ajaxResponseSuccessRedirect(__ug("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS)); break; case "add_slide": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $numSlides = $slider->createSlideFromData($data); $sliderID = $data["sliderid"]; if ($numSlides == 1) { $responseText = __ug("Slide Created", REVSLIDER_TEXTDOMAIN); } else { $responseText = $numSlides . " " . __ug("Slides Created", REVSLIDER_TEXTDOMAIN); } $urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"); self::ajaxResponseSuccessRedirect($responseText, $urlRedirect); break; case "add_slide_fromslideview": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $slideID = $slider->createSlideFromData($data, true); $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}"); $responseText = __ug("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN); self::ajaxResponseSuccessRedirect($responseText, $urlRedirect); break; case "update_slide": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_EDIT_SLIDE); require self::getSettingsFilePath("slide_settings"); $slide->updateSlideFromData($data, $slideSettings); self::ajaxResponseSuccess(__ug("Slide updated", REVSLIDER_TEXTDOMAIN)); break; case "delete_slide": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $isPost = $slide->deleteSlideFromData($data); if ($isPost) { $message = __ug("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN); } else { $message = __ug("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN); } $sliderID = UniteFunctionsRev::getVal($data, "sliderID"); self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "update_static_slide": $slide->updateStaticSlideFromData($data); self::ajaxResponseSuccess(__ug("Static Global Layers updated", REVSLIDER_TEXTDOMAIN)); break; case "duplicate_slide": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $sliderID = $slider->duplicateSlideFromData($data); self::ajaxResponseSuccessRedirect(__ug("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "copy_move_slide": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $sliderID = $slider->copyMoveSlideFromData($data); self::ajaxResponseSuccessRedirect(__ug("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "get_static_css": $contentCSS = $operations->getStaticCss(); self::ajaxResponseData($contentCSS); break; case "get_dynamic_css": $contentCSS = $operations->getDynamicCss(); self::ajaxResponseData($contentCSS); break; case "insert_captions_css": $arrCaptions = $operations->insertCaptionsContentData($data); self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "update_captions_css": $arrCaptions = $operations->updateCaptionsContentData($data); self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "delete_captions_css": $arrCaptions = $operations->deleteCaptionsContentData($data); self::ajaxResponseSuccess(__ug("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "update_static_css": $staticCss = $operations->updateStaticCss($data); self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss)); break; case "insert_custom_anim": $arrAnims = $operations->insertCustomAnim($data); //$arrCaptions = self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims); //,array("arrCaptions"=>$arrCaptions) break; case "update_custom_anim": $arrAnims = $operations->updateCustomAnim($data); self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims); //,array("arrCaptions"=>$arrCaptions) break; case "delete_custom_anim": $arrAnims = $operations->deleteCustomAnim($data); self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims); //,array("arrCaptions"=>$arrCaptions) break; case "update_slides_order": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $slider->updateSlidesOrderFromData($data); self::ajaxResponseSuccess(__ug("Order updated successfully", REVSLIDER_TEXTDOMAIN)); break; case "change_slide_image": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $slide->updateSlideImageFromData($data); $sliderID = UniteFunctionsRev::getVal($data, "slider_id"); self::ajaxResponseSuccessRedirect(__ug("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "preview_slide": $operations->putSlidePreviewByData($data); break; case "preview_slider": $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid"); $do_markup = UniteFunctionsRev::getPostGetVariable("only_markup"); if ($do_markup == 'true') { $operations->previewOutputMarkup($sliderID); } else { $operations->previewOutput($sliderID); } break; case "toggle_slide_state": $currentState = $slide->toggleSlideStatFromData($data); self::ajaxResponseData(array("state" => $currentState)); break; case "slide_lang_operation": $responseData = $slide->doSlideLangOperation($data); self::ajaxResponseData($responseData); break; case "update_plugin": self::updatePlugin(self::DEFAULT_VIEW); break; case "update_text": self::updateSettingsText(); self::ajaxResponseSuccess(__ug("All files successfully updated", REVSLIDER_TEXTDOMAIN)); break; case "update_general_settings": $operations->updateGeneralSettings($data); self::ajaxResponseSuccess(__ug("General settings updated", REVSLIDER_TEXTDOMAIN)); break; case "update_posts_sortby": $slider->updatePostsSortbyFromData($data); self::ajaxResponseSuccess(__ug("Sortby updated", REVSLIDER_TEXTDOMAIN)); break; case "replace_image_urls": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS); $slider->replaceImageUrlsFromData($data); self::ajaxResponseSuccess(__ug("Image urls replaced", REVSLIDER_TEXTDOMAIN)); break; case "reset_slide_settings": RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS); $slider->resetSlideSettings($data); self::ajaxResponseSuccess(__ug("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN)); break; default: self::ajaxResponseError("wrong ajax action: {$action} "); break; } } catch (Exception $e) { $message = $e->getMessage(); if ($action == "preview_slide" || $action == "preview_slider") { echo $message; exit; } self::ajaxResponseError($message); } //it's an ajax action, so exit self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer."); exit; }
/** * * the form */ public function form($instance) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); if (empty($arrSliders)) { echo __ug("No sliders found, Please create a slider", REVSLIDER_TEXTDOMAIN); } else { $field = "rev_slider"; $fieldPages = "rev_slider_pages"; $fieldCheck = "rev_slider_homepage"; $fieldTitle = "rev_slider_title"; $sliderID = UniteFunctionsRev::getVal($instance, $field); $homepage = UniteFunctionsRev::getVal($instance, $fieldCheck); $pagesValue = UniteFunctionsRev::getVal($instance, $fieldPages); $title = UniteFunctionsRev::getVal($instance, $fieldTitle); $fieldID = $this->get_field_id($field); $fieldName = $this->get_field_name($field); $select = UniteFunctionsRev::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true); $fieldID_check = $this->get_field_id($fieldCheck); $fieldName_check = $this->get_field_name($fieldCheck); $checked = ""; if ($homepage == "on") { $checked = "checked='checked'"; } $fieldPages_ID = $this->get_field_id($fieldPages); $fieldPages_Name = $this->get_field_name($fieldPages); $fieldTitle_ID = $this->get_field_id($fieldTitle); $fieldTitle_Name = $this->get_field_name($fieldTitle); ?> <label for="<?php echo $fieldTitle_ID; ?> "><?php _uge("Title", REVSLIDER_TEXTDOMAIN); ?> :</label> <input type="text" name="<?php echo $fieldTitle_Name; ?> " id="<?php echo $fieldTitle_ID; ?> " value="<?php echo $title; ?> " class="widefat"> <br><br> <?php _uge("Choose Slider", REVSLIDER_TEXTDOMAIN); ?> : <?php echo $select; ?> <div style="padding-top:10px;"></div> <label for="<?php echo $fieldID_check; ?> "><?php _uge("Home Page Only", REVSLIDER_TEXTDOMAIN); ?> :</label> <input type="checkbox" name="<?php echo $fieldName_check; ?> " id="<?php echo $fieldID_check; ?> " <?php echo $checked; ?> > <br><br> <label for="<?php echo $fieldPages_ID; ?> "><?php _uge("Pages: (example: 2,10)", REVSLIDER_TEXTDOMAIN); ?> </label> <input type="text" name="<?php echo $fieldPages_Name; ?> " id="<?php echo $fieldPages_ID; ?> " value="<?php echo $pagesValue; ?> "> <div style="padding-top:10px;"></div> <?php } //else }
$sliderMainSettings->addTextBox("fullscreen_min_height", "", __ug("Min. Fullscreen Height", REVSLIDER_TEXTDOMAIN), $arrParams); $sliderMainSettings->addControl("slider_type", "fullscreen_min_height", UniteSettingsRev::CONTROL_TYPE_SHOW, "fullscreen"); $sliderMainSettings->addRadio("full_screen_align_force", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("FullScreen Align", REVSLIDER_TEXTDOMAIN), "off"); $sliderMainSettings->addRadio("auto_height", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("Unlimited Height", REVSLIDER_TEXTDOMAIN), "off"); $sliderMainSettings->addRadio("force_full_width", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("Force Full Width", REVSLIDER_TEXTDOMAIN), "off"); $arrParams = array("description" => __ug("", REVSLIDER_TEXTDOMAIN)); $sliderMainSettings->addTextBox("min_height", "0", __ug("Min. Height", REVSLIDER_TEXTDOMAIN), $arrParams); $sliderMainSettings->addControl("slider_type", "min_height", UniteSettingsRev::CONTROL_TYPE_HIDE, "fullscreen"); $paramsSize = array("width" => 960, "height" => 350, "datatype" => UniteSettingsRev::DATATYPE_NUMBER, "description" => __ug(' - The <span class="prevxmpl">LAYERS GRID</span> is the container of layers within the <span class="prevxmpl">SLIDER</span> <br> - The "Grid Size" setting does not relate to the actual "Slider Size". <br> - "Max Height" of the slider equals the "Grid Height"<br> - "Slider Width" can be greater than the set "Grid Width"', REVSLIDER_TEXTDOMAIN)); $sliderMainSettings->addCustom("slider_size", "slider_size", "", __ug("Layers Grid Size", REVSLIDER_TEXTDOMAIN), $paramsSize); $paramsResponsitive = array("w1" => 940, "sw1" => 770, "w2" => 780, "sw2" => 500, "w3" => 510, "sw3" => 310, "datatype" => UniteSettingsRev::DATATYPE_NUMBER); $sliderMainSettings->addCustom("responsitive_settings", "responsitive", "", __ug("Responsive Sizes", REVSLIDER_TEXTDOMAIN), $paramsResponsitive); $sliderMainSettings->addHr(); self::storeSettings("slider_main", $sliderMainSettings); //set "slider_params" settings. $sliderParamsSettings = new UniteSettingsAdvancedRev(); $sliderParamsSettings->loadXMLFile(self::$path_settings . "/slider_settings.xml"); //update transition type setting. $settingFirstType = $sliderParamsSettings->getSettingByName("first_transition_type"); $operations = new RevOperations(); $arrTransitions = $operations->getArrTransition(); if (count($arrTransitions) == 0) { $arrTransitions = $operations->getArrTransition(true); } //get premium transitions $settingFirstType["items"] = $arrTransitions; $sliderParamsSettings->updateArrSettingByName("first_transition_type", $settingFirstType);
?> </a> <span class="loader_round loader_delete" style="display:none;"><?php _uge("Deleting Slide...", REVSLIDER_TEXTDOMAIN); ?> </span> <a id="button_duplicate_slide_<?php echo $slideid; ?> " style="width:120px; " class='button-primary revyellow button_duplicate_slide' href='javascript:void(0)'><i class="revicon-picture"></i><?php _uge("Duplicate", REVSLIDER_TEXTDOMAIN); ?> </a> <?php $copyButtonClass = "button-primary revblue button_copy_slide"; $copyButtonTitle = __ug("Open copy / move dialog", REVSLIDER_TEXTDOMAIN); if ($numSliders == 0) { $copyButtonClass .= " button-disabled"; $copyButtonTitle = "Copy / move disabled, no more sliders found"; } ?> <a id="button_copy_slide_<?php echo $slideid; ?> " class='<?php echo $copyButtonClass; ?> ' title="<?php echo $copyButtonTitle; ?> " style="width:120px; " href='javascript:void(0)'><i class="revicon-picture"></i><?php
/** * * draw all settings */ public function drawSettings() { $this->prepareToDraw(); $this->drawHeaderIncludes(); $arrSaps = $this->groupSettingsIntoSaps(); $class = "postbox unite-postbox"; if (!empty($this->addClass)) { $class .= " " . $this->addClass; } //draw wrapper echo "<div class='settings_wrapper'>"; //draw settings - advanced - with sections foreach ($arrSaps as $key => $sap) { //set accordion closed $style = ""; if ($this->isAccordion == false) { $h3Class = "class='no-accordion'"; } else { $h3Class = ""; if ($key > 0) { $style = "style='display:none;'"; $h3Class = "class='box_closed'"; } } $text = $sap["text"]; $icon = $sap["icon"]; $text = __ug($text, REVSLIDER_TEXTDOMAIN); ?> <div class="<?php echo $class; ?> "> <h3 <?php echo $h3Class; ?> ><i style="float:left;margin-top:4px;font-size:14px;" class="<?php echo $icon; ?> "></i> <?php if ($this->isAccordion == true) { ?> <div class="postbox-arrow"></div> <?php } ?> <span><?php echo $text; ?> </span> </h3> <div class="inside" <?php echo $style; ?> > <ul class="list_settings"> <?php foreach ($sap["settings"] as $setting) { $this->drawSetting($setting); } ?> </ul> <?php if (!empty($this->arrButtons)) { ?> <div class="clear"></div> <div class="settings_buttons"> <?php $this->drawButtons(); ?> </div> <div class="clear"></div> <?php } ?> <div class="clear"></div> </div> </div> <?php } echo "</div>"; //wrapper close }
$arrCorners = array("nothing" => __ug("No Corner", REVSLIDER_TEXTDOMAIN), "curved" => __ug("Sharp", REVSLIDER_TEXTDOMAIN), "reverced" => __ug("Sharp Reversed", REVSLIDER_TEXTDOMAIN)); $params = array(); $layerSettings->addSelect("layer_cornerleft", $arrCorners, __ug("Left Corner", REVSLIDER_TEXTDOMAIN), "nothing", $params); $layerSettings->addSelect("layer_cornerright", $arrCorners, __ug("Right Corner", REVSLIDER_TEXTDOMAIN), "nothing", $params); $layerSettings->addCheckbox("layer_resizeme", true, __ug("Responsive Through All Levels", REVSLIDER_TEXTDOMAIN), $params); $params = array(); $layerSettings->addTextBox("layer_id", "", __ug("ID", REVSLIDER_TEXTDOMAIN), $params); $layerSettings->addTextBox("layer_classes", "", __ug("Classes", REVSLIDER_TEXTDOMAIN), $params); $layerSettings->addTextBox("layer_title", "", __ug("Title", REVSLIDER_TEXTDOMAIN), $params); $layerSettings->addTextBox("layer_rel", "", __ug("Rel", REVSLIDER_TEXTDOMAIN), $params); //Loop Animation $arrAnims = array("none" => __ug("Disabled", REVSLIDER_TEXTDOMAIN), "rs-pendulum" => __ug("Pendulum", REVSLIDER_TEXTDOMAIN), "rs-rotate" => __ug("Rotate", REVSLIDER_TEXTDOMAIN), "rs-slideloop" => __ug("Slideloop", REVSLIDER_TEXTDOMAIN), "rs-pulse" => __ug("Pulse", REVSLIDER_TEXTDOMAIN), "rs-wave" => __ug("Wave", REVSLIDER_TEXTDOMAIN)); $params = array(); $layerSettings->addSelect("layer_loop_animation", $arrAnims, __ug("Animation", REVSLIDER_TEXTDOMAIN), "none", $params); $layerSettings->addTextBox("layer_loop_speed", "2", __ug("Speed", REVSLIDER_TEXTDOMAIN), array("unit" => __ug(" (0.00 - 10.00)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_startdeg", "-20", __ug("Start Degree", REVSLIDER_TEXTDOMAIN)); $layerSettings->addTextBox("layer_loop_enddeg", "20", __ug("End Degree", REVSLIDER_TEXTDOMAIN), array("unit" => __ug(" (-720 - 720)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_xorigin", "50", __ug("x Origin", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("%", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_yorigin", "50", __ug("y Origin", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("% (-250% - 250%)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_xstart", "0", __ug("x Start Pos.", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("px", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_xend", "0", __ug("x End Pos.", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("px (-2000px - 2000px)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_ystart", "0", __ug("y Start Pos.", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("px", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_yend", "0", __ug("y End Pos.", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("px (-2000px - 2000px)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_zoomstart", "1", __ug("Start Zoom", REVSLIDER_TEXTDOMAIN)); $layerSettings->addTextBox("layer_loop_zoomend", "1", __ug("End Zoom", REVSLIDER_TEXTDOMAIN), array("unit" => __ug(" (0.00 - 20.00)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_angle", "0", __ug("Angle", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("° (0° - 360°)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addTextBox("layer_loop_radius", "10", __ug("Radius", REVSLIDER_TEXTDOMAIN), array("unit" => __ug("px (0px - 2000px)", REVSLIDER_TEXTDOMAIN))); $layerSettings->addSelect("layer_loop_easing", $arrEasing, __ug("Easing", REVSLIDER_TEXTDOMAIN), "Power3.easeInOut"); self::storeSettings("layer_settings", $layerSettings); //store settings of content css for editing on the client. self::storeSettings("css_captions_content", $contentCSS);
<?php $generalSettings = new UniteSettingsRev(); $generalSettings->addSelect("role", array(UniteBaseAdminClassRev::ROLE_ADMIN => __ug("To Admin", REVSLIDER_TEXTDOMAIN), UniteBaseAdminClassRev::ROLE_EDITOR => __ug("To Editor, Admin", REVSLIDER_TEXTDOMAIN), UniteBaseAdminClassRev::ROLE_AUTHOR => __ug("Author, Editor, Admin", REVSLIDER_TEXTDOMAIN)), __ug("View Plugin Permission", REVSLIDER_TEXTDOMAIN), UniteBaseAdminClassRev::ROLE_ADMIN, array("description" => __ug("The role of user that can view and edit the plugin", REVSLIDER_TEXTDOMAIN))); $generalSettings->addRadio("includes_globally", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("Include RevSlider libraries globally", REVSLIDER_TEXTDOMAIN), "on", array("description" => __ug("Add css and js includes only on all pages. Id turned to off they will added to pages where the rev_slider shortcode exists only. This will work only when the slider added by a shortcode.", REVSLIDER_TEXTDOMAIN))); $generalSettings->addTextBox("pages_for_includes", "", __ug("Pages to include RevSlider libraries", REVSLIDER_TEXTDOMAIN), array("description" => __ug("Specify the page id's that the front end includes will be included in. Example: 2,3,5 also: homepage,3,4", REVSLIDER_TEXTDOMAIN))); $generalSettings->addRadio("js_to_footer", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("Put JS Includes To Footer", REVSLIDER_TEXTDOMAIN), "off", array("description" => __ug("Putting the js to footer (instead of the head) is good for fixing some javascript conflicts.", REVSLIDER_TEXTDOMAIN))); $generalSettings->addRadio("show_dev_export", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("Enable Markup Export option", REVSLIDER_TEXTDOMAIN), "off", array("description" => __ug("This will enable the option to export the Slider Markups to copy/paste it directly into websites.", REVSLIDER_TEXTDOMAIN))); $generalSettings->addRadio("enable_logs", array("on" => __ug("On", REVSLIDER_TEXTDOMAIN), "off" => __ug("Off", REVSLIDER_TEXTDOMAIN)), __ug("Enable Logs", REVSLIDER_TEXTDOMAIN), "off", array("description" => __ug("Enable console logs for debugging.", REVSLIDER_TEXTDOMAIN))); //transition /*$operations = new RevOperations(); $arrTransitions = $operations->getArrTransition(); $arrPremiumTransitions = $operations->getArrTransition(true); $arrTransitions = array_merge($arrTransitions, $arrPremiumTransitions); $params = array("description"=>"<br>".__ug("The default appearance transitions of slides.",REVSLIDER_TEXTDOMAIN),"minwidth"=>"450px"); $generalSettings->addRadio("slide_transition_default",$arrTransitions,__ug("Default Transition",REVSLIDER_TEXTDOMAIN),"random",$params); */ //-------------------------- //get stored values $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $generalSettings->setStoredValues($arrValues); self::storeSettings("general", $generalSettings);
$htmlBefore = ""; $htmlBefore .= "<li class='item_operation operation_delete'><a data-operation='delete' href='javascript:void(0)'>" . "\n"; $htmlBefore .= "<img src='" . $urlIconDelete . "'/> " . $textDelete . "\n"; $htmlBefore .= "</a></li>" . "\n"; $htmlBefore .= "<li class='item_operation operation_edit'><a data-operation='edit' href='javascript:void(0)'>" . "\n"; $htmlBefore .= "<img src='" . $urlIconEdit . "'/> " . $textEdit . "\n"; $htmlBefore .= "</a></li>" . "\n"; $htmlBefore .= "<li class='item_operation operation_preview'><a data-operation='preview' href='javascript:void(0)'>" . "\n"; $htmlBefore .= "<img src='" . $urlIconPreview . "'/> " . $textPreview . "\n"; $htmlBefore .= "</a></li>" . "\n"; $htmlBefore .= "<li class='item_operation operation_sap'>" . "\n"; $htmlBefore .= "<div class='float_menu_sap'></div>" . "\n"; $htmlBefore .= "</a></li>" . "\n"; $langFloatMenu = UniteWpmlRev::getLangsWithFlagsHtmlList("id='slides_langs_float' class='slides_langs_float'", $htmlBefore); } } else { //slides from posts $templateName = "slides_posts"; $sourceType = $slider->getParam("source_type", "posts"); $showSortBy = $sourceType == "posts" ? true : false; //get button links $urlNewPost = UniteFunctionsWPRev::getUrlNewPost(); $linkNewPost = UniteFunctionsRev::getHtmlLink($urlNewPost, __ug("<i class='revicon-pencil-1'></i>New Post", REVSLIDER_TEXTDOMAIN), "button_new_post", "button-primary revblue", true); //get ordering $arrSortBy = UniteFunctionsWPRev::getArrSortBy(); $sortBy = $slider->getParam("post_sortby", RevSlider::DEFAULT_POST_SORTBY); $selectSortBy = UniteFunctionsRev::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true); } require self::getPathTemplate($templateName); ?>
<?php if ($outputTemplates) { $useSliders = $arrSlidersTemplates; } else { $useSliders = $arrSliders; } foreach ($useSliders as $slider) { try { $id = $slider->getID(); $showTitle = $slider->getShowTitle(); $title = $slider->getTitle(); $alias = $slider->getAlias(); $isFromPosts = $slider->isSlidesFromPosts(); $rowClass = ""; if ($isFromPosts == true) { $strSource = __ug("Posts", REVSLIDER_TEXTDOMAIN); $preicon = "revicon-doc"; $rowClass = "class='row_alt'"; } if ($outputTemplates) { $editLink = self::getViewUrl(RevSliderAdmin::VIEW_SLIDER_TEMPLATE, "id={$id}"); } else { $editLink = self::getViewUrl(RevSliderAdmin::VIEW_SLIDER, "id={$id}"); } $editSlidesLink = self::getViewUrl(RevSliderAdmin::VIEW_SLIDES, "id={$id}"); $showTitle = UniteFunctionsRev::getHtmlLink($editLink, $showTitle); $numSlides = $slider->getNumSlides(); } catch (Exception $e) { $errorMessage = "ERROR: " . $e->getMessage(); $strSource = ""; $numSlides = "";
/** * get categories list, copy the code from default wp functions */ public static function getCategoriesHtmlList($catIDs, $strTax = null) { global $wp_rewrite; //$catList = get_the_category_list( ",", "", $postID ); $categories = self::getCategoriesByIDs($catIDs, $strTax); $arrErrors = UniteFunctionsRev::getVal($categories, "errors"); if (!empty($arrErrors)) { foreach ($arrErrors as $key => $arr) { $strErrors = implode($arr, ","); } UniteFunctionsRev::throwError("getCategoriesHtmlList error: " . $strErrors); } $rel = is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ? 'rel="category tag"' : 'rel="category"'; $separator = ','; $thelist = ''; $i = 0; foreach ($categories as $category) { if (is_object($category)) { $category = (array) $category; } if (0 < $i) { $thelist .= $separator; } $catID = $category["term_id"]; $link = get_category_link($catID); $catName = $category["name"]; if (!empty($link)) { $thelist .= '<a href="' . esc_url($link) . '" title="' . esc_attr(sprintf(__ug("View all posts in %s", REVSLIDER_TEXTDOMAIN), $category["name"])) . '" ' . $rel . '>' . $catName . '</a>'; } else { $thelist .= $catName; } ++$i; } return $thelist; }
public function previewOutputMarkup($sliderID, $output = null) { if ($sliderID == "empty_output") { $this->loadingMessageOutput(); exit; } if ($output == null) { $output = new RevSliderOutput(); } $slider = new RevSlider(); $slider->initByID($sliderID); $isWpmlExists = UniteWpmlRev::isWpmlExists(); $useWpml = $slider->getParam("use_wpml", "off"); $wpmlActive = false; if ($isWpmlExists && $useWpml == "on") { $wpmlActive = true; $arrLanguages = UniteWpmlRev::getArrLanguages(false); //set current lang to output $currentLang = UniteFunctionsRev::getPostGetVariable("lang"); if (empty($currentLang)) { $currentLang = UniteWpmlRev::getCurrentLang(); } if (empty($currentLang)) { $currentLang = $arrLanguages[0]; } $output->setLang($currentLang); $selectLangChoose = UniteFunctionsRev::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true); } $output->setPreviewMode(); //put the output html $urlPlugin = "http://yourpluginpath/"; $urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&only_markup=true&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]"; $nonce = wp_create_nonce("revslider_actions"); $setBase = is_ssl() ? "https://" : "http://"; $f = new ThemePunch_Fonts(); $my_fonts = $f->get_all_fonts(); ?> <html> <head> <script type='text/javascript' src='<?php echo $setBase; ?> ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script> </head> <body style="padding:0px;margin:0px;"> <?php if ($wpmlActive == true) { ?> <div style="margin-bottom:10px;text-align:center;"> <?php _uge("Choose language", REVSLIDER_TEXTDOMAIN); ?> : <?php echo $selectLangChoose; ?> </div> <script type="text/javascript"> var g_previewPattern = '<?php echo $urlPreviewPattern; ?> '; jQuery("#select_langs").change(function(){ var lang = this.value; var nonce = "<?php echo $nonce; ?> "; var pattern = g_previewPattern; var urlPreview = pattern.replace("[lang]",lang).replace("[nonce]",nonce); location.href = urlPreview; }); jQuery('body').on('click', '#rev_replace_images', function(){ var from = jQuery('input[name="orig_image_path"]').val(); var to = jQuery('input[name="replace_image_path"]').val(); jQuery('#rev_script_content').val(jQuery('#rev_script_content').val().replace(from, to)); jQuery('#rev_the_content').val(jQuery('#rev_the_content').val().replace(from, to)); jQuery('#rev_style_content').val(jQuery('#rev_style_content').val().replace(from, to)); jQuery('#rev_head_content').val(jQuery('#rev_head_content').val().replace(from, to)); }); </script> <?php } ?> <?php //UniteBaseClassRev::$url_plugin ob_start(); ?> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> css/settings.css?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?> ' type='text/css' media='all' /> <?php $http = is_ssl() ? 'https' : 'http'; if (!empty($my_fonts)) { foreach ($my_fonts as $c_font) { ?> <link rel='stylesheet' href="<?php echo $http . '://fonts.googleapis.com/css?family=' . strip_tags($c_font['url']); ?> " type='text/css' /><?php echo "\n"; } } ?> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.tools.min.js?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?> '></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.revolution.min.js?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?> '></script> <?php $head_content = ob_get_contents(); ob_clean(); ob_end_clean(); ob_start(); $custom_css = RevOperations::getStaticCss(); echo $custom_css . "\n\n"; echo '/*****************' . "\n"; echo ' ** ' . __ug('CAPTIONS CSS', REVSLIDER_TEXTDOMAIN) . "\n"; echo ' ****************/' . "\n\n"; $db = new UniteDBRev(); $styles = $db->fetch(GlobalsRevSlider::$table_css); echo UniteCssParserRev::parseDbArrayToCss($styles, "\n"); $style_content = ob_get_contents(); ob_clean(); ob_end_clean(); ob_start(); $output->putSliderBase($sliderID); $content = ob_get_contents(); ob_clean(); ob_end_clean(); $script_content = substr($content, strpos($content, '<script type="text/javascript">'), strpos($content, '</script>') + 9 - strpos($content, '<script type="text/javascript">')); $content = htmlentities(str_replace($script_content, '', $content)); $script_content = str_replace(' ', '', $script_content); $script_content = str_replace(array('<script type="text/javascript">', '</script>'), '', $script_content); ?> <style> body { font-family:sans-serif; font-size:12px;} textarea { background:#f1f1f1; border:#ddd; font-size:10px; line-height:16px; margin-bottom:40px; padding:10px;} .rev_cont_title { color:#000; text-decoration:none;font-size:14px; line-height:24px; font-weight:800;background: #D5D5D5;padding: 10px;} .rev_cont_title a, .rev_cont_title a:visited { margin-left:25px;font-size:12px;line-height:12px;float:right;background-color:#8e44ad; color:#fff; padding:8px 10px;text-decoration:none;} .rev_cont_title a:hover { background-color:#9b59b6} </style> <p><?php $dir = wp_upload_dir(); ?> <?php _uge('Replace image path:', REVSLIDER_TEXTDOMAIN); ?> <?php _uge('From:', REVSLIDER_TEXTDOMAIN); ?> <input type="text" name="orig_image_path" value="<?php echo @$dir['baseurl']; ?> " /> <?php _uge('To:', REVSLIDER_TEXTDOMAIN); ?> <input type="text" name="replace_image_path" value="" /> <input id="rev_replace_images" type="button" name="replace_images" value="<?php _uge('Replace', REVSLIDER_TEXTDOMAIN); ?> " /> </p> <div class="rev_cont_title"><?php _uge('Header', REVSLIDER_TEXTDOMAIN); ?> <a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_head_content" href="javascript:void(0);" original-title=""><?php _uge('Mark to Copy', REVSLIDER_TEXTDOMAIN); ?> </a><div style="clear:both"></div></div> <textarea id="rev_head_content" readonly="true" style="width: 100%; height: 100px; color:#3498db"><?php echo $head_content; ?> </textarea> <div class="rev_cont_title"><?php _uge('CSS', REVSLIDER_TEXTDOMAIN); ?> <a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_style_content" href="javascript:void(0);" original-title=""><?php _uge('Mark to Copy', REVSLIDER_TEXTDOMAIN); ?> </a></div> <textarea id="rev_style_content" readonly="true" style="width: 100%; height: 100px;"><?php echo $style_content; ?> </textarea> <div class="rev_cont_title"><?php _uge('Body', REVSLIDER_TEXTDOMAIN); ?> <a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_the_content" href="javascript:void(0);" original-title=""><?php _uge('Mark to Copy', REVSLIDER_TEXTDOMAIN); ?> </a></div> <textarea id="rev_the_content" readonly="true" style="width: 100%; height: 100px;"><?php echo $content; ?> </textarea> <div class="rev_cont_title"><?php _uge('Script', REVSLIDER_TEXTDOMAIN); ?> <a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_script_content" href="javascript:void(0);" original-title=""><?php _uge('Mark to Copy', REVSLIDER_TEXTDOMAIN); ?> </a></div> <textarea id="rev_script_content" readonly="true" style="width: 100%; height: 100px;"><?php echo $script_content; ?> </textarea> <script> jQuery('body').on('click','.copytoclip',function() { jQuery("#"+jQuery(this).data('idt')).select(); }); </script> </body> </html> <?php exit; }
/** * Add Slider to the List of choosable media */ public function add_slider_to_eg_ajax($media) { $media['revslider'] = array('name' => __ug('Slider Revolution', REVSLIDER_TEXTDOMAIN), 'type' => 'ccw'); return $media; }
/** * * get events sort by array */ public static function getArrSortBy() { $arrSortBy = array(); $arrSortBy["event_start_date"] = __ug("Event Start Date", REVSLIDER_TEXTDOMAIN); $arrSortBy["event_end_date"] = __ug("Event End Date", REVSLIDER_TEXTDOMAIN); return $arrSortBy; }
/** * * import slider from multipart form */ public function importSliderFromPost($updateAnim = true, $updateStatic = true) { try { $sliderID = UniteFunctionsRev::getPostVariable("sliderid"); $sliderExists = !empty($sliderID); if ($sliderExists) { $this->initByID($sliderID); } $filepath = $_FILES["import_file"]["tmp_name"]; if (file_exists($filepath) == false) { UniteFunctionsRev::throwError("Import file not found!!!"); } //check if zip file or fallback to old, if zip, check if all files exist if (!class_exists("ZipArchive")) { $importZip = false; } else { $zip = new ZipArchive(); $importZip = $zip->open($filepath, ZIPARCHIVE::CREATE); } if ($importZip === true) { //true or integer. If integer, its not a correct zip file //check if files all exist in zip $slider_export = $zip->getStream('slider_export.txt'); $custom_animations = $zip->getStream('custom_animations.txt'); $dynamic_captions = $zip->getStream('dynamic-captions.css'); $static_captions = $zip->getStream('static-captions.css'); if (!$slider_export) { UniteFunctionsRev::throwError("slider_export.txt does not exist!"); } //if(!$custom_animations) UniteFunctionsRev::throwError("custom_animations.txt does not exist!"); //if(!$dynamic_captions) UniteFunctionsRev::throwError("dynamic-captions.css does not exist!"); //if(!$static_captions) UniteFunctionsRev::throwError("static-captions.css does not exist!"); $content = ''; $animations = ''; $dynamic = ''; $static = ''; while (!feof($slider_export)) { $content .= fread($slider_export, 1024); } if ($custom_animations) { while (!feof($custom_animations)) { $animations .= fread($custom_animations, 1024); } } if ($dynamic_captions) { while (!feof($dynamic_captions)) { $dynamic .= fread($dynamic_captions, 1024); } } if ($static_captions) { while (!feof($static_captions)) { $static .= fread($static_captions, 1024); } } fclose($slider_export); if ($custom_animations) { fclose($custom_animations); } if ($dynamic_captions) { fclose($dynamic_captions); } if ($static_captions) { fclose($static_captions); } //check for images! } else { //check if fallback //get content array $content = @file_get_contents($filepath); } if ($importZip === true) { //we have a zip $db = new UniteDBRev(); //update/insert custom animations $animations = @unserialize($animations); if (!empty($animations)) { foreach ($animations as $key => $animation) { //$animation['id'], $animation['handle'], $animation['params'] $exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'"); if (!empty($exist)) { //update the animation, get the ID if ($updateAnim == "true") { //overwrite animation if exists $arrUpdate = array(); $arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params']))); $db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle'])); $id = $exist['0']['id']; } else { //insert with new handle $arrInsert = array(); $arrInsert["handle"] = 'copy_' . $animation['handle']; $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params']))); $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert); } } else { //insert the animation, get the ID $arrInsert = array(); $arrInsert["handle"] = $animation['handle']; $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params']))); $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert); } //and set the current customin-oldID and customout-oldID in slider params to new ID from $id $content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content); } dmp(__ug("animations imported!", REVSLIDER_TEXTDOMAIN)); } else { dmp(__ug("no custom animations found, if slider uses custom animations, the provided export may be broken...", REVSLIDER_TEXTDOMAIN)); } //overwrite/append static-captions.css if (!empty($static)) { if ($updateStatic == "true") { //overwrite file RevOperations::updateStaticCss($static); } else { //append $static_cur = RevOperations::getStaticCss(); $static = $static_cur . "\n" . $static; RevOperations::updateStaticCss($static); } } //overwrite/create dynamic-captions.css //parse css to classes $dynamicCss = UniteCssParserRev::parseCssToArray($dynamic); if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) { foreach ($dynamicCss as $class => $styles) { //check if static style or dynamic style $class = trim($class); if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) { //.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img continue; } if (strpos($class, ".tp-caption") === false) { $class = ".tp-caption" . $class; } //is a dynamic style 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); } //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); } } dmp(__ug("dynamic styles imported!", REVSLIDER_TEXTDOMAIN)); } else { dmp(__ug("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); if (empty($arrSlider)) { UniteFunctionsRev::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"] = 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(); $sliderAlias = UniteFunctionsRev::getVal($sliderParams, "alias"); $sliderAlias = trim($sliderAlias); if (empty($sliderAlias)) { $sliderAlias = "defaultslider"; } foreach ($arrSlides as $slide) { $params = $slide["params"]; $layers = $slide["layers"]; $image = UniteFunctionsRev::getVal($params, "image"); $image = trim($image); //convert params images: if (!empty($image)) { if ($importZip === true) { //we have a zip, check if exists //import from wp format $entryPath = 'images/' . $image; $imageEntry = $zip->getStream($entryPath); //import from joomla format if (!$imageEntry) { $entryPath = $image; $imageEntry = $zip->getStream($entryPath); } if (!$imageEntry) { echo "{$image} not found!<br>"; } else { try { $pathImage = RevOperations::extractImageToSliderFolder($zip, $sliderAlias, $entryPath, $image); $params["image"] = $pathImage; } catch (Exception $e) { echo "can't extract image: {$image} <br>"; $params["image"] = $image; //UniteFunctionsWPRev::getImageUrlFromPath($image); } } } else { //$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($image); } } //convert layers images: foreach ($layers as $key => $layer) { $image = UniteFunctionsRev::getVal($layer, "image_url"); $image = trim($image); if (!empty($image)) { if ($importZip === true) { //we have a zip, check if exists //import from wp format $entryPath = 'images/' . $image; $imageEntry = $zip->getStream($entryPath); //import from joomla format if (!$imageEntry) { $entryPath = $image; $imageEntry = $zip->getStream($entryPath); } if (!$imageEntry) { echo $image . ' not found!<br>'; } else { try { $pathImage = RevOperations::extractImageToSliderFolder($zip, $sliderAlias, $entryPath, $image); $layer["image_url"] = $pathImage; } catch (Exception $e) { echo "can't extract image: {$image} <br>"; $layer["image_url"] = $image; //UniteFunctionsWPRev::getImageUrlFromPath($image); } } } else { //$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($image); } } $layers[$key] = $layer; } //create new slide $arrCreate = array(); $arrCreate["slider_id"] = $sliderID; $arrCreate["slide_order"] = $slide["slide_order"]; $my_layers = json_encode($layers); if (empty($my_layers)) { $my_layers = stripslashes(json_encode($layers)); } $my_params = json_encode($params); if (empty($my_params)) { $my_params = stripslashes(json_encode($params)); } $arrCreate["layers"] = $my_layers; $arrCreate["params"] = $my_params; $this->db->insert(GlobalsRevSlider::$table_slides, $arrCreate); //check if static slide exists and import if (isset($arrSlider['static_slides']) && !empty($arrSlider['static_slides'])) { $static_slide = $arrSlider['static_slides']; foreach ($static_slide as $slide) { $params = $slide["params"]; $layers = $slide["layers"]; //convert params images: if (isset($params["image"])) { //import if exists in zip folder if (strpos($params["image"], 'http') !== false) { } else { 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"] . __ug(' 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 (strpos($layer["image_url"], 'http') !== false) { } else { 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"] . __ug(' 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"] = $layer["image_url"]; //$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]); $layers[$key] = $layer; } } //create new slide $arrCreate = array(); $arrCreate["slider_id"] = $sliderID; $my_layers = json_encode($layers); if (empty($my_layers)) { $my_layers = stripslashes(json_encode($layers)); } $my_params = json_encode($params); if (empty($my_params)) { $my_params = stripslashes(json_encode($params)); } $arrCreate["layers"] = $my_layers; $arrCreate["params"] = $my_params; if ($sliderExists) { unset($arrCreate["slider_id"]); $this->db->update(GlobalsRevSlider::$table_static_slides, $arrCreate, array("slider_id" => $sliderID)); } else { $this->db->insert(GlobalsRevSlider::$table_static_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); }
$slideName = $arr["title"]; $arrSlideLink[$slideNameID] = $slideName; $arrSlideLinkLayers[$slideNameID] = $slideName; } $slideSettings->addSelect("slide_link", $arrSlideLink, "Link To Slide", "nothing"); $params = array("description" => "The position of the link related to layers"); $slideSettings->addRadio("link_pos", array("front" => "Front", "back" => "Back"), "Link Position", "front", $params); //$slideSettings->addHr("link_sap"); $slideSettings->endBulkControl(); $slideSettings->addControl("link_type", "slide_link", UniteSettingsRev::CONTROL_TYPE_ENABLE, "slide"); $slideSettings->addControl("link_type", "link", UniteSettingsRev::CONTROL_TYPE_DISABLE, "slide"); $slideSettings->addControl("link_type", "link_open_in", UniteSettingsRev::CONTROL_TYPE_DISABLE, "slide"); //----------------------- $slideSettings->addHr(""); $params = array("description" => __ug("Slide Thumbnail. If not set - it will be taken from the slide image.", REVSLIDER_TEXTDOMAIN)); $slideSettings->addImage("slide_thumb", "", __ug("Thumbnail", REVSLIDER_TEXTDOMAIN), $params); //$params = array("description"=>__ug("Apply to full width mode only. Centering vertically slide images.",REVSLIDER_TEXTDOMAIN)); //$slideSettings->addCheckbox("fullwidth_centering", false, __ug("Full Width Centering",REVSLIDER_TEXTDOMAIN), $params); //add background type (hidden) $slideSettings->addTextBox("background_type", "image", __ug("Background Type", REVSLIDER_TEXTDOMAIN), array("hidden" => true)); //store settings $slideSettings->addHr(""); $params = array("description" => __ug('Adds a unique class to the li of the Slide like class="rev_special_class" (add only the classnames, seperated by space)', REVSLIDER_TEXTDOMAIN)); $slideSettings->addTextBox("class_attr", "", __ug("Class", REVSLIDER_TEXTDOMAIN), $params); $params = array("description" => __ug('Adds a unique ID to the li of the Slide like id="rev_special_id" (add only the id)', REVSLIDER_TEXTDOMAIN)); $slideSettings->addTextBox("id_attr", "", __ug("ID", REVSLIDER_TEXTDOMAIN), $params); $params = array("description" => __ug('Adds a unique Attribute to the li of the Slide like attr="rev_special_attr" (add only the attribute)', REVSLIDER_TEXTDOMAIN)); $slideSettings->addTextBox("attr_attr", "", __ug("Attribute", REVSLIDER_TEXTDOMAIN), $params); $params = array("description" => __ug('Add as many attributes as you wish here. (i.e.: data-layer="firstlayer" data-custom="somevalue")', REVSLIDER_TEXTDOMAIN)); $slideSettings->addTextArea("data_attr", "", __ug("Custom Fields", REVSLIDER_TEXTDOMAIN), $params); self::storeSettings("slide_settings", $slideSettings);
/** * * get language title by code */ public static function getLangTitle($code) { $langs = self::getArrLanguages(); if ($code == "all") { return __ug("All Languages", REVSLIDER_TEXTDOMAIN); } if (array_key_exists($code, $langs)) { return $langs[$code]; } $details = self::getLangDetails($code); if (!empty($details)) { return $details["english_name"]; } return ""; }