/** * * 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 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 }
/** * 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; }
/** * * 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 }
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 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 slider id */ public function getSliderID() { $sliderID = JRequest::getCmd("id"); if (empty($sliderID)) { UniteFunctionsRev::throwError("Slider ID url argument not found (id)"); } return $sliderID; }
/** * * 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; }
/** * * delete rows */ public function delete($table, $where) { global $wpdb; UniteFunctionsRev::validateNotEmpty($table, "table name"); UniteFunctionsRev::validateNotEmpty($where, "where"); $query = "delete from {$table} where {$where}"; $wpdb->query($query); $this->checkForErrors("Delete query error"); }
public function update($table, $arrItems, $where) { $response = $this->wpdb->update($table, $arrItems, $where); if ($response === false) { UniteFunctionsRev::throwError("no update action taken!"); } $this->checkForErrors("Update query error"); return $response; }
/** * 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); }
/** * * check that captions file exists and if not - copy it to it's place. */ private function checkCopyCaptionsCssFile() { if (file_exists(GlobalsUniteRev::$pathCaptionsCss) == false) { copy(GlobalsUniteRev::$pathCaptionsCssOriginal, GlobalsUniteRev::$pathCaptionsCss); } if (file_exists(GlobalsUniteRev::$pathCaptionsCss) == false) { UniteFunctionsRev::throwError("The captions file couldn't be copied to it's place: {GlobalsUniteRev::{$pathCaptionsCss}}, please copy it by hand from captions-original.css from the same folder, or turn to support."); } }
/** * * get field from db */ public function getFieldFromDB($name) { $arr = $this->db->fetch(GlobalsRevSlider::$table_settings); if (empty($arr)) { return ""; } $arr = $arr[0]; if (array_key_exists($name, $arr) == false) { UniteFunctionsRev::throwError("The settings db should cotnain field: {$name}"); } $value = $arr[$name]; return $value; }
/** * * check if some db table exists */ public static function isDBTableExists($tableName) { global $wpdb; if (empty($tableName)) { UniteFunctionsRev::throwError("Empty table name!!!"); } $sql = "show tables like '{$tableName}'"; $table = $wpdb->get_var($sql); if ($table == $tableName) { return true; } return false; }
/** * * 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); }
/** * 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; }
/** * * 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); }
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'); } }
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')); }
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'); // } }
/** * * display master template (master.php from tpl folder) */ private function displayMasterTemplate() { //each view has self controls UniteControlsRev::emptyControls(); if (isset($this->form)) { UniteControlsRev::loadControlsFromForm($this->form); } $filepath = dirname(__FILE__) . "/tpl/master.php"; if (!is_file($filepath)) { UniteFunctionsRev::throwError("master template not found: {$filepath}"); } $arrControls = UniteControlsRev::getArrayForJsOutput(); $jsonControls = json_encode($arrControls); //prepare content ob_start(); require $filepath; $output = ob_get_contents(); ob_end_clean(); //output content echo $output; }
/** * * 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"); }
/** * * check export / import actions */ private function checkExportImport() { //set message on start $message = UniteFunctionsRev::getGetVar("m"); if ($message == "is") { //import success message $this->messageOnStart = "Import slider parameters and slides success!!!"; } $clientAction = UniteFunctionsRev::getPostGetVariable("client_action"); $helper = new HelperUniteOperationsRev(); switch ($clientAction) { case "export_slider": $helper->exportSlider($this->sliderID); break; case "import_slider": $helper->importSlider($this->sliderID); //redirect $urlSlider = HelperUniteRev::getViewUrl_Slider($this->sliderID); $urlSlider .= "&m=is"; UniteFunctionsRev::redirectToUrl($urlSlider); break; } }
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')); } } }
/** * * draw settings function */ public function draw($formID = null) { if (empty($formID)) { UniteFunctionsRev::throwError("You must provide formID to side settings."); } $this->formID = $formID; if (!empty($formID)) { ?> <form name="<?php echo $formID; ?> " id="<?php echo $formID; ?> "> <?php $this->drawSettings(); ?> </form> <?php } else { $this->drawSettings(); } if ($this->isAccordion == true) { $this->putAccordionInit(); } }