/** * * set custom values to settings */ public static function setSettingsCustomValues(UniteSettingsRev $settings, $arrValues) { $arrSettings = $settings->getArrSettings(); foreach ($arrSettings as $key => $setting) { $type = UniteFunctionsRev::getVal($setting, "type"); if ($type != UniteSettingsRev::TYPE_CUSTOM) { continue; } $customType = UniteFunctionsRev::getVal($setting, "custom_type"); switch ($customType) { case "slider_size": $setting["width"] = UniteFunctionsRev::getVal($arrValues, "width", UniteFunctionsRev::getVal($setting, "width")); $setting["height"] = UniteFunctionsRev::getVal($arrValues, "height", UniteFunctionsRev::getVal($setting, "height")); $arrSettings[$key] = $setting; break; case "responsitive_settings": $id = $setting["id"]; $setting["w1"] = UniteFunctionsRev::getVal($arrValues, $id . "_w1", UniteFunctionsRev::getVal($setting, "w1")); $setting["w2"] = UniteFunctionsRev::getVal($arrValues, $id . "_w2", UniteFunctionsRev::getVal($setting, "w2")); $setting["w3"] = UniteFunctionsRev::getVal($arrValues, $id . "_w3", UniteFunctionsRev::getVal($setting, "w3")); $setting["w4"] = UniteFunctionsRev::getVal($arrValues, $id . "_w4", UniteFunctionsRev::getVal($setting, "w4")); $setting["w5"] = UniteFunctionsRev::getVal($arrValues, $id . "_w5", UniteFunctionsRev::getVal($setting, "w5")); $setting["w6"] = UniteFunctionsRev::getVal($arrValues, $id . "_w6", UniteFunctionsRev::getVal($setting, "w6")); $setting["sw1"] = UniteFunctionsRev::getVal($arrValues, $id . "_sw1", UniteFunctionsRev::getVal($setting, "sw1")); $setting["sw2"] = UniteFunctionsRev::getVal($arrValues, $id . "_sw2", UniteFunctionsRev::getVal($setting, "sw2")); $setting["sw3"] = UniteFunctionsRev::getVal($arrValues, $id . "_sw3", UniteFunctionsRev::getVal($setting, "sw3")); $setting["sw4"] = UniteFunctionsRev::getVal($arrValues, $id . "_sw4", UniteFunctionsRev::getVal($setting, "sw4")); $setting["sw5"] = UniteFunctionsRev::getVal($arrValues, $id . "_sw5", UniteFunctionsRev::getVal($setting, "sw5")); $setting["sw6"] = UniteFunctionsRev::getVal($arrValues, $id . "_sw6", UniteFunctionsRev::getVal($setting, "sw6")); $arrSettings[$key] = $setting; break; } } $settings->setArrSettings($arrSettings); //disable settings by slider type: $sliderType = $settings->getSettingValue("slider_type"); switch ($sliderType) { case "fixed": case "fullwidth": //hide responsitive $settingRes = $settings->getSettingByName("responsitive"); $settingRes["disabled"] = true; $settings->updateArrSettingByName("responsitive", $settingRes); break; } //change height to max height if ($sliderType == "fullwidth") { $settingSize = $settings->getSettingByName("slider_size"); $settingSize["fullwidth_mode"] = true; $settings->updateArrSettingByName("slider_size", $settingSize); } return $settings; }
/** * * modify custom slider params. This is instead custom settings difficulties. */ public function modifyCustomSliderParams($data) { $settigns = new UniteSettingsRev(); $arrNames = array("width", "height", "responsitive_w1", "responsitive_sw1", "responsitive_w2", "responsitive_sw2", "responsitive_w3", "responsitive_sw3", "responsitive_w4", "responsitive_sw4", "responsitive_w5", "responsitive_sw5", "responsitive_w6", "responsitive_sw6"); $arrMain = $data["main"]; foreach ($arrNames as $name) { if (array_key_exists($name, $arrMain)) { $arrMain[$name] = $settigns->modifyValueByDatatype($arrMain[$name], UniteSettingsRev::DATATYPE_NUMBER); } } $arrMain["fullscreen_offset_container"] = $settigns->modifyValueByDatatype($arrMain["fullscreen_offset_container"], UniteSettingsRev::DATATYPE_STRING); //$arrMain["auto_height"] = $settigns->modifyValueByDatatype($arrMain["auto_height"], UniteSettingsRev::DATATYPE_STRING); $data["main"] = $arrMain; return $data; }
/** * set category by post type, with specific name (can be regular or woocommerce) */ public static function setCategoryByPostTypes(UniteSettingsRev $settings, $arrValues, $postTypesWithCats, $nameType, $nameCat, $defaultType) { //update the categories list by the post types $postTypes = UniteFunctionsRev::getVal($arrValues, $nameType, $defaultType); if (strpos($postTypes, ",") !== false) { $postTypes = explode(",", $postTypes); } else { $postTypes = array($postTypes); } $arrCats = array(); $globalCounter = 0; $arrCats = array(); $isFirst = true; foreach ($postTypes as $postType) { $cats = UniteFunctionsRev::getVal($postTypesWithCats, $postType, array()); if ($isFirst == true) { $firstValue = self::getFirstCategory($cats); $isFirst = false; } $arrCats = array_merge($arrCats, $cats); } $settingCategory = $settings->getSettingByName($nameCat); $settingCategory["items"] = $arrCats; $settings->updateArrSettingByName($nameCat, $settingCategory); //update value to first category $value = $settings->getSettingValue($nameCat); if (empty($value)) { $settings->updateSettingValue($nameCat, $firstValue); } return $settings; }
<?php $generalSettings = new UniteSettingsRev(); $generalSettings->addSelect("role", array(UniteBaseAdminClassRev::ROLE_ADMIN => __("To Admin", REVSLIDER_TEXTDOMAIN), UniteBaseAdminClassRev::ROLE_EDITOR => __("To Editor, Admin", REVSLIDER_TEXTDOMAIN), UniteBaseAdminClassRev::ROLE_AUTHOR => __("Author, Editor, Admin", REVSLIDER_TEXTDOMAIN)), __("View Plugin Permission", REVSLIDER_TEXTDOMAIN), UniteBaseAdminClassRev::ROLE_ADMIN, array("description" => "<br>" . __("The role of user that can view and edit the plugin", REVSLIDER_TEXTDOMAIN))); $generalSettings->addRadio("includes_globally", array("on" => __("On", REVSLIDER_TEXTDOMAIN), "off" => __("Off", REVSLIDER_TEXTDOMAIN)), __("Include RevSlider libraries globally", REVSLIDER_TEXTDOMAIN), "on", array("description" => "<br>" . __("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", "", __("Pages to include RevSlider libraries", REVSLIDER_TEXTDOMAIN), array("description" => "<br>" . __("Specify the page id's that the front end includes will be included in. Example: 2,3,5 also: homepage,3,4", REVSLIDER_TEXTDOMAIN))); //-------------------------- //get stored values $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $generalSettings->setStoredValues($arrValues); self::storeSettings("general", $generalSettings);
<?php $generalSettings = new UniteSettingsRev(); $generalSettings->addRadio("includes_globally", array("on" => Mage::helper('nwdrevslider')->__("On"), "off" => Mage::helper('nwdrevslider')->__("Off")), Mage::helper('nwdrevslider')->__("Include RevSlider libraries globally"), "on", array("description" => Mage::helper('nwdrevslider')->__("Add slider css and js includes on all pages. If turned to off they will be added to specified pages only."))); $generalSettings->addTextBox("pages_for_includes", "", Mage::helper('nwdrevslider')->__("Pages to include RevSlider libraries"), array("description" => Mage::helper('nwdrevslider')->__("Specify the page handles that the front end includes will be included in. Example: cms_page_view,catalog_product_view"))); $generalSettings->addRadio("show_dev_export", array("on" => Mage::helper('nwdrevslider')->__("On"), "off" => Mage::helper('nwdrevslider')->__("Off")), Mage::helper('nwdrevslider')->__("Enable Markup Export option"), "off", array("description" => Mage::helper('nwdrevslider')->__("This will enable the option to export the Slider Markups to copy/paste it directly into websites."))); $generalSettings->addRadio("enable_logs", array("on" => Mage::helper('nwdrevslider')->__("On"), "off" => Mage::helper('nwdrevslider')->__("Off")), Mage::helper('nwdrevslider')->__("Enable Logs"), "off", array("description" => Mage::helper('nwdrevslider')->__("Enable console logs for debugging."))); //get stored values $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $generalSettings->setStoredValues($arrValues); self::storeSettings("general", $generalSettings);
<?php $generalSettings = new UniteSettingsRev(); $generalSettings->addSelect("role", array(UniteBaseAdminClassRev::ROLE_ADMIN => RevsliderPrestashop::$lang['To_Admin'], UniteBaseAdminClassRev::ROLE_EDITOR => RevsliderPrestashop::$lang['Editor_Admin'], UniteBaseAdminClassRev::ROLE_AUTHOR => RevsliderPrestashop::$lang['Author_Editor_Admin']), RevsliderPrestashop::$lang['Plugin_Permission'], UniteBaseAdminClassRev::ROLE_ADMIN, array("description" => RevsliderPrestashop::$lang['edit_plugin'])); $generalSettings->addRadio("includes_globally", array("on" => RevsliderPrestashop::$lang['on'], "off" => RevsliderPrestashop::$lang['off']), RevsliderPrestashop::$lang['RevSlider_libraries'], "on", array("description" => RevsliderPrestashop::$lang['shortcode_exists'])); $generalSettings->addTextBox("pages_for_includes", "", RevsliderPrestashop::$lang['Pages_RevSlider'], array("description" => RevsliderPrestashop::$lang['Specify_homepage'])); $generalSettings->addRadio("js_to_footer", array("on" => RevsliderPrestashop::$lang['on'], "off" => RevsliderPrestashop::$lang['off']), RevsliderPrestashop::$lang['JS_Includes'], "off", array("description" => RevsliderPrestashop::$lang['fixing_javascript'])); $generalSettings->addRadio("show_dev_export", array("on" => RevsliderPrestashop::$lang['on'], "off" => RevsliderPrestashop::$lang['off']), RevsliderPrestashop::$lang['Export_option'], "off", array("description" => RevsliderPrestashop::$lang['export_Slider'])); $generalSettings->addRadio("enable_logs", array("on" => RevsliderPrestashop::$lang['on'], "off" => RevsliderPrestashop::$lang['off']), RevsliderPrestashop::$lang['Enable_Logs'], "off", array("description" => RevsliderPrestashop::$lang['Enable_console'])); $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $generalSettings->setStoredValues($arrValues); self::storeSettings("general", $generalSettings);
<?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);
<?php $generalSettings = new UniteSettingsRev(); $generalSettings->addRadio("show_dev_export", array("on" => ControllerModulerevslideropencart::$lang_var['On'], "off" => ControllerModulerevslideropencart::$lang_var['Off']), ControllerModulerevslideropencart::$lang_var['Export_option'], "off", array("description" => ControllerModulerevslideropencart::$lang_var['export_Slider'])); $generalSettings->addRadio("enable_logs", array("on" => ControllerModulerevslideropencart::$lang_var['On'], "off" => ControllerModulerevslideropencart::$lang_var['Off']), ControllerModulerevslideropencart::$lang_var['Enable_Logs'], "off", array("description" => ControllerModulerevslideropencart::$lang_var['Enable_console'])); $operations = new RevOperations(); $arrValues = $operations->getGeneralSettingsValues(); $generalSettings->setStoredValues($arrValues); self::storeSettings("general", $generalSettings);