function print_custom_css()
 {
     $fields = self::get_color_fields();
     $settings = FLBuilderModel::get_global_settings();
     print "<style id='bb-ui-theme-custom'>\n";
     foreach ($fields as $name => $field) {
         $color = '#' . $settings->{$name};
         $properties = $field['properties'];
         $selectors = $field['selectors'];
         foreach ($selectors as $selector) {
             print $selector . "{\n";
             foreach ($properties as $property) {
                 print $property . " : " . $color;
             }
             print "}\n";
         }
     }
     ?>
     body .fl-builder-blocks-section .fl-builder-blocks-section-title:hover,
     body .fl-builder-blocks-section .fl-builder-blocks-section-title:hover i {
         background:transparent;
     }
     <?php 
     print "</style>\n";
 }
Esempio n. 2
0
function my_theme_show_page_header()
{
    if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_enabled()) {
        $global_settings = FLBuilderModel::get_global_settings();
        if (!$global_settings->show_default_heading) {
            return false;
        }
    }
    return true;
}
Esempio n. 3
0
<?php

$global_settings = FLBuilderModel::get_global_settings();
FLBuilder::register_settings_form('module_advanced', array('title' => __('Advanced', 'fl-builder'), 'sections' => array('margins' => array('title' => __('Margins', 'fl-builder'), 'fields' => array('margin_top' => array('type' => 'text', 'label' => __('Top', 'fl-builder'), 'default' => '', 'description' => 'px', 'maxlength' => '4', 'size' => '5', 'placeholder' => $global_settings->module_margins, 'preview' => array('type' => 'none')), 'margin_bottom' => array('type' => 'text', 'label' => __('Bottom', 'fl-builder'), 'default' => '', 'description' => 'px', 'maxlength' => '4', 'size' => '5', 'placeholder' => $global_settings->module_margins, 'preview' => array('type' => 'none')), 'margin_left' => array('type' => 'text', 'label' => __('Left', 'fl-builder'), 'default' => '', 'description' => 'px', 'maxlength' => '4', 'size' => '5', 'placeholder' => $global_settings->module_margins, 'preview' => array('type' => 'none')), 'margin_right' => array('type' => 'text', 'label' => __('Right', 'fl-builder'), 'default' => '', 'description' => 'px', 'maxlength' => '4', 'size' => '5', 'placeholder' => $global_settings->module_margins, 'preview' => array('type' => 'none')))), 'responsive' => array('title' => __('Responsive Layout', 'fl-builder'), 'fields' => array('responsive_display' => array('type' => 'select', 'label' => __('Display', 'fl-builder'), 'options' => array('' => __('Always', 'fl-builder'), 'desktop' => __('Large Devices Only', 'fl-builder'), 'desktop-medium' => __('Large &amp; Medium Devices Only', 'fl-builder'), 'medium' => __('Medium Devices Only', 'fl-builder'), 'medium-mobile' => __('Medium &amp; Small Devices Only', 'fl-builder'), 'mobile' => __('Small Devices Only', 'fl-builder')), 'help' => __('Choose whether to show or hide this module at different device sizes.', 'fl-builder'), 'preview' => array('type' => 'none')))), 'animation' => array('title' => __('Animation', 'fl-builder'), 'fields' => array('animation' => array('type' => 'select', 'label' => __('Style', 'fl-builder'), 'options' => array('' => _x('None', 'Animation style.', 'fl-builder'), 'fade-in' => _x('Fade In', 'Animation style.', 'fl-builder'), 'slide-left' => _x('Slide Left', 'Animation style.', 'fl-builder'), 'slide-right' => _x('Slide Right', 'Animation style.', 'fl-builder'), 'slide-up' => _x('Slide Up', 'Animation style.', 'fl-builder'), 'slide-down' => _x('Slide Down', 'Animation style.', 'fl-builder')), 'preview' => array('type' => 'none')), 'animation_delay' => array('type' => 'text', 'label' => __('Delay', 'fl-builder'), 'default' => '0.0', 'maxlength' => '4', 'size' => '5', 'description' => _x('seconds', 'Value unit for form field of time in seconds. Such as: "5 seconds"', 'fl-builder'), 'help' => __('The amount of time in seconds before this animation starts.', 'fl-builder'), 'preview' => array('type' => 'none')))), 'css_selectors' => array('title' => __('CSS Selectors', 'fl-builder'), 'fields' => array('id' => array('type' => 'text', 'label' => __('ID', 'fl-builder'), 'help' => __("A unique ID that will be applied to this module's HTML. Must start with a letter and only contain dashes, underscores, letters or numbers. No spaces.", 'fl-builder'), 'preview' => array('type' => 'none')), 'class' => array('type' => 'text', 'label' => __('Class', 'fl-builder'), 'help' => __("A class that will be applied to this module's HTML. Must start with a letter and only contain dashes, underscores, letters or numbers. Separate multiple classes with spaces.", 'fl-builder'), 'preview' => array('type' => 'none')))))));
 /**
  * Renders and caches the JavaScript for a builder layout.
  *
  * @since 1.0
  * @return void
  */
 public static function render_js()
 {
     // Delete the old file.
     FLBuilderModel::delete_asset_cache('js');
     // Get info on the new file.
     $nodes = FLBuilderModel::get_categorized_nodes();
     $global_settings = FLBuilderModel::get_global_settings();
     $rows = FLBuilderModel::get_nodes('row');
     $asset_info = FLBuilderModel::get_asset_info();
     $compiled = array();
     $js = '';
     // Layout config object.
     ob_start();
     include FL_BUILDER_DIR . 'includes/layout-js-config.php';
     $js .= ob_get_clean();
     // Main JS
     $js .= file_get_contents(FL_BUILDER_DIR . 'js/fl-builder-layout.js');
     // Loop through the rows.
     foreach ($nodes['rows'] as $row) {
         // Setup row vars
         $settings = $row->settings;
         $id = $row->node;
         // Include the row instance JS
         ob_start();
         include FL_BUILDER_DIR . 'includes/row-js.php';
         $js .= ob_get_clean();
     }
     // Loop through the modules.
     foreach ($nodes['modules'] as $module) {
         // Global module JS
         $file = $module->dir . 'js/frontend.js';
         if (file_exists($file) && !in_array($module->settings->type, $compiled)) {
             $js .= "\n" . file_get_contents($file);
             $compiled[] = $module->settings->type;
         }
         // Instance module JS
         $file = $module->dir . 'includes/frontend.js.php';
         $settings = $module->settings;
         $id = $module->node;
         if (file_exists($file)) {
             ob_start();
             include $file;
             $js .= ob_get_clean();
         }
     }
     // Add the path legacy vars (FLBuilderLayoutConfig.paths should be used instead).
     $js .= "var wpAjaxUrl = '" . admin_url('admin-ajax.php') . "';";
     $js .= "var flBuilderUrl = '" . FL_BUILDER_URL . "';";
     // Call the FLBuilder._renderLayoutComplete method if we're currently editing.
     if (stristr($asset_info['js'], '-draft.js') || stristr($asset_info['js'], '-preview.js')) {
         $js .= "; if(typeof FLBuilder !== 'undefined' && typeof FLBuilder._renderLayoutComplete !== 'undefined') FLBuilder._renderLayoutComplete();";
     }
     // Include FLJSMin
     if (!class_exists('FLJSMin')) {
         include FL_BUILDER_DIR . 'classes/class-fl-jsmin.php';
     }
     // Save the js
     if (!empty($js)) {
         file_put_contents($asset_info['js'], FLJSMin::minify($js));
     }
 }
Esempio n. 5
0
 /**
  * Renders the JavaScript for a single module.
  *
  * @since 1.7
  * @param string|object $module_id A module ID or object.
  * @param array $compiled An array of module types that have already has frontend.js compiled.
  * @return string
  */
 public static function render_module_js($module_id, &$compiled = array())
 {
     $module = is_object($module_id) ? $module_id : FLBuilderModel::get_module($module_id);
     $global_settings = FLBuilderModel::get_global_settings();
     $js = '';
     // Global module JS
     $file = $module->dir . 'js/frontend.js';
     if (file_exists($file) && !in_array($module->settings->type, $compiled)) {
         $js .= "\n" . file_get_contents($file);
         $compiled[] = $module->settings->type;
     }
     // Instance module JS
     $file = $module->dir . 'includes/frontend.js.php';
     $settings = $module->settings;
     $id = $module->node;
     if (file_exists($file)) {
         ob_start();
         include $file;
         $js .= ob_get_clean();
     }
     // Return the JS.
     return $js;
 }
Esempio n. 6
0
 public function responsive_breakpoint()
 {
     $settings = FLBuilderModel::get_global_settings();
     return $settings->responsive_breakpoint;
 }
 static function get_accent_color($handle)
 {
     $global_settings = FLBuilderModel::get_global_settings();
     $accent_color_handle = $handle . '-accent-color';
     return $global_settings->{$accent_color_handle};
 }