예제 #1
0
 /**
  * Load interface js and css
  *
  * @since 2.1.9
  */
 function load_frontend_interface()
 {
     // load only when editing and login
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         wp_enqueue_style('themify-builder-main', THEMIFY_BUILDER_URI . '/css/themify-builder-main.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-builder-admin-ui', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui.css', array(), THEMIFY_VERSION);
         if (is_rtl()) {
             wp_enqueue_style('themify-builder-admin-ui-rtl', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui-rtl.css', array('themify-builder-admin-ui'), THEMIFY_VERSION);
         }
         wp_enqueue_style('themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('google-fonts-builder', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Open+Sans:400,300,600|Montserrat');
         wp_enqueue_style('colorpicker', THEMIFY_URI . '/css/jquery.minicolors.css');
         // from themify framework
         // Icon picker
         wp_enqueue_script('themify-font-icons-js', THEMIFY_URI . '/js/themify.font-icons-select.js', array('jquery'), THEMIFY_VERSION, true);
         wp_localize_script('themify-font-icons-js', 'themifyIconPicker', array('icons_list' => THEMIFY_URI . '/fontawesome/list.html'));
         do_action('themify_builder_admin_enqueue', $this);
     }
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         if (class_exists('Jetpack_VideoPress')) {
             // Load this so submit_button() is available in VideoPress' print_media_templates().
             require_once ABSPATH . 'wp-admin/includes/template.php';
         }
         $enqueue_scripts = array('underscore', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-tooltip', 'jquery-effects-core', 'media-upload', 'jquery-ui-dialog', 'wpdialogs', 'wpdialogs-popup', 'wplink', 'word-count', 'editor', 'quicktags', 'wp-fullscreen', 'admin-widgets', 'colorpicker-js', 'themify-builder-google-webfont', 'themify-builder-undo-manager-js', 'themify-builder-common-js', 'themify-builder-front-ui-js', 'jss');
         // For editor
         wp_enqueue_style('buttons');
         // is mobile version
         if ($this->isMobile()) {
             wp_register_script('themify-builder-mobile-ui-js', THEMIFY_BUILDER_URI . "/js/jquery.ui.touch-punch.js", array('jquery'), THEMIFY_VERSION, true);
             wp_enqueue_script('jquery-ui-mouse');
             wp_enqueue_script('themify-builder-mobile-ui-js');
         }
         foreach ($enqueue_scripts as $script) {
             switch ($script) {
                 case 'admin-widgets':
                     wp_enqueue_script($script, admin_url('/js/widgets.min.js'), array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'));
                     break;
                 case 'colorpicker-js':
                     wp_enqueue_script($script, THEMIFY_URI . '/js/jquery.minicolors.js', array('jquery'));
                     // grab from themify framework
                     break;
                 case 'themify-builder-google-webfont':
                     wp_enqueue_script($script, themify_https_esc('http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'));
                     break;
                 case 'themify-builder-undo-manager-js':
                     wp_enqueue_script($script, THEMIFY_BUILDER_URI . '/js/undomanager.js', array('jquery'));
                     break;
                 case 'themify-builder-common-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.common.js", array('jquery'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     wp_localize_script('themify-builder-common-js', 'themifyBuilderCommon', apply_filters('themify_builder_common_vars', array('text_no_localStorage' => __("Your browser does not support this feature. Please use a modern browser such as Google Chrome or Safari.", 'themify'), 'text_confirm_data_paste' => __('This will overwrite the data. Ok to proceed?', 'themify'), 'text_alert_wrong_paste' => __('Error: Paste valid data only (paste row data to row, sub-row data to sub-row, module data to module).', 'themify'))));
                     break;
                 case 'jss':
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/jss.min.js", null, THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     break;
                 case 'themify-builder-front-ui-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.front.ui.js", array('jquery', 'jquery-ui-tabs', 'themify-builder-common-js', 'jss'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     $gutterClass = Themify_Builder_Model::get_grid_settings('gutter_class');
                     wp_localize_script($script, 'themifyBuilder', apply_filters('themify_builder_ajax_front_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'tfb_load_nonce' => wp_create_nonce('tfb_load_nonce'), 'tfb_url' => THEMIFY_BUILDER_URI, 'post_ID' => get_the_ID(), 'dropPlaceHolder' => __('drop module here', 'themify'), 'draggerTitleMiddle' => __('Drag left/right to change columns', 'themify'), 'draggerTitleLast' => __('Drag left to add columns', 'themify'), 'moduleDeleteConfirm' => __('Press OK to remove this module', 'themify'), 'rowDeleteConfirm' => __('Press OK to remove this row', 'themify'), 'toggleOn' => __('Turn On Builder', 'themify'), 'toggleOff' => __('Turn Off Builder', 'themify'), 'confirm_on_turn_off' => __('Do you want to save the changes made to this page?', 'themify'), 'confirm_on_duplicate_page' => __('Save the Builder before duplicating this page?', 'themify'), 'confirm_on_unload' => __('You have unsaved data.', 'themify'), 'isFrontend' => 'true', 'textImportBuilder' => __('Import From', 'themify'), 'textRowStyling' => __('Row Styling', 'themify'), 'textColumnStyling' => __('Column Styling', 'themify'), 'load_layout_title' => __('Layouts', 'themify'), 'save_as_layout_title' => __('Save as Layout', 'themify'), 'text_import_module_data' => __('Import Module'), 'text_export_module_data' => __('Export Module'), 'text_import_row_data' => __('Import Row'), 'text_export_row_data' => __('Export Row'), 'text_import_sub_row_data' => __('Import Sub-Row'), 'text_export_sub_row_data' => __('Export Sub-Row'), 'importFileConfirm' => __('This import will override all current Builder data. Press OK to continue', 'themify'), 'confirm_template_selected' => __('This will replace your current Builder layout with the Template', 'themify'), 'confirm_delete_layout' => __('Are you sure want to delete this layout ?', 'themify'), 'isThemifyTheme' => $this->is_themify_theme() ? 'true' : 'false', 'gutterClass' => $gutterClass, 'subRowDeleteConfirm' => __('Press OK to remove this sub row', 'themify'), 'disableShortcuts' => themify_check('setting-page_builder_disable_shortcuts'), 'webSafeFonts' => themify_get_web_safe_font_list(true))));
                     wp_localize_script($script, 'themify_builder_plupload_init', $this->get_builder_plupload_init());
                     break;
                 default:
                     wp_enqueue_script($script);
                     break;
             }
         }
     }
 }
 /**
  * Load interface js and css
  *
  * @since 2.1.9
  */
 function load_frontend_interface()
 {
     // Builder main styles
     $this->load_main_styles();
     // Charts
     wp_enqueue_script('themify-easy-pie-chart');
     // Waypoints
     wp_enqueue_script('theme-waypoints');
     // load only when editing and login
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         wp_enqueue_style('themify-builder-main', THEMIFY_BUILDER_URI . '/css/themify-builder-main.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-builder-admin-ui', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('google-fonts-builder', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Open+Sans:400,300,600|Montserrat');
         wp_enqueue_style('colorpicker', THEMIFY_URI . '/css/jquery.minicolors.css');
         // from themify framework
         // Icon picker
         wp_enqueue_script('themify-font-icons-js', THEMIFY_URI . '/js/themify.font-icons-select.js', array('jquery'), THEMIFY_VERSION, true);
         do_action('themify_builder_admin_enqueue', $this);
     }
     // lib scripts
     if (!wp_script_is('themify-carousel-js')) {
         wp_enqueue_script('themify-carousel-js');
         // grab from themify framework
     }
     // Check if BigVideo.js is loaded, if it's not, load it after loading Video.js
     // which is set as dependency under the handler 'themify-videojs-js'
     if (!wp_script_is('themify-bigvideo-js')) {
         wp_enqueue_script('themify-bigvideo-js');
     }
     // Check if scroll highlight is loaded. If it's not, load it.
     $this->load_scroll_highlight();
     // module scripts
     wp_register_script('themify-builder-module-plugins-js', THEMIFY_BUILDER_URI . "/js/themify.builder.module.plugins.js", array('jquery'), THEMIFY_VERSION, true);
     wp_enqueue_script('themify-builder-module-plugins-js');
     wp_register_script('themify-builder-script-js', THEMIFY_BUILDER_URI . "/js/themify.builder.script.js", array('jquery', 'theme-waypoints'), THEMIFY_VERSION, true);
     wp_enqueue_script('themify-builder-script-js');
     wp_localize_script('themify-builder-script-js', 'tbLocalScript', apply_filters('themify_builder_script_vars', array('isTouch' => themify_is_touch() ? true : false, 'isAnimationActive' => Themify_Builder_Model::is_animation_active(), 'isParallaxActive' => Themify_Builder_Model::is_parallax_active(), 'animationInviewSelectors' => self::$inview_selectors, 'createAnimationSelectors' => self::$new_selectors, 'backgroundSlider' => array('autoplay' => 5000, 'speed' => 2000), 'animationOffset' => 100, 'videoPoster' => THEMIFY_BUILDER_URI . '/img/blank.png')));
     // Main module scripts
     $this->load_main_scripts();
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         if (class_exists('Jetpack_VideoPress')) {
             // Load this so submit_button() is available in VideoPress' print_media_templates().
             require_once ABSPATH . 'wp-admin/includes/template.php';
         }
         $enqueue_scripts = array('underscore', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-effects-core', 'media-upload', 'jquery-ui-dialog', 'wpdialogs', 'wpdialogs-popup', 'wplink', 'word-count', 'editor', 'quicktags', 'wp-fullscreen', 'admin-widgets', 'colorpicker-js', 'themify-builder-google-webfont', 'themify-builder-front-ui-js');
         // For editor
         wp_enqueue_style('buttons');
         // is mobile version
         if ($this->isMobile()) {
             wp_register_script('themify-builder-mobile-ui-js', THEMIFY_BUILDER_URI . "/js/jquery.ui.touch-punch.js", array('jquery'), THEMIFY_VERSION, true);
             wp_enqueue_script('jquery-ui-mouse');
             wp_enqueue_script('themify-builder-mobile-ui-js');
         }
         foreach ($enqueue_scripts as $script) {
             switch ($script) {
                 case 'admin-widgets':
                     wp_enqueue_script($script, admin_url('/js/widgets.min.js'), array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'));
                     break;
                 case 'colorpicker-js':
                     wp_enqueue_script($script, THEMIFY_URI . '/js/jquery.minicolors.js', array('jquery'));
                     // grab from themify framework
                     break;
                 case 'themify-builder-google-webfont':
                     //wp_enqueue_script( $script, themify_https_esc( 'http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js' ) );
                     break;
                 case 'themify-builder-front-ui-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.front.ui.js", array('jquery', 'jquery-ui-tabs'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     $gutterClass = Themify_Builder_Model::get_grid_settings('gutter_class');
                     wp_localize_script($script, 'themifyBuilder', apply_filters('themify_builder_ajax_front_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'tfb_load_nonce' => wp_create_nonce('tfb_load_nonce'), 'tfb_url' => THEMIFY_BUILDER_URI, 'post_ID' => get_the_ID(), 'dropPlaceHolder' => __('drop module here', 'themify'), 'draggerTitleMiddle' => __('Drag left/right to change columns', 'themify'), 'draggerTitleLast' => __('Drag left to add columns', 'themify'), 'moduleDeleteConfirm' => __('Press OK to remove this module', 'themify'), 'toggleOn' => __('Turn On Builder', 'themify'), 'toggleOff' => __('Turn Off Builder', 'themify'), 'confirm_on_turn_off' => __('Do you want to save the changes made to this page?', 'themify'), 'confirm_on_duplicate_page' => __('Save the Builder before duplicating this page?', 'themify'), 'confirm_on_unload' => __('You have unsaved data.', 'themify'), 'textImportBuilder' => __('Import From', 'themify'), 'textRowStyling' => __('Row Styling', 'themify'), 'importFileConfirm' => __('This import will override all current Builder data. Press OK to continue', 'themify'), 'confirm_template_selected' => __('This will replace your current Builder layout with the Template', 'themify'), 'load_layout_title' => __('Layouts', 'themify'), 'save_as_layout_title' => __('Save as Layout', 'themify'), 'confirm_delete_layout' => __('Are you sure want to delete this layout ?', 'themify'), 'isThemifyTheme' => $this->is_themify_theme() ? 'true' : 'false', 'gutterClass' => $gutterClass, 'subRowDeleteConfirm' => __('Press OK to remove this sub row', 'themify'))));
                     wp_localize_script($script, 'themify_builder_plupload_init', $this->get_builder_plupload_init());
                     break;
                 default:
                     wp_enqueue_script($script);
                     break;
             }
         }
     }
 }
예제 #3
0
    /**
     * Get Grid menu list
     */
    function themify_builder_grid_lists($handle = 'row', $set_gutter = null, $set_column_equal_height = null)
    {
        $grid_lists = Themify_Builder_Model::get_grid_settings();
        $gutters = Themify_Builder_Model::get_grid_settings('gutter');
        $selected_gutter = is_null($set_gutter) ? '' : $set_gutter;
        ?>
		<div class="grid_menu" data-handle="<?php 
        echo esc_attr($handle);
        ?>
">
			<div class="grid_icon ti-layout-column3"></div>
			<div class="themify_builder_grid_list_wrapper">
				<ul class="themify_builder_grid_list clearfix">
					<?php 
        foreach ($grid_lists as $row) {
            ?>
					<li>
						<ul>
							<?php 
            foreach ($row as $li) {
                ?>
								<li><a href="#" class="themify_builder_column_select <?php 
                echo esc_attr('grid-layout-' . implode('-', $li['data']));
                ?>
" data-handle="<?php 
                echo esc_attr($handle);
                ?>
" data-grid="<?php 
                echo esc_attr(json_encode($li['data']));
                ?>
"><img src="<?php 
                echo esc_url($li['img']);
                ?>
"></a></li>
							<?php 
            }
            ?>
						</ul>
					</li>
					<?php 
        }
        ?>
				</ul>

				<div class="themify_builder_equal_column_height themify_builder_admin">
					<input type="checkbox" class="themify_builder_equal_column_height_checkbox" data-handle="<?php 
        echo esc_attr($handle);
        ?>
"
						<?php 
        if ($set_column_equal_height != null) {
            echo ' checked="checked"';
        }
        ?>
>
					<span><?php 
        esc_html_e('Equal Column Height', 'themify');
        ?>
</span>
				</div>

				<select class="gutter_select" data-handle="<?php 
        echo esc_attr($handle);
        ?>
">
					<?php 
        foreach ($gutters as $gutter) {
            ?>
					<option value="<?php 
            echo esc_attr($gutter['value']);
            ?>
"<?php 
            selected($selected_gutter, $gutter['value']);
            ?>
><?php 
            echo esc_html($gutter['name']);
            ?>
</option>
					<?php 
        }
        ?>
				</select>
				<small><?php 
        esc_html_e('Gutter Spacing', 'themify');
        ?>
</small>

			</div>
			<!-- /themify_builder_grid_list_wrapper -->
		</div>
		<!-- /grid_menu -->
		<?php 
    }