Beispiel #1
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $random_id = WR_Pb_Utils_Common::random_string();
     $tooltip_id = "tooltip_{$random_id}";
     // don't allow to run shortcode
     $content = str_replace('[', '[[', $content);
     $content = str_replace(']', ']]', $content);
     $content = html_entity_decode($content);
     $content = preg_replace('/\\s+/', ' ', trim($content));
     $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color;
     $position = strtolower($position);
     $delay_show = !empty($show) ? intval($show) : 500;
     $delay_hide = !empty($hide) ? intval($hide) : 100;
     $direction = array('top' => 'top', 'bottom' => 'bottom', 'left' => 'left', 'right' => 'right');
     $script = "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$('#{$tooltip_id}').click(function(e){\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t})\n\t\t\t\t\t\$('#{$tooltip_id}').tooltip({\n\t\t\t\t\t\thtml: true,\n\t\t\t\t\t\tdelay: { show: {$delay_show}, hide: {$delay_hide} },\n\t\t\t\t\t\tplacement: '{$direction[$position]}'\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>";
     if ($tooltips_button == 'no') {
         $html = "<a id='{$tooltip_id}' class='wr-label-des-tipsy' title='{$content}' href='#'>{$text}</a>";
     } else {
         $html = "<a id='{$tooltip_id}' class='wr-label-des-tipsy btn {$button_color}' title='{$content}' href='#'>{$text}</a>";
     }
     $html = $html . $script;
     if (is_admin()) {
         $custom_style = "style='margin-top: 50px;'";
         $html_element = "<center {$custom_style}>{$html}</center>";
     } else {
         $html_element = $html;
     }
     return $this->element_wrapper($html_element, $arr_params);
 }
Beispiel #2
0
        /**
         *
         * @param type $content			 : inner shortcode elements of this column
         * @param string $shortcode_data
         * @return string
         */
        public function element_in_pgbldr($content = '', $shortcode_data = '')
        {
            $column_html = empty($content) ? '' : WR_Pb_Helper_Shortcode::do_shortcode_admin($content, true);
            $span = !empty($this->params['span']) ? $this->params['span'] : 'span12';
            if (empty($shortcode_data)) {
                $shortcode_data = $this->config['shortcode_structure'];
            }
            // remove [/wr_row][wr_column...] from $shortcode_data
            $shortcode_data = explode('][', $shortcode_data);
            $shortcode_data = $shortcode_data[0] . ']';
            // Remove empty value attributes of shortcode tag.
            $shortcode_data = preg_replace('/\\[*([a-z_]*[\\n\\s\\t]*=[\\n\\s\\t]*"")/', '', $shortcode_data);
            $rnd_id = WR_Pb_Utils_Common::random_string();
            $column[] = '<div class="jsn-column-container clearafter shortcode-container ">
							<div class="jsn-column ' . $span . '">
								<div class="thumbnail clearafter">
									<textarea class="hidden" data-sc-info="shortcode_content" name="shortcode_content[]" >' . $shortcode_data . '</textarea>
									<div class="jsn-column-content item-container" data-column-class="' . $span . '" >
										<div class="jsn-handle-drag jsn-horizontal jsn-iconbar-trigger">
											<div class="jsn-iconbar layout">
												<a href="javascript:void(0);" title="Edit Column" data-shortcode="' . $this->config['shortcode'] . '" class="element-edit column" data-use-ajax="' . ($this->config['edit_using_ajax'] ? 1 : 0) . '"><i class="icon-pencil"></i></a>
												<a class="item-delete column" onclick="return false;" title="' . __('Delete column', WR_PBL) . '" href="#"><i class="icon-trash"></i></a>
											</div>
										</div>
										<div class="jsn-element-container item-container-content">
											' . $column_html . '</div>
										<a class="jsn-add-more wr-more-element" href="javascript:void(0);"><i class="icon-plus"></i>' . __('Add Element', WR_PBL) . '</a>
									</div>
									<textarea class="hidden" name="shortcode_content[]" >[/' . $this->config['shortcode'] . ']</textarea>
								</div>
							</div>
						</div>';
            return $column;
        }
Beispiel #3
0
 /**
  * Remove cache folder
  *
  * @return type
  */
 static function remove_cache_folder()
 {
     $cache_dir = WP_CONTENT_DIR . '/uploads' . '/igcache/pagebuilder';
     WR_Pb_Utils_Common::recursive_delete($cache_dir);
     // if directory still exits, false
     if (is_dir($dir)) {
         return false;
     }
     return true;
 }
Beispiel #4
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $random_id = WR_Pb_Utils_Common::random_string();
     $carousel_id = "carousel_{$random_id}";
     $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000;
     $interval = $automatic_cycling == 'yes' ? $interval_time : 'false';
     $pause = $pause_mouseover == 'yes' ? 'pause : "hover"' : '';
     $script = "<script type='text/javascript'>(function (\$){ \$( document ).ready(function(){if( \$( '#{$carousel_id}' ).length ){ \$( '#{$carousel_id}' ).carousel( {interval: {$interval},{$pause}} );}});} )( jQuery )</script>";
     $styles = array();
     if (!empty($dimension_width)) {
         $styles[] = "width : {$dimension_width}{$dimension_width_unit};";
     }
     if (!empty($dimension_height)) {
         $styles[] = "height : {$dimension_height}px;";
     }
     if (in_array($align, array('left', 'right', 'inherit'))) {
         $styles[] = "float : {$align};";
     } else {
         if ($align == 'center') {
             $styles[] = 'margin : 0 auto;';
         }
     }
     $styles = trim(implode(' ', $styles));
     $styles = !empty($styles) ? "style='{$styles}'" : '';
     $carousel_indicators = array();
     $carousel_indicators[] = '<ol class="carousel-indicators">';
     $sub_shortcode = do_shortcode($content);
     $items = explode('<!--seperate-->', $sub_shortcode);
     $items = array_filter($items);
     $initial_open = isset($initial_open) ? $initial_open > count($items) ? 1 : $initial_open : 1;
     foreach ($items as $idx => $item) {
         $active = $idx + 1 == $initial_open ? 'active' : '';
         $item = str_replace('{active}', $active, $item);
         $item = str_replace('{WIDTH}', !empty($dimension_width) ? (string) $dimension_width : '', $item);
         $item = str_replace('{HEIGHT}', !empty($dimension_height) ? (string) $dimension_height : '', $item);
         $items[$idx] = $item;
         $active_li = $idx + 1 == $initial_open ? "class='active'" : '';
         $carousel_indicators[] = "<li {$active_li}></li>";
     }
     $carousel_content = "<div class='carousel-inner'>" . implode('', $items) . '</div>';
     $carousel_indicators[] = '</ol>';
     $carousel_indicators = implode('', $carousel_indicators);
     if ($show_indicator == 'no') {
         $carousel_indicators = '';
     }
     $carousel_navigator = '';
     if ($show_arrows == 'yes') {
         $carousel_navigator = "<a class='left carousel-control'><span class='icon-arrow-left'></span></a><a class='right carousel-control'><span class='icon-arrow-right'></span></a>";
     }
     $html = "<div class='carousel slide' {$styles} id='{$carousel_id}'>{$carousel_indicators} {$carousel_content} {$carousel_navigator}</div>";
     return $this->element_wrapper($html . $script, $arr_params);
 }
Beispiel #5
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     $initial_open = intval($arr_params['initial_open']);
     $tab_position = $arr_params['tab_position'];
     $random_id = WR_Pb_Utils_Common::random_string();
     $tab_navigator = array();
     $tab_navigator[] = '<ul class="nav nav-tabs">';
     $sub_shortcode = do_shortcode($content);
     $items = explode('<!--seperate-->', $sub_shortcode);
     $items = array_filter($items);
     $initial_open = $initial_open > count($items) ? 1 : $initial_open;
     $fade_effect = '';
     if ($arr_params['fade_effect'] == 'yes') {
         $fade_effect = 'fade in';
     }
     foreach ($items as $idx => $item) {
         // Extract icon & heading
         $ex_heading = explode('<!--heading-->', $item);
         $ex_icon = explode('<!--icon-->', isset($ex_heading[1]) ? $ex_heading[1] : '');
         $new_key = $random_id . $idx;
         $active = $idx + 1 == $initial_open ? 'active' : '';
         $item = isset($ex_icon[1]) ? $ex_icon[1] : '';
         $item = str_replace('{index}', $new_key, $item);
         $item = str_replace('{active}', $active, $item);
         $item = str_replace('{fade_effect}', $fade_effect, $item);
         $items[$idx] = $item;
         $icon = !empty($ex_icon[0]) ? "<i class='{$ex_icon[0]}'></i>&nbsp;" : '';
         $heading = !empty($ex_heading[0]) ? $ex_heading[0] : __('Tab Item ') . ' ' . $idx;
         WR_Pb_Helper_Functions::heading_icon($heading, $icon);
         $active_li = $idx + 1 == $initial_open ? "class='active'" : '';
         $tab_navigator[] = "<li {$active_li}><a href='#pane{$new_key}'>{$icon}{$heading}</a></li>";
     }
     $sub_shortcode = implode('', $items);
     $tab_content = "<div class='tab-content'>{$sub_shortcode}</div>";
     // update min-height of each tab content in case tap position is left/right
     if (in_array($tab_position, array('left', 'right'))) {
         $min_height = 36 * count($items);
         $tab_content = WR_Pb_Utils_Placeholder::remove_placeholder($tab_content, 'custom_style', "style='min-height: {$min_height}px'");
     }
     $tab_navigator[] = '</ul>';
     $tab_positions = array('top' => '', 'left' => 'tabs-left', 'right' => 'tabs-right', 'bottom' => 'tabs-below');
     $extra_class = $tab_positions[$tab_position];
     if ($tab_position == 'bottom') {
         $tab_content .= implode('', $tab_navigator);
     } else {
         $tab_content = implode('', $tab_navigator) . $tab_content;
     }
     $html_element = "<div class='tabbable {$extra_class}' id='tab_{ID}'>{$tab_content}</div>";
     $html_element = str_replace('{ID}', "{$random_id}", $html_element);
     return $this->element_wrapper($html_element, $arr_params);
 }
Beispiel #6
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     $initial_open = intval($arr_params['initial_open']);
     $multi_open = $arr_params['multi_open'];
     $filter = $arr_params['filter'];
     $random_id = WR_Pb_Utils_Common::random_string();
     $script = '';
     extract($arr_params);
     if ($multi_open == 'no') {
         $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t// Bind event click accordion\n\t\t\t\t\t\$( '#accordion_{$random_id} .panel-title a' ).on('click', function (e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\$('#accordion_{$random_id} .in').collapse('hide');\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>";
     }
     $sub_shortcode = do_shortcode($content);
     $items = explode('<!--seperate-->', $sub_shortcode);
     // remove empty element
     $items = array_filter($items);
     // update id, class for each item
     $initial_open = $initial_open > count($items) ? 1 : $initial_open;
     foreach ($items as $idx => $item) {
         $open = $idx + 1 == $initial_open ? 'in' : '';
         $item = str_replace('{index}', $random_id . $idx, $item);
         $item = str_replace('{show_hide}', $open, $item);
         $items[$idx] = $item;
     }
     $sub_shortcode = implode('', $items);
     $filter_html = '';
     if ($filter == 'yes') {
         $sub_sc_data = WR_Pb_Helper_Shortcode::extract_sub_shortcode($content);
         $sub_sc_data = reset($sub_sc_data);
         // tags to filter item
         $tags = array('all');
         foreach ($sub_sc_data as $shortcode) {
             $extract_params = shortcode_parse_atts($shortcode);
             $tags[] = $extract_params['tag'];
         }
         $tags = array_filter($tags);
         if (count($tags) > 1) {
             $tags = implode(',', $tags);
             $tags = explode(',', $tags);
             $tags = array_unique($tags);
             $filter_html = WR_Pb_Helper_Shortcode::render_parameter('filter_list', $tags, $random_id);
             // remove "All" tag
             array_shift($tags);
             $inner_tags = implode(',', $tags);
             $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\twindow.parent.jQuery.noConflict()( '#jsn_view_modal').contents().find( '#wr_share_data' ).text( '{$inner_tags}')\n\t\t\t\t\tvar parent_criteria = '#filter_{$random_id}'\n\t\t\t\t\tvar clientsClone = \$( '#accordion_{$random_id}' );\n\t\t\t\t\tvar tag_to_filter = 'div';\n\t\t\t\t\tvar class_to_filter = '.panel-default';\n\n\t\t\t\t\t\$( parent_criteria + ' a' ).click( function(e ) {\n\t\t\t\t\t\t// stop running filter\n\t\t\t\t\t\t\$( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\$( this ).stop( true )\n\t\t\t\t\t\t})\n\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\t//active clicked criteria\n\t\t\t\t\t\t\$( parent_criteria + ' li' ).removeClass( 'active' );\n\t\t\t\t\t\t\$( this ).parent().addClass( 'active' );\n\n\t\t\t\t\t\tvar filterData = \$( this ).attr( 'class' );\n\t\t\t\t\t\tvar filters;\n\t\t\t\t\t\tif( filterData == 'all' ){\n\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter + '[data-tag~='+ filterData +']' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclientsClone.find( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\$( this ).fadeOut()\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfilters.each(function(){\n\t\t\t\t\t\t\t\$( this ).fadeIn()\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>";
         }
     }
     $html = '<div class="panel-group" id="accordion_{ID}">' . $sub_shortcode . '</div>';
     $html = str_replace('{ID}', $random_id, $html);
     return $this->element_wrapper($filter_html . $html . $script, $arr_params);
 }
 /**
  * element items
  *
  * @see    WR_Element::element_items()
  * @access public
  * @return array
  */
 public function element_items()
 {
     //$random_id = WR_Pb_Utils_Common::random_string( 8, true );
     $this->items = array('Notab' => array(array('id' => 'prtbl_item_attr_id', 'type' => 'text_field', 'std' => 'attr_' . WR_Pb_Utils_Common::random_string(), 'input-type' => 'hidden', 'container_class' => 'hidden'), array('name' => __('Title', WR_PBL), 'id' => 'prtbl_item_attr_title', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => '', 'tooltip' => __('Title', WR_PBL)), array('name' => __('Description', WR_PBL), 'id' => 'prtbl_item_attr_desc', 'type' => 'text_area', 'class' => 'jsn-input-xxlarge-fluid', 'std' => '', 'tooltip' => __('Description', WR_PBL)), array('name' => __('Type', WR_PBL), 'id' => 'prtbl_item_attr_type', 'type' => 'select', 'class' => 'input-sm', 'std' => '', 'options' => WR_Pb_Helper_Type::get_sub_item_pricing_type(), 'tooltip' => __('Type', WR_PBL))));
 }
Beispiel #8
0
        /**
         * Generate HTML for Vimeo.
         *
         * @param   array  $params  Shortcode parameters.
         *
         * @return  string  HTML code.
         */
        function generate_vimeo($params)
        {
            $random_id = WR_Pb_Utils_Common::random_string();
            $_w = ' width="' . $params['video_vimeo_dimension_width'] . '" ';
            $_h = $params['video_vimeo_dimension_height'] ? ' height="' . $params['video_vimeo_dimension_height'] . '" ' : '';
            // Alignment
            $container_class = '';
            $object_style = '';
            if ($params['video_alignment'] === 'right') {
                $object_style .= 'float:right;';
                $container_class .= 'clearafter pull-right';
            } else {
                if ($params['video_alignment'] === 'center') {
                    $object_style .= 'margin: 0 auto;';
                } else {
                    if ($params['video_alignment'] === 'left') {
                        $object_style .= 'float:left;';
                        $container_class .= 'clearafter pull-left';
                    }
                }
            }
            // Genarate Container class
            $container_class = $container_class ? 'class="' . $container_class . '" ' : '';
            // Get video ID.
            $params['video_source_link_vimeo'] = urldecode($params['video_source_link_vimeo']);
            $video_info = self::get_vimeo_video_info($params['video_source_link_vimeo']);
            $video_info = json_decode($video_info);
            if (!$video_info) {
                return;
            }
            $video_info = $video_info->html;
            $_arr = array();
            $video_src = '';
            preg_match('/src\\s*\\n*=\\s*\\n*"([^"]*)"/i', $video_info, $_arr);
            if (count($_arr)) {
                $video_src = $_arr[1];
                $video_src .= '?innerframe=true';
                $video_src .= isset($params['video_vimeo_autoplay']) ? '&autoplay=' . (string) $params['video_vimeo_autoplay'] : '';
                $video_src .= isset($params['video_vimeo_loop']) ? '&loop=' . (string) $params['video_vimeo_loop'] : '';
                $video_src .= isset($params['video_vimeo_title']) ? '&title=' . (string) $params['video_vimeo_title'] : '';
                $video_src .= isset($params['video_vimeo_color']) ? '&color=' . str_replace('#', '', (string) $params['video_vimeo_color']) : '';
            }
            $embed = '<div ' . $container_class . '>';
            $embed .= '<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen style="display:block;' . $object_style . '" ' . $_w . $_h . '"
src="' . $video_src . '" frameborder="0"></iframe>';
            $embed .= '</div>';
            return $embed;
        }
Beispiel #9
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $random_id = WR_Pb_Utils_Common::random_string();
     $script = $html_element = '';
     if (!empty($content)) {
         $content = WR_Pb_Helper_Shortcode::remove_autop($content);
     }
     if (isset($enable_dropcap) && $enable_dropcap == 'yes') {
         if ($content) {
             $styles = array();
             if ($dropcap_font_face_type == 'google fonts' and $dropcap_font_face_value != '') {
                 $script .= WR_Pb_Helper_Functions::add_google_font_link_tag($dropcap_font_face_value);
                 $styles[] = 'font-family:' . $dropcap_font_face_value;
             } elseif ($dropcap_font_face_type == 'standard fonts' and $dropcap_font_face_value) {
                 $styles[] = 'font-family:' . $dropcap_font_face_value;
             }
             if (intval($dropcap_font_size) > 0) {
                 $styles[] = 'font-size:' . intval($dropcap_font_size) . 'px';
                 $styles[] = 'line-height:' . intval($dropcap_font_size) . 'px';
             }
             switch ($dropcap_font_style) {
                 case 'bold':
                     $styles[] = 'font-weight:700';
                     break;
                 case 'italic':
                     $styles[] = 'font-style:italic';
                     break;
                 case 'normal':
                     $styles[] = 'font-weight:normal';
                     break;
             }
             if (strpos($dropcap_font_color, '#') !== false) {
                 $styles[] = 'color:' . $dropcap_font_color;
             }
             if (count($styles)) {
                 $html_element .= '<style type="text/css">';
                 $html_element .= sprintf('%1$s .dropcap:first-letter, %1$s .dropcap p:first-letter { float:left;', "#{$random_id}");
                 $html_element .= implode(';', $styles);
                 $html_element .= '}';
                 $html_element .= '</style>';
             }
             $html_element .= "<div class='dropcap'>{$content}</div>";
         }
     } else {
         $html_element .= $content;
     }
     $html = sprintf('<div class="wr_text" id="%s">', $random_id);
     $html .= $script;
     $html .= $html_element;
     $html .= '</div>';
     // Process margins
     if (isset($arr_params['text_margin_top'])) {
         $arr_params['div_margin_top'] = $arr_params['text_margin_top'];
     }
     if (isset($arr_params['text_margin_bottom'])) {
         $arr_params['div_margin_bottom'] = $arr_params['text_margin_bottom'];
     }
     if (isset($arr_params['text_margin_right'])) {
         $arr_params['div_margin_right'] = $arr_params['text_margin_right'];
     }
     if (isset($arr_params['text_margin_left'])) {
         $arr_params['div_margin_left'] = $arr_params['text_margin_left'];
     }
     return $this->element_wrapper($html, $arr_params);
 }
Beispiel #10
0
 /**
  * define shortcode structure of element
  */
 function element_shortcode($atts = null, $content = null)
 {
     $extra_class = $style = $custom_script = $extra_content = $data_attr = '';
     $extra_id = !empty($atts['id_wrapper']) ? esc_attr($atts['id_wrapper']) : WR_Pb_Utils_Common::random_string();
     if (isset($atts) && is_array($atts)) {
         $arr_styles = array();
         switch ($atts['width']) {
             case 'full':
                 $extra_class = 'wr_fullwidth';
                 // some overwrite css to enable row full width
                 $script = "\$('body').addClass('wr-full-width');";
                 $custom_script = WR_Pb_Helper_Functions::script_box($script);
                 $arr_styles[] = '-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;width: 100%;padding-left: 1000px;padding-right: 1000px;margin:0 -1000px;';
                 break;
             case 'boxed':
                 ///$arr_styles[] = "width: 100%;";
                 break;
         }
         $background = '';
         switch ($atts['background']) {
             case 'none':
                 if ($atts['width'] == 'full') {
                     $background = 'background: none;';
                 }
                 break;
             case 'solid':
                 $solid_color = $atts['solid_color_value'];
                 $background = "background-color: {$solid_color};";
                 break;
             case 'gradient':
                 $background = $atts['gradient_color_css'];
                 break;
             case 'pattern':
                 $pattern_img = $atts['pattern'];
                 $background = "background-image:url(\"{$pattern_img}\");";
                 $background_repeat = self::background_repeat($atts['repeat']);
                 if (!empty($background_repeat)) {
                     $background .= "background-repeat:{$background_repeat};";
                 }
                 break;
             case 'image':
                 $image = $atts['image'];
                 $image_position = $atts['position'];
                 $background = "background-image:url(\"{$image}\");background-position:{$image_position};";
                 // Background repeat
                 $background_repeat = self::background_repeat($atts['img_repeat']);
                 if (!empty($background_repeat)) {
                     $background .= "background-repeat:{$background_repeat};";
                 }
                 break;
             case 'video':
                 $url = $atts['video_url'];
                 // Youtube video
                 if (preg_match('/youtube\\.com/', $url)) {
                     $extra_class .= ' wr_video_bg';
                     parse_str($url, $youtube_url);
                     $data_attr = sprintf("data-property=\"{videoURL:'http://youtu.be/%s', containment:'%s', autoPlay:%s, mute:true, startAt:0, opacity:1, showControls:false}\"", reset($youtube_url), "#{$extra_id}", $atts['autoplay']);
                     add_action('wp_footer', array(__CLASS__, 'enqueue_player_scripts'));
                     add_action('wp_footer', array(__CLASS__, 'print_player_scripts'));
                 }
                 break;
         }
         $arr_styles[] = $background;
         // Paralax background
         if (isset($atts['paralax']) && $atts['paralax'] == 'yes') {
             $data_attr .= " data-stellar-background-ratio='-.3'";
         }
         // Border
         if (isset($atts['border_width_value_']) && intval($atts['border_width_value_'])) {
             $border = array();
             $border[] = $atts['border_width_value_'] . 'px';
             $border[] = $atts['border_style'];
             $border[] = $atts['border_color'];
             $arr_styles[] = sprintf('border-top:%1$s; border-bottom:%1$s;', implode(' ', $border));
         }
         // Padding
         $arr_styles[] = "padding-top:{$atts['div_padding_top']}px;";
         $arr_styles[] = "padding-bottom:{$atts['div_padding_bottom']}px;";
         if ($atts['width'] != 'full') {
             $arr_styles[] = "padding-left:{$atts['div_padding_left']}px;";
             $arr_styles[] = "padding-right:{$atts['div_padding_right']}px;";
         }
         $style = $arr_styles ? sprintf("style='%s'", implode('', $arr_styles)) : '';
     }
     $extra_class .= !empty($atts['css_suffix']) ? ' ' . esc_attr($atts['css_suffix']) : '';
     $content = WR_Pb_Helper_Shortcode::remove_autop($content);
     return $custom_script . sprintf("<div class='jsn-bootstrap3'><div id='%s' class='row %s' %s>%s</div></div>", $extra_id, ltrim($extra_class, ' '), $data_attr . ' ' . $style, balanceTags($extra_content . $content));
 }
Beispiel #11
0
    /**
     * Deactivate handle
     *
     * @global type $pagenow
     * @global type $wpdb
     */
    function do_deactivate()
    {
        global $pagenow;
        if ($pagenow == 'plugins.php') {
            $deactivate_action = false;
            $wr_pb_plugin = 'wr-pagebuilder/wr-pagebuilder.php';
            // check if single deactivate plugin/ bulk deactivate plugins
            if (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], array('deactivate-selected', 'deactivate'))) {
                $action = $_REQUEST['action'];
                if ($action == 'deactivate' && $_REQUEST['plugin'] == $wr_pb_plugin || $action == 'deactivate-selected' && in_array($wr_pb_plugin, $_REQUEST['checked'])) {
                    $deactivate_action = true;
                }
            }
            if ($deactivate_action) {
                $wr_action = 'wr_deactivate';
                if (is_network_admin()) {
                    $plugin_url = network_admin_url('plugins.php');
                } else {
                    $plugin_url = admin_url('plugins.php');
                }
                // check whether delete only WR PageBuilder OR Bulk deactivate plugins
                $deactivate_one = isset($_POST['action']) ? false : true;
                // show Confirmation form before doing deactivate
                if (!isset($_REQUEST['wr_wpnonce']) && !isset($_REQUEST['wr_back'])) {
                    // create wr_nonce
                    $wr_nonce = wp_create_nonce($wr_action);
                    $method = $deactivate_one ? 'GET' : 'POST';
                    $back_text = __('No, take me back', WR_PBL);
                    if ($deactivate_one) {
                        $back_btn = "<a href='{$plugin_url}' class='button button-large'>" . $back_text . '</a>';
                    } else {
                        $back_btn = "<input type='submit' name='wr_back' class='button button-large' value='" . $back_text . "'>";
                    }
                    $form = " action='{$plugin_url}' method='{$method}' ";
                    $fields = '';
                    foreach ($_REQUEST as $key => $value) {
                        if (!is_array($value)) {
                            $fields .= "<input type='hidden' name='{$key}' value='{$value}' />";
                        } else {
                            foreach ($value as $p) {
                                $fields .= "<input type='hidden' name='{$key}[]' value='{$p}' />";
                            }
                        }
                    }
                    $fields .= "<input type='hidden' name='wr_wpnonce' value='{$wr_nonce}' />";
                    // show message
                    ob_start();
                    ?>
<p>
<?php 
                    _e('After deactivating, all content built with PageBuilder will be parsed to plain HTML code. Are you sure you want to deactivate PageBuilder plugin?', WR_PBL);
                    ?>
</p>
<center>
	<form <?php 
                    echo balanceTags($form);
                    ?>
>
	<?php 
                    echo balanceTags($fields);
                    ?>
		<input type="submit" name="wr_deactivate" class="button button-large"
			value="<?php 
                    _e('Yes, deactivate plugin', WR_PBL);
                    ?>
"
			style="background: #d9534f; color: #fff; text-shadow: none; border: none;">
			<?php 
                    echo balanceTags($back_btn);
                    ?>
	</form>
</center>
<p style="font-style: italic; font-size: 12px; margin-top: 20px;">
<?php 
                    _e("Or if you want to deactivate without parsing 'content built with PageBuilder' to HTML code, click on the button below", WR_PBL);
                    ?>
</p>
<center>
	<form <?php 
                    echo balanceTags($form);
                    ?>
>
	<?php 
                    echo balanceTags($fields);
                    ?>
		<input type="submit" name="wr_deactivate_light"
			class="button button-large"
			value="<?php 
                    _e('Deactivate without parsing data', WR_PBL);
                    ?>
"
			style="background: #f0ad4e; color: #fff; text-shadow: none; border: none;">
	</form>
</center>
	<?php 
                    $message = ob_get_clean();
                    // Change page title
                    _default_wp_die_handler($message, __('WordPress &rsaquo; Confirmation', WR_PBL));
                    exit;
                } else {
                    // get nonce
                    $wr_nonce = esc_sql($_REQUEST['wr_wpnonce']);
                    $nonce = wp_verify_nonce($wr_nonce, $wr_action);
                    // if nonce is invalid
                    if (!in_array($nonce, array(1, 2))) {
                        _default_wp_die_handler(__('Nonce is invalid!', WR_PBL));
                        exit;
                    }
                    // do action when customer choose "take me back" in confirmation form
                    if (isset($_REQUEST['wr_back'])) {
                        // remove WR PageBuilder from the checked list
                        if (($key = array_search($wr_pb_plugin, $_REQUEST['checked'])) !== false) {
                            unset($_REQUEST['checked'][$key]);
                        }
                        // Overwrite list of checked plugins to deactivating
                        $_POST['checked'] = $_REQUEST['checked'];
                    } else {
                        if (isset($_REQUEST['wr_deactivate'])) {
                            global $wpdb;
                            // update post content = value of '_wr_html_content', deactivate pagebuilder
                            $meta_key1 = 1;
                            $meta_key2 = '_wr_html_content';
                            $meta_key3 = '_wr_deactivate_pb';
                            $wpdb->query($wpdb->prepare("\n\t\t\t\t\t\t\t\tUPDATE\t\t{$wpdb->posts} p\n\t\t\t\t\t\t\t\tLEFT JOIN\t{$wpdb->postmeta} p1\n\t\t\t\t\t\t\t\t\t\t\tON p1.post_id = p.ID\n\t\t\t\t\t\t\t\tLEFT JOIN\t{$wpdb->postmeta} p2\n\t\t\t\t\t\t\t\t\t\t\tON p2.post_id = p.ID\n\t\t\t\t\t\t\t\tSET\t\t\tpost_content = p1.meta_value, p2.meta_value = %d\n\t\t\t\t\t\t\t\tWHERE\t\tp1.meta_key = %s\n\t\t\t\t\t\t\t\t\t\t\tAND p2.meta_key = %s\n\t\t\t\t\t\t\t\t", $meta_key1, $meta_key2, $meta_key3));
                            // update post content = value of '_wr_html_content', deactivate pagebuilder all blog
                            if (is_network_admin()) {
                                // get list id blog all
                                $list_prefix_musite = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A);
                                if ($list_prefix_musite && count($list_prefix_musite) > 1) {
                                    foreach ($list_prefix_musite as $key => $value) {
                                        if ($value['blog_id'] == 1) {
                                            continue;
                                        }
                                        $prefix = $wpdb->prefix . $value['blog_id'] . '_';
                                        $wpdb->query($wpdb->prepare("\n\t\t\t\t\t\t\t\t\t\t\t\tUPDATE\t\t{$prefix}posts p\n\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN\t{$prefix}postmeta p1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON p1.post_id = p.ID\n\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN\t{$prefix}postmeta p2\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON p2.post_id = p.ID\n\t\t\t\t\t\t\t\t\t\t\t\tSET\t\t\tpost_content = p1.meta_value, p2.meta_value = %d\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE\t\tp1.meta_key = %s\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND p2.meta_key = %s\n\t\t\t\t\t\t\t\t\t\t\t\t", $meta_key1, $meta_key2, $meta_key3));
                                    }
                                }
                            }
                            // delete pagebuilder content
                            WR_Pb_Utils_Common::delete_meta_key(array('_wr_page_builder_content', '_wr_page_active_tab'));
                            do_action('wr_pb_deactivate');
                        }
                    }
                }
            }
        }
    }
Beispiel #12
0
 /**
  * Dummy content
  *
  * @return array
  */
 static function lorem_text($word_count = 50)
 {
     return ucfirst(WR_Pb_Utils_Common::lorem_text($word_count, true));
 }
Beispiel #13
0
        /**
         * Generate HTML code from shortcode content.
         *
         * @param   array   $atts     Shortcode attributes.
         * @param   string  $content  Current content.
         *
         * @return  string
         */
        public function element_shortcode_full($atts = null, $content = null)
        {
            $html_element = $container_class = $str_scripts = '';
            $arr_params = shortcode_atts($this->config['params'], $atts);
            extract($arr_params);
            $arrDefaultOptions = array('streetViewControl', 'zoomControl', 'panControl', 'mapTypeControl', 'scaleControl', 'overviewMapControl', 'scrollwheel');
            if ($gmap_elements) {
                $arr_elements = array_filter(explode('__#__', $gmap_elements));
                foreach ($arrDefaultOptions as $i => $item) {
                    if (in_array($item, $arr_elements)) {
                        $str_scripts .= $item . ': true,';
                    } else {
                        $str_scripts .= $item . ': false,';
                    }
                }
            }
            $random_id = WR_Pb_Utils_Common::random_string();
            $player_elements = '';
            if ($gmap_alignment === 'right') {
                $player_elements .= '$( "#wr-gmap-' . $random_id . '" ).css( "float", "right" );';
                $container_class .= 'clearafter ';
            } else {
                if ($gmap_alignment === 'center') {
                    $player_elements .= '$( "#wr-gmap-' . $random_id . '" ).css( {"margin" : "0 auto", "display" : "block" } );';
                } else {
                    if ($gmap_alignment === 'left') {
                        $player_elements .= '$( "#wr-gmap-' . $random_id . '" ).css( "float", "left" );';
                        $container_class .= 'clearafter ';
                    }
                }
            }
            $html_element .= '<script type="text/javascript">(function ($) {
			$( document ).ready( function () {
				' . $player_elements . '
				var map_' . $random_id . '				= "";
				var marker_locations_' . $random_id . ' = [];
				function get_latlong(obj) {
					var myLatlng		 = new google.maps.LatLng( obj.gmi_lat, obj.gmi_long);
					return myLatlng;
				}

				function get_infobox(obj) {
					var infowindow		= "";
					var contentString	 = "<div class=\\"wr-gmi-info\\" style=\\"width:250px\\" >";
					contentString		 += "<div class=\\"wr-gmi-thumb\\">";
					if ( obj.gmi_image != "" && obj.gmi_image != "http://" )
						contentString		 += "<img src=\\"" + obj.gmi_image + "\\" />";
					contentString		 += "</div>";
					contentString		 += "<span class=\\"wr-gmi-title\\"><b>" + obj.gmi_title + "</b></span>";
					if ( obj.gmi_desc_content )
						contentString		 += "<p>" + obj.gmi_desc_content + "</p>";
					if ( obj.gmi_url != "" && obj.gmi_url != "http://" )
						contentString		 += "<a href=\\"" + obj.gmi_url + "\\" target=\\"_blank\\">more...></a>";
					contentString		 += "</div>";
					infowindow		 = new google.maps.InfoWindow({
						content: contentString
					});
					infowindow.setOptions({maxWidth:300});
					return infowindow;
				}

				function markerAtPoint(latlng) {
					for (var i = 0; i < marker_locations_' . $random_id . '.length; ++i) {
						if (marker_locations_' . $random_id . '[i].equals(latlng)) return true;
					}
					return false;
				}

				function initialize_' . $random_id . '() {
					var gmap_zoom	= parseInt("' . $gmap_zoom . '");
					var gmap_lat	= "";
					var gmap_long	= "";
					var gmap_type	= google.maps.MapTypeId.' . $gmap_type . ';
					var directionsService_' . $random_id . '	 = new google.maps.DirectionsService();
					var has_direction		= false;

					var mapOptions_' . $random_id . ' = {
						zoom: gmap_zoom,
						center: new google.maps.LatLng(0,0),
						mapTypeId: gmap_type,
						' . $str_scripts . '
					};
					map_' . $random_id . ' = new google.maps.Map(document.getElementById(\'wr-gmap-' . $random_id . '\'), mapOptions_' . $random_id . ');
					var rendererOptions_' . $random_id . ' = {
						map: map_' . $random_id . ',
						suppressMarkers: true
					}
					var directionsDisplay_' . $random_id . ' = new google.maps.DirectionsRenderer(rendererOptions_' . $random_id . ');
					directionsDisplay_' . $random_id . '.setMap(map_' . $random_id . ');

					// Check has directions
					$( "#wr-gmap-wrapper-' . $random_id . ' .wr-gmi-lat-long" ).each(function (index) {
						var obj = JSON.parse($(this).val());
						if ( obj.gmi_lat != "" && obj.gmi_long != "" && obj.gmi_destination != "" ) {
							has_direction = true;
						}
					});

					// Add markers
					if ( has_direction == false ) {
						$( "#wr-gmap-wrapper-' . $random_id . ' .wr-gmi-lat-long" ).each(function (index) {
							var obj = JSON.parse($(this).val());
							if ( obj.gmi_lat != "" && obj.gmi_long != "" ) {
								var myLatlng	 = get_latlong(obj);
								var infowindow	 = get_infobox(obj);
								if ( map_' . $random_id . ' ) {
									var marker		= new google.maps.Marker({
										position: myLatlng,
										map: map_' . $random_id . ',
										title: obj.gmi_title
									});
									marker_locations_' . $random_id . '.push(myLatlng);
									map_' . $random_id . '.setCenter(marker.getPosition());
									google.maps.event.addListener(marker, \'click\', function() {
										infowindow.open(map_' . $random_id . ',marker);
									});
								}
							}
						});
					} else {

						$( "#wr-gmap-wrapper-' . $random_id . ' .wr-gmi-lat-long" ).each(function (i) {
							var obj = JSON.parse($(this).val());
							$( "#wr-gmap-wrapper-' . $random_id . ' .wr-gmi-lat-long" ).each(function (j) {
								var sub_obj	 = JSON.parse($(this).val());

								if ( sub_obj.gmi_title == obj.gmi_destination && sub_obj.gmi_lat != "" && sub_obj.gmi_long != "" ) {
									var start        = get_latlong(obj);
									var end			 = get_latlong(sub_obj);

									var infowindow	 = get_infobox(obj);
									if ( map_' . $random_id . ' ) {
										var marker			 = new google.maps.Marker({
											position: start,
											map: map_' . $random_id . ',
											title: obj.gmi_title
										});
										marker_locations_' . $random_id . '.push(start);
										google.maps.event.addListener(marker, \'click\', function() {
											infowindow.open(map_' . $random_id . ',marker);
										});
									}

									var sub_infowindow	 = get_infobox(sub_obj);
									if ( map_' . $random_id . ' ) {
										var sub_marker		 = new google.maps.Marker({
											position: end,
											map: map_' . $random_id . ',
											title: sub_obj.gmi_title
										});
										marker_locations_' . $random_id . '.push(end);
										google.maps.event.addListener(sub_marker, \'click\', function() {
											sub_infowindow.open(map_' . $random_id . ',sub_marker);
										});
									}

									var request = {
										origin:start,
										destination:end,
										travelMode: google.maps.DirectionsTravelMode.DRIVING
									};

									directionsService_' . $random_id . '.route(request, function(response, status) {
										if (status == google.maps.DirectionsStatus.OK) {
											directionsDisplay_' . $random_id . '.setDirections(response);
										}
									});
								}

								if ( markerAtPoint(new google.maps.LatLng( obj.gmi_lat, obj.gmi_long) ) == false ) {
									var myLatlng	 = get_latlong(obj);
									var infowindow	 = get_infobox(obj);
									if ( map_' . $random_id . ' ) {
										var marker		= new google.maps.Marker({
											position: myLatlng,
											map: map_' . $random_id . ',
											title: obj.gmi_title
										});
										marker_locations_' . $random_id . '.push(myLatlng);
										map_' . $random_id . '.setCenter(marker.getPosition());
										google.maps.event.addListener(marker, \'click\', function() {
											infowindow.open(map_' . $random_id . ',marker);
										});
									}
								}
							});
						});
					}
				}
				google.maps.event.addDomListener(window, \'load\', initialize_' . $random_id . ');

				// Center map on resize
				google.maps.event.addDomListener(window, \'resize\', function() {
					var center = map_' . $random_id . '.getCenter();
					google.maps.event.trigger(map_' . $random_id . ', \'resize\');
					map_' . $random_id . '.setCenter(center);
				});
			});
		})(jQuery)</script>';
            $class = 'wr-googlemap';
            if ($gmap_container_style == 'img-thumbnail') {
                $class .= ' img-thumbnail';
            }
            if ($gmap_margin_top) {
                $gmap_styles[] = "margin-top:{$gmap_margin_top}px !important";
            }
            if ($gmap_margin_bottom) {
                $gmap_styles[] = "margin-bottom:{$gmap_margin_bottom}px !important";
            }
            if ($gmap_margin_right) {
                $gmap_styles[] = "margin-right:{$gmap_margin_right}px !important";
            }
            if ($gmap_margin_left) {
                $gmap_styles[] = "margin-left:{$gmap_margin_left}px !important";
            }
            if ($gmap_dimension_height) {
                $gmap_styles[] = "height:{$gmap_dimension_height}px !important";
            }
            if ($gmap_dimension_width) {
                $gmap_styles[] = "width:{$gmap_dimension_width}{$gmap_dimension_width_unit} !important";
            }
            $styles = count($gmap_styles) ? ' style="' . implode(';', $gmap_styles) . '"' : '';
            $html_element .= '<div id="wr-gmap-wrapper-' . $random_id . '">';
            $html_element .= '<div id="wr-gmap-' . $random_id . '" ' . $styles . ' class="' . $class . '"></div>';
            $sub_shortcode = WR_Pb_Helper_Shortcode::remove_autop($content);
            $items = explode('<!--seperate-->', $sub_shortcode);
            // remove empty element
            $items = array_filter($items);
            $initial_open = !isset($initial_open) || $initial_open > count($items) ? 1 : $initial_open;
            foreach ($items as $idx => $item) {
                $open = $idx + 1 == $initial_open ? 'in' : '';
                $items[$idx] = $item;
            }
            $sub_htmls = do_shortcode($sub_shortcode);
            $html_element .= $sub_htmls;
            $html_element .= '</div>';
            return $this->element_wrapper($html_element, $arr_params);
        }
Beispiel #14
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $random_id = WR_Pb_Utils_Common::random_string();
     $testimonial_id = "testimonial_{$random_id}";
     $styles = "style='width:100%'";
     $image_container_style = $author_image_style != 'no-styling' ? "{$author_image_style}" : '';
     $content_elements = array_filter(explode('__#__', $content_elements));
     $testimonial_indicators = array();
     $testimonial_indicators[] = '<ol class="carousel-indicators">';
     $sub_shortcode = do_shortcode($content);
     $testimonial_content = array();
     $items = explode('<!--seperate-->', $sub_shortcode);
     $items = array_filter($items);
     $count_items = count($items);
     foreach ($items as $idx => $item) {
         $item = unserialize($item);
         if ($idx % $items_per_slide == 0) {
             $active = $idx == 0 ? 'active' : '';
             $testimonial_content[] = "<div class='item row {$active}'>";
             $active_li = $idx == 0 ? "class='active'" : '';
             $testimonial_indicators[] = "<li {$active_li}></li>";
         }
         $divide = $count_items > $items_per_slide ? $items_per_slide : $count_items;
         $colmd = 'col-md-' . 12 / $divide;
         $colsm = 'col-sm-' . 12 / $divide;
         $item_html = "<div class='wr-testimonial-item {$colmd} {$colsm}'>";
         $testimonial_info = array();
         if (in_array('content', $content_elements)) {
             $item_content = WR_Pb_Helper_Shortcode::remove_autop($item['testimonial_content']);
             $item_content = WR_Pb_Utils_Common::trim_content($item_content, $content_count, $content_type);
             $testimonial_info['content'] = "<div class='wr-testimonial-box top'><div class='arrow'></div><div class='wr-testimonial-content'><p>" . $item_content . '</p></div></div>';
         }
         if (isset($item['image_file']) && !empty($item['image_file'])) {
             $data = getimagesize($item['image_file']);
             $width = $data[0];
             $height = $data[1];
             $img = "<div class='wr-testimonial-avatar'><img width='{$width}' height='{$height}' class='{$image_container_style}' src='{$item['image_file']}' /></div>";
         } else {
             $img = '';
         }
         $testimonial_info['image'] = in_array('image', $content_elements) ? $img : '';
         // Process company field
         if (isset($item['company']) && $item['company'] != '') {
             $company_link = "<a href='{$item['web_url']}'>{$item['company']}</a>";
         } else {
             $company_link = "<a href='{$item['web_url']}'>{$item['web_url']}</a>";
         }
         if (!isset($item['web_url']) || empty($item['web_url'])) {
             $company_link = $item['company'];
         }
         // Process testimonial metadata
         $arr_style = array();
         if (isset($item['name_height'])) {
             $arr_style[] = 'font-size: ' . $item['name_height'] . 'px';
         }
         if (isset($item['name_color'])) {
             $arr_style[] = 'color: ' . $item['name_color'];
         }
         $style = $arr_style ? "style='" . implode(';', $arr_style) . "'" : '';
         $name = isset($item['name']) && in_array('name', $content_elements) ? "<strong {$style} class='wr-testimonial-name'>{$item['name']}</strong>" : '';
         $job_title = isset($item['job_title']) && in_array('job_title', $content_elements) ? "<span class='wr-testimonial-jobtitle'>{$item['job_title']}</span>" : '';
         $country = isset($item['country']) && in_array('country', $content_elements) ? "<span class='wr-testimonial-country'>{$item['country']}</span>" : '';
         if ($company_link) {
             $company = in_array('company', $content_elements) ? "<span class='wr-testimonial-link'>{$company_link}</span>" : '';
         }
         $html_metadata = '';
         if ($name != '' || $job_title != '' || $country != '' || $company != '') {
             $html_metadata .= '<div class="wr-testimonial-meta">';
             $html_metadata .= $name . $job_title . $country . $company;
             $html_metadata .= '</div>';
         }
         foreach ($content_elements as $element) {
             $item_html .= isset($testimonial_info[$element]) ? $testimonial_info[$element] : '';
         }
         $item_html .= $html_metadata;
         $item_html .= '</div>';
         $testimonial_content[] = $item_html;
         if (($idx + 1) % $items_per_slide == 0 || $idx + 1 == count($items)) {
             $testimonial_content[] = '</div>';
         }
     }
     $testimonial_content = "<div class='carousel-inner'>" . implode('', $testimonial_content) . '</div>';
     $testimonial_indicators[] = '</ol>';
     $testimonial_indicators = implode('', $testimonial_indicators);
     $script = "<script type='text/javascript'>\n\t\t(function (\$){\n\t\t\t\$( document ).ready(function(){\n\t\t\t\tif( \$( '#{$testimonial_id}' ).length ){\n\t\t\t\t\t\$( '#{$testimonial_id} .carousel-indicators li' ).each(function (i) {\n\t\t\t\t\t\t\$(this).on('click', function () {\n\t\t\t\t\t\t\t\$('#{$testimonial_id}').carousel(i);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t} )( jQuery );\n\t\t</script>";
     $slider_elements = explode('__#__', $slider_elements);
     if ($count_items <= $items_per_slide || !in_array('indicator', $slider_elements)) {
         $testimonial_indicators = '';
     }
     $testimonial_navigator = $count_items > $items_per_slide && in_array('arrows', $slider_elements) ? "<a class='carousel-control left icon-arrow-left wr-arrow-left'></a><a class='carousel-control right icon-arrow-right wr-arrow-right'></a>" : '';
     $html = "<div class='carousel slide wr-testimonial' {$styles} id='{$testimonial_id}'>{$testimonial_indicators} {$testimonial_content} {$testimonial_navigator}</div>";
     return $this->element_wrapper($script . $html, $arr_params);
 }
Beispiel #15
0
 /**
  * Return html structure of shortcode in Page Builder area
  *
  * @param type $shortcode_name
  * @param type $attr
  * @param type $content
  */
 public static function shortcode_to_pagebuilder($shortcode_name, $content = '', $shortcode_data = '', $shortcode_params = '')
 {
     $class = WR_Pb_Helper_Shortcode::get_shortcode_class($shortcode_name);
     if (class_exists($class)) {
         global $Wr_Pb;
         $elements = $Wr_Pb->get_elements();
         $instance = isset($elements['element'][strtolower($class)]) ? $elements['element'][strtolower($class)] : null;
         if (!is_object($instance)) {
             $instance = new $class();
         }
         $instance->init_element();
         $el_title = '';
         if ($class != 'WR_Widget') {
             // extract param of shortcode ( now for column )
             if (isset($instance->config['extract_param'])) {
                 parse_str(trim($shortcode_params), $output);
                 foreach ($instance->config['extract_param'] as $param) {
                     if (isset($output[$param])) {
                         $instance->params[$param] = WR_Pb_Utils_Common::remove_quotes($output[$param]);
                     }
                 }
             }
             // get content in pagebuilder of shortcode: Element Title must always first option of Content tab
             if (isset($instance->items['content']) && isset($instance->items['content'][0])) {
                 $title = $instance->items['content'][0];
                 if ($title['role'] == 'title') {
                     $params = shortcode_parse_atts($shortcode_params);
                     $el_title = !empty($params[$title['id']]) ? $params[$title['id']] : __('(Untitled)', WR_PBL);
                 }
             }
         } else {
             $widget_info = WR_Pb_Helper_Shortcode::extract_widget_params($shortcode_data);
             $el_title = !empty($widget_info['title']) ? $widget_info['title'] : '';
             $params = WR_Pb_Helper_Shortcode::extract_params($shortcode_data);
             $instance->config['shortcode'] = $params['widget_id'];
             $instance->config['el_type'] = 'widget';
         }
         $shortcode_view = $instance->element_in_pgbldr($content, $shortcode_data, $el_title);
         return $shortcode_view[0];
     }
 }
Beispiel #16
0
 /**
  * Upload premade layout to file
  *
  * @return type
  */
 function upload_layout()
 {
     if (!isset($_POST[WR_NONCE]) || !wp_verify_nonce($_POST[WR_NONCE], WR_NONCE)) {
         return;
     }
     $status = 0;
     if (!empty($_FILES)) {
         $fileinfo = $_FILES['file'];
         $file = $fileinfo['tmp_name'];
         $tmp_file = 'tmp-layout-' . time();
         $dest = WR_Pb_Helper_Functions::get_wp_upload_folder('/wr-pb-layout/' . $tmp_file);
         if ($fileinfo['type'] == 'application/octet-stream') {
             WP_Filesystem();
             $unzipfile = unzip_file($file, $dest);
             if ($unzipfile) {
                 // explore extracted folder to get provider info
                 $status = WR_Pb_Helper_Layout::import($dest);
             }
             // remove zip file
             unlink($file);
         }
         WR_Pb_Utils_Common::recursive_delete($dest);
     }
     echo intval($status);
     exit;
 }
Beispiel #17
0
/**
 *
 * Uninstalling WR PageBuilder: deletes post metas & options
 *
 * @author		WooRockets Team <*****@*****.**>
 * @package		IGPGBLDR
 * @version		$Id$
 */
//if uninstall not called from WordPress exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
include_once 'core/utils/common.php';
// delete all other providers
$providers = get_option('_wr_pb_providers');
if ($providers) {
    $providers = unserialize($providers);
    $list_plugins = array();
    foreach ($providers as $provider) {
        if (!empty($provider['file'])) {
            $list_plugins[] = $provider['file'];
        }
    }
    delete_plugins($list_plugins);
}
// delete cache folder
WR_Pb_Utils_Common::remove_cache_folder();
// delete meta key
WR_Pb_Utils_Common::delete_meta_key(array('_wr_page_builder_content', '_wr_html_content', '_wr_page_active_tab', '_wr_post_view_count', '_wr_deactivate_pb', '_wr_page_builder_css_files', '_wr_page_builder_css_custom'));
Beispiel #18
0
        /**
         * Generate HTML for local audio player.
         *
         * @param   array  $params  Shortcode parameters.
         *
         * @return  string  HTML code.
         */
        function generate_local_files($params)
        {
            $random_id = WR_Pb_Utils_Common::random_string();
            $audio_size = array();
            $audio_size['width'] = ' width="' . $params['audio_local_dimension_width'] . '" ';
            $audio_size['height'] = $params['audio_local_dimension_height'] != '' ? ' height="' . $params['audio_local_dimension_height'] . '" ' : '';
            $player_options = '{';
            $player_options .= $params['audio_local_start_volume'] != '' ? 'startVolume: ' . (int) $params['audio_local_start_volume'] / 100 . ',' : '';
            $player_options .= $params['audio_local_loop'] != '' ? 'loop: ' . $params['audio_local_loop'] . ',' : '';
            if (!isset($params['audio_local_player_image'])) {
                $_player_color = isset($params['audio_local_player_color']) ? '$( ".mejs-mediaelement, .mejs-controls", audio_container ).css( "background", "none repeat scroll 0 0 ' . $params['audio_local_player_color'] . '" );' : '';
            } else {
                $_player_color = isset($params['audio_local_player_color']) ? '$( ".mejs-mediaelement, .mejs-controls", audio_container ).css( "background", "url(\'' . $params['audio_local_player_image'] . '\' ) repeat scroll 0 0 ' . $params['audio_local_player_color'] . '");' : '';
            }
            $_progress_bar_color = isset($params['audio_local_progress_color']) ? '$( ".mejs-time-loaded, .mejs-horizontal-volume-current", audio_container ).css( "background", "none repeat scroll 0 0 ' . $params['audio_local_progress_color'] . '" );' : '';
            $params['audio_local_elements'] = explode('__#__', $params['audio_local_elements']);
            $player_elements = '';
            $player_elements .= in_array('play_button', $params['audio_local_elements']) ? '' : '$( ".mejs-playpause-button", audio_container ).hide();';
            $player_elements .= in_array('current_time', $params['audio_local_elements']) ? '' : '$( ".mejs-currenttime-container", audio_container ).hide();';
            $player_elements .= in_array('time_rail', $params['audio_local_elements']) ? '' : '$( ".mejs-time-rail", audio_container ).hide();';
            $player_elements .= in_array('track_duration', $params['audio_local_elements']) ? '' : '$( ".mejs-duration-container", audio_container ).hide();';
            $player_elements .= in_array('volume_button', $params['audio_local_elements']) ? '' : '$( ".mejs-volume-button", audio_container ).hide();';
            $player_elements .= in_array('volume_slider', $params['audio_local_elements']) ? '' : '$( ".mejs-horizontal-volume-slider", audio_container ).hide();';
            $container_class = $container_style = '';
            if ($params['audio_alignment'] === 'right') {
                $player_elements .= 'audio_container.css( "float", "right" )';
                $container_class .= 'clearafter pull-right';
            } else {
                if ($params['audio_alignment'] === 'center') {
                    $container_style .= 'margin: 0 auto;';
                    $player_elements .= 'audio_container.css( "margin", "0 auto" )';
                } else {
                    if ($params['audio_alignment'] === 'left') {
                        $player_elements .= 'audio_container.css( "float", "left" )';
                        $container_class .= 'clearafter pull-left';
                    }
                }
            }
            // Genarate Container class
            $container_class .= ' wr-' . $random_id . ' ' . $container_class;
            $container_class = $container_class ? ' class="' . $container_class . '" ' : '';
            $player_options .= 'success: function( mediaElement, domObject ){

			var audio_container	= $( domObject ).parents( ".mejs-container" );
			' . $player_elements . '
		},';
            $player_options .= 'keyActions:[]}';
            $script = '
		<script type="text/javascript">
			jQuery( document ).ready( function ($ ){

				new MediaElementPlayer("#' . $random_id . '",
					' . $player_options . '
				);
			});
		</script>';
            $fixed_css = '';
            if (isset($params['audio_local_dimension_height']) && $params['audio_local_dimension_height'] != '') {
                $fixed_css = "<style type='text/css'>.wr-element-audio .wr-{$random_id} .mejs-container {\n\tmin-height: {$params['audio_local_dimension_height']}px;\n}</style>";
            }
            $container_style .= isset($params['audio_local_dimension_width']) && $params['audio_local_dimension_width'] != '' ? 'width:' . $params['audio_local_dimension_width'] . 'px' : '';
            $container_style = $container_style ? ' style=" ' . $container_style . ' " ' : '';
            // Define the media type
            $src = str_replace(' ', '+', $params['audio_source_local']);
            $source = '<source type="%s" src="%s" />';
            $type = wp_check_filetype($src);
            $source = sprintf($source, $type['type'], esc_url($src));
            return $fixed_css . $script . '<div ' . $container_class . $container_style . '>
								<audio controls="controls" preload="none" ' . $audio_size['width'] . $audio_size['height'] . ' id="' . $random_id . '" src="' . $src . '" >
									' . $source . '
								</audio>
							</div>';
        }
Beispiel #19
0
 /**
  * Remove group layout
  *
  * @param type $group
  */
 static function remove_group($group)
 {
     $group = substr($group, 0, -7);
     $dir = WR_Pb_Helper_Functions::get_wp_upload_folder('/wr-pb-layout/' . $group, false);
     if (is_dir($dir)) {
         WR_Pb_Utils_Common::recursive_delete($dir);
         // if directory still exits, false
         if (is_dir($dir)) {
             return false;
         }
         return true;
     }
     return false;
 }