Exemple #1
0
 /**
  * Wrap output html of a shortcode
  *
  * @param array $arr_params
  * @param string $html_element
  * @param string $extra_class
  * @return string
  */
 public function element_wrapper($html_element, $arr_params, $extra_class = '', $custom_style = '')
 {
     $shortcode_name = WR_Pb_Helper_Shortcode::shortcode_name($this->config['shortcode']);
     // extract margin here then insert inline style to wrapper div
     $styles = array();
     if (!empty($arr_params['div_margin_top'])) {
         $styles[] = 'margin-top:' . intval($arr_params['div_margin_top']) . 'px';
     }
     if (!empty($arr_params['div_margin_bottom'])) {
         $styles[] = 'margin-bottom:' . intval($arr_params['div_margin_bottom']) . 'px';
     }
     if (!empty($arr_params['div_margin_left'])) {
         $styles[] = 'margin-left:' . intval($arr_params['div_margin_left']) . 'px';
     }
     if (!empty($arr_params['div_margin_right'])) {
         $styles[] = 'margin-right:' . intval($arr_params['div_margin_right']) . 'px';
     }
     $style = count($styles) ? implode('; ', $styles) : '';
     if (!empty($style) || !empty($custom_style)) {
         $style = "style='{$style} {$custom_style}'";
     }
     $class = "jsn-bootstrap3 wr-element-container wr-element-{$shortcode_name}";
     $extra_class .= !empty($arr_params['css_suffix']) ? ' ' . esc_attr($arr_params['css_suffix']) : '';
     $class .= !empty($extra_class) ? ' ' . ltrim($extra_class, ' ') : '';
     $extra_id = !empty($arr_params['id_wrapper']) ? ' ' . esc_attr($arr_params['id_wrapper']) : '';
     $extra_id = !empty($extra_id) ? "id='" . ltrim($extra_id, ' ') . "'" : '';
     // Element appearing animation
     $appearring_animation = '';
     if (!empty($arr_params['appearing_animation']) && $arr_params['appearing_animation'] != '0') {
         $animation_speed = '0.6';
         if (!empty($arr_params['appearing_animation_speed'])) {
             switch ($arr_params['appearing_animation_speed']) {
                 case 'Slow':
                     $animation_speed = '0.9';
                     break;
                 case 'Medium':
                     $animation_speed = '0.6';
                     break;
                 case 'Fast':
                     $animation_speed = '0.3';
                     break;
             }
         }
         switch ($arr_params['appearing_animation']) {
             case 'slide_from_top':
                 $appearring_animation = ' data-scroll-reveal="enter top and move 150px over ' . $animation_speed . 's" ';
                 break;
             case 'slide_from_right':
                 $appearring_animation = ' data-scroll-reveal="enter right and move 150px over ' . $animation_speed . 's" ';
                 break;
             case 'slide_from_bottom':
                 $appearring_animation = ' data-scroll-reveal="enter bottom and move 150px over ' . $animation_speed . 's" ';
                 break;
             case 'slide_from_left':
                 $appearring_animation = ' data-scroll-reveal="enter left and move 150px over ' . $animation_speed . 's" ';
                 break;
             case 'fade_in':
                 $appearring_animation = ' data-scroll-reveal="ease-in 0px over ' . $animation_speed . 's" ';
                 break;
         }
     }
     $html = "<div  {$extra_id} class='{$class}' {$style}>" . balanceTags($html_element) . '</div>';
     if ($appearring_animation) {
         $html = "<div {$appearring_animation}>" . $html . "</div>";
     }
     return $html;
 }
Exemple #2
0
if (!empty($shortcode)) {
    $script = '';
    if (isset($init_tab) && $init_tab == 'styling') {
        // Auto move to Styling tab if previous action
        // is coping style from other element.
        $script .= "\n\t\t\t(function (\$) {\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tsetTimeout(function (){\n\t\t\t\t\t\t\$('[href=\"#styling\"]').click();\n\t\t\t\t\t}, 500);\n\n\t\t\t\t});\n\t\t\t})(jQuery);";
    }
    if ($_REQUEST['form_only']) {
        $script .= " var wr_pb_modal_ajax = true;";
    }
    WR_Pb_Init_Assets::print_inline('js', $script, true);
    ?>

<div
	id="wr-element-<?php 
    echo esc_attr(WR_Pb_Helper_Shortcode::shortcode_name($shortcode));
    ?>
">
	<div class="wr-pb-form-container jsn-bootstrap3">
		<div id="modalOptions"
			class="form <?php 
    echo esc_attr($submodal);
    ?>
">
			<?php 
    if (!empty($params)) {
        $params = stripslashes($params);
        $params = urldecode($params);
    }
    // elements
    if ($el_type == 'element') {