/** * * javascript output to footer */ public function putJavascript() { $urlPlugin = UniteBaseClassRev::$url_plugin . "rs-plugin/"; $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $use_hammer = UniteFunctionsRev::getVal($arrValues, "use_hammer_js", 'on'); if ($use_hammer == 'off') { ?> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.disablehammer.js?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?> '></script> <?php } ?> <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 }
/** * * get filename for thumbnail save / retrieve * TODO: do input validations - security measures */ private function getThumbFilename() { $info = pathInfo($this->filename); //add dirname as postfix (if exists) $postfix = ""; $dirname = UniteFunctionsRev::getVal($info, "dirname"); if (!empty($dirname)) { $postfix = str_replace("/", "-", $dirname); } $ext = $info["extension"]; $name = $info["filename"]; $width = ceil($this->maxWidth); $height = ceil($this->maxHeight); $thumbFilename = $name . "_" . $width . "x" . $height; if (!empty($this->type)) { $thumbFilename .= "_" . $this->type; } if (!empty($this->effect)) { $thumbFilename .= "_e" . $this->effect; if (!empty($this->effect_arg1)) { $thumbFilename .= "x" . $this->effect_arg1; } } //add postfix if (!empty($postfix)) { $thumbFilename .= "_" . $postfix; } $thumbFilename .= "." . $ext; return $thumbFilename; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function onArrowsSelect(data){'; $script[] = ' UniteAdminRev.onArrowsChange(data);'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=' . GlobalsUniteRev::COMPONENT_NAME . '&view=slider&layout=arrows&tmpl=component&settingid=' . $this->id; $buttonType = $this->value; $arrArrowSet = HelperUniteRev::getArrowSet($buttonType); $arrowName = $arrArrowSet["name"]; $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />'; $buttonID = $this->id . "-btn"; $desc = UniteFunctionsRev::getVal($this->element, "description"); // The the arrow $imageArrow = $arrArrowSet["url_right"]; $html[] = '<span class="chooser-image-wrapper"><img id="' . $this->id . '-img" title="' . $arrowName . '" src="' . $imageArrow . '"></span>'; //put select button $html[] = ' <a id="' . $buttonID . '" class="modal button-secondary button-chooser" href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">Change</a>'; $html = implode("\n", $html); return $html; }
/** * * get fields that relevant for the control */ public function getControlFields() { $arrControls = array(); //get base elements array $arrBase = array(); $arrBase["parent"] = (string) UniteFunctionsRev::getVal($this->element, 'parent'); $arrBase["value"] = (string) UniteFunctionsRev::getVal($this->element, 'value'); $arrBase["ctype"] = (string) UniteFunctionsRev::getVal($this->element, 'ctype'); //validate fields: if (empty($arrBase["parent"])) { UniteFunctionsRev::throwError("The parent can't be empty in control"); } if (empty($arrBase["value"])) { UniteFunctionsRev::throwError("The value can't be empty in control: {$arrBase['parent']}"); } if (empty($arrBase["ctype"])) { UniteFunctionsRev::throwError("The ctype can't be empty in control: {$arrBase['parent']}"); } //get children $strchild = (string) UniteFunctionsRev::getVal($this->element, 'child'); //validate child if (empty($strchild)) { UniteFunctionsRev::throwError("The child can't be empty in control: {$arrBase['parent']}"); } $strchild = trim($strchild); $children = explode(",", $strchild); foreach ($children as $child) { $arrControl = $arrBase; $arrControl["child"] = $child; $arrControls[] = $arrControl; } return $arrControls; }
function yit_revslider_slider() { $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally","on"); $isWidgetActive = is_active_widget( false, false, "rev-slider-widget", true ); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ( yit_slider_get_setting('slider_type',yit_slider_name()) != 'revolution-slider' || $includesGlobally == "on" || $isWidgetActive || $hasShortcode ) { return; } wp_enqueue_style('rs-plugin-settings', RS_PLUGIN_URL .'public/assets/css/settings.css', array(), RevSliderGlobals::SLIDER_REVISION); $custom_css = RevOperations::getStaticCss(); $custom_css = UniteCssParserRev::compress_css($custom_css); wp_add_inline_style('rs-plugin-settings', $custom_css); $setBase = (is_ssl()) ? "https://" : "http://"; $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; wp_enqueue_script("jquery", $url_jquery); // put javascript to footer add_action('wp_footer', array($GLOBALS['productFront'], 'putJavascript')); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function onBulletsSelect(data){'; $script[] = ' alert("do something: " + data)'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=com_uniterevolution&view=slider&layout=bullets&tmpl=component'; $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />'; $bulletsText = "Change Bullets"; $buttonID = $this->id . "-btn"; $desc = UniteFunctionsRev::getVal($this->element, "description"); $htmlAddon = ""; if (!empty($desc)) { $htmlAddon = ' title="' . $desc . '"'; //$class .= " hasTip"; //making problems with rel } // The user select button. $html[] = ' <a id="' . $buttonID . '" class="modal panel_button" ' . $htmlAddon . ' href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">' . $bulletsText . '</a>'; $html = implode("\n", $html); return $html; }
function rev_slider_shortcode($args) { $sliderAlias = UniteFunctionsRev::getVal($args, 0); ob_start(); $slider = RevSliderOutput::putSlider($sliderAlias); $content = ob_get_contents(); ob_clean(); ob_end_clean(); //handle slider output types if (!empty($slider)) { $outputType = $slider->getParam("output_type", ""); switch ($outputType) { case "compress": $content = str_replace("\n", "", $content); $content = str_replace("\r", "", $content); return $content; break; case "echo": echo $content; //bypass the filters break; default: return $content; break; } } else { return $content; } //normal output }
/** * * a must function. you can not use it, but the function must stay there!. * */ public static function onAddScripts() { global $wp_version; $style_pre = ''; $style_post = ''; if ($wp_version < 3.7) { $style_pre = '<style type="text/css">'; $style_post = '</style>'; } $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on"); $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off"); $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes"); $isPutIn = RevSliderOutput::isPutIn($strPutIn, true); //put the includes only on pages with active widget or shortcode // if the put in match, then include them always (ignore this if) if ($isPutIn == false && $includesGlobally == "off") { $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css"); $custom_css = RevOperations::getStaticCss(); $custom_css = UniteCssParserRev::compress_css($custom_css); wp_add_inline_style('rs-plugin-settings', $style_pre . $custom_css . $style_post); /* */ /* $styles = $db->fetch(GlobalsRevSlider::$table_css); $styles = UniteCssParserRev::parseDbArrayToCss($styles, "\n"); $styles = UniteCssParserRev::compress_css($styles); wp_add_inline_style( 'rs-plugin-settings', $style_pre.$styles.$style_post ); // KRISZTIAN MODIFICATION FOR INNERLAYERS $stylesinnerlayers = str_replace('.tp-caption', '',$styles);´ wp_add_inline_style( 'rs-plugin-settings', $style_pre.$stylesinnerlayers.$style_post ); // END MODIFICATION */ $setBase = is_ssl() ? "https://" : "http://"; $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; self::addScriptAbsoluteUrl($url_jquery, "jquery"); if ($includesFooter == "off") { $waitfor = array('jquery'); $enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs", 'off'); if ($enable_logs == 'on') { self::addScriptWaitFor("jquery.themepunch.enablelog", "rs-plugin/js", 'enable-logs'); $waitfor[] = 'enable-logs'; } self::addScriptWaitFor("jquery.themepunch.tools.min", "rs-plugin/js", 'tp-tools', $waitfor); self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'tp-tools'); } else { //put javascript to footer UniteBaseClassRev::addAction('wp_footer', 'putJavascript'); } }
function rev_slider_shortcode($args) { $sliderAlias = UniteFunctionsRev::getVal($args, 0); ob_start(); RevSliderOutput::putSlider($sliderAlias); $content = ob_get_contents(); ob_clean(); return $content; }
/** * Constructor */ public function __construct() { parent::__construct(); $revSliderAdmin = Mage::getSingleton('RevSliderAdmin'); $revSliderAdmin->requireSettings("slider_settings"); $settingsMain = $revSliderAdmin->getSettings("slider_main"); $settingsParams = $revSliderAdmin->getSettings("slider_params"); $settingsSliderMain = new RevSliderSettingsProduct(); $settingsSliderParams = new UniteSettingsProductSidebarRev(); //get taxonomies with cats $postTypesWithCats = RevOperations::getPostTypesWithCatsForClient(); $jsonTaxWithCats = UniteFunctionsRev::jsonEncodeForClientSide($postTypesWithCats); //check existing slider data: $sliderID = $this->getRequest()->getParam('id'); if (!empty($sliderID)) { $slider = new RevSlider(); $slider->initByID($sliderID); //get setting fields $settingsFields = $slider->getSettingsFields(); $arrFieldsMain = $settingsFields["main"]; $arrFieldsParams = $settingsFields["params"]; //modify arrows type for backword compatability $arrowsType = UniteFunctionsRev::getVal($arrFieldsParams, "navigation_arrows"); switch ($arrowsType) { case "verticalcentered": $arrFieldsParams["navigation_arrows"] = "solo"; break; } //set custom type params values: $settingsMain = RevSliderSettingsProduct::setSettingsCustomValues($settingsMain, $arrFieldsParams, $postTypesWithCats); //set setting values from the slider $settingsMain->setStoredValues($arrFieldsParams); $settingsParams->setStoredValues($arrFieldsParams); //update short code setting $shortcode = $slider->getShortcode(); $settingsMain->updateSettingValue("shortcode", htmlentities($shortcode)); $linksEditSlides = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slides/id/' . $sliderID); $settingsSliderParams->init($settingsParams); $settingsSliderMain->init($settingsMain); $settingsSliderParams->isAccordion(true); $this->assign('sliderID', $sliderID); $this->assign('linksEditSlides', $linksEditSlides); $this->assign('arrFieldsParams', $arrFieldsParams); $this->setTemplate('nwdthemes/revslider/templates/slider_edit.phtml'); } else { //set custom type params values: $settingsMain = RevSliderSettingsProduct::setSettingsCustomValues($settingsMain, array(), $postTypesWithCats); $settingsSliderParams->init($settingsParams); $settingsSliderMain->init($settingsMain); $settingsSliderParams->isAccordion(true); $this->setTemplate('nwdthemes/revslider/templates/slider_new.phtml'); } $this->assign('sliderTemplate', $this->_sliderTemplate); $this->assign('settingsSliderMain', $settingsSliderMain); $this->assign('settingsSliderParams', $settingsSliderParams); $this->assign('jsonTaxWithCats', $jsonTaxWithCats); }
/** * * widget output */ public function widget($args, $instance) { $sliderID = UniteFunctionsRev::getVal($instance, "rev_slider"); $homepageCheck = UniteFunctionsRev::getVal($instance, "rev_slider_homepage"); $homepage = ""; if ($homepageCheck == "on") { $homepage = "homepage"; } if (empty($sliderID)) { return false; } RevSliderOutput::putSlider($sliderID, $homepage); }
/** * * the form */ public function form($instance) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $sliderID = UniteFunctionsRev::getVal($instance, "rev_slider"); if (empty($arrSliders)) { echo __("No sliders found, Please create a slider", tk_theme_name); } else { $field = "rev_slider"; $fieldID = $this->get_field_id($field); $fieldName = $this->get_field_name($field); $select = UniteFunctionsRev::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true); } echo "Choose slider: "; echo $select; }
/** * * put rev slider on the page. * the data can be slider ID or slider alias. */ function putRevSlider($data, $putIn = "") { $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on"); $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes"); $isPutIn = RevSliderOutput::isPutIn($strPutIn, true); if ($isPutIn == false && $includesGlobally == "off") { $output = new RevSliderOutput(); $option1Name = "Include RevSlider libraries globally (all pages/posts)"; $option2Name = "Pages to include RevSlider libraries"; $output->putErrorMessage(__("If you want to use the PHP function \"putRevSlider\" in your code please make sure to check \" ", REVSLIDER_TEXTDOMAIN) . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", REVSLIDER_TEXTDOMAIN) . $option2Name . __("\" option box.")); return false; } RevSliderOutput::putSlider($data, $putIn); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Initialize some field attributes. if (empty($class)) { $class = "button1"; } $id = $this->element['name']; $label = $this->element['label']; $desc = UniteFunctionsRev::getVal($this->element, "description"); $htmlAddon = ""; if (!empty($desc)) { $htmlAddon = "class='hasTip' title='{$desc}'"; } $html = "<input type='button' id='{$id}' value='{$label}' {$htmlAddon}>"; return $html; }
/** * * save the slider */ private function saveSlider() { $sliderID = $this->data["sliderid"]; $params = UniteFunctionsRev::getVal($this->data, "params", array()); $settings = UniteFunctionsRev::getVal($this->data, "settings", array()); $params = array_merge($settings, $params); $params = UniteFunctionJoomlaRev::clearParamsArray($params); //validate title not empty: $title = UniteFunctionsRev::getVal($params, "title"); UniteFunctionsRev::validateNotEmpty($title, "Title"); //unset sldier id from the params unset($params["id"]); if (empty($sliderID)) { $sliderID = $this->operations->addNewSlider($params); } else { $this->operations->saveSlider($sliderID, $params); } return $sliderID; }
public static function onAddScripts() { global $wp_version; $style_pre = ''; $style_post = ''; if ($wp_version < 3.7) { $style_pre = '<style type="text/css">'; $style_post = '</style>'; } $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on"); $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off"); $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes"); $isPutIn = RevSliderOutput::isPutIn($strPutIn, true); if ($isPutIn == false && $includesGlobally == "off") { $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css"); $custom_css = RevOperations::getStaticCss(); $custom_css = UniteCssParserRev::compress_css($custom_css); wp_add_inline_style('rs-plugin-settings', $style_pre . $custom_css . $style_post); $setBase = get_http(); $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; self::addScriptAbsoluteUrl($url_jquery, "jquery"); if ($includesFooter == "off") { $waitfor = array('jquery'); $enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs", 'off'); if ($enable_logs == 'on') { self::addScriptWaitFor("jquery.themepunch.enablelog", "rs-plugin/js", 'enable-logs'); $waitfor[] = 'enable-logs'; } self::addScriptWaitFor("jquery.themepunch.tools.min", "rs-plugin/js", 'tp-tools', $waitfor); self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'tp-tools'); } else { UniteBaseClassRev::addAction('wp_footer', 'putJavascript'); } }
/** * * a must function. you can not use it, but the function must stay there!. * */ public static function onAddScripts() { $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on"); $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off"); $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes"); $isPutIn = RevSliderOutput::isPutIn($strPutIn, true); //put the includes only on pages with active widget or shortcode // if the put in match, then include them always (ignore this if) if ($isPutIn == false && $includesGlobally == "off") { $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css"); //check if dynamic-captions.css exists. If not, include captions.php if (file_exists(self::$path_plugin . "rs-plugin/css/dynamic-captions.css") == false) { self::addDynamicStyle("captions", "rs-plugin-captions", "rs-plugin/css"); } else { $db = new UniteDBRev(); $styles = $db->fetch(GlobalsRevSlider::$table_css); $styles = UniteCssParserRev::parseDbArrayToCss($styles, "\n"); wp_add_inline_style('rs-plugin-settings', $styles); //self::addStyle("dynamic-captions","rs-captions","rs-plugin/css"); } $custom_css = RevOperations::getStaticCss(); wp_add_inline_style('rs-plugin-settings', $custom_css); //self::addStyle("static-captions","rs-plugin-static","rs-plugin/css"); $setBase = is_ssl() ? "https://" : "http://"; $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; self::addScriptAbsoluteUrl($url_jquery, "jquery"); if ($includesFooter == "off") { self::addScriptWaitFor("jquery.themepunch.plugins.min", "rs-plugin/js", 'themepunchtools', 'jquery'); self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'jquery'); } else { //put javascript to footer UniteBaseClassRev::addAction('wp_footer', 'putJavascript'); } }
public static function onAddScripts() { $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on"); $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off"); $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes"); $isPutIn = RevSliderOutput::isPutIn($strPutIn, true); //put the includes only on pages with active widget or shortcode // if the put in match, then include them always (ignore this if) if ($isPutIn == false && $includesGlobally == "off") { $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } //self::addStyle("settings","rs-settings","rs-plugin/css"); //check if dynamic-captions.css exists. If not, include captions.php //if(file_exists(self::$path_plugin."rs-plugin/css/dynamic-captions.css") == false){ //self::addDynamicStyle("captions","rs-plugin-captions","rs-plugin/css"); // $captionsAction = Context::getContext()->link->getAdminLink('Revolutionslider_ajax').'&revControllerAction=captions'; // // wp_enqueue_style ('captions', $captionsAction); // } //else //self::addStyle("dynamic-captions","rs-captions","rs-plugin/css"); //self::addStyle("static-captions","rs-plugin-static","rs-plugin/css"); // $setBase = (is_ssl()) ? "https://" : "http://"; // $url_jquery = $setBase."ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; // self::addScriptAbsoluteUrl($url_jquery, "jquery"); // if($includesFooter == "off"){ // self::addScript("jquery.themepunch.tools.min","rs-plugin/js",'themepunchtools'); // self::addScript("jquery.themepunch.revolution.min","rs-plugin/js"); //self::addScriptWaitFor("jquery.themepunch.tools.min","rs-plugin/js",'themepunchtools', array('jquery')); //self::addScriptWaitFor("jquery.themepunch.revolution.min","rs-plugin/js", null, array('jquery')); // }else{ //put javascript to footer // UniteBaseClassRev::addAction('wp_footer', 'putJavascript'); // } }
function yit_revslider_slider() { if ( ! class_exists('RevOperations') ) { return; } $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally","on"); $isWidgetActive = is_active_widget( false, false, "rev-slider-widget", true ); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ( YIT_Layout()->slider_name===false || (YIT_Layout()->slider_name != 'none' && YIT_Slider::get_slider( YIT_Layout()->slider_name )->config->layout != 'revolution-slider') || $includesGlobally == "on" || $isWidgetActive || $hasShortcode ) { return; } if ( defined( 'RS_PLUGIN_URL' ) ) { wp_enqueue_style( 'rs-plugin-settings', RS_PLUGIN_URL . 'public/assets/css/settings.css', array(), RevSliderGlobals::SLIDER_REVISION ); } else { wp_enqueue_style( "rs-plugin-settings", UniteBaseClassRev::$url_plugin . "rs-plugin/css/settings.css", array(), GlobalsRevSlider::SLIDER_REVISION ); } $custom_css = RevOperations::getStaticCss(); $custom_css = UniteCssParserRev::compress_css($custom_css); wp_add_inline_style('rs-plugin-settings', $custom_css); $setBase = (is_ssl()) ? "https://" : "http://"; $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; wp_enqueue_script("jquery", $url_jquery); // put javascript to footer add_action('wp_footer', array($GLOBALS['productFront'], 'putJavascript')); }
/** * * a must function. you can not use it, but the function must stay there!. * */ public static function onAddScripts() { $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on"); $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes"); $isPutIn = RevSliderOutput::isPutIn($strPutIn, true); //put the includes only on pages with active widget or shortcode // if the put in match, then include them always (ignore this if) if ($isPutIn == false && $includesGlobally == "off") { $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true); $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } self::addStyle("settings", "rs-settings", "rs-plugin/css"); self::addStyle("captions", "rs-captions", "rs-plugin/css"); $url_jquery = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution"; self::addScriptAbsoluteUrl($url_jquery, "jquery"); self::addScript("jquery.themepunch.revolution.min", "rs-plugin/js"); }
public function addSelect_filescan($name, $path, $arrExtensions, $defaultValue, $text, $arrParams = array()) { if (getType($arrExtensions) == "string") { $arrExtensions = array($arrExtensions); } elseif (getType($arrExtensions) != "array") { $this->throwError("The extensions array is not array and not string in setting: {$name}, please check."); } //make items array if (!is_dir($path)) { $this->throwError("path: {$path} not found"); } $arrItems = array(); $files = scandir($path); foreach ($files as $file) { //general filter if ($file == ".." || $file == "." || $file == ".svn") { continue; } $info = pathinfo($file); $ext = UniteFunctionsRev::getVal($info, "extension"); $ext = strtolower($ext); if (array_search($ext, $arrExtensions) === FALSE) { continue; } $arrItems[$file] = $file; } //handle add data array if (isset($arrParams["addData"])) { foreach ($arrParams["addData"] as $key => $value) { $arrItems[$key] = $value; } } if (empty($defaultValue) && !empty($arrItems)) { $defaultValue = current($arrItems); } $this->addSelect($name, $arrItems, $text, $defaultValue, $arrParams); }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $this->operateControlStates(); // Initialize some field attributes. $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $classOutput = ""; $class = (string) $this->element['class']; if ($this->hidden == true) { $hiddenType = $this->element["hiddentype"]; if ($hiddenType != "soft") { $class .= " hidden"; } } if (!empty($class)) { $classOutput = " class=\"{$class}\""; } $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : ''; $disabled = (string) $this->element['disabled'] == 'true' || $this->disabled == true ? ' disabled="disabled"' : ''; $unit = (string) UniteFunctionsRev::getVal($this->element, 'unit', ""); // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $html = '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $classOutput . $size . $disabled . $readonly . $onchange . $maxLength . '/>'; if (!empty($unit)) { $unitClass = "setting_unit"; if ($disabled == true) { $unitClass .= " field_disabled"; } if ($this->hidden == true) { $unitClass .= " hidden"; } $unitID = $this->id . "-unit"; $html .= "<span id='{$unitID}' class='{$unitClass}'>{$unit}</span>"; } return $html; }
function fusion_importer() { global $wpdb; if (current_user_can('manage_options') && isset($_GET['import_data_content'])) { if (!defined('WP_LOAD_IMPORTERS')) { define('WP_LOAD_IMPORTERS', true); } // we are loading importers if (!class_exists('WP_Importer')) { // if main importer class doesn't exist $wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; include $wp_importer; } if (!class_exists('WP_Import')) { // if WP importer doesn't exist $wp_import = get_template_directory() . '/framework/plugins/importer/wordpress-importer.php'; include $wp_import; } if (class_exists('WP_Importer') && class_exists('WP_Import')) { // check for main import class and wp import class $importer = new WP_Import(); /* First Import Posts, Pages, Portfolio Content, FAQ, Images, Menus */ $theme_xml = get_template_directory() . '/framework/plugins/importer/data/avada.xml.gz'; $importer->fetch_attachments = true; ob_start(); $importer->import($theme_xml); ob_end_clean(); /* Import Woocommerce if WooCommerce Exists */ if (class_exists('Woocommerce')) { $importer = new WP_Import(); $theme_xml = get_template_directory() . '/framework/plugins/importer/data/wooproducts.xml.gz'; $importer->fetch_attachments = true; ob_start(); $importer->import($theme_xml); ob_end_clean(); // Set pages $woopages = array('woocommerce_shop_page_id' => 'Shop', 'woocommerce_cart_page_id' => 'Cart', 'woocommerce_checkout_page_id' => 'Checkout', 'woocommerce_pay_page_id' => 'Checkout → Pay', 'woocommerce_thanks_page_id' => 'Order Received', 'woocommerce_myaccount_page_id' => 'My Account', 'woocommerce_edit_address_page_id' => 'Edit My Address', 'woocommerce_view_order_page_id' => 'View Order', 'woocommerce_change_password_page_id' => 'Change Password', 'woocommerce_logout_page_id' => 'Logout', 'woocommerce_lost_password_page_id' => 'Lost Password'); foreach ($woopages as $woo_page_name => $woo_page_title) { $woopage = get_page_by_title($woo_page_title); if ($woopage->ID) { update_option($woo_page_name, $woopage->ID); // Front Page } } // We no longer need to install pages delete_option('_wc_needs_pages'); delete_transient('_wc_activation_redirect'); // Flush rules after install flush_rewrite_rules(); } // Set imported menus to registered theme locations $locations = get_theme_mod('nav_menu_locations'); // registered menu locations in theme $menus = wp_get_nav_menus(); // registered menus if ($menus) { foreach ($menus as $menu) { // assign menus to theme locations if ($menu->name == 'Main') { $locations['main_navigation'] = $menu->term_id; } else { if ($menu->name == '404') { $locations['404_pages'] = $menu->term_id; } else { if ($menu->name == 'Top') { $locations['top_navigation'] = $menu->term_id; } } } } } set_theme_mod('nav_menu_locations', $locations); // set menus to locations // Import Theme Options $theme_options_txt = get_template_directory_uri() . '/framework/plugins/importer/data/theme_options.txt'; // theme options data file $theme_options_txt = wp_remote_get($theme_options_txt); $data = unserialize(base64_decode($theme_options_txt['body'])); update_option(OPTIONS, $data); // update theme options // Add sidebar widget areas $sidebars = array('ContactSidebar' => 'Contact Sidebar', 'FAQ' => 'FAQ', 'HomepageSidebar' => 'Home Page Sidebar', 'Portfolio' => 'Portfolio'); update_option('sbg_sidebars', $sidebars); foreach ($sidebars as $sidebar) { $sidebar_class = avada_name_to_class($sidebar); register_sidebar(array('name' => $sidebar, 'id' => 'avada-custom-sidebar-' . strtolower($sidebar_class), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="heading"><h3>', 'after_title' => '</h3></div>')); } // Add data to widgets $widgets_json = get_template_directory_uri() . '/framework/plugins/importer/data/widget_data.json'; // widgets data file $widgets_json = wp_remote_get($widgets_json); $widget_data = $widgets_json['body']; $import_widgets = fusion_import_widget_data($widget_data); // Import Layerslider if (function_exists('layerslider_import_sample_slider')) { // if layerslider is activated $ls_txt = get_template_directory_uri() . '/framework/plugins/importer/data/layerslider.txt'; // layerslider data file $ls_txt = wp_remote_get($ls_txt); $data = json_decode(base64_decode($ls_txt['body']), true); avada_import_sample_slider($data); // update theme options // Get all sliders // Table name $table_name = $wpdb->prefix . "layerslider"; // Get sliders $sliders = $wpdb->get_results("SELECT * FROM {$table_name}\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE flag_hidden = '0' AND flag_deleted = '0'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY date_c ASC"); if (!empty($sliders)) { foreach ($sliders as $key => $item) { $slides[$item->id] = $item->name; } } if ($slides) { foreach ($slides as $key => $val) { $slides_array[$val] = $key; } } // Assign LayerSlider $lspage = get_page_by_title('Layer Slider'); if ($lspage->ID && $slides_array['Avada Full Width']) { update_post_meta($lspage->ID, 'pyre_slider', $slides_array['Avada Full Width']); } } // Import Revslider if (class_exists('UniteFunctionsRev')) { // if revslider is activated $rev_directory = get_template_directory() . '/framework/plugins/importer/data/revsliders/'; // layerslider data dir foreach (glob($rev_directory . '*.txt') as $filename) { // get all files from revsliders data dir $filename = basename($filename); $rev_files[] = get_template_directory_uri() . '/framework/plugins/importer/data/revsliders/' . $filename; } foreach ($rev_files as $rev_file) { // finally import rev slider data files $get_file = wp_remote_get($rev_file); $arrSlider = unserialize($get_file['body']); $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"); $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert); $sliderID = mysql_insert_id(); //create all slides $arrSlides = $arrSlider["slides"]; foreach ($arrSlides as $slide) { $params = $slide["params"]; $layers = $slide["layers"]; //convert params images: if (isset($params["image"])) { $params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]); } //convert layers images: foreach ($layers as $key => $layer) { if (isset($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); } } } // Set reading options $homepage = get_page_by_title('Home Version 13'); $posts_page = get_page_by_title('Blog Large'); if ($homepage->ID && $posts_page->ID) { update_option('show_on_front', 'page'); update_option('page_on_front', $homepage->ID); // Front Page update_option('page_for_posts', $posts_page->ID); // Blog Page } // finally redirect to success page wp_redirect(admin_url('themes.php?page=optionsframework&imported=success#of-option-generaloptions')); } } }
protected function drawSettingRow($setting) { //set cellstyle: $cellStyle = ""; if (isset($setting[UniteSettingsRev::PARAM_CELLSTYLE])) { $cellStyle .= $setting[UniteSettingsRev::PARAM_CELLSTYLE]; } //set text style: $textStyle = $cellStyle; if (isset($setting[UniteSettingsRev::PARAM_TEXTSTYLE])) { $textStyle .= $setting[UniteSettingsRev::PARAM_TEXTSTYLE]; } if ($textStyle != "") { $textStyle = "style='" . $textStyle . "'"; } if ($cellStyle != "") { $cellStyle = "style='" . $cellStyle . "'"; } //set hidden $rowStyle = ""; if (isset($setting["hidden"]) && $setting["hidden"] == true) { $rowStyle = "display:none;"; } if (!empty($rowStyle)) { $rowStyle = "style='{$rowStyle}'"; } //set row class: $rowClass = ""; if (isset($setting["disabled"])) { $rowClass = "class='disabled'"; } //modify text: $text = UniteFunctionsRev::getVal($setting, "text", ""); $text = __($text, REVSLIDER_TEXTDOMAIN); // prevent line break (convert spaces to nbsp) $text = str_replace(" ", " ", $text); if ($setting["type"] == UniteSettingsRev::TYPE_CHECKBOX) { $text = "<label for='{$setting["id"]}'>{$text}</label>"; } //set settings text width: $textWidth = ""; if (isset($setting["textWidth"])) { $textWidth = 'width="' . $setting["textWidth"] . '"'; } $description = UniteFunctionsRev::getVal($setting, "description"); $description = __($description, REVSLIDER_TEXTDOMAIN); $unit = UniteFunctionsRev::getVal($setting, "unit"); $unit = __($unit, REVSLIDER_TEXTDOMAIN); $required = UniteFunctionsRev::getVal($setting, "required"); $addHtml = UniteFunctionsRev::getVal($setting, UniteSettingsRev::PARAM_ADDTEXT); $addHtmlBefore = UniteFunctionsRev::getVal($setting, UniteSettingsRev::PARAM_ADDTEXT_BEFORE_ELEMENT); //set if draw text or not. $toDrawText = true; if ($setting["type"] == UniteSettingsRev::TYPE_BUTTON || $setting["type"] == UniteSettingsRev::TYPE_MULTIPLE_TEXT) { $toDrawText = false; } $settingID = $setting["id"]; $attribsText = UniteFunctionsRev::getVal($setting, "attrib_text"); $info = $toDrawText == true && $description !== '' ? ' <div class="setting_info">i</div>' : ''; ?> <li id="<?php echo $settingID; ?> _row" <?php echo $rowStyle . " " . $rowClass; ?> > <?php if ($toDrawText == true) { ?> <div id="<?php echo $settingID; ?> _text" class='setting_text' title="<?php echo $description; ?> " <?php echo $attribsText; ?> ><?php echo $text . $info; ?> </div> <?php } ?> <?php if (!empty($addHtmlBefore)) { ?> <div class="settings_addhtmlbefore"><?php echo $addHtmlBefore; ?> </div> <?php } ?> <div class='setting_input'> <?php $this->drawInputs($setting); ?> </div> <?php if (!empty($unit)) { ?> <div class='setting_unit'><?php echo $unit; ?> </div> <?php } ?> <?php if (!empty($required)) { ?> <div class='setting_required'>*</div> <?php } ?> <?php if (!empty($addHtml)) { ?> <div class="settings_addhtml"><?php echo $addHtml; ?> </div> <?php } ?> <div class="clear"></div> </li> <?php if ($setting['name'] == 'shadow_type') { //For shadow types, add box with shadow types $this->drawShadowTypes($setting['value']); } }
/** * * widget output */ public function widget($args, $instance) { $sliderID = UniteFunctionsRev::getVal($instance, "rev_slider"); $title = UniteFunctionsRev::getVal($instance, "rev_slider_title"); $homepageCheck = UniteFunctionsRev::getVal($instance, "rev_slider_homepage"); $homepage = ""; if ($homepageCheck == "on") { $homepage = "homepage"; } $pages = UniteFunctionsRev::getVal($instance, "rev_slider_pages"); if (!empty($pages)) { if (!empty($homepage)) { $homepage .= ","; } $homepage .= $pages; } if (empty($sliderID)) { return false; } //widget output $beforeWidget = UniteFunctionsRev::getVal($args, "before_widget"); $afterWidget = UniteFunctionsRev::getVal($args, "after_widget"); $beforeTitle = UniteFunctionsRev::getVal($args, "before_title"); $afterTitle = UniteFunctionsRev::getVal($args, "after_title"); echo $beforeWidget; if (!empty($title)) { echo $beforeTitle . $title . $afterTitle; } RevSliderOutput::putSlider($sliderID, $homepage); echo $afterWidget; }
/** * * get lang filter value from session */ public function getLangFilterValue() { if (!isset($_SESSION)) { return "all"; } $langFitler = UniteFunctionsRev::getVal($_SESSION, "revslider_lang_filter", "all"); return $langFitler; }
/** * * replace image url's among slide image and layer images */ public function replaceImageUrls($urlFrom, $urlTo) { $this->validateInited(); $urlImage = UniteFunctionsRev::getVal($this->params, "image"); if (strpos($urlImage, $urlFrom) !== false) { $imageNew = str_replace($urlFrom, $urlTo, $urlImage); $this->params["image"] = $imageNew; $this->updateParamsInDB(); } // update image url in layers $isUpdated = false; foreach ($this->arrLayers as $key => $layer) { $type = UniteFunctionsRev::getVal($layer, "type"); if ($type == "image") { $urlImage = UniteFunctionsRev::getVal($layer, "image_url"); if (strpos($urlImage, $urlFrom) !== false) { $newUrlImage = str_replace($urlFrom, $urlTo, $urlImage); $this->arrLayers[$key]["image_url"] = $newUrlImage; $isUpdated = true; } } } if ($isUpdated == true) { $this->updateLayersInDB(); } }
public static function onAjaxAction() { $slider = new RevSlider(); $slide = new RevSlide(); $operations = new RevOperations(); $action = self::getPostGetVar("client_action"); $data = self::getPostGetVar("data"); //$nonce = self::getPostGetVar("nonce"); try { //verify the nonce // $isVerified = wp_verify_nonce($nonce, "revslider_actions"); // // if($isVerified == false) // UniteFunctionsRev::throwError("Wrong request"); switch ($action) { //start font case 'add_google_fonts': $f = new ThemePunch_Fonts(); $result = $f->add_new_font($data); if ($result === true) { self::ajaxResponseSuccessRedirect(__("Font successfully created!", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders")); } else { self::ajaxResponseError($result, false); } break; case 'remove_google_fonts': if (!isset($data['handle'])) { self::ajaxResponseError(__('Font not found', REVSLIDER_TEXTDOMAIN), false); } $f = new ThemePunch_Fonts(); $result = $f->remove_font_by_handle($data['handle']); if ($result === true) { self::ajaxResponseSuccess(__("Font successfully removed!", REVSLIDER_TEXTDOMAIN), array('data' => $result)); } else { self::ajaxResponseError($result, false); } break; case 'edit_google_fonts': if (!isset($data['handle'])) { self::ajaxResponseError(__('No handle given', REVSLIDER_TEXTDOMAIN), false); } if (!isset($data['url'])) { self::ajaxResponseError(__('No parameters given', REVSLIDER_TEXTDOMAIN), false); } $f = new ThemePunch_Fonts(); $result = $f->edit_font_by_handle($data); if ($result === true) { self::ajaxResponseSuccess(__("Font successfully changed!", REVSLIDER_TEXTDOMAIN), array('data' => $result)); } else { self::ajaxResponseError($result, false); } break; //end font //end font case "export_slider": $sliderID = self::getGetVar("sliderid"); $dummy = self::getGetVar("dummy"); $slider->initByID($sliderID); $slider->exportSlider($dummy); break; case "import_slider": $updateAnim = self::getPostGetVar("update_animations"); $updateStatic = self::getPostGetVar("update_static_captions"); self::importSliderHandle(null, $updateAnim, $updateStatic); break; case "import_slider_slidersview": $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": self::requireSettings("slider_settings"); $settingsMain = self::getSettings("slider_main"); $settingsParams = self::getSettings("slider_params"); $data = $operations->modifyCustomSliderParams($data); //var_dump($settingsMain); $newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams); if ($newSliderID > 0) { self::ajaxResponseSuccessRedirect(__("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders")); } break; case "update_slider": self::requireSettings("slider_settings"); $settingsMain = self::getSettings("slider_main"); $settingsParams = self::getSettings("slider_params"); $data = $operations->modifyCustomSliderParams($data); $slider->updateSliderFromOptions($data, $settingsMain, $settingsParams); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN)); break; case "delete_slider": $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(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS)); } break; case "duplicate_slider": $slider->duplicateSliderFromData($data); self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS)); break; case "add_slide": $numSlides = $slider->createSlideFromData($data); $sliderID = $data["sliderid"]; if ($numSlides == 1) { $responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN); } else { $responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN); } $urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccessRedirect($responseText, $urlRedirect); break; case "add_slide_fromslideview": $slideID = $slider->createSlideFromData($data, true); $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}"); $responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccessRedirect($responseText, $urlRedirect); break; case "update_slide": require self::getSettingsFilePath("slide_settings"); $slide->updateSlideFromData($data, $slideSettings); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN)); break; case "update_static_slide": $slide->updateStaticSlideFromData($data); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("Static Layers updated", REVSLIDER_TEXTDOMAIN)); break; case "delete_slide": $isPost = $slide->deleteSlideFromData($data); if ($isPost) { $message = __("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN); } else { $message = __("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN); } $sliderID = UniteFunctionsRev::getVal($data, "sliderID"); self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "duplicate_slide": $sliderID = $slider->duplicateSlideFromData($data); self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "copy_move_slide": $sliderID = $slider->copyMoveSlideFromData($data); self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "get_static_css": sdsconfig::getgeneratecssfile(); $contentCSS = $operations->getStaticCss(); self::ajaxResponseData($contentCSS); break; case "get_dynamic_css": sdsconfig::getgeneratecssfile(); $contentCSS = $operations->getDynamicCss(); self::ajaxResponseData($contentCSS); break; case "insert_captions_css": $arrCaptions = $operations->insertCaptionsContentData($data); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "update_captions_css": $arrCaptions = $operations->updateCaptionsContentData($data); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "delete_captions_css": $arrCaptions = $operations->deleteCaptionsContentData($data); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "update_static_css": $staticCss = $operations->updateStaticCss($data); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss)); break; case "insert_custom_anim": $arrAnims = $operations->insertCustomAnim($data); //$arrCaptions = self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims); //,array("arrCaptions"=>$arrCaptions) break; case "update_custom_anim": $arrAnims = $operations->updateCustomAnim($data); self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims); //,array("arrCaptions"=>$arrCaptions) break; case "delete_custom_anim": $arrAnims = $operations->deleteCustomAnim($data); self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims); //,array("arrCaptions"=>$arrCaptions) break; case "update_slides_order": $slider->updateSlidesOrderFromData($data); self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN)); break; case "change_slide_image": $slide->updateSlideImageFromData($data); $sliderID = UniteFunctionsRev::getVal($data, "slider_id"); self::ajaxResponseSuccessRedirect(__("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"); // $operations->previewOutput($sliderID); // break; // case "preview_slider": // $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid"); // $operations->previewOutput($sliderID); // 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(); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("All files successfully updated", REVSLIDER_TEXTDOMAIN)); break; case "update_general_settings": $new_data = array(); // print_r($data); foreach ($data as $key => $value) { $new_data[$key] = $value; } $operations->updateGeneralSettings($new_data); // sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("General settings updated", REVSLIDER_TEXTDOMAIN)); break; case "update_posts_sortby": $slider->updatePostsSortbyFromData($data); self::ajaxResponseSuccess(__("Sortby updated", REVSLIDER_TEXTDOMAIN)); break; case "replace_image_urls": $slider->replaceImageUrlsFromData($data); self::ajaxResponseSuccess(__("Image urls replaced", REVSLIDER_TEXTDOMAIN)); break; case "reset_slide_settings": $slider->resetSlideSettings($data); sdsconfig::getgeneratecssfile(); self::ajaxResponseSuccess(__("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN)); break; case 'delete_uploaded_image': self::delete_uploaded_file($data); break; case 'get_uploaded_images': self::get_uploaded_files_json(); break; case 'add_slider_pos_val': $newdata = array(); if (!empty($data)) { $k = array_keys($data); $k = preg_replace_callback('/\\[[0-9]+/', create_function('$match', 'return "";'), $k[0]); foreach ($data as $key => $arr) { $newdata[$k][] = $arr; } $data = $newdata; } sdsconfig::editSetting('revslideropencart', $data); self::ajaxResponseSuccess(__("Slider Position Save SuccessFully", 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; }
/** * * get list of all files in the directory * ext - filter by his extension only */ public static function getFileList($path, $ext = "") { $dir = scandir($path); $arrFiles = array(); foreach ($dir as $file) { if ($file == "." || $file == "..") { continue; } if (!empty($ext)) { $info = pathinfo($file); $extension = UniteFunctionsRev::getVal($info, "extension"); if ($ext != strtolower($extension)) { continue; } } $filepath = $path . "/" . $file; if (is_file($filepath)) { $arrFiles[] = $file; } } return $arrFiles; }
public function setStoredValues($arrValues) { foreach ($this->arrSettings as $key => $setting) { $name = UniteFunctionsRev::getVal($setting, "name"); //type consolidation $type = UniteFunctionsRev::getVal($setting, "type"); $datatype = UniteFunctionsRev::getVal($setting, "datatype"); //skip custom type $customType = UniteFunctionsRev::getVal($setting, "custom_type"); if (!empty($customType)) { continue; } if (array_key_exists($name, $arrValues)) { $value = $arrValues[$name]; $value = $this->modifyValueByDatatype($value, $datatype); $this->arrSettings[$key]["value"] = $value; $arrValues[$name] = $value; } } //end foreach return $arrValues; }