Example #1
0
/**
 * Display module options
 *
 * @since 1.0
 */
function dslc_ajax_display_module_options($atts)
{
    // Allowed to do this?
    if (is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
        // The array we'll pass back to the AJAX call.
        $response = array();
        // This will hold the output.
        $response['output'] = '';
        $response['output_tabs'] = '';
        // The ID of the module.
        $module_id = $_POST['dslc_module_id'];
        // Instanciate the module class.
        $module_instance = new $module_id();
        // Get the module options.
        $module_options = $module_instance->options();
        // Tabs.
        $tabs = array();
        ob_start();
        // Go through each option, generate the option HTML and append to output.
        foreach ($module_options as $module_option) {
            $curr_value = $module_option['std'];
            if (isset($_POST[$module_option['id']])) {
                $curr_value = $_POST[$module_option['id']];
            }
            /**
             * Visibility
             */
            if (isset($module_option['visibility'])) {
                $visibility = false;
            } else {
                $visibility = true;
            }
            if ('checkbox' === $module_option['type'] && count($module_option['choices']) < 1) {
                $visibility = false;
            }
            /**
             * Refresh on change
             */
            if (isset($module_option['refresh_on_change'])) {
                if ($module_option['refresh_on_change']) {
                    $refresh_on_change = 'active';
                } else {
                    $refresh_on_change = 'inactive';
                }
            } else {
                $refresh_on_change = 'active';
            }
            // Force refresh on change for images ( due to the URL -> ID change ).
            if ('image' === $module_option['type']) {
                $refresh_on_change = 'active';
            }
            /**
             * Section (functionality and styling)
             */
            if (isset($module_option['section'])) {
                $section = $module_option['section'];
            } else {
                $section = 'functionality';
            }
            /**
             * Tab
             */
            if (!isset($module_option['tab'])) {
                if ('functionality' === $section) {
                    $tabs['general_functionality'] = array('title' => __('General', 'live-composer-page-builder'), 'id' => 'general_functionality', 'section' => 'functionality');
                } else {
                    $tabs['general_styling'] = array('title' => __('General', 'live-composer-page-builder'), 'id' => 'general_styling', 'section' => 'styling');
                }
                $tab_id = 'general_' . $section;
            }
            if (isset($module_option['tab'])) {
                // Lowercase it.
                $tab_id = strtolower($module_option['tab']);
                // Replace spaces with _ .
                $tab_id = str_replace(' ', '_', $tab_id);
                // Add section ID append.
                $tab_id .= '_' . $section;
                // If not already in the tabs array.
                if (!in_array($tab_id, $tabs, true)) {
                    // Add it to the tabs array.
                    $tabs[$tab_id] = array('title' => $module_option['tab'], 'id' => $tab_id, 'section' => $section);
                }
            }
            $ext = ' ';
            if (isset($module_option['ext'])) {
                $ext = $module_option['ext'];
            }
            $affect_on_change_append = '';
            if (isset($module_option['affect_on_change_el']) && isset($module_option['affect_on_change_rule'])) {
                $affect_on_change_append = 'data-affect-on-change-el="' . $module_option['affect_on_change_el'] . '" data-affect-on-change-rule="' . $module_option['affect_on_change_rule'] . '"';
            }
            /**
             * List of options that need not toggle
             * – Enable/Disable Custom CSS
             * – Show On
             * – Presets controls
             * – Animation controls
             */
            $controls_without_toggle = array('css_custom', 'css_show_on', 'css_save_preset', 'css_load_preset', 'css_anim', 'css_anim_delay', 'css_anim_duration', 'css_anim_easing', 'content', 'css_res_t', 'css_res_p', 'image', 'elements', 'post_elements', 'carousel_elements', 'thumb_resize_width', 'thumb_resize_width_manual', 'button_icon_id', 'icon_pos', 'button_state', 'resize_width', 'resize_height');
            $control_with_toggle = '';
            $sections_with_toggle = array('styling', 'responsive');
            $module_option['section'] = isset($module_option['section']) ? $module_option['section'] : 'functionality';
            /**
             * Display styling control toggle [On/Off]
             */
            if (!in_array($module_option['id'], $controls_without_toggle, true) && in_array($module_option['section'], $sections_with_toggle, true)) {
                $control_with_toggle = 'dslca-option-with-toggle';
                if ('' === stripslashes($curr_value)) {
                    $control_with_toggle .= ' dslca-option-off';
                }
            }
            $dep = '';
            // Show/hide option controls that depend on current option.
            if (isset($module_option['dependent_controls'])) {
                $dep = ' data-dep="' . base64_encode(wp_json_encode($module_option['dependent_controls'])) . '"';
            }
            ?>

				<div class="dslca-module-edit-option dslca-module-edit-option-<?php 
            echo esc_attr($module_option['type']);
            ?>
 dslca-module-edit-option-<?php 
            echo esc_attr($module_option['id']);
            ?>
 <?php 
            if (!$visibility) {
                echo 'dslca-module-edit-option-hidden';
            }
            ?>
 <?php 
            echo esc_attr($control_with_toggle);
            ?>
"
					data-id="<?php 
            echo esc_attr($module_option['id']);
            ?>
"
					<?php 
            echo $dep;
            /* Base64 code. */
            ?>
					data-refresh-on-change="<?php 
            echo esc_attr($refresh_on_change);
            ?>
"
					data-section="<?php 
            echo esc_attr($section);
            ?>
"
					data-tab="<?php 
            echo esc_attr($tab_id);
            ?>
">

					<?php 
            if (isset($module_option['help'])) {
                ?>
						<div class="dslca-module-edit-field-ttip-content"><?php 
                echo esc_html($module_option['help']);
                ?>
</div>
					<?php 
            }
            ?>

					<span class="dslca-module-edit-label">
						<?php 
            if (isset($module_option['label'])) {
                echo esc_html($module_option['label']);
            }
            ?>
						<?php 
            /**
             * Display styling control toggle [On/Off]
             */
            if (!in_array($module_option['id'], $controls_without_toggle, true) && in_array($module_option['section'], $sections_with_toggle, true) && !stristr($module_option['id'], 'css_res_')) {
                echo '<span class="dslc-control-toggle dslc-icon dslc-icon-"></span>';
            }
            ?>
						<?php 
            if ('icon' === $module_option['type']) {
                ?>
							<span class="dslca-module-edit-field-icon-ttip-hook"><span class="dslca-icon dslc-icon-info"></span></span>
						<?php 
            }
            ?>
						<?php 
            if (isset($module_option['help'])) {
                ?>
							<span class="dslca-module-edit-field-ttip-hook"><span class="dslca-icon dslc-icon-info"></span></span>
						<?php 
            }
            ?>
					</span>

					<?php 
            if ('text' === $module_option['type']) {
                ?>

						<input type="text" class="dslca-module-edit-field" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr(stripslashes($curr_value));
                ?>
" data-starting-val="<?php 
                echo esc_attr(stripslashes($curr_value));
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

					<?php 
            } elseif ('textarea' === $module_option['type']) {
                ?>

						<textarea class="dslca-module-edit-field" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
><?php 
                echo stripslashes($curr_value);
                ?>
</textarea>

					<?php 
            } elseif ('select' === $module_option['type']) {
                ?>

						<select class="dslca-module-edit-field" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 >
							<?php 
                foreach ($module_option['choices'] as $select_option) {
                    ?>
								<option value="<?php 
                    echo $select_option['value'];
                    ?>
" <?php 
                    if ($curr_value == $select_option['value']) {
                        echo 'selected="selected"';
                    }
                    ?>
><?php 
                    echo $select_option['label'];
                    ?>
</option>
							<?php 
                }
                ?>
						</select>
						<span class="dslca-icon dslc-icon-caret-down"></span>

					<?php 
            } elseif ($module_option['type'] == 'checkbox') {
                ?>

						<?php 
                // Current Value Array.
                if (empty($curr_value)) {
                    $curr_value = array();
                } else {
                    $curr_value = explode(' ', trim($curr_value));
                }
                ?>

						<div class="dslca-module-edit-option-checkbox-wrapper">
							<?php 
                foreach ($module_option['choices'] as $checkbox_option) {
                    ?>
								<div class="dslca-module-edit-option-checkbox-single">
									<span class="dslca-module-edit-option-checkbox-hook"><span class="dslca-icon <?php 
                    if (in_array($checkbox_option['value'], $curr_value)) {
                        echo 'dslc-icon-check';
                    } else {
                        echo 'dslc-icon-check-empty';
                    }
                    ?>
"></span><?php 
                    echo $checkbox_option['label'];
                    ?>
</span>
									<input type="checkbox" class="dslca-module-edit-field dslca-module-edit-field-checkbox" data-id="<?php 
                    echo esc_attr($module_option['id']);
                    ?>
" name="<?php 
                    echo esc_attr($module_option['id']);
                    ?>
" value="<?php 
                    echo $checkbox_option['value'];
                    ?>
" <?php 
                    if (in_array($checkbox_option['value'], $curr_value)) {
                        echo 'checked="checked"';
                    }
                    ?>
 <?php 
                    echo $affect_on_change_append;
                    ?>
 />
								</div><!-- .dslca-module-edit-option-checkbox-single -->
							<?php 
                }
                ?>
						</div><!-- .dslca-module-edit-option-checkbox-wrapper -->

					<?php 
            } elseif ('radio' === $module_option['type']) {
                ?>

						<div class="dslca-module-edit-option-radio-wrapper">
							<?php 
                foreach ($module_option['choices'] as $checkbox_option) {
                    ?>
								<div class="dslca-module-edit-option-radio-single">
									<input type="radio" class="dslca-module-edit-field" data-id="<?php 
                    echo esc_attr($module_option['id']);
                    ?>
" name="<?php 
                    echo esc_attr($module_option['id']);
                    ?>
" value="<?php 
                    echo $checkbox_option['value'];
                    ?>
" /> <?php 
                    echo $checkbox_option['label'];
                    ?>
<br>
								</div><!-- .dslca-module-edit-option-radio-single -->
							<?php 
                }
                ?>
						</div><!-- .dslca-module-edit-option-radio-wrapper -->

					<?php 
            } elseif ('color' === $module_option['type']) {
                ?>

						<?php 
                $default_value = false;
                if (isset($module_option['std'])) {
                    $default_value = $module_option['std'];
                }
                $style = '';
                if ('' !== $curr_value) {
                    $text_color_value = $curr_value;
                    if (!strpos($curr_value, '#')) {
                        $text_color_value = dslc_rgbtohex($text_color_value);
                    }
                    $color = dslc_get_contrast_bw($text_color_value);
                    $style = ' style="background: ' . $curr_value . '; color: ' . $color . '"';
                }
                ?>

						<input type="text" class="dslca-module-edit-field dslca-module-edit-field-colorpicker" <?php 
                echo $style;
                ?>
 name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" data-affect-on-change-el="<?php 
                echo $module_option['affect_on_change_el'];
                ?>
" data-affect-on-change-rule="<?php 
                echo $module_option['affect_on_change_rule'];
                ?>
" <?php 
                if ($default_value) {
                    ?>
 data-default="<?php 
                    echo $default_value;
                    ?>
" <?php 
                }
                ?>
 />

					<?php 
            } elseif ('slider' === $module_option['type']) {
                ?>

						<?php 
                $slider_min = 0;
                $slider_max = 100;
                $slider_increment = 1;
                if (isset($module_option['min'])) {
                    $slider_min = $module_option['min'];
                }
                if (isset($module_option['max'])) {
                    $slider_max = $module_option['max'];
                }
                if (isset($module_option['increment'])) {
                    $slider_increment = $module_option['increment'];
                }
                ?>

						<div class="dslca-module-edit-field-numeric-wrap">
							<input type="number" class="dslca-module-edit-field dslca-module-edit-field-numeric" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" data-starting-val="<?php 
                echo esc_attr($curr_value);
                ?>
" data-min="<?php 
                echo esc_attr($slider_min);
                ?>
" data-max="<?php 
                echo esc_attr($slider_max);
                ?>
"  data-increment="<?php 
                echo esc_attr($slider_increment);
                ?>
" data-ext="<?php 
                echo esc_attr($ext);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />
							<span class="dslca-module-edit-field-numeric-ext"><?php 
                echo $module_option['ext'];
                ?>
</span>
						</div>

					<?php 
            } elseif ('font' === $module_option['type']) {
                ?>

						<div class="dslca-module-edit-field-font-wrapper">
							<input type="text" class="dslca-module-edit-field dslca-module-edit-field-font" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />
							<span class="dslca-module-edit-field-font-suggest"></span>
						</div>
						<span class="dslca-options-iconbutton dslca-module-edit-field-font-prev"><span class="dslca-icon dslc-icon-chevron-left"></span></span>
						<span class="dslca-options-iconbutton dslca-module-edit-field-font-next"><span class="dslca-icon dslc-icon-chevron-right"></span></span>

					<?php 
            } elseif ('icon' === $module_option['type']) {
                ?>

						<div class="dslca-module-edit-field-icon-wrapper">
							<input type="text" class="dslca-module-edit-field dslca-module-edit-field-icon" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />
							<span class="dslca-module-edit-field-icon-suggest"></span>
						</div>
						<span class="dslca-options-iconbutton dslca-open-modal-hook" data-modal=".dslc-list-icons-fontawesome"><span class="dslca-icon dslc-icon-th"></span></span>
						<span class="dslca-module-edit-field-icon-switch-set"><span class="dslca-icon dslc-icon-cog"></span> <span class="dslca-module-edit-field-icon-curr-set"><?php 
                echo dslc_icons_current_set($curr_value);
                ?>
</span></span>


					<?php 
            } elseif ('image' === $module_option['type']) {
                ?>

						<span class="dslca-module-edit-field-image-add-hook" <?php 
                if ($curr_value != '') {
                    echo 'style="display: none;"';
                }
                ?>
><span class="dslca-icon dslc-icon-cloud-upload"></span><?php 
                esc_html_e('Upload Image', 'live-composer-page-builder');
                ?>
</span>
						<span class="dslca-module-edit-field-image-remove-hook" <?php 
                if ($curr_value == '') {
                    echo 'style="display: none;"';
                }
                ?>
><span class="dslca-icon dslc-icon-remove"></span><?php 
                esc_html_e('Remove Image', 'live-composer-page-builder');
                ?>
</span>
						<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-image" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

					<?php 
            } elseif ('text_align' === $module_option['type']) {
                ?>

						<div class="dslca-module-edit-option-text-align-wrapper">
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'inherit') {
                    echo 'dslca-active';
                }
                ?>
" data-val="inherit">
								<span class="dslca-icon dslc-icon-remove"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'left') {
                    echo 'dslca-active';
                }
                ?>
" data-val="left">
								<span class="dslca-icon dslc-icon-align-left"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'center') {
                    echo 'dslca-active';
                }
                ?>
" data-val="center">
								<span class="dslca-icon dslc-icon-align-center"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'right') {
                    echo 'dslca-active';
                }
                ?>
" data-val="right">
								<span class="dslca-icon dslc-icon-align-right"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'justify') {
                    echo 'dslca-active';
                }
                ?>
" data-val="justify">
								<span class="dslca-icon dslc-icon-align-justify"></span>
							</div>
						</div>

						<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-text-align" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

					<?php 
            } elseif ('box_shadow' === $module_option['type']) {
                ?>

						<?php 
                $box_shadow_hor_val = 0;
                $box_shadow_ver_val = 0;
                $box_shadow_blur_val = 0;
                $box_shadow_spread_val = 0;
                $box_shadow_color_val = 'transparent';
                $box_shadow_inset_val = 'outset';
                $box_shadow_val = false;
                if ('' !== $curr_value) {
                    $box_shadow_val = explode(' ', $curr_value);
                }
                if (is_array($box_shadow_val)) {
                    $box_shadow_hor_val = str_replace('px', '', $box_shadow_val[0]);
                    $box_shadow_ver_val = str_replace('px', '', $box_shadow_val[1]);
                    $box_shadow_blur_val = str_replace('px', '', $box_shadow_val[2]);
                    $box_shadow_spread_val = str_replace('px', '', $box_shadow_val[3]);
                    $box_shadow_color_val = str_replace('px', '', $box_shadow_val[4]);
                    if (isset($box_shadow_val[5])) {
                        $box_shadow_inset_val = $box_shadow_val[5];
                    }
                }
                ?>

						<div class="dslca-module-edit-option-box-shadow-wrapper">

							<div class="dslca-module-edit-option-box-shadow-single">
								<span class="dslca-module-edit-option-checkbox-hook"><?php 
                esc_html_e('Inner', 'live-composer-page-builder');
                ?>
<span class="dslca-icon <?php 
                if ($box_shadow_inset_val == 'inset') {
                    echo 'dslc-icon-check';
                } else {
                    echo 'dslc-icon-check-empty';
                }
                ?>
"></span></span>
								<input type="checkbox" class="dslca-module-edit-field-checkbox dslca-module-edit-option-box-shadow-inset" <?php 
                if ($box_shadow_inset_val == 'inset') {
                    echo 'checked="checked"';
                }
                ?>
 />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                esc_html_e('Hor', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-hor" step="0.1" type="number" value="<?php 
                echo $box_shadow_hor_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                esc_html_e('Ver', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-ver" step="0.1" type="number" value="<?php 
                echo $box_shadow_ver_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                esc_html_e('Blur', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-blur" step="0.1" type="number" value="<?php 
                echo $box_shadow_blur_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                esc_html_e('Spread', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-spread" step="0.1" type="number" value="<?php 
                echo $box_shadow_spread_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                esc_html_e('Color', 'live-composer-page-builder');
                ?>
</span><input type="text" class="dslca-module-edit-option-box-shadow-color" value="<?php 
                echo $box_shadow_color_val;
                ?>
" />
							</div>

							<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-box-shadow" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

						</div><!-- .dslca-module-edit-option-box-shadow-wrapper -->

					<?php 
            } elseif ($module_option['type'] == 'text_shadow') {
                ?>

						<?php 
                $text_shadow_hor_val = 0;
                $text_shadow_ver_val = 0;
                $text_shadow_blur_val = 0;
                $text_shadow_color_val = 'transparent';
                $text_shadow_val = false;
                if ('' !== $curr_value) {
                    $text_shadow_val = explode(' ', $curr_value);
                }
                if (is_array($text_shadow_val)) {
                    $text_shadow_hor_val = str_replace('px', '', $text_shadow_val[0]);
                    $text_shadow_ver_val = str_replace('px', '', $text_shadow_val[1]);
                    $text_shadow_blur_val = str_replace('px', '', $text_shadow_val[2]);
                    $text_shadow_color_val = str_replace('px', '', $text_shadow_val[3]);
                }
                ?>

						<div class="dslca-module-edit-option-text-shadow-wrapper">

							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                esc_html_e('Hor', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-hor" step="0.1" type="number" value="<?php 
                echo $text_shadow_hor_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                esc_html_e('Ver', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-ver" step="0.1" type="number" value="<?php 
                echo $text_shadow_ver_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                esc_html_e('Blur', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-blur" step="0.1" type="number" value="<?php 
                echo $text_shadow_blur_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                esc_html_e('Color', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-color" type="text" value="<?php 
                echo $text_shadow_color_val;
                ?>
" />
							</div>

							<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-text-shadow" name="<?php 
                echo esc_attr($module_option['id']);
                ?>
" data-id="<?php 
                echo esc_attr($module_option['id']);
                ?>
" value="<?php 
                echo esc_attr($curr_value);
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

						</div><!-- .dslca-module-edit-option-text-shadow-wrapper -->

					<?php 
            } else {
                ?>

						<?php 
                if (has_action('dslc_custom_option_type_' . $module_option['type'])) {
                    ?>

							<?php 
                    do_action('dslc_custom_option_type_' . $module_option['type'], $module_option, $curr_value, $affect_on_change_append);
                    ?>

						<?php 
                } else {
                    ?>

							<input type="text" class="dslca-module-edit-field" name="<?php 
                    echo esc_attr($module_option['id']);
                    ?>
" data-id="<?php 
                    echo esc_attr($module_option['id']);
                    ?>
" value="<?php 
                    echo esc_attr($curr_value);
                    ?>
" data-starting-val="<?php 
                    echo $curr_value;
                    ?>
" <?php 
                    echo $affect_on_change_append;
                    ?>
 />

						<?php 
                }
                ?>

					<?php 
            }
            ?>

				</div><!-- .dslc-module-edit-option -->

			<?php 
        }
        $output_fields = ob_get_contents();
        ob_end_clean();
        // Output Start.
        $output_start = '<div class="dslca-module-edit-options-wrapper dslc-clearfix">';
        // Output End.
        $output_end = '</div>';
        // Output Tabs.
        $output_tabs = '';
        foreach ($tabs as $tab) {
            $output_tabs .= '<a href="#" class="dslca-module-edit-options-tab-hook" data-section="' . $tab['section'] . '" data-id="' . $tab['id'] . '">' . $tab['title'] . '</a>';
        }
        // Combine output.
        $response['output_tabs'] .= $output_tabs;
        $response['output'] .= $output_start;
        $response['output'] .= $output_fields;
        $response['output'] .= $output_end;
        // Encode response.
        $response_json = wp_json_encode($response);
        // Send the response.
        header('Content-Type: application/json');
        echo $response_json;
        // Auf wiedersehen.
        exit;
    }
}
Example #2
0
/**
 * Display module options
 *
 * @since 1.0
 */
function dslc_ajax_display_module_options($atts)
{
    // Allowed to do this?
    if (is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
        // The array we'll pass back to the AJAX call
        $response = array();
        // This will hold the output
        $response['output'] = '';
        $response['output_tabs'] = '';
        // The ID of the module
        $module_id = $_POST['dslc_module_id'];
        // Instanciate the module class
        $module_instance = new $module_id();
        // Get the module options
        $module_options = $module_instance->options();
        // Tabs
        $tabs = array();
        ob_start();
        // Go through each option, generate the option HTML and append to output
        foreach ($module_options as $module_option) {
            $curr_value = $module_option['std'];
            if (isset($_POST[$module_option['id']])) {
                $curr_value = $_POST[$module_option['id']];
            }
            /**
             * Visibility
             */
            if (isset($module_option['visibility'])) {
                $visibility = false;
            } else {
                $visibility = true;
            }
            if ($module_option['type'] == 'checkbox' && count($module_option['choices']) < 2) {
                $visibility = false;
            }
            /**
             * Refresh on change
             */
            if (isset($module_option['refresh_on_change'])) {
                if ($module_option['refresh_on_change']) {
                    $refresh_on_change = 'active';
                } else {
                    $refresh_on_change = 'inactive';
                }
            } else {
                $refresh_on_change = 'active';
            }
            // Force refresh on change for images ( due to the URL -> ID change )
            if ($module_option['type'] == 'image') {
                $refresh_on_change = 'active';
            }
            /**
             * Section (functionality and styling)
             */
            if (isset($module_option['section'])) {
                $section = $module_option['section'];
            } else {
                $section = 'functionality';
            }
            /**
             * Tab
             */
            if (!isset($module_option['tab'])) {
                if ($section == 'functionality') {
                    $tabs['general_functionality'] = array('title' => __('General', 'live-composer-page-builder'), 'id' => 'general_functionality', 'section' => 'functionality');
                } else {
                    $tabs['general_styling'] = array('title' => __('General', 'live-composer-page-builder'), 'id' => 'general_styling', 'section' => 'styling');
                }
                $tab_ID = 'general_' . $section;
            }
            if (isset($module_option['tab'])) {
                // Lowercase it
                $tab_ID = strtolower($module_option['tab']);
                // Replace spaces with _
                $tab_ID = str_replace(' ', '_', $tab_ID);
                // Add section ID append
                $tab_ID .= '_' . $section;
                // If not already in the tabs array
                if (!in_array($tab_ID, $tabs)) {
                    // Add it to the tabs array
                    $tabs[$tab_ID] = array('title' => $module_option['tab'], 'id' => $tab_ID, 'section' => $section);
                }
            }
            $ext = ' ';
            if (isset($module_option['ext'])) {
                $ext = $module_option['ext'];
            }
            $affect_on_change_append = '';
            if (isset($module_option['affect_on_change_el']) && isset($module_option['affect_on_change_rule'])) {
                $affect_on_change_append = 'data-affect-on-change-el="' . $module_option['affect_on_change_el'] . '" data-affect-on-change-rule="' . $module_option['affect_on_change_rule'] . '"';
            }
            ?>
	

				<div class="dslca-module-edit-option dslca-module-edit-option-<?php 
            echo $module_option['type'];
            ?>
 dslca-module-edit-option-<?php 
            echo $module_option['id'];
            ?>
 <?php 
            if (!$visibility) {
                echo 'dslca-module-edit-option-hidden';
            }
            ?>
" data-id="<?php 
            echo $module_option['id'];
            ?>
" data-refresh-on-change="<?php 
            echo $refresh_on_change;
            ?>
" data-section="<?php 
            echo $section;
            ?>
" data-tab="<?php 
            echo $tab_ID;
            ?>
">

					<?php 
            if (isset($module_option['help'])) {
                ?>
						<div class="dslca-module-edit-field-ttip-content"><?php 
                echo $module_option['help'];
                ?>
</div>
					<?php 
            }
            ?>

					<span class="dslca-module-edit-label">
						<?php 
            echo $module_option['label'];
            ?>
						<?php 
            if ($module_option['type'] == 'icon') {
                ?>
							<span class="dslca-module-edit-field-icon-ttip-hook"><span class="dslca-icon dslc-icon-info"></span></span>
							<span class="dslca-module-edit-field-icon-switch-set"><span class="dslca-module-edit-field-icon-curr-set"><?php 
                echo dslc_icons_current_set($curr_value);
                ?>
</span><span class="dslca-icon dslc-icon-cog"></span></span>
						<?php 
            }
            ?>
						<?php 
            if (isset($module_option['help'])) {
                ?>
							<span class="dslca-module-edit-field-ttip-hook"><span class="dslca-icon dslc-icon-info"></span></span>
						<?php 
            }
            ?>
					</span>

					<?php 
            if ($module_option['type'] == 'text') {
                ?>
						
						<input type="text" class="dslca-module-edit-field" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo esc_attr(stripslashes($curr_value));
                ?>
" data-starting-val="<?php 
                echo esc_attr(stripslashes($curr_value));
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

					<?php 
            } elseif ($module_option['type'] == 'textarea') {
                ?>

						<textarea class="dslca-module-edit-field" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
><?php 
                echo stripslashes($curr_value);
                ?>
</textarea>

					<?php 
            } elseif ($module_option['type'] == 'select') {
                ?>

						<select class="dslca-module-edit-field" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 >
							<?php 
                foreach ($module_option['choices'] as $select_option) {
                    ?>
								<option value="<?php 
                    echo $select_option['value'];
                    ?>
" <?php 
                    if ($curr_value == $select_option['value']) {
                        echo 'selected="selected"';
                    }
                    ?>
><?php 
                    echo $select_option['label'];
                    ?>
</option>
							<?php 
                }
                ?>
						</select>

					<?php 
            } elseif ($module_option['type'] == 'checkbox') {
                ?>

						<?php 
                // Current Value Array
                if (empty($curr_value)) {
                    $curr_value = array();
                } else {
                    $curr_value = explode(' ', trim($curr_value));
                }
                // Determined brakepoints
                $chck_amount = count($module_option['choices']);
                $chck_breakpoint = ceil($chck_amount / 1);
                $chck_count = 0;
                ?>

						<div class="dslca-module-edit-option-checkbox-wrapper">
							<?php 
                foreach ($module_option['choices'] as $checkbox_option) {
                    $chck_count++;
                    ?>
								<div class="dslca-module-edit-option-checkbox-single">
									<span class="dslca-module-edit-option-checkbox-hook"><span class="dslca-icon <?php 
                    if (in_array($checkbox_option['value'], $curr_value)) {
                        echo 'dslc-icon-check';
                    } else {
                        echo 'dslc-icon-check-empty';
                    }
                    ?>
"></span><?php 
                    echo $checkbox_option['label'];
                    ?>
</span>
									<input type="checkbox" class="dslca-module-edit-field dslca-module-edit-field-checkbox" data-id="<?php 
                    echo $module_option['id'];
                    ?>
" name="<?php 
                    echo $module_option['id'];
                    ?>
" value="<?php 
                    echo $checkbox_option['value'];
                    ?>
" <?php 
                    if (in_array($checkbox_option['value'], $curr_value)) {
                        echo 'checked="checked"';
                    }
                    ?>
 <?php 
                    echo $affect_on_change_append;
                    ?>
 />
								</div><!-- .dslca-module-edit-option-checkbox-single -->
								<?php 
                    if ($chck_count == $chck_breakpoint) {
                        echo '<br>';
                        $chck_count = 0;
                    }
                    ?>
							<?php 
                }
                ?>
						</div><!-- .dslca-module-edit-option-checkbox-wrapper -->

					<?php 
            } elseif ($module_option['type'] == 'radio') {
                ?>

						<div class="dslca-module-edit-option-radio-wrapper">
							<?php 
                foreach ($module_option['choices'] as $checkbox_option) {
                    ?>
								<div class="dslca-module-edit-option-radio-single">
									<input type="radio" class="dslca-module-edit-field" data-id="<?php 
                    echo $module_option['id'];
                    ?>
" name="<?php 
                    echo $module_option['id'];
                    ?>
" value="<?php 
                    echo $checkbox_option['value'];
                    ?>
" /> <?php 
                    echo $checkbox_option['label'];
                    ?>
<br>
								</div><!-- .dslca-module-edit-option-radio-single -->
							<?php 
                }
                ?>
						</div><!-- .dslca-module-edit-option-radio-wrapper -->

					<?php 
            } elseif ($module_option['type'] == 'color') {
                ?>

						<?php 
                $default_value = false;
                if (isset($module_option['std'])) {
                    $default_value = $module_option['std'];
                }
                ?>

						<input type="text" class="dslca-module-edit-field dslca-module-edit-field-colorpicker" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" data-affect-on-change-el="<?php 
                echo $module_option['affect_on_change_el'];
                ?>
" data-affect-on-change-rule="<?php 
                echo $module_option['affect_on_change_rule'];
                ?>
" <?php 
                if ($default_value) {
                    ?>
 data-default="<?php 
                    echo $default_value;
                    ?>
" <?php 
                }
                ?>
 />

					<?php 
            } elseif ($module_option['type'] == 'slider') {
                ?>

						<?php 
                $slider_min = 0;
                $slider_max = 100;
                $slider_increment = 1;
                if (isset($module_option['min'])) {
                    $slider_min = $module_option['min'];
                }
                if (isset($module_option['max'])) {
                    $slider_max = $module_option['max'];
                }
                if (isset($module_option['increment'])) {
                    $slider_increment = $module_option['increment'];
                }
                $numeric_option_type = dslc_get_option('lc_numeric_opt_type', 'dslc_plugin_options_other');
                if (empty($numeric_option_type)) {
                    $numeric_option_type = 'slider';
                }
                ?>

						<?php 
                if ($numeric_option_type == 'slider') {
                    ?>

							<div class="dslca-module-edit-field-slider"></div>
							<span class="dslca-module-edit-field-slider-tooltip"><?php 
                    echo $curr_value;
                    ?>
</span>
							<input type="hidden" class="dslca-module-edit-field" name="<?php 
                    echo $module_option['id'];
                    ?>
" data-id="<?php 
                    echo $module_option['id'];
                    ?>
" value="<?php 
                    echo $curr_value;
                    ?>
" data-affect-on-change-el="<?php 
                    echo $module_option['affect_on_change_el'];
                    ?>
" data-affect-on-change-rule="<?php 
                    echo $module_option['affect_on_change_rule'];
                    ?>
" data-min="<?php 
                    echo $slider_min;
                    ?>
" data-max="<?php 
                    echo $slider_max;
                    ?>
" data-ext="<?php 
                    echo $ext;
                    ?>
" data-increment="<?php 
                    echo $slider_increment;
                    ?>
" />

						<?php 
                } else {
                    ?>

							<div class="dslca-module-edit-field-numeric-wrap">
								<input type="text" class="dslca-module-edit-field dslca-module-edit-field-numeric" name="<?php 
                    echo $module_option['id'];
                    ?>
" data-id="<?php 
                    echo $module_option['id'];
                    ?>
" value="<?php 
                    echo $curr_value;
                    ?>
" data-starting-val="<?php 
                    echo $curr_value;
                    ?>
" data-ext="<?php 
                    echo $ext;
                    ?>
" <?php 
                    echo $affect_on_change_append;
                    ?>
 />
								<span class="dslca-module-edit-field-numeric-ext"><?php 
                    echo $module_option['ext'];
                    ?>
</span>
							</div>


						<?php 
                }
                ?>

					<?php 
            } elseif ($module_option['type'] == 'font') {
                ?>
						
						<div class="dslca-module-edit-field-font-wrapper">
							<input type="text" class="dslca-module-edit-field dslca-module-edit-field-font" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />
							<span class="dslca-module-edit-field-font-suggest"></span>
						</div>
						<span class="dslca-module-edit-field-font-prev"><span class="dslca-icon dslc-icon-chevron-left"></span></span>
						<span class="dslca-module-edit-field-font-next"><span class="dslca-icon dslc-icon-chevron-right"></span></span>

					<?php 
            } elseif ($module_option['type'] == 'icon') {
                ?>
						
						<div class="dslca-module-edit-field-icon-wrapper">
							<input type="text" class="dslca-module-edit-field dslca-module-edit-field-icon" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />
							<span class="dslca-module-edit-field-icon-suggest"></span>
						</div>
						<span class="dslca-module-edit-field-icon-prev"><span class="dslca-icon dslc-icon-chevron-left"></span></span>
						<span class="dslca-module-edit-field-icon-next"><span class="dslca-icon dslc-icon-chevron-right"></span></span>

					<?php 
            } elseif ($module_option['type'] == 'image') {
                ?>

						<span class="dslca-module-edit-field-image-add-hook" <?php 
                if ($curr_value != '') {
                    echo 'style="display: none;"';
                }
                ?>
><span class="dslca-icon dslc-icon-cloud-upload"></span><?php 
                _e('Upload Image', 'live-composer-page-builder');
                ?>
</span>
						<span class="dslca-module-edit-field-image-remove-hook" <?php 
                if ($curr_value == '') {
                    echo 'style="display: none;"';
                }
                ?>
><span class="dslca-icon dslc-icon-remove"></span><?php 
                _e('Remove Image', 'live-composer-page-builder');
                ?>
</span>
						<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-image" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

					<?php 
            } elseif ($module_option['type'] == 'text_align') {
                ?>

						<div class="dslca-module-edit-option-text-align-wrapper">
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'inherit') {
                    echo 'dslca-active';
                }
                ?>
" data-val="inherit">
								<span class="dslca-icon dslc-icon-remove"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'left') {
                    echo 'dslca-active';
                }
                ?>
" data-val="left">
								<span class="dslca-icon dslc-icon-align-left"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'center') {
                    echo 'dslca-active';
                }
                ?>
" data-val="center">
								<span class="dslca-icon dslc-icon-align-center"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'right') {
                    echo 'dslca-active';
                }
                ?>
" data-val="right">
								<span class="dslca-icon dslc-icon-align-right"></span>
							</div>
							<div class="dslca-module-edit-option-text-align-single dslca-module-edit-option-text-align-hook <?php 
                if ($curr_value == 'justify') {
                    echo 'dslca-active';
                }
                ?>
" data-val="justify">
								<span class="dslca-icon dslc-icon-align-justify"></span>
							</div>
						</div>

						<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-text-align" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

					<?php 
            } elseif ($module_option['type'] == 'box_shadow') {
                ?>

						<?php 
                $box_shadow_hor_val = 0;
                $box_shadow_ver_val = 0;
                $box_shadow_blur_val = 0;
                $box_shadow_spread_val = 0;
                $box_shadow_color_val = 'transparent';
                $box_shadow_inset_val = 'outset';
                $box_shadow_val = false;
                if ($curr_value !== '') {
                    $box_shadow_val = explode(' ', $curr_value);
                }
                if (is_array($box_shadow_val)) {
                    $box_shadow_hor_val = str_replace('px', '', $box_shadow_val[0]);
                    $box_shadow_ver_val = str_replace('px', '', $box_shadow_val[1]);
                    $box_shadow_blur_val = str_replace('px', '', $box_shadow_val[2]);
                    $box_shadow_spread_val = str_replace('px', '', $box_shadow_val[3]);
                    $box_shadow_color_val = str_replace('px', '', $box_shadow_val[4]);
                    if (isset($box_shadow_val[5])) {
                        $box_shadow_inset_val = $box_shadow_val[5];
                    }
                }
                ?>

						<div class="dslca-module-edit-option-box-shadow-wrapper">

							<div class="dslca-module-edit-option-box-shadow-single">								
								<span class="dslca-module-edit-option-checkbox-hook"><?php 
                _e('Inner', 'live-composer-page-builder');
                ?>
<span class="dslca-icon <?php 
                if ($box_shadow_inset_val == 'inset') {
                    echo 'dslc-icon-check';
                } else {
                    echo 'dslc-icon-check-empty';
                }
                ?>
"></span></span>
								<input type="checkbox" class="dslca-module-edit-field-checkbox dslca-module-edit-option-box-shadow-inset" <?php 
                if ($box_shadow_inset_val == 'inset') {
                    echo 'checked="checked"';
                }
                ?>
 />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                _e('Hor', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-hor" step="0.1" type="number" value="<?php 
                echo $box_shadow_hor_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                _e('Ver', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-ver" step="0.1" type="number" value="<?php 
                echo $box_shadow_ver_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                _e('Blur', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-blur" step="0.1" type="number" value="<?php 
                echo $box_shadow_blur_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                _e('Spread', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-spread" step="0.1" type="number" value="<?php 
                echo $box_shadow_spread_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-box-shadow-single">
								<span><?php 
                _e('Color', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-box-shadow-color" type="text" value="<?php 
                echo $box_shadow_color_val;
                ?>
" />
							</div>

							<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-box-shadow" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

						</div><!-- .dslca-module-edit-option-box-shadow-wrapper -->

					<?php 
            } elseif ($module_option['type'] == 'text_shadow') {
                ?>

						<?php 
                $text_shadow_hor_val = 0;
                $text_shadow_ver_val = 0;
                $text_shadow_blur_val = 0;
                $text_shadow_color_val = 'transparent';
                $text_shadow_val = false;
                if ($curr_value !== '') {
                    $text_shadow_val = explode(' ', $curr_value);
                }
                if (is_array($text_shadow_val)) {
                    $text_shadow_hor_val = str_replace('px', '', $text_shadow_val[0]);
                    $text_shadow_ver_val = str_replace('px', '', $text_shadow_val[1]);
                    $text_shadow_blur_val = str_replace('px', '', $text_shadow_val[2]);
                    $text_shadow_color_val = str_replace('px', '', $text_shadow_val[4]);
                }
                ?>

						<div class="dslca-module-edit-option-text-shadow-wrapper">

							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                _e('Hor', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-hor" step="0.1" type="number" value="<?php 
                echo $text_shadow_hor_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                _e('Ver', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-ver" step="0.1" type="number" value="<?php 
                echo $text_shadow_ver_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                _e('Blur', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-blur" step="0.1" type="number" value="<?php 
                echo $text_shadow_blur_val;
                ?>
" />
							</div>
							<div class="dslca-module-edit-option-text-shadow-single">
								<span><?php 
                _e('Color', 'live-composer-page-builder');
                ?>
</span><input class="dslca-module-edit-option-text-shadow-color" type="text" value="<?php 
                echo $text_shadow_color_val;
                ?>
" />
							</div>

							<input type="hidden" class="dslca-module-edit-field dslca-module-edit-field-text-shadow" name="<?php 
                echo $module_option['id'];
                ?>
" data-id="<?php 
                echo $module_option['id'];
                ?>
" value="<?php 
                echo $curr_value;
                ?>
" <?php 
                echo $affect_on_change_append;
                ?>
 />

						</div><!-- .dslca-module-edit-option-text-shadow-wrapper -->

					<?php 
            } else {
                ?>

						<?php 
                if (has_action('dslc_custom_option_type_' . $module_option['type'])) {
                    ?>

							<?php 
                    do_action('dslc_custom_option_type_' . $module_option['type'], $module_option, $curr_value, $affect_on_change_append);
                    ?>

						<?php 
                } else {
                    ?>
						
							<input type="text" class="dslca-module-edit-field" name="<?php 
                    echo $module_option['id'];
                    ?>
" data-id="<?php 
                    echo $module_option['id'];
                    ?>
" value="<?php 
                    echo $curr_value;
                    ?>
" data-starting-val="<?php 
                    echo $curr_value;
                    ?>
" <?php 
                    echo $affect_on_change_append;
                    ?>
 />

						<?php 
                }
                ?>

					<?php 
            }
            ?>

				</div><!-- .dslc-module-edit-option -->

			<?php 
        }
        $output_fields = ob_get_contents();
        ob_end_clean();
        // Output Start
        $output_start = '<div class="dslca-module-edit-options-wrapper dslc-clearfix">';
        // Output End
        $output_end = '</div>';
        // Output Tabs
        $output_tabs = '';
        foreach ($tabs as $tab) {
            $output_tabs .= '<span class="dslca-module-edit-options-tab-hook" data-section="' . $tab['section'] . '" data-id="' . $tab['id'] . '">' . $tab['title'] . '</span>';
        }
        // Combine output
        $response['output_tabs'] .= $output_tabs;
        $response['output'] .= $output_start;
        $response['output'] .= $output_fields;
        $response['output'] .= $output_end;
        // Encode response
        $response_json = json_encode($response);
        // Send the response
        header("Content-Type: application/json");
        echo $response_json;
        // Auf wiedersehen
        exit;
    }
}