Exemple #1
0
 public static function enqueue_admin_scripts($hook)
 {
     if (!in_array($hook, array(self::$export_page, self::$import_page))) {
         return;
     }
     wp_enqueue_style('widget_data', JVLibrary::urls('assets') . '/css/widget-data.css');
     wp_enqueue_script('widget_data', JVLibrary::urls('assets') . '/js/widget-data.js', array('jquery', 'wp-ajax-response'));
     wp_localize_script('widget_data', 'widgets_url', get_admin_url(false, 'widgets.php'));
 }
Exemple #2
0
function loadCustomStyle()
{
    $config = JVLibrary::getConfig();
    wp_enqueue_style('chosen', JVLibrary::urls('theme') . '/css/chosen.css');
    wp_enqueue_style('font-awesome', JVLibrary::urls('theme') . '/css/font-awesome.css');
    wp_enqueue_style('shop', JVLibrary::urls('theme') . '/css/shop.css');
    wp_enqueue_style('blog', JVLibrary::urls('theme') . '/css/blog.css');
    wp_enqueue_style('menu', JVLibrary::urls('theme') . '/css/menu.css');
    if (!isset($config->show_demo)) {
        return;
    }
    if ($config->show_demo != 'yes') {
        return;
    }
    wp_enqueue_style('switcher', JVLibrary::urls('theme') . '/css/switcher.css');
}
Exemple #3
0
    }
    $result .= count($datas) > 1 ? '</div>' : '';
    return $result;
}
add_action('wp_enqueue_scripts', 'theme_register_oss_custom_scripts');
function theme_register_oss_custom_scripts()
{
    wp_enqueue_script('js-oss-theme', JVLibrary::urls('assets') . 'js/oss-function.js', array(), '', true);
Exemple #4
0
 public static function urls($type)
 {
     if (empty(self::$urls)) {
         self::$urls = array('theme' => get_template_directory_uri() . '/', 'site' => get_site_url(), 'assets' => get_template_directory_uri() . '/library/assets/', 'demo' => 'http://joomlavi.com/demo/wordpress/sample/jv-allinone/');
     }
     return self::$urls[$type];
 }
Exemple #5
0
 public static function importSQL()
 {
     //@ini_set('mysql.connect_timeout', 2000);
     //@ini_set('default_socket_timeout', 2000);
     @set_time_limit(0);
     global $wp_filesystem;
     $sql = JVLibrary::path('theme') . "library/import/data/jv_allinone.sql";
     $sample = JVLibrary::urls('demo') . '/jv_allinone.sql';
     $contents = $wp_filesystem->get_contents($sample);
     $wp_filesystem->put_contents($sql, $contents);
     $db = self::getDb();
     $jvfn = 'f' . 'open';
     if (!($file = $jvfn($sql, 'r'))) {
         return;
     }
     $query = "";
     $queries = $totalqueries = $querylines = $inparents = $linenumber = 0;
     while ($linenumber < self::$max_query_lines || $query != "") {
         // Read the whole next line
         $dumpline = "";
         while (!feof($file) && substr($dumpline, -1) != "\n" && substr($dumpline, -1) != "\r") {
             $dumpline .= fgets($file, self::$DATA_CHUNK_LENGTH);
             //else $dumpline .= gzgets($file, self::$DATA_CHUNK_LENGTH);
         }
         if ($dumpline === "") {
             break;
         }
         // Remove UTF8 Byte Order Mark at the file beginning if any
         $dumpline = preg_replace('|^\\xEF\\xBB\\xBF|', '', $dumpline);
         // Handle DOS and Mac encoded linebreaks (I don't know if it really works on Win32 or Mac Servers)
         $dumpline = str_replace("\r\n", "\n", $dumpline);
         $dumpline = str_replace("\r", "\n", $dumpline);
         // DIAGNOSTIC
         // echo ("<p>Line $linenumber: $dumpline</p>\n");
         // Recognize delimiter statement
         if (!$inparents && strpos($dumpline, "DELIMITER ") === 0) {
             self::$delimiter = str_replace("DELIMITER ", "", trim($dumpline));
         }
         // Skip comments and blank lines only if NOT in parents
         if (!$inparents) {
             $skipline = false;
             reset(self::$comment);
             foreach (self::$comment as $comment_value) {
                 if (trim($dumpline) == "" || strpos(trim($dumpline), $comment_value) === 0) {
                     $skipline = true;
                     break;
                 }
             }
             if ($skipline) {
                 $linenumber++;
                 continue;
             }
         }
         // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings)
         $dumpline_deslashed = str_replace("\\\\", "", $dumpline);
         // Count ' and \' (or " and \") in the dumpline to avoid query break within a text field ending by $delimiter
         $string_quotes = self::$string_quotes;
         $parents = substr_count($dumpline_deslashed, self::$string_quotes) - substr_count($dumpline_deslashed, "\\{$string_quotes}");
         if ($parents % 2 != 0) {
             $inparents = !$inparents;
         }
         // Add the line to query
         $query .= $dumpline;
         // Don't count the line if in parents (text fields may include unlimited linebreaks)
         if (!$inparents) {
             $querylines++;
         }
         // Stop if query contains more lines as defined by $max_query_lines
         if ($querylines > self::$max_query_lines) {
             $error[] = 'Too long';
             break;
         }
         // Execute query if end of query detected ($delimiter as last character) AND NOT in parents
         $query = self::replaceImageUrl($query);
         if ((preg_match('/' . preg_quote(self::$delimiter, '/') . '$/', trim($dumpline)) || self::$delimiter == '') && !$inparents) {
             // Cut off delimiter of the end of the query
             $query = substr(trim($query), 0, -1 * strlen(self::$delimiter));
             // echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
             if (!$db->query($query)) {
                 //echo ("<p class=\"error\">Error at the line $linenumber: ". trim($dumpline)."</p>\n");
                 echo "<p>Query: " . trim(nl2br(htmlentities($query))) . "</p>\n";
                 echo "<p>MySQL: " . $db->last_error . "</p>\n";
                 break;
             }
             $totalqueries++;
             $queries++;
             $query = "";
             $querylines = 0;
         }
         $linenumber++;
     }
     $wp_filesystem->delete($sql);
 }
Exemple #6
0
function tmpl_themeoptions_script()
{
    ?>

<script src="<?php 
    echo JVLibrary::urls('theme');
    ?>
library/assets/js/json2.js" type="text/javascript"></script> 
<script src="<?php 
    echo JVLibrary::urls('theme');
    ?>
library/assets/js/select2.js" type="text/javascript"></script> 
<script src="<?php 
    echo JVLibrary::urls('theme');
    ?>
library/assets/js/themeoptions.js" type="text/javascript"></script>
<link rel='stylesheet'  href='<?php 
    echo JVLibrary::urls('theme');
    ?>
library/assets/css/select2.css' type='text/css'  />
<link rel='stylesheet'  href='<?php 
    echo JVLibrary::urls('theme');
    ?>
library/assets/css/themeoptions.css' type='text/css'  />
<style type="text/css">
    #jvStyles .background-style label.radiobtn { width: 50px; height: 50px; height: auto; float: left; clear: none}
    #jvStyles .background-style span.bg-list {padding:10px; border: 2px solid #CCCCCC; width: 70px; height: 70px; float: left; text-indent: -999em; font-size: 0; color: #fff; margin-right: 10px; }
    #jvStyles .background-style span.bgactive {  border-color:#62C022; }
    
    #jvStyles .themecolor label.radiobtn { width: 50px; height: 50px; height: auto; float: left; clear: none}
    #jvStyles .themecolor span.color-list {padding:10px; margin-bottom:5px; cursor: pointer;  background-color: #FFFFFF !important; border: 2px solid #CCCCCC; width: 180px; height: 260px; float: left; text-indent: -999em; font-size: 0; color: #fff; margin-right: 10px; }
    #jvStyles .themecolor span.active {  border-color: #62C022; }
</style>
<script type="text/javascript">

/* Script to add tabs without refresh in tevolution general settings */
jQuery( function ( $ ){
    
    $('.jFonts-item .data-input').fadeOut();
    var listText = $('#textAnimate').val(),
        listJson = {},
        totalAni = 0
    ;
    try{
        
        if(listText) listJson = JSON.parse(listText);
        
    }catch( e ){ console.log( e ); }
    
    if(listJson){
        $.each(listJson, function(key, item){
            jvThemeOptioins.addAnimate(key, item);
            totalAni++;
        })
    }
    $('input.bntAnimate').click(function(){
        jvThemeOptioins.addAnimate(totalAni);
    });
    
    var urlsite = '<?php 
    echo JVLibrary::urls('site');
    ?>
/',
        jLogo = jQuery('#jLogo')
    ;
    // logo
    jvThemeOptioins.upload(urlsite);
    jvThemeOptioins.logo(jLogo);
	jvThemeOptioins.btn_show_hide.call( $( '#btn_sample_data' ), $('.jvadmin .btnsampledata, .jvadmin .div_no_install') );
    jLogo.change(function(){ 
        jvThemeOptioins.logo($(this));
    });
    $('.jvInstallData').click(function(){
        var agree = confirm("WARNING: Importing demo content will give you all content and other settings. This will replicate the live demo!");
        if(agree) jvThemeOptioins.InstallDataSample();
    });
    
    //fonts
    jvThemeOptioins.initFonts(parseInt($('#googlefonts').val()));
    jvThemeOptioins.initOwl(parseInt($('#jsOwl').val()));
    $('input.jvFonts').click(function(){
        jvThemeOptioins.addNewFont();
    });
    
    $('input.jsOwlCustom').click(function(){
        jvThemeOptioins.addNewOwl();
    })
    
    $('#jvGoogleFonts .jContent').find(".jFonts-item").each(function(){
        jvThemeOptioins.jvSelect2(this);
    });
    //save options
    $('.submit input[type="submit"]').click(function(){
        jvThemeOptioins.jFontsSetValue();
        jvThemeOptioins.OWLSetValue();
        jvThemeOptioins.AniSetValue();
        return true;
    });
    
    $('span.color-list').each(function(){
        jQuery(this).click(function(){
            jQuery('span.color-list').removeClass('active');
            jQuery(this).addClass('active');
            jQuery('#themecolor').val(jQuery(this).text());
        })		
    });		
    
    $('span.bg-list').each(function(){
        jQuery(this).click(function(){
            jQuery('span.bg-list').removeClass('bgactive');
            jQuery(this).addClass('bgactive');
            jQuery('#background').val(jQuery(this).text());
        })		
    });		

    $('#tev_theme_settings li a').click(function (e) {
        $("#wtheme_options_settings .tmpl-theme_settings").removeClass('active-tab');
        $("#tev_theme_settings li a").removeClass('current');
        $(this).parents('li').addClass('active');
        $(this).addClass('current');
        $("#wtheme_options_settings table#"+this.id)
        .addClass('active-tab')
        .find( '.input-select2' ).each( function(){
			
			$( this ).trigger( 'init-select2' );
			
		} );	
    });
});
</script>
<?php 
}