/**
 * Generate CSS - Module
 */
function dslc_module_gen_css($atts, $settings_raw)
{
    $settings = maybe_unserialize(base64_decode($settings_raw));
    // If it's an array
    if (is_array($settings)) {
        // The ID of the module
        $module_id = $settings['module_id'];
        // Check if module exists
        if (!dslc_is_module_active($module_id)) {
            return;
        }
        // If class does not exists
        if (!class_exists($module_id)) {
            return;
        }
        // Instanciate the module class
        $module_instance = new $module_id();
        // Get array of options
        $options_arr = $module_instance->options();
        // Load preset options if preset supplied
        $settings = apply_filters('dslc_filter_settings', $settings);
        // Transform image ID to URL
        global $dslc_var_image_option_bckp;
        $dslc_var_image_option_bckp = array();
        foreach ($options_arr as $option_arr) {
            if ($option_arr['type'] == 'image') {
                if (isset($settings[$option_arr['id']]) && !empty($settings[$option_arr['id']]) && is_numeric($settings[$option_arr['id']])) {
                    $dslc_var_image_option_bckp[$option_arr['id']] = $settings[$option_arr['id']];
                    $image_info = wp_get_attachment_image_src($settings[$option_arr['id']], 'full');
                    $settings[$option_arr['id']] = $image_info[0];
                }
            }
            // Fix css_custom value ( issue when default changed programmatically )
            if ($option_arr['id'] == 'css_custom' && $module_id == 'DSLC_Text_Simple' && !isset($settings['css_custom'])) {
                $settings['css_custom'] = $option_arr['std'];
            }
        }
        // Generate custom CSS
        if (($module_id == 'DSLC_TP_Content' || $module_id == 'DSLC_Html') && !isset($settings['css_custom'])) {
            $css_output = '';
        } elseif (isset($settings['css_custom']) && $settings['css_custom'] == 'disabled') {
            $css_output = '';
        } else {
            $css_output = dslc_generate_custom_css($options_arr, $settings);
        }
    }
}
    function module_start($options)
    {
        global $dslc_should_filter;
        $dslc_should_filter = false;
        if (!isset($options['css_anim'])) {
            $options['css_anim'] = 'none';
        }
        if (!isset($options['css_anim_delay'])) {
            $options['css_anim_delay'] = '0';
        }
        if (!isset($options['css_anim_duration'])) {
            $options['css_anim_duration'] = '650';
        }
        if (!isset($options['css_anim_easing'])) {
            $options['css_anim_easing'] = 'default';
        }
        $options['module_id'] = $this->module_id;
        /**
         * Size Classes
         */
        $class_size_output = '';
        $data_attr_size = '12';
        if (isset($options['dslc_m_size'])) {
            $class_size_output .= ' dslc-col dslc-' . $options['dslc_m_size'] . '-col';
            $data_attr_size = $options['dslc_m_size'];
        }
        if (isset($options['dslc_m_size_last']) && $options['dslc_m_size_last'] == 'yes') {
            $class_size_output .= ' dslc-last-col';
        }
        /**
         * Show on ( desktop, tablet, phone )
         */
        $class_show_on = '';
        if (isset($options['css_show_on'])) {
            $show_on = explode(' ', trim($options['css_show_on']));
            if (!in_array('desktop', $show_on)) {
                $class_show_on .= 'dslc-hide-on-desktop ';
            }
            if (!in_array('tablet', $show_on)) {
                $class_show_on .= 'dslc-hide-on-tablet ';
            }
            if (!in_array('phone', $show_on)) {
                $class_show_on .= 'dslc-hide-on-phone ';
            }
        }
        /**
         * Handle like
         */
        if (isset($this->handle_like)) {
            $class_handle_like = 'dslc-module-handle-like-' . $this->handle_like;
        } else {
            $class_handle_like = 'dslc-module-handle-like-regular';
        }
        /**
         * Globals
         */
        global $dslc_css_style;
        global $dslc_googlefonts_array;
        global $dslc_all_googlefonts_array;
        /**
         * Title Attr
         */
        $title_attr = '';
        if (dslc_is_editor_active()) {
            $title_attr = 'title="' . strtoupper(esc_attr($this->module_title)) . '"';
        }
        ?>

		<div id="dslc-module-<?php 
        echo $options['module_instance_id'];
        ?>
" class="dslc-module-front dslc-module-<?php 
        echo $this->module_id;
        ?>
 dslc-in-viewport-check dslc-in-viewport-anim-<?php 
        echo $options['css_anim'];
        ?>
 <?php 
        echo $class_size_output . ' ' . $class_show_on . ' ' . $class_handle_like;
        ?>
" data-module-id="<?php 
        echo $options['module_instance_id'];
        ?>
" data-dslc-module-id="<?php 
        echo $this->module_id;
        ?>
" data-dslc-module-size="<?php 
        echo $data_attr_size;
        ?>
" data-dslc-anim="<?php 
        echo $options['css_anim'];
        ?>
" data-dslc-anim-delay="<?php 
        echo $options['css_anim_delay'];
        ?>
" data-dslc-anim-duration="<?php 
        echo $options['css_anim_duration'];
        ?>
"  data-dslc-anim-easing="<?php 
        echo $options['css_anim_easing'];
        ?>
" data-dslc-preset="<?php 
        echo $options['css_load_preset'];
        ?>
" <?php 
        echo $title_attr;
        ?>
>

			<?php 
        do_action('dslc_module_before');
        ?>

			<?php 
        if (DS_LIVE_COMPOSER_ACTIVE && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
            ?>

				<style><?php 
            $options_arr = $this->options();
            if (isset($options['css_custom']) && $options['css_custom'] == 'disabled') {
            } else {
                dslc_generate_custom_css($options_arr, $options, true);
                $googlefonts_output = '';
                foreach ($dslc_googlefonts_array as $googlefont) {
                    if (in_array($googlefont, $dslc_all_googlefonts_array)) {
                        $googlefont = str_replace(' ', '+', $googlefont);
                        if ($googlefont != '') {
                            $googlefonts_output .= '@import url("//fonts.googleapis.com/css?family=' . $googlefont . ':100,200,300,400,500,600,700,800,900&subset=latin,latin-ext"); ';
                        }
                    }
                }
                echo $googlefonts_output;
                echo $dslc_css_style;
            }
            ?>
</style>
			
				<div class="dslca-module-manage">
					<span class="dslca-module-manage-line"></span>
					<div class="dslca-module-manage-inner">
						<a href="#" class="dslca-module-edit-hook"><span class="dslc-icon-cog"></span></a>				
						<a href="#" class="dslca-copy-module-hook"><span class="dslc-icon-copy"></span></a>
						<a href="#" class="dslca-move-module-hook"><span class="dslc-icon-move"></span></a>
						<a href="#" class="dslca-change-width-module-hook">
							<span class="dslc-icon-columns"></span>
							<div class="dslca-change-width-module-options">
								<span data-size="1">1/12</span><span data-size="2">2/12</span>
								<span data-size="3">3/12</span><span data-size="4">4/12</span>
								<span data-size="5">5/12</span><span data-size="6">6/12</span>
								<span data-size="7">7/12</span><span data-size="8">8/12</span>
								<span data-size="9">9/12</span><span data-size="10">10/12</span>
								<span data-size="11">11/12</span><span data-size="12">12/12</span>
							</div>
						</a>
						<a href="#" class="dslca-delete-module-hook"><span class="dslc-icon-remove"></span></a>
					</div>
					<?php 
            if (DS_LIVE_COMPOSER_DEV_MODE) {
                ?>
						<div class="dslca-module-manage-inner dslca-dev-mode">
							<a href="#" class="dslca-module-get-defaults-hook"><span class="dslc-icon-upload-alt"></span></a>				
						</div>
					<?php 
            }
            ?>
				</div>

			<?php 
        }
        ?>

		<?php 
    }
Beispiel #3
0
    function module_start($options)
    {
        global $dslc_active;
        global $dslc_should_filter;
        $dslc_should_filter = false;
        if (!isset($options['css_anim'])) {
            $options['css_anim'] = 'none';
        }
        if (!isset($options['css_anim_delay'])) {
            $options['css_anim_delay'] = '0';
        }
        if (!isset($options['css_anim_duration'])) {
            $options['css_anim_duration'] = '650';
        }
        if (!isset($options['css_anim_easing'])) {
            $options['css_anim_easing'] = 'default';
        }
        $options['module_id'] = $this->module_id;
        /**
         * Size Classes
         */
        $class_size_output = '';
        $data_attr_size = '12';
        if (isset($options['dslc_m_size'])) {
            $class_size_output .= ' dslc-col dslc-' . $options['dslc_m_size'] . '-col';
            $data_attr_size = $options['dslc_m_size'];
        }
        if (isset($options['dslc_m_size_last']) && $options['dslc_m_size_last'] == 'yes') {
            $class_size_output .= ' dslc-last-col';
        }
        /**
         * Show on ( desktop, tablet, phone )
         */
        $class_show_on = '';
        if (isset($options['css_show_on'])) {
            $show_on = explode(' ', trim($options['css_show_on']));
            if (!in_array('desktop', $show_on)) {
                $class_show_on .= 'dslc-hide-on-desktop ';
            }
            if (!in_array('tablet', $show_on)) {
                $class_show_on .= 'dslc-hide-on-tablet ';
            }
            if (!in_array('phone', $show_on)) {
                $class_show_on .= 'dslc-hide-on-phone ';
            }
        }
        /**
         * Handle like
         */
        if (isset($this->handle_like)) {
            $class_handle_like = 'dslc-module-handle-like-' . $this->handle_like;
        } else {
            $class_handle_like = 'dslc-module-handle-like-regular';
        }
        /**
         * Globals
         */
        global $dslc_css_style;
        global $dslc_googlefonts_array;
        global $dslc_all_googlefonts_array;
        /**
         * Title Attr
         */
        $title_attr = '';
        if ($dslc_active) {
            $title_attr = 'title="' . strtoupper(esc_attr($this->module_title)) . '"';
        }
        /**
         * Option Preset
         */
        if (!isset($options['css_load_preset'])) {
            $options['css_load_preset'] = '';
        }
        // Module class array
        $module_class_arr = array();
        $module_class_arr[] = 'dslc-module-front';
        $module_class_arr[] = 'dslc-module-' . $this->module_id;
        $module_class_arr[] = 'dslc-in-viewport-check';
        $module_class_arr[] = 'dslc-in-viewport-anim-' . $options['css_anim'];
        $module_class_arr[] = $class_size_output;
        $module_class_arr[] = $class_show_on;
        $module_class_arr[] = $class_handle_like;
        // Process all class definitions.
        $custom_class = preg_replace('/,/', ' ', $options['custom_class']);
        $custom_class = preg_replace('/\\b\\.\\b/', ' ', $custom_class);
        $custom_class = preg_replace('/\\./', '', $custom_class);
        $custom_class = preg_replace('/\\s{2,}/', ' ', $custom_class);
        $custom_class = trim($custom_class);
        $module_class_arr[] = $custom_class;
        // Module class array apply filters
        $module_class_arr = apply_filters('dslc_module_class', $module_class_arr, $this->module_id, $options);
        // Turn module class array into string
        $module_class = implode(' ', $module_class_arr);
        ?>

		<div id="dslc-module-<?php 
        echo $options['module_instance_id'];
        ?>
" class="<?php 
        echo $module_class;
        ?>
" data-module-id="<?php 
        echo $options['module_instance_id'];
        ?>
" data-dslc-module-id="<?php 
        echo $this->module_id;
        ?>
" data-dslc-module-size="<?php 
        echo $data_attr_size;
        ?>
" data-dslc-anim="<?php 
        echo $options['css_anim'];
        ?>
" data-dslc-anim-delay="<?php 
        echo $options['css_anim_delay'];
        ?>
" data-dslc-anim-duration="<?php 
        echo $options['css_anim_duration'];
        ?>
"  data-dslc-anim-easing="<?php 
        echo $options['css_anim_easing'];
        ?>
" data-dslc-preset="<?php 
        echo $options['css_load_preset'];
        ?>
" <?php 
        echo $title_attr;
        ?>
>

			<?php 
        do_action('dslc_module_before');
        ?>

			<?php 
        // If Live Composer in editing mode: output <style> block for the current module.
        if (DS_LIVE_COMPOSER_ACTIVE && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
            ?>

				<style type="text/css" id="css-for-dslc-module-<?php 
            echo $options['module_instance_id'];
            ?>
"><?php 
            $options_arr = $this->options();
            if (isset($options['css_custom']) && $options['css_custom'] == 'disabled') {
            } else {
                dslc_generate_custom_css($options_arr, $options, true);
                $googlefonts_output = '';
                foreach ($dslc_googlefonts_array as $googlefont) {
                    if (in_array($googlefont, $dslc_all_googlefonts_array)) {
                        $googlefont = str_replace(' ', '+', $googlefont);
                        if ($googlefont != '') {
                            $googlefonts_output .= '@import url("//fonts.googleapis.com/css?family=' . $googlefont . ':100,200,300,400,500,600,700,800,900&subset=latin,latin-ext"); ';
                        }
                    }
                }
                echo $googlefonts_output;
                echo $dslc_css_style;
            }
            ?>
</style>

				<div class="dslca-module-manage">
					<span class="dslca-module-manage-line"></span>
					<div class="dslca-module-manage-inner">
						<span class="dslca-manage-action dslca-module-manage-hook dslca-module-edit-hook" title="<?php 
            esc_attr_e('Edit options', 'live-composer-page-builder');
            ?>
"><span class="dslca-icon dslc-icon-cog"></span></span>
						<span class="dslca-manage-action dslca-module-manage-hook dslca-copy-module-hook" title="<?php 
            esc_attr_e('Duplicate', 'live-composer-page-builder');
            ?>
"><span class="dslca-icon dslc-icon-copy"></span></span>
						<span class="dslca-manage-action dslca-module-manage-hook dslca-move-module-hook" title="<?php 
            esc_attr_e('Drag to move', 'live-composer-page-builder');
            ?>
"><span class="dslca-icon dslc-icon-move"></span></span>
						<span class="dslca-manage-action dslca-module-manage-hook dslca-change-width-module-hook" title="<?php 
            esc_attr_e('Change width', 'live-composer-page-builder');
            ?>
">
							<span class="dslca-icon dslc-icon-columns"></span>
							<div class="dslca-change-width-module-options">
								<span><?php 
            esc_attr_e('Element Width', 'live-composer-page-builder');
            ?>
</span>
								<span data-size="1">1/12</span><span data-size="2">2/12</span>
								<span data-size="3">3/12</span><span data-size="4">4/12</span>
								<span data-size="5">5/12</span><span data-size="6">6/12</span>
								<span data-size="7">7/12</span><span data-size="8">8/12</span>
								<span data-size="9">9/12</span><span data-size="10">10/12</span>
								<span data-size="11">11/12</span><span data-size="12">12/12</span>
							</div>
						</span>
						<span class="dslca-manage-action dslca-module-manage-hook dslca-delete-module-hook" title="<?php 
            esc_attr_e('Delete', 'live-composer-page-builder');
            ?>
"><span class="dslca-icon dslc-icon-remove"></span></span>
					</div>
					<?php 
            if (DS_LIVE_COMPOSER_DEV_MODE) {
                ?>
						<div class="dslca-manage-action dslca-module-manage-inner dslca-dev-mode">
							<span class="dslca-module-manage-hook dslca-module-get-defaults-hook"><span class="dslca-icon dslc-icon-upload-alt"></span></span>
						</div>
					<?php 
            }
            ?>
				</div>

			<?php 
        }
        ?>

		<?php 
    }