Ejemplo n.º 1
0
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'));
}
Ejemplo n.º 2
0
 private function rev_uploader()
 {
     $key = Tools::getValue('security_key');
     if (empty($key) || Tools::encrypt(GlobalsRevSlider::MODULE_NAME) != $key) {
         echo json_encode(array('error_on' => 1, 'error_details' => 'Security Error'));
         die;
     }
     $targetFolder = ABSPATH . '/uploads/';
     $randnum = rand(00, 9999999);
     $sds_time = time();
     $NewFileName = $randnum . '-' . $sds_time;
     //$verifyToken = md5('unique_salt' . $_POST['timestamp']);
     if (!empty($_FILES)) {
         $tempFile = $_FILES['Filedata']['tmp_name'];
         //$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
         $targetPath = $targetFolder;
         //$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
         // Validate the file type
         $fileTypes = array('jpg', 'jpeg', 'gif', 'png');
         // File extensions
         $fileParts = pathinfo($_FILES['Filedata']['name']);
         if (in_array($fileParts['extension'], $fileTypes)) {
             // $worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $randnum.$_FILES['Filedata']['name']);
             $worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $NewFileName . '.' . $fileParts['extension']);
             if (!empty($worked)) {
                 echo '1';
             }
         } else {
             echo '0';
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * 
  * 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');
     }
 }
Ejemplo n.º 4
0
    /**
     * 
     * draw imaeg input:
     * @param $setting
     */
    protected function drawImageInput($setting)
    {
        $class = UniteFunctionsRev::getVal($setting, "class");
        if (!empty($class)) {
            $class = "class='{$class}'";
        }
        $settingsID = $setting["id"];
        $buttonID = $settingsID . "_button";
        $buttonRemoveID = $settingsID . "_button_remove";
        $spanPreviewID = $buttonID . "_preview";
        $img = "";
        $value = UniteFunctionsRev::getVal($setting, "value");
        if (!empty($value)) {
            $urlImage = $value;
            $imagePath = UniteFunctionsWPRev::getImageRealPathFromUrl($urlImage);
            $img = '<div style="width:100px;height:70px;background:url(' . $urlImage . '); background-position:center center; background-size:cover;"></div>';
        }
        ?>

				<span id='<?php 
        echo $spanPreviewID;
        ?>
' class='setting-image-preview'><?php 
        echo $img;
        ?>
</span>
				
				<input type="hidden" id="<?php 
        echo $setting["id"];
        ?>
" name="<?php 
        echo $setting["name"];
        ?>
" value="<?php 
        echo $setting["value"];
        ?>
" />
				
				<input type="button" id="<?php 
        echo $buttonID;
        ?>
" style="width: 110px !important; float: left;" class='button-image-select button-primary revblue<?php 
        echo $class;
        ?>
' value="<?php 
        _e('Choose Image', REVSLIDER_TEXTDOMAIN);
        ?>
"></input>
				<input type="button" class="button-image-remove button-primary revred" style="width: 110px !important;" id="<?php 
        echo $buttonRemoveID;
        ?>
" value="<?php 
        _e('Remove', REVSLIDER_TEXTDOMAIN);
        ?>
" />
				<div class="clear"></div>
			<?php 
    }
 /**
  * 
  * init the static variables
  */
 public static function initStaticVars()
 {
     //UniteFunctionsRev::printDefinedConstants();
     self::$urlSite = site_url();
     if (substr(self::$urlSite, -1) != "/") {
         self::$urlSite .= "/";
     }
     self::$urlAdmin = admin_url();
     if (substr(self::$urlAdmin, -1) != "/") {
         self::$urlAdmin .= "/";
     }
 }
    /**
     * 
     * draw imaeg input:
     * @param $setting
     */
    protected function drawImageInput($setting)
    {
        $class = UniteFunctionsRev::getVal($setting, "class");
        if (!empty($class)) {
            $class = "class='{$class}'";
        }
        $settingsID = $setting["id"];
        $buttonID = $settingsID . "_button";
        $spanPreviewID = $buttonID . "_preview";
        $img = "";
        $value = UniteFunctionsRev::getVal($setting, "value");
        if (!empty($value)) {
            $urlImage = $value;
            $imagePath = UniteFunctionsWPRev::getImageRealPathFromUrl($urlImage);
            if (file_exists($realPath)) {
                $filepath = UniteFunctionsWPRev::getImagePathFromURL($urlImage);
                $urlImage = UniteBaseClassRev::getImageUrl($filepath, 100, 70, true);
            }
            $img = "<img width='100' height='70' src='{$urlImage}'></img>";
        }
        ?>

				<span id='<?php 
        echo $spanPreviewID;
        ?>
' class='setting-image-preview'><?php 
        echo $img;
        ?>
</span>
				
				<input type="hidden" id="<?php 
        echo $setting["id"];
        ?>
" name="<?php 
        echo $setting["name"];
        ?>
" value="<?php 
        echo $setting["value"];
        ?>
" />
				
				<input type="button" id="<?php 
        echo $buttonID;
        ?>
" class='button-image-select <?php 
        echo $class;
        ?>
' value="Choose Image"></input>
			<?php 
    }
 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');
     }
 }
Ejemplo n.º 8
0
 /**
  * 
  * 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');
     }
 }
Ejemplo n.º 9
0
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'));
}
Ejemplo n.º 10
0
 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');
     // }
 }
Ejemplo n.º 11
0
 /**
  * 
  * 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");
 }
Ejemplo n.º 12
0
 /**
  * 
  * 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");
     $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";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     if ($includesFooter == "off") {
         $use_hammer = UniteFunctionsRev::getVal($arrValues, "use_hammer_js", 'on');
         $waitfor = array('jquery');
         if ($use_hammer == 'off') {
             self::addScriptWaitFor("jquery.themepunch.disablehammer", "rs-plugin/js", 'disable-hammer');
             $waitfor[] = 'disable-hammer';
         }
         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');
     }
 }
Ejemplo n.º 13
0
 /**
  * 
  * craete tables
  */
 public static function createTable($tableName)
 {
     //if table exists - don't create it.
     $tableRealName = self::$table_prefix . $tableName;
     if (UniteFunctionsWPRev::isDBTableExists($tableRealName)) {
         return false;
     }
     switch ($tableName) {
         case GlobalsRevSlider::TABLE_SLIDERS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t  title tinytext NOT NULL,\r\n\t\t\t\t\t\t\t  alias tinytext,\r\n\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t);";
             break;
         case GlobalsRevSlider::TABLE_SLIDES_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\r\n\t\t\t\t\t\t\t\t  slide_order int not NULL,\t\t  \r\n\t\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t\t  layers text NOT NULL,\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t\t);";
             break;
         default:
             UniteFunctionsRev::throwError("table: {$tableName} not found");
             break;
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
 }
Ejemplo n.º 14
0
 /**
  * 
  * craete tables
  */
 public static function createTable($tableName)
 {
     global $wpdb;
     $parseCssToDb = false;
     $checkForTablesOneTime = get_option('revslider_checktables', '0');
     if ($checkForTablesOneTime == '0') {
         update_option('revslider_checktables', '1');
         if (UniteFunctionsWPRev::isDBTableExists(self::$table_prefix . GlobalsRevSlider::TABLE_CSS_NAME)) {
             //check if database is empty
             $result = $wpdb->get_row("SELECT COUNT( DISTINCT id ) AS NumberOfEntrys FROM " . self::$table_prefix . GlobalsRevSlider::TABLE_CSS_NAME);
             if ($result->NumberOfEntrys == 0) {
                 $parseCssToDb = true;
             }
         }
     }
     if ($parseCssToDb) {
         $revOperations = new RevOperations();
         $revOperations->importCaptionsCssContentArray();
         $revOperations->moveOldCaptionsCss();
         //$revOperations->updateDynamicCaptions(true);
     }
     //if table exists - don't create it.
     $tableRealName = self::$table_prefix . $tableName;
     if (UniteFunctionsWPRev::isDBTableExists($tableRealName)) {
         return false;
     }
     $charset_collate = '';
     if (method_exists($wpdb, "get_charset_collate")) {
         $charset_collate = $wpdb->get_charset_collate();
     } else {
         if (!empty($wpdb->charset)) {
             $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $charset_collate .= " COLLATE {$wpdb->collate}";
         }
     }
     switch ($tableName) {
         case GlobalsRevSlider::TABLE_SLIDERS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t  title tinytext NOT NULL,\n\t\t\t\t\t\t\t  alias tinytext,\n\t\t\t\t\t\t\t  params text NOT NULL,\n\t\t\t\t\t\t\t  PRIMARY KEY (id)\n\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsRevSlider::TABLE_SLIDES_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\n\t\t\t\t\t\t\t\t  slide_order int not NULL,\t\n\t\t\t\t\t\t\t\t  params text NOT NULL,\n\t\t\t\t\t\t\t\t  layers text NOT NULL,\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsRevSlider::TABLE_STATIC_SLIDES_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\n\t\t\t\t\t\t\t\t  params text NOT NULL,\n\t\t\t\t\t\t\t\t  layers text NOT NULL,\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsRevSlider::TABLE_SETTINGS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t  general TEXT NOT NULL,\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsRevSlider::TABLE_CSS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t  handle TEXT NOT NULL,\n\t\t\t\t\t\t\t\t  settings TEXT,\n\t\t\t\t\t\t\t\t  hover TEXT,\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
             $parseCssToDb = true;
             break;
         case GlobalsRevSlider::TABLE_LAYER_ANIMS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t  handle TEXT NOT NULL,\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
             break;
         default:
             UniteFunctionsRev::throwError("table: {$tableName} not found");
             break;
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
     if ($parseCssToDb) {
         $revOperations = new RevOperations();
         $revOperations->importCaptionsCssContentArray();
         $revOperations->moveOldCaptionsCss();
         //$revOperations->updateDynamicCaptions(true);
     }
 }
Ejemplo n.º 15
0
    public function putSliderBase($sliderID)
    {
        try {
            self::$sliderSerial++;
            $this->slider = new RevSlider();
            $this->slider->initByMixed($sliderID);
            //modify settings for admin preview mode
            if ($this->previewMode == true) {
                $this->modifyPreviewModeSettings();
            }
            //set slider language
            $isWpmlExists = UniteWpmlRev::isWpmlExists();
            $useWpml = $this->slider->getParam("use_wpml", "off");
            if ($isWpmlExists && $useWpml == "on") {
                if ($this->previewMode == false) {
                    $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
                }
            }
            //edit html before slider
            $htmlBeforeSlider = "";
            if ($this->slider->getParam("load_googlefont", "false") == "true") {
                $googleFont = $this->slider->getParam("google_font");
                $htmlBeforeSlider = "<link rel='stylesheet' id='rev-google-font' href='http://fonts.googleapis.com/css?family={$googleFont}' type='text/css' media='all' />";
            }
            //pub js to body handle
            if ($this->slider->getParam("js_to_body", "false") == "true") {
                $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js";
                $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
            }
            //the initial id can be alias
            $sliderID = $this->slider->getID();
            $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
            $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
            $sliderType = $this->slider->getParam("slider_type");
            //set wrapper height
            $wrapperHeigh = 0;
            $wrapperHeigh += $this->slider->getParam("height");
            //add thumb height
            if ($this->slider->getParam("navigaion_type") == "thumb") {
                $wrapperHeigh += $this->slider->getParam("thumb_height");
            }
            $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
            $this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
            $containerStyle = "";
            $sliderPosition = $this->slider->getParam("position", "center");
            //set position:
            if ($sliderType != "fullscreen") {
                switch ($sliderPosition) {
                    case "center":
                    default:
                        $containerStyle .= "margin:0px auto;";
                        break;
                    case "left":
                        $containerStyle .= "float:left;";
                        break;
                    case "right":
                        $containerStyle .= "float:right;";
                        break;
                }
            }
            //add background color
            $backgrondColor = trim($this->slider->getParam("background_color"));
            if (!empty($backgrondColor)) {
                $containerStyle .= "background-color:{$backgrondColor};";
            }
            //set padding
            $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
            //set margin:
            if ($sliderType != "fullscreen") {
                if ($sliderPosition != "center") {
                    $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                    $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
                }
                $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
                $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
            }
            //set height and width:
            $bannerStyle = "display:none;";
            //add background image (to banner style)
            $showBackgroundImage = $this->slider->getParam("show_background_image", "false");
            if ($showBackgroundImage == "true") {
                $backgroundImage = $this->slider->getParam("background_image");
                if (!empty($backgroundImage)) {
                    $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:no-repeat;";
                }
            }
            //set wrapper and slider class:
            $sliderWrapperClass = "rev_slider_wrapper";
            $sliderClass = "rev_slider";
            $putResponsiveStyles = false;
            switch ($sliderType) {
                default:
                case "fixed":
                    $bannerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;";
                    $containerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;";
                    break;
                case "responsitive":
                    $putResponsiveStyles = true;
                    break;
                case "fullwidth":
                    $sliderWrapperClass .= " fullwidthbanner-container";
                    $sliderClass .= " fullwidthabanner";
                    $bannerStyle .= "max-height:{$bannerHeight}px;height:{$bannerHeight};";
                    $containerStyle .= "max-height:{$bannerHeight}px;";
                    break;
                case "fullscreen":
                    $sliderWrapperClass .= " fullscreen-container";
                    $sliderClass .= " fullscreenbanner";
                    break;
            }
            $htmlTimerBar = "";
            $timerBar = $this->slider->getParam("show_timerbar", "top");
            if ($timerBar == "true") {
                $timerBar = $this->slider->getParam("timebar_position", "top");
            }
            switch ($timerBar) {
                case "top":
                    $htmlTimerBar = '<div class="tp-bannertimer"></div>';
                    break;
                case "bottom":
                    $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
                    break;
            }
            //check inner / outer border
            $paddingType = $this->slider->getParam("padding_type", "outter");
            if ($paddingType == "inner") {
                $sliderWrapperClass .= " tp_inner_padding";
            }
            global $revSliderVersion;
            ?>
				
				<!-- START REVOLUTION SLIDER <?php 
            echo $revSliderVersion;
            ?>
 <?php 
            echo $sliderType;
            ?>
 mode -->
				
				<?php 
            if ($putResponsiveStyles == true) {
                $this->putResponsitiveStyles();
            }
            ?>
				
				<?php 
            echo $htmlBeforeSlider;
            ?>
				<div id="<?php 
            echo $this->sliderHtmlID_wrapper;
            ?>
" class="<?php 
            echo $sliderWrapperClass;
            ?>
" style="<?php 
            echo $containerStyle;
            ?>
">
					<div id="<?php 
            echo $this->sliderHtmlID;
            ?>
" class="<?php 
            echo $sliderClass;
            ?>
" style="<?php 
            echo $bannerStyle;
            ?>
">						
						<?php 
            $this->putSlides();
            ?>
						<?php 
            echo $htmlTimerBar;
            ?>
					</div>
				</div>				
				<?php 
            $this->putJS();
            ?>
				<!-- END REVOLUTION SLIDER -->
				<?php 
        } catch (Exception $e) {
            $message = $e->getMessage();
            $this->putErrorMessage($message);
        }
    }
Ejemplo n.º 16
0
 /**
  * 
  * put html slider on the html page.
  * @param $data - mixed, can be ID ot Alias.
  */
 public function putSliderBase($sliderID)
 {
     try {
         self::$sliderSerial++;
         $this->slider = new RevSlider();
         $this->slider->initByMixed($sliderID);
         // Do not output Slider if we are on mobile
         $disable_on_mobile = $this->slider->getParam("disable_on_mobile", "off");
         $isMobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') ? true : false;
         if ($disable_on_mobile == 'on' && $isMobile) {
             return false;
         }
         $show_alternate = $this->slider->getParam("show_alternative_type", "off");
         if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
             if ($isMobile) {
                 $show_alternate_image = $this->slider->getParam("show_alternate_image", "");
                 echo '<img class="tp-slider-alternative-image" src="' . $show_alternate_image . '">';
                 return false;
             }
         }
         $doWrapFromTemplate = false;
         if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) {
             //need to use general settings from the Template Slider
             $this->slider->initByMixed($this->slider->getParam("slider_template_id", false));
             $doWrapFromTemplate = $sliderID;
         }
         //modify settings for admin preview mode
         if ($this->previewMode == true) {
             $this->modifyPreviewModeSettings();
         }
         //set slider language
         $isWpmlExists = UniteWpmlRev::isWpmlExists();
         $useWpml = $this->slider->getParam("use_wpml", "off");
         if ($isWpmlExists && $useWpml == "on") {
             if ($this->previewMode == false) {
                 $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
             }
         }
         //edit html before slider
         $htmlBeforeSlider = "";
         if ($this->slider->getParam("load_googlefont", "false") == "true") {
             $googleFont = $this->slider->getParam("google_font");
             if (is_array($googleFont)) {
                 foreach ($googleFont as $key => $font) {
                     $htmlBeforeSlider .= RevOperations::getCleanFontImport($font);
                 }
             } else {
                 $htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont);
             }
         }
         //pub js to body handle
         if ($this->jsToBody == true) {
             //$operations = new RevOperations();
             //$arrValues = $operations->getGeneralSettingsValues();
             $urlIncludeJSTools = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.tools.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJSTools}'></script>\n";
             //$enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs",'off');
             $enable_logs = "off";
             if ($enable_logs == 'on') {
                 $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.enablelog.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
                 $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
             }
             $useHammer = 'on';
             if ($useHammer == 'off') {
                 $urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.disablehammer.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
                 $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n";
             }
             $urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n";
         }
         //the initial id can be alias
         $sliderID = $this->slider->getID();
         $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
         $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
         $sliderType = $this->slider->getParam("slider_type");
         //set wrapper height
         $wrapperHeigh = 0;
         $wrapperHeigh += $this->slider->getParam("height");
         //add thumb height
         if ($this->slider->getParam("navigaion_type") == "thumb") {
             $wrapperHeigh += $this->slider->getParam("thumb_height");
         }
         $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
         $this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
         $containerStyle = "";
         $sliderPosition = $this->slider->getParam("position", "center");
         //set position:
         if ($sliderType != "fullscreen") {
             switch ($sliderPosition) {
                 case "center":
                 default:
                     $containerStyle .= "margin:0px auto;";
                     break;
                 case "left":
                     $containerStyle .= "float:left;";
                     break;
                 case "right":
                     $containerStyle .= "float:right;";
                     break;
             }
         }
         //add background color
         $backgrondColor = trim($this->slider->getParam("background_color"));
         if (!empty($backgrondColor)) {
             $containerStyle .= "background-color:{$backgrondColor};";
         }
         //set padding
         $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
         //set margin:
         if ($sliderType != "fullscreen") {
             if ($sliderPosition != "center") {
                 $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                 $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
             }
             $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
             $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
         }
         //set height and width:
         $bannerStyle = "display:none;";
         //add background image (to banner style)
         $showBackgroundImage = $this->slider->getParam("show_background_image", "false");
         if ($showBackgroundImage == "true") {
             $backgroundImage = $this->slider->getParam("background_image");
             $backgroundFit = $this->slider->getParam("bg_fit", "cover");
             $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat");
             $backgroundPosition = $this->slider->getParam("bg_position", "center top");
             if (!empty($backgroundImage)) {
                 $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
             }
         }
         //set wrapper and slider class:
         $sliderWrapperClass = "rev_slider_wrapper";
         $sliderClass = "rev_slider";
         $putResponsiveStyles = false;
         switch ($sliderType) {
             default:
             case "fixed":
                 $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 break;
             case "responsitive":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $putResponsiveStyles = true;
                 break;
             case "fullwidth":
                 $sliderWrapperClass .= " fullwidthbanner-container";
                 $sliderClass .= " fullwidthabanner";
                 $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . "px;";
                 $containerStyle .= "max-height:" . $bannerHeight . "px;";
                 break;
             case "fullscreen":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $sliderWrapperClass .= " fullscreen-container";
                 $sliderClass .= " fullscreenbanner";
                 break;
         }
         //handle position behind
         $posBehind = $this->slider->getParam("position_behind", "false");
         $posBehind = UniteFunctionsRev::strToBool($posBehind);
         if ($posBehind == true) {
             $containerStyle .= "position:relative;z-index:0;";
         }
         $htmlTimerBar = "";
         $timerBar = $this->slider->getParam("show_timerbar", "top");
         if ($timerBar == "true") {
             $timerBar = $this->slider->getParam("timebar_position", "top");
         }
         switch ($timerBar) {
             case "top":
                 $htmlTimerBar = '<div class="tp-bannertimer"></div>';
                 break;
             case "bottom":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
                 break;
             case "hide":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="display:none; visibility: hidden !important;"></div>';
                 break;
         }
         //check inner / outer border
         $paddingType = $this->slider->getParam("padding_type", "outter");
         if ($paddingType == "inner") {
             $sliderWrapperClass .= " tp_inner_padding";
         }
         global $revSliderVersion;
         echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n";
         if ($putResponsiveStyles == true) {
             $this->putResponsitiveStyles();
         }
         echo $htmlBeforeSlider . "\n";
         echo "<div id=\"";
         echo $this->sliderHtmlID_wrapper;
         echo "\" ";
         echo "class=\"" . $sliderWrapperClass . "\"";
         $show_alternate = $this->slider->getParam("show_alternative_type", "off");
         if ($show_alternate !== 'off') {
             $show_alternate_image = $this->slider->getParam("show_alternate_image", "");
             echo ' data-aimg="' . $show_alternate_image . '" ';
             if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
                 echo ' data-amobile="enabled" ';
             } else {
                 echo ' data-amobile="disabled" ';
             }
             if ($show_alternate == 'mobile-ie8' || $show_alternate == 'ie8') {
                 echo ' data-aie8="enabled" ';
             } else {
                 echo ' data-aie8="disabled" ';
             }
         }
         echo " style=\"" . $containerStyle . "\">\n";
         echo "\t<div id=\"";
         echo $this->sliderHtmlID;
         echo "\" ";
         echo "class=\"" . $sliderClass . "\"";
         echo " style=\"" . $bannerStyle . "\">\n";
         echo $this->putSlides($doWrapFromTemplate);
         echo $htmlTimerBar;
         echo "\t</div>\n";
         $this->putJS();
         echo "</div>\n";
         echo "<!-- END REVOLUTION SLIDER -->";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->putErrorMessage($message);
     }
 }
 /**
  *
  * get post types with categories for client side.
  */
 public static function getPostTypesWithCatsForClient()
 {
     $arrPostTypes = UniteFunctionsWPRev::getPostTypesWithCats();
     $globalCounter = 0;
     $arrOutput = array();
     foreach ($arrPostTypes as $postType => $arrTaxWithCats) {
         $arrCats = array();
         foreach ($arrTaxWithCats as $tax) {
             $taxName = $tax["name"];
             $taxTitle = $tax["title"];
             $globalCounter++;
             $arrCats["option_disabled_" . $globalCounter] = "---- " . $taxTitle . " ----";
             foreach ($tax["cats"] as $catID => $catTitle) {
                 $arrCats[$taxName . "_" . $catID] = $catTitle;
             }
         }
         //loop tax
         $arrOutput[$postType] = $arrCats;
     }
     //loop types
     return $arrOutput;
 }
Ejemplo n.º 18
0
require_once $folderIncludes . 'base_front.class.php';
//include product files
require_once $currentFolder . '/inc_php/revslider_settings_product.class.php';
require_once $currentFolder . '/inc_php/revslider_globals.class.php';
require_once $currentFolder . '/inc_php/revslider_operations.class.php';
require_once $currentFolder . '/inc_php/revslider_slider.class.php';
require_once $currentFolder . '/inc_php/revslider_output.class.php';
require_once $currentFolder . '/inc_php/revslider_slide.class.php';
require_once $currentFolder . '/inc_php/revslider_widget.class.php';
require_once $currentFolder . '/inc_php/revslider_params.class.php';
require_once $currentFolder . '/inc_php/revslider_tinybox.class.php';
require_once $currentFolder . '/inc_php/fonts.class.php';
//punchfonts
try {
    //register the revolution slider widget
    UniteFunctionsWPRev::registerWidget("RevSlider_Widget");
    //add shortcode
    function rev_slider_shortcode($args)
    {
        extract(shortcode_atts(array('alias' => ''), $args, 'rev_slider'));
        $sliderAlias = $alias != '' ? $alias : UniteFunctionsRev::getVal($args, 0);
        ob_start();
        $slider = RevSliderOutput::putSlider($sliderAlias);
        $content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        // Do not output Slider if we are on mobile
        $disable_on_mobile = $slider->getParam("disable_on_mobile", "off");
        if ($disable_on_mobile == 'on') {
            $mobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') ? true : false;
            if ($mobile) {
Ejemplo n.º 19
0
    }
    if ($bgPosition == 'percentage') {
        $bgStyle .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;';
    } else {
        $bgStyle .= "background-position: " . $bgPosition . ";";
    }
    $bgStyle .= "background-repeat: " . $bgRepeat . ";";
    if ($sortBy == UniteFunctionsWPRev::SORTBY_MENU_ORDER) {
        $order = $slide->getOrder();
    } else {
        $order = $index + 1;
    }
    $urlImageForView = $slide->getUrlImageThumb();
    $slideTitle = $slide->getParam("title", "Slide");
    $title = $slideTitle;
    $filename = $slide->getImageFilename();
    $imageAlt = stripslashes($slideTitle);
    if (empty($imageAlt)) {
        $imageAlt = "slide";
    }
    if ($bgType == "image" && !empty($filename)) {
        $title .= " (" . $filename . ")";
    }
    $postID = $slide->getID();
    $urlEditSlide = UniteFunctionsWPRev::getUrlEditPost($postID);
    $linkEdit = UniteFunctionsRev::getHtmlLink($urlEditSlide, $title, "", "", true);
    $state = $slide->getParam("state", "published");
    ?>

					<li id="slidelist_item_<?php 
    echo $postID;
Ejemplo n.º 20
0
 /**
  * 
  * make config file of all the text in the settings for the .mo and .po creation
  */
 protected static function updateSettingsText()
 {
     $filelist = UniteFunctionsRev::getFileList(self::$path_settings, "xml");
     foreach ($filelist as $file) {
         $filepath = self::$path_settings . $file;
         UniteFunctionsWPRev::writeSettingLanguageFile($filepath);
     }
 }
Ejemplo n.º 21
0
 /**
  * 
  * get posts from specific posts list
  */
 private function getPostsFromSpecificList()
 {
     $strPosts = $this->getParam("posts_list", "");
     $arrPosts = UniteFunctionsWPRev::getPostsByIDs($strPosts);
     return $arrPosts;
 }
Ejemplo n.º 22
0
 /**
  * 
  * get current language
  */
 public static function getCurrentLang()
 {
     self::validateWpmlExists();
     $wpml = new SitePress();
     if (is_admin()) {
         $lang = $wpml->get_default_language();
     } else {
         $lang = UniteFunctionsWPRev::getCurrentLangCode();
     }
     return $lang;
 }
Ejemplo n.º 23
0
 /**
  * 
  * Enter description here ...
  */
 protected static function updatePlugin($viewBack = false)
 {
     $linkBack = self::getViewUrl($viewBack);
     $htmlLinkBack = UniteFunctionsRev::getHtmlLink($linkBack, "Go Back");
     //check if css table exist, if not, we need to verify that the current captions.css can be parsed
     if (UniteFunctionsWPRev::isDBTableExists(GlobalsRevSlider::TABLE_CSS_NAME)) {
         $captions = RevOperations::getCaptionsCssContentArray();
         if ($captions === false) {
             $message = "CSS parse error! Please make sure your captions.css is valid CSS before updating the plugin!";
             echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
             echo $htmlLinkBack;
             exit;
         }
     }
     $zip = new UniteZipRev();
     try {
         if (function_exists("unzip_file") == false) {
             if (UniteZipRev::isZipExists() == false) {
                 UniteFunctionsRev::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
             }
         }
         dmp("Update in progress...");
         $arrFiles = UniteFunctionsRev::getVal($_FILES, "update_file");
         if (empty($arrFiles)) {
             UniteFunctionsRev::throwError("Update file don't found.");
         }
         $filename = UniteFunctionsRev::getVal($arrFiles, "name");
         if (empty($filename)) {
             UniteFunctionsRev::throwError("Update filename not found.");
         }
         $fileType = UniteFunctionsRev::getVal($arrFiles, "type");
         /*				
         $fileType = strtolower($fileType);
         
         if($fileType != "application/zip")
         	UniteFunctionsRev::throwError("The file uploaded is not zip.");
         */
         $filepathTemp = UniteFunctionsRev::getVal($arrFiles, "tmp_name");
         if (file_exists($filepathTemp) == false) {
             UniteFunctionsRev::throwError("Can't find the uploaded file.");
         }
         //crate temp folder
         UniteFunctionsRev::checkCreateDir(self::$path_temp);
         //create the update folder
         $pathUpdate = self::$path_temp . "update_extract/";
         UniteFunctionsRev::checkCreateDir($pathUpdate);
         //remove all files in the update folder
         if (is_dir($pathUpdate)) {
             $arrNotDeleted = UniteFunctionsRev::deleteDir($pathUpdate, false);
             if (!empty($arrNotDeleted)) {
                 $strNotDeleted = print_r($arrNotDeleted, true);
                 UniteFunctionsRev::throwError("Could not delete those files from the update folder: {$strNotDeleted}");
             }
         }
         //copy the zip file.
         $filepathZip = $pathUpdate . $filename;
         $success = move_uploaded_file($filepathTemp, $filepathZip);
         if ($success == false) {
             UniteFunctionsRev::throwError("Can't move the uploaded file here: " . $filepathZip . ".");
         }
         if (function_exists("unzip_file") == true) {
             WP_Filesystem();
             $response = unzip_file($filepathZip, $pathUpdate);
         } else {
             $zip->extract($filepathZip, $pathUpdate);
         }
         //get extracted folder
         $arrFolders = UniteFunctionsRev::getFoldersList($pathUpdate);
         if (empty($arrFolders)) {
             UniteFunctionsRev::throwError("The update folder is not extracted");
         }
         if (count($arrFolders) > 1) {
             UniteFunctionsRev::throwError("Extracted folders are more then 1. Please check the update file.");
         }
         //get product folder
         $productFolder = $arrFolders[0];
         if (empty($productFolder)) {
             UniteFunctionsRev::throwError("Wrong product folder.");
         }
         if ($productFolder != self::$dir_plugin) {
             UniteFunctionsRev::throwError("The update folder don't match the product folder, please check the update file.");
         }
         $pathUpdateProduct = $pathUpdate . $productFolder . "/";
         //check some file in folder to validate it's the real one:
         $checkFilepath = $pathUpdateProduct . $productFolder . ".php";
         if (file_exists($checkFilepath) == false) {
             UniteFunctionsRev::throwError("Wrong update extracted folder. The file: " . $checkFilepath . " not found.");
         }
         //copy the plugin without the captions file.
         //$pathOriginalPlugin = $pathUpdate."copy/";
         $pathOriginalPlugin = self::$path_plugin;
         $arrBlackList = array();
         $arrBlackList[] = "rs-plugin/css/captions.css";
         $arrBlackList[] = "rs-plugin/css/dynamic-captions.css";
         $arrBlackList[] = "rs-plugin/css/static-captions.css";
         UniteFunctionsRev::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList);
         //delete the update
         UniteFunctionsRev::deleteDir($pathUpdate);
         dmp("Updated Successfully, redirecting...");
         echo "<script>location.href='{$linkBack}'</script>";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $message .= " <br> Please update the plugin manually via the ftp";
         echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
         echo $htmlLinkBack;
         exit;
     }
 }
Ejemplo n.º 24
0
        $htmlBefore = "";
        $htmlBefore .= "<li class='item_operation operation_delete'><a data-operation='delete' href='javascript:void(0)'>" . "\n";
        $htmlBefore .= "<img src='" . $urlIconDelete . "'/> " . $textDelete . "\n";
        $htmlBefore .= "</a></li>" . "\n";
        $htmlBefore .= "<li class='item_operation operation_edit'><a data-operation='edit' href='javascript:void(0)'>" . "\n";
        $htmlBefore .= "<img src='" . $urlIconEdit . "'/> " . $textEdit . "\n";
        $htmlBefore .= "</a></li>" . "\n";
        $htmlBefore .= "<li class='item_operation operation_preview'><a data-operation='preview' href='javascript:void(0)'>" . "\n";
        $htmlBefore .= "<img src='" . $urlIconPreview . "'/> " . $textPreview . "\n";
        $htmlBefore .= "</a></li>" . "\n";
        $htmlBefore .= "<li class='item_operation operation_sap'>" . "\n";
        $htmlBefore .= "<div class='float_menu_sap'></div>" . "\n";
        $htmlBefore .= "</a></li>" . "\n";
        $langFloatMenu = UniteWpmlRev::getLangsWithFlagsHtmlList("id='slides_langs_float' class='slides_langs_float'", $htmlBefore);
    }
} else {
    //slides from posts
    $templateName = "slides_posts";
    $sourceType = $slider->getParam("source_type", "posts");
    $showSortBy = $sourceType == "posts" ? true : false;
    //get button links
    $urlNewPost = UniteFunctionsWPRev::getUrlNewPost();
    $linkNewPost = UniteFunctionsRev::getHtmlLink($urlNewPost, ControllerModulerevslideropencart::$lang_var['New_Post'], "button_new_post", "button-primary revblue", true);
    //get ordering
    $arrSortBy = UniteFunctionsWPRev::getArrSortBy();
    $sortBy = $slider->getParam("post_sortby", RevSlider::DEFAULT_POST_SORTBY);
    $selectSortBy = UniteFunctionsRev::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true);
}
require self::getPathTemplate($templateName);
?>
	
Ejemplo n.º 25
0
$sliderMainSettings->addSelect("post_category", array(), __("Post Categories", REVSLIDER_TEXTDOMAIN), "", $arrParams);
//sort by
$arrSortBy = UniteFunctionsWPRev::getArrSortBy();
//events integration
if (UniteEmRev::isEventsExists()) {
    $arrEventsFilter = UniteEmRev::getArrFilterTypes();
    $sliderMainSettings->addHr();
    $sliderMainSettings->addSelect("events_filter", $arrEventsFilter, __("Filter Events By", REVSLIDER_TEXTDOMAIN), UniteEmRev::DEFAULT_FILTER);
    $sliderMainSettings->addHr();
    //add values to sortby array
    $arrEMSortBy = UniteEmRev::getArrSortBy();
    $arrSortBy = $arrSortBy + $arrEMSortBy;
}
$sliderMainSettings->addSelect("post_sortby", $arrSortBy, __("Sort Posts By", REVSLIDER_TEXTDOMAIN), RevSlider::DEFAULT_POST_SORTBY);
//sort direction
$arrSortDir = UniteFunctionsWPRev::getArrSortDirection();
$sliderMainSettings->addRadio("posts_sort_direction", $arrSortDir, __("Sort Direction", REVSLIDER_TEXTDOMAIN), RevSlider::DEFAULT_POST_SORTDIR);
//max posts for slider
$arrParams = array("class" => "small", "unit" => "posts");
$sliderMainSettings->addTextBox("max_slider_posts", "30", __("Max Posts Per Slider", REVSLIDER_TEXTDOMAIN), $arrParams);
//exerpt limit
$arrParams = array("class" => "small", "unit" => "words");
$sliderMainSettings->addTextBox("excerpt_limit", "55", __("Limit The Excerpt To", REVSLIDER_TEXTDOMAIN), $arrParams);
//slider template
$sliderMainSettings->addhr();
$slider1 = new RevSlider();
$arrSlidersTemplates = $slider1->getArrSlidersShort(null, RevSlider::SLIDER_TYPE_TEMPLATE);
$sliderMainSettings->addSelect("slider_template_id", $arrSlidersTemplates, __("Template Slider", REVSLIDER_TEXTDOMAIN), "", array());
$sliderMainSettings->endBulkControl();
$arrParams = array("description" => __("Type here the post IDs you want to use separated by coma. ex: 23,24,25", REVSLIDER_TEXTDOMAIN));
$sliderMainSettings->addTextBox("posts_list", "", __("Specific Posts List", REVSLIDER_TEXTDOMAIN), $arrParams);
Ejemplo n.º 26
0
function cmo_import_sliders_ajax()
{
    global $wpdb;
    if (!class_exists('UniteFunctionsRev')) {
        ajax_finish(false, __('Revolution Slider plugin is not installed or activated.', 'cumulo'));
    } else {
        $rev_directory = CMO_FRAMEWORK_PATH . '/demo/sliders/';
        if (!empty($_POST['demo'])) {
            if ($_POST['demo'] != 'default') {
                $rev_directory .= $_POST['demo'] . '/';
            }
        }
        foreach (glob($rev_directory . '*.zip') as $filename) {
            $filename = basename($filename);
            $rev_files[] = $rev_directory . $filename;
        }
        foreach ($rev_files as $rev_file) {
            $filepath = $rev_file;
            $zip = new ZipArchive();
            $importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
            if ($importZip === true) {
                $slider_export = $zip->getStream('slider_export.txt');
                $custom_animations = $zip->getStream('custom_animations.txt');
                $dynamic_captions = $zip->getStream('dynamic-captions.css');
                $static_captions = $zip->getStream('static-captions.css');
                $content = '';
                $animations = '';
                $dynamic = '';
                $static = '';
                while (!feof($slider_export)) {
                    $content .= fread($slider_export, 1024);
                }
                if ($custom_animations) {
                    while (!feof($custom_animations)) {
                        $animations .= fread($custom_animations, 1024);
                    }
                }
                if ($dynamic_captions) {
                    while (!feof($dynamic_captions)) {
                        $dynamic .= fread($dynamic_captions, 1024);
                    }
                }
                if ($static_captions) {
                    while (!feof($static_captions)) {
                        $static .= fread($static_captions, 1024);
                    }
                }
                fclose($slider_export);
                if ($custom_animations) {
                    fclose($custom_animations);
                }
                if ($dynamic_captions) {
                    fclose($dynamic_captions);
                }
                if ($static_captions) {
                    fclose($static_captions);
                }
                //check for images!
            } else {
                $content = @file_get_contents($filepath);
            }
            if ($importZip === true) {
                //we have a zip
                $db = new UniteDBRev();
                //update/insert custom animations
                $animations = @unserialize($animations);
                if (!empty($animations)) {
                    foreach ($animations as $key => $animation) {
                        $exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
                        if (!empty($exist)) {
                            if ($updateAnim == "true") {
                                $arrUpdate = array();
                                $arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                                $db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
                                $id = $exist['0']['id'];
                            } else {
                                $arrInsert = array();
                                $arrInsert["handle"] = 'copy_' . $animation['handle'];
                                $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                                $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                            }
                        } else {
                            $arrInsert = array();
                            $arrInsert["handle"] = $animation['handle'];
                            $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                            $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                        }
                        $content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content);
                    }
                } else {
                }
                //overwrite/append static-captions.css
                if (!empty($static)) {
                    if (isset($updateStatic) && $updateStatic == "true") {
                        RevOperations::updateStaticCss($static);
                    } else {
                        //append
                        $static_cur = RevOperations::getStaticCss();
                        $static = $static_cur . "\n" . $static;
                        RevOperations::updateStaticCss($static);
                    }
                }
                $dynamicCss = UniteCssParserRev::parseCssToArray($dynamic);
                if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
                    foreach ($dynamicCss as $class => $styles) {
                        $class = trim($class);
                        if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
                            //.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
                            continue;
                        }
                        //is a dynamic style
                        if (strpos($class, ':hover') !== false) {
                            $class = trim(str_replace(':hover', '', $class));
                            $arrInsert = array();
                            $arrInsert["hover"] = json_encode($styles);
                            $arrInsert["settings"] = json_encode(array('hover' => 'true'));
                        } else {
                            $arrInsert = array();
                            $arrInsert["params"] = json_encode($styles);
                        }
                        //check if class exists
                        $result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
                        if (!empty($result)) {
                            //update
                            $db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
                        } else {
                            //insert
                            $arrInsert["handle"] = $class;
                            $db->insert(GlobalsRevSlider::$table_css, $arrInsert);
                        }
                    }
                } else {
                }
            }
            $content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
            //clear errors in string
            $arrSlider = @unserialize($content);
            $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");
            $sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
            $sliderID = $wpdb->insert_id;
            $arrSlides = $arrSlider["slides"];
            $alreadyImported = array();
            foreach ($arrSlides as $slide) {
                $params = $slide["params"];
                $layers = $slide["layers"];
                if (isset($params["image"])) {
                    if (trim($params["image"]) !== '') {
                        if ($importZip === true) {
                            $image = $zip->getStream('images/' . $params["image"]);
                            if (!$image) {
                                echo esc_html($params["image"]) . ' not found!<br>';
                            } else {
                                if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
                                    $importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
                                    if ($importImage !== false) {
                                        $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
                                        $params["image"] = $importImage['path'];
                                    }
                                } else {
                                    $params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
                                }
                            }
                        }
                    }
                    $params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
                }
                //convert layers images:
                foreach ($layers as $key => $layer) {
                    if (isset($layer["image_url"])) {
                        //import if exists in zip folder
                        if (trim($layer["image_url"]) !== '') {
                            if ($importZip === true) {
                                //we have a zip, check if exists
                                $image_url = $zip->getStream('images/' . $layer["image_url"]);
                                if (!$image_url) {
                                    echo esc_html($layer["image_url"]) . ' not found!<br>';
                                } else {
                                    if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
                                        $importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
                                        if ($importImage !== false) {
                                            $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
                                            $layer["image_url"] = $importImage['path'];
                                        }
                                    } else {
                                        $layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]];
                                    }
                                }
                            }
                        }
                        $layer["image_url"] = 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);
            }
        }
        ajax_finish(true, "done");
    }
}
 /**
  * 
  * get thumb url
  */
 public function getUrlImageThumb()
 {
     //get image url by thumb
     if (!empty($this->imageID)) {
         $urlImage = UniteFunctionsWPRev::getUrlAttachmentImage($this->imageID, UniteFunctionsWPRev::THUMB_MEDIUM);
     } else {
         //get from cache
         if (!empty($this->imageFilepath)) {
             $urlImage = UniteBaseClassRev::getImageUrl($this->imageFilepath, 200, 100, true);
         } else {
             $urlImage = $this->imageUrl;
         }
     }
     if (empty($urlImage)) {
         $urlImage = $this->imageUrl;
     }
     return $urlImage;
 }
Ejemplo n.º 28
0
 /**
  * 
  * get params for export
  */
 public function getParamsForExport()
 {
     $arrParams = $this->getParams();
     $urlImage = UniteFunctionsRev::getVal($arrParams, "image");
     if (!empty($urlImage)) {
         $arrParams["image"] = UniteFunctionsWPRev::getImagePathFromURL($urlImage);
     }
     return $arrParams;
 }
Ejemplo n.º 29
0
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 &#8594; 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'));
        }
    }
}
 public function putSliderBase($sliderID)
 {
     try {
         self::$sliderSerial++;
         $this->slider = new RevSlider();
         $this->slider->initByMixed($sliderID);
         $doWrapFromTemplate = false;
         if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) {
             //need to use general settings from the Template Slider
             $this->slider->initByMixed($this->slider->getParam("slider_template_id", false));
             $doWrapFromTemplate = $sliderID;
         }
         //modify settings for admin preview mode
         if ($this->previewMode == true) {
             $this->modifyPreviewModeSettings();
         }
         //set slider language
         $isWpmlExists = UniteWpmlRev::isWpmlExists();
         $useWpml = $this->slider->getParam("use_wpml", "off");
         if ($isWpmlExists && $useWpml == "on") {
             if ($this->previewMode == false) {
                 $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
             }
         }
         //edit html before slider
         $htmlBeforeSlider = "";
         if ($this->slider->getParam("load_googlefont", "false") == "true") {
             $googleFont = $this->slider->getParam("google_font");
             if (is_array($googleFont)) {
                 foreach ($googleFont as $key => $font) {
                     $htmlBeforeSlider .= RevOperations::getCleanFontImport($font);
                 }
             } else {
                 $htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont);
             }
         }
         //pub js to body handle
         if ($this->slider->getParam("js_to_body", "false") == "true") {
             $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.plugins.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
             $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
         }
         //the initial id can be alias
         $sliderID = $this->slider->getID();
         $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
         $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
         $sliderType = $this->slider->getParam("slider_type");
         //set wrapper height
         $wrapperHeigh = 0;
         $wrapperHeigh += $this->slider->getParam("height");
         //add thumb height
         if ($this->slider->getParam("navigaion_type") == "thumb") {
             $wrapperHeigh += $this->slider->getParam("thumb_height");
         }
         $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
         $this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
         $containerStyle = "";
         $sliderPosition = $this->slider->getParam("position", "center");
         //set position:
         if ($sliderType != "fullscreen") {
             switch ($sliderPosition) {
                 case "center":
                 default:
                     $containerStyle .= "margin:0px auto;";
                     break;
                 case "left":
                     $containerStyle .= "float:left;";
                     break;
                 case "right":
                     $containerStyle .= "float:right;";
                     break;
             }
         }
         //add background color
         $backgrondColor = trim($this->slider->getParam("background_color"));
         if (!empty($backgrondColor)) {
             $containerStyle .= "background-color:{$backgrondColor};";
         }
         //set padding
         $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
         //set margin:
         if ($sliderType != "fullscreen") {
             if ($sliderPosition != "center") {
                 $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                 $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
             }
             $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
             $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
         }
         //set height and width:
         $bannerStyle = "display:none;";
         //add background image (to banner style)
         $showBackgroundImage = $this->slider->getParam("show_background_image", "false");
         if ($showBackgroundImage == "true") {
             $backgroundImage = $this->slider->getParam("background_image");
             $backgroundFit = $this->slider->getParam("bg_fit", "cover");
             $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat");
             $backgroundPosition = $this->slider->getParam("bg_position", "center top");
             if (!empty($backgroundImage)) {
                 $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
             }
         }
         //set wrapper and slider class:
         $sliderWrapperClass = "rev_slider_wrapper";
         $sliderClass = "rev_slider";
         $putResponsiveStyles = false;
         switch ($sliderType) {
             default:
             case "fixed":
                 $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 break;
             case "responsitive":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $putResponsiveStyles = true;
                 break;
             case "fullwidth":
                 $sliderWrapperClass .= " fullwidthbanner-container";
                 $sliderClass .= " fullwidthabanner";
                 $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . ";";
                 $containerStyle .= "max-height:" . $bannerHeight . "px;";
                 break;
             case "fullscreen":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $sliderWrapperClass .= " fullscreen-container";
                 $sliderClass .= " fullscreenbanner";
                 break;
         }
         $htmlTimerBar = "";
         $timerBar = $this->slider->getParam("show_timerbar", "top");
         if ($timerBar == "true") {
             $timerBar = $this->slider->getParam("timebar_position", "top");
         }
         switch ($timerBar) {
             case "top":
                 $htmlTimerBar = '<div class="tp-bannertimer"></div>';
                 break;
             case "bottom":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
                 break;
         }
         //check inner / outer border
         $paddingType = $this->slider->getParam("padding_type", "outter");
         if ($paddingType == "inner") {
             $sliderWrapperClass .= " tp_inner_padding";
         }
         global $revSliderVersion;
         echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n";
         if ($putResponsiveStyles == true) {
             $this->putResponsitiveStyles();
         }
         echo $htmlBeforeSlider . "\n";
         echo "<div id=\"";
         echo $this->sliderHtmlID_wrapper;
         echo "\" ";
         echo "class=\"" . $sliderWrapperClass . "\"";
         echo " style=\"" . $containerStyle . "\">\n";
         echo "\t<div id=\"";
         echo $this->sliderHtmlID;
         echo "\" ";
         echo "class=\"" . $sliderClass . "\"";
         echo " style=\"" . $bannerStyle . "\">\n";
         echo $this->putSlides($doWrapFromTemplate);
         echo $htmlTimerBar;
         echo "\t</div>\n";
         echo "</div>";
         $this->putJS();
         echo "<!-- END REVOLUTION SLIDER -->";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->putErrorMessage($message);
     }
 }