/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $drag = $this->config['drag-level']; $drop = $this->config['drop-level']; $size = array('av_cell_one_full' => '1/1', 'av_cell_one_half' => '1/2', 'av_cell_one_third' => '1/3', 'av_cell_one_fourth' => '1/4', 'av_cell_one_fifth' => '1/5', 'av_cell_two_third' => '2/3', 'av_cell_three_fourth' => '3/4', 'av_cell_two_fifth' => '2/5', 'av_cell_three_fifth' => '3/5', 'av_cell_four_fifth' => '4/5'); $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = __('Edit Cell', 'avia_framework'); $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $output = "<div class='avia_layout_column avia_layout_cell avia_pop_class avia-no-visual-updates " . $name . " av_drag' {$dataString} data-width='{$name}'>"; $output .= "<div class='avia_sorthandle'>"; $output .= "<span class='avia-col-size'>" . $size[$name] . "</span>"; $output .= "<a class='avia-delete' href='#delete' title='" . __('Delete Cell', 'avia_framework') . "'>x</a>"; $output .= "<a class='avia-clone' href='#clone' title='" . __('Clone Cell', 'avia_framework') . "' >" . __('Clone Cell', 'avia_framework') . "</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Cell', 'avia_framework') . "'>edit</a>"; } $output .= "</div><div class='avia_inner_shortcode avia_connect_sort av_drop ' data-dragdrop-level='{$drop}'><span class='av-fake-cellborder'></span>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
/** * Editor Element */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = $this->config['name']; $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $output = "<div class='avia_layout_section avia_pop_class avia-no-visual-updates " . $name . " av_drag' " . $dataString . ">"; $output .= " <div class='avia_sorthandle menu-item-handle'>"; $output .= " <span class='avia-element-title'>" . $this->config['name'] . "</span>"; $output .= " <a class='avia-delete' href='#delete' title='" . __('Delete Section', 'avia_framework') . "'>x</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Section', 'avia_framework') . "'>edit</a>"; } $output .= " <a class='avia-clone' href='#clone' title='" . __('Clone Section', 'avia_framework') . "' >" . __('Clone Section', 'avia_framework') . "</a></div>"; $output .= " <div class='avia_inner_shortcode avia_connect_sort av_drop' data-dragdrop-level='" . $this->config['drop-level'] . "'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { /* $params['content'] = trim($params['content']); if(empty($params['content'])) $params['content'] = "[av_cell_one_half first][/av_cell_one_half] [av_cell_one_half][/av_cell_one_half]"; */ extract($params); $name = $this->config['shortcode']; $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = $this->config['name']; $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); if ($content) { $final_content = $this->builder->do_shortcode_backend($content); $text_area = ShortcodeHelper::create_shortcode_by_array($name, $content, $args); } else { $cell = new avia_sc_cell_one_half($this->builder); $params = array('content' => "", 'args' => array(), 'data' => ''); $final_content = ""; $final_content .= $cell->editor_element($params); $final_content .= $cell->editor_element($params); $text_area = ShortcodeHelper::create_shortcode_by_array($name, '[av_cell_one_half first][/av_cell_one_half] [av_cell_one_half][/av_cell_one_half]', $args); } $output = "<div class='avia_layout_row avia_layout_section avia_pop_class avia-no-visual-updates " . $name . " av_drag' " . $dataString . ">"; $output .= " <a class='avia-add-cell avia-add' href='#add-cell' title='" . __('Add Cell', 'avia_framework') . "'>Add Cell</a>"; $output .= " <a class='avia-set-cell-size avia-add' href='#set-size' title='" . __('Set Cell Size', 'avia_framework') . "'>Set Cell Size</a>"; $output .= " <div class='avia_sorthandle menu-item-handle'>"; $output .= " <span class='avia-element-title'>" . $this->config['name'] . "</span>"; $output .= " <a class='avia-delete' href='#delete' title='" . __('Delete Row', 'avia_framework') . "'>x</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Row', 'avia_framework') . "'>edit</a>"; } $output .= "<a class='avia-save-element' href='#save-element' title='" . __('Save Element as Template', 'avia_framework') . "'>+</a>"; $output .= " <a class='avia-clone' href='#clone' title='" . __('Clone Row', 'avia_framework') . "' >" . __('Clone Row', 'avia_framework') . "</a></div>"; $output .= " <div class='avia_inner_shortcode avia_connect_sort av_drop' data-dragdrop-level='" . $this->config['drop-level'] . "'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . $text_area . "</textarea>"; $output .= $final_content; $output .= "</div></div>"; return $output; }
/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { $atts = shortcode_atts(array('style' => "grid", 'columns' => "2", "autoplay" => true, "interval" => 5), $atts); $custom_class = !empty($meta['custom_class']) ? $meta['custom_class'] : ""; extract($atts); $output = ""; switch ($columns) { case 1: $columnClass = "av_one_full flex_column no_margin"; break; case 2: $columnClass = "av_one_half flex_column no_margin"; break; case 3: $columnClass = "av_one_third flex_column no_margin"; break; case 4: $columnClass = "av_one_fourth flex_column no_margin"; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => 'fade', 'hoverpause' => true)); $output .= "<div {$data} class='avia-testimonial-wrapper avia-{$style}-testimonials avia-{$style}-{$columns}-testimonials avia_animate_when_almost_visible {$custom_class}'>"; avia_sc_testimonial::$counter = 1; avia_sc_testimonial::$rows = 1; avia_sc_testimonial::$columnClass = $columnClass; avia_sc_testimonial::$columns = $columns; avia_sc_testimonial::$style = $style; //if we got a slider we only need a single row wrpper if ($style == "slider") { avia_sc_testimonial::$columns = 100000; } $output .= ShortcodeHelper::avia_remove_autop($content, true); //close unclosed wrapper containers if (avia_sc_testimonial::$counter != 1) { $output .= "</div>"; } $output .= "</div>"; return $output; }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { extract($params); $name = $this->config['shortcode']; $drag = $this->config['drag-level']; $drop = $this->config['drop-level']; $size = array('av_one_full' => '1/1', 'av_one_half' => '1/2', 'av_one_third' => '1/3', 'av_one_fourth' => '1/4', 'av_one_fifth' => '1/5', 'av_two_third' => '2/3', 'av_three_fourth' => '3/4', 'av_two_fifth' => '2/5', 'av_three_fifth' => '3/5', 'av_four_fifth' => '4/5'); $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = __('Edit Column', 'avia_framework'); $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $extraClass = isset($args[0]) ? $args[0] == 'first' ? ' avia-first-col' : "" : ""; $output = "<div class='avia_layout_column avia_layout_column_no_cell avia_pop_class avia-no-visual-updates " . $name . $extraClass . " av_drag' {$dataString} data-width='{$name}'>"; $output .= "<div class='avia_sorthandle menu-item-handle'>"; $output .= "<a class='avia-smaller avia-change-col-size' href='#smaller' title='" . __('Decrease Column Size', 'avia_framework') . "'>-</a>"; $output .= "<span class='avia-col-size'>" . $size[$name] . "</span>"; $output .= "<a class='avia-bigger avia-change-col-size' href='#bigger' title='" . __('Increase Column Size', 'avia_framework') . "'>+</a>"; $output .= "<a class='avia-delete' href='#delete' title='" . __('Delete Column', 'avia_framework') . "'>x</a>"; $output .= "<a class='avia-save-element' href='#save-element' title='" . __('Save Element as Template', 'avia_framework') . "'>+</a>"; //$output .= "<a class='avia-new-target' href='#new-target' title='".__('Move Element','avia_framework' )."'>+</a>"; $output .= "<a class='avia-clone' href='#clone' title='" . __('Clone Column', 'avia_framework') . "' >" . __('Clone Column', 'avia_framework') . "</a>"; if (!empty($this->config['popup_editor'])) { $output .= " <a class='avia-edit-element' href='#edit-element' title='" . __('Edit Cell', 'avia_framework') . "'>edit</a>"; } $output .= "</div>"; $output .= "<div class='avia_inner_shortcode avia_connect_sort av_drop ' data-dragdrop-level='{$drop}'>"; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($name, $content, $args) . "</textarea>"; if ($content) { $content = $this->builder->do_shortcode_backend($content); } $output .= $content; $output .= "</div></div>"; return $output; }
static function set_video_slide($video_url, $service = false, $meta = false) { $video = ""; if (empty($service)) { $service = self::which_video_service($video_url); } $uid = 'player_' . get_the_ID() . '_' . mt_rand() . '_' . mt_rand(); $controls = empty($meta['video_controls']) ? 1 : 0; $loop = empty($meta['video_loop']) ? 0 : 1; switch ($service) { case "html5": $video = "<div class='av-click-overlay'></div>" . avia_html5_video_embed($video_url); break; case "iframe": $video = $video_url; break; case "youtube": $explode_at = strpos($video_url, 'youtu.be/') !== false ? "/" : "v="; $video_url = explode($explode_at, trim($video_url)); $video_url = end($video_url); $video_id = $video_url; //if parameters are appended make sure to create the correct video id if (strpos($video_url, '?') !== false || strpos($video_url, '?') !== false) { preg_match('!(.+)[&?]!', $video_url, $video_id); $video_id = isset($video_id[1]) ? $video_id[1] : $video_id[0]; } $video_data = apply_filters('avf_youtube_video_data', array('autoplay' => 0, 'videoid' => $video_id, 'hd' => 1, 'rel' => 0, 'wmode' => 'opaque', 'playlist' => $uid, 'loop' => 0, 'version' => 3, 'autohide' => 1, 'color' => 'white', 'controls' => $controls, 'showinfo' => 0)); $data = AviaHelper::create_data_string($video_data); $video = "<div class='av-click-overlay'></div><div class='mejs-mediaelement'><div height='1600' width='900' class='av_youtube_frame' id='{$uid}' {$data}></div></div>"; break; case "vimeo": $color = ltrim(avia_get_option('colorset-main_color-primary'), '#'); $autopause = empty($meta['video_section_bg']) ? 1 : 0; //pause if another vimeo video plays? $video_url = explode('/', trim($video_url)); $video_url = end($video_url); $video_url = add_query_arg(array('portrait' => 0, 'byline' => 0, 'title' => 0, 'badge' => 0, 'loop' => $loop, 'autopause' => $autopause, 'api' => 1, 'rel' => 0, 'player_id' => $uid, 'color' => $color), 'http://player.vimeo.com/video/' . $video_url); $video_url = apply_filters('avf_vimeo_video_url', $video_url); $video = "<div class='av-click-overlay'></div><div class='mejs-mediaelement'><iframe src='{$video_url}' height='1600' width='900' frameborder='' class='av_vimeo_frame' id='{$uid}'></iframe></div>"; break; } return $video; }
public function html() { $output = ""; $counter = 0; avia_partner_logo::$slider++; if ($this->slide_count == 0) { return $output; } extract($this->config); $extraClass = 'first'; $grid = 'one_third'; $slide_loop_count = 1; $loop_counter = 1; $total = $columns % 2 ? "odd" : "even"; $heading = !empty($this->config['heading']) ? '<h3>' . $this->config['heading'] . '</h3>' : " "; switch ($columns) { case "1": $grid = 'av_fullwidth'; break; case "2": $grid = 'av_one_half'; break; case "3": $grid = 'av_one_third'; break; case "4": $grid = 'av_one_fourth'; break; case "5": $grid = 'av_one_fifth'; break; case "6": $grid = 'av_one_sixth'; break; case "7": $grid = 'av_one_seventh'; break; case "8": $grid = 'av_one_eighth'; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation)); $thumb_fallback = ""; $output .= "<div {$data} class='avia-logo-element-container {$border} avia-logo-{$type} avia-content-slider avia-smallarrow-slider avia-content-{$type}-active noHover avia-content-slider" . avia_partner_logo::$slider . " avia-content-slider-{$total} {$class}' >"; $heading_class = ''; if ($navigation == 'no') { $heading_class .= ' no-logo-slider-navigation '; } if ($heading == ' ') { $heading_class .= ' no-logo-slider-heading '; } $output .= "<div class='avia-smallarrow-slider-heading {$heading_class}'>"; if ($heading != ' ' || $navigation != 'no') { $output .= "<div class='new-special-heading'>" . $heading . "</div>"; } if (count($this->id_array) > $columns && $type == 'slider' && $navigation != 'no') { if ($navigation == 'arrows') { $output .= $this->slide_navigation_arrows(); } } $output .= "</div>"; $markup_url = avia_markup_helper(array('context' => 'image_url', 'echo' => false, 'custom_markup' => $custom_markup)); $markup = avia_markup_helper(array('context' => 'image', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<div class='avia-content-slider-inner'>"; foreach ($this->id_array as $key => $id) { if (isset($this->slides[$id])) { $slide = $this->slides[$id]; $meta = array_merge(array('link' => '', 'link_target' => '', 'linktitle' => '', 'hover' => '', 'custom_markup' => ''), $this->subslides[$key]['attr']); extract($meta); $markup_url = avia_markup_helper(array('context' => 'image_url', 'echo' => false, 'id' => $slide->ID, 'custom_markup' => $custom_markup)); $markup = avia_markup_helper(array('context' => 'image', 'echo' => false, 'id' => $slide->ID, 'custom_markup' => $custom_markup)); $img = wp_get_attachment_image($slide->ID, $size); $link = aviaHelper::get_url($link, $slide->ID); $blank = strpos($link_target, '_blank') !== false || $link_target == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($link_target, 'nofollow') !== false ? ' rel="nofollow" ' : ""; } $parity = $loop_counter % 2 ? 'odd' : 'even'; $last = $this->slide_count == $slide_loop_count ? " post-entry-last " : ""; $post_class = "post-entry slide-entry-overview slide-loop-{$slide_loop_count} slide-parity-{$parity} {$last}"; $thumb_class = "real-thumbnail"; $single_data = empty($hover) ? '' : 'data-avia-tooltip="' . $hover . '"'; if ($loop_counter == 1) { $output .= "<div class='slide-entry-wrap' {$markup}>"; } $img = str_replace('<img ', "<img {$markup_url} ", $img); $output .= "<div {$single_data} class='slide-entry flex_column no_margin {$post_class} {$grid} {$extraClass} {$thumb_class}'>"; $output .= !empty($link) ? "<a href='{$link}' data-rel='slide-" . avia_partner_logo::$slider . "' class='slide-image' title='{$linktitle}' {$blank} >{$img}</a>" : $img; $output .= "</div>"; $loop_counter++; $slide_loop_count++; $extraClass = ""; if ($loop_counter > $columns) { $loop_counter = 1; $extraClass = 'first'; } if ($loop_counter == 1 || !empty($last)) { $output .= "</div>"; } } $output .= "</div>"; if (count($this->id_array) > $columns && $type == 'slider' && $navigation != 'no') { if ($navigation == 'dots') { $output .= $this->slide_navigation_dots(); } } $output .= "</div>"; return $output; }
public function html() { global $avia_config; $output = ""; if (empty($this->entries) || empty($this->entries->posts)) { return $output; } avia_post_slider::$slide++; extract($this->atts); if ($preview_mode == 'auto') { $image_size = 'portfolio'; } $extraClass = 'first'; $grid = 'one_third'; $post_loop_count = 1; $loop_counter = 1; $autoplay = $autoplay == "no" ? false : true; $total = $columns % 2 ? "odd" : "even"; switch ($columns) { case "1": $grid = 'av_fullwidth'; if ($preview_mode == 'auto') { $image_size = 'large'; } break; case "2": $grid = 'av_one_half'; break; case "3": $grid = 'av_one_third'; break; case "4": $grid = 'av_one_fourth'; if ($preview_mode == 'auto') { $image_size = 'portfolio_small'; } break; case "5": $grid = 'av_one_fifth'; if ($preview_mode == 'auto') { $image_size = 'portfolio_small'; } break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'show_slide_delay' => 90)); $thumb_fallback = ""; $markup = avia_markup_helper(array('context' => 'blog', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<div {$data} class='avia-content-slider avia-content-{$type}-active avia-content-slider" . avia_post_slider::$slide . " avia-content-slider-{$total} {$class}' {$markup}>"; $output .= "<div class='avia-content-slider-inner'>"; foreach ($this->entries->posts as $entry) { $the_id = $entry->ID; $parity = $loop_counter % 2 ? 'odd' : 'even'; $last = $this->entries->post_count == $post_loop_count ? " post-entry-last " : ""; $post_class = "post-entry post-entry-{$the_id} slide-entry-overview slide-loop-{$post_loop_count} slide-parity-{$parity} {$last}"; $link = get_permalink($the_id); $excerpt = ""; $title = ''; $show_meta = !is_post_type_hierarchical($entry->post_type); $commentCount = get_comments_number($the_id); $thumbnail = get_the_post_thumbnail($the_id, $image_size); $format = get_post_format($the_id); if (empty($format)) { $format = "standard"; } if ($thumbnail) { $thumb_fallback = $thumbnail; $thumb_class = "real-thumbnail"; } else { $thumbnail = "<span class=' fallback-post-type-icon' " . av_icon_string($format) . "></span><span class='slider-fallback-image'>{{thumbnail}}</span>"; $thumb_class = "fake-thumbnail"; } $permalink = '<div class="read-more-link"><a href="' . get_permalink($the_id) . '" class="more-link">' . __('Read more', 'avia_framework') . '<span class="more-link-arrow"> →</span></a></div>'; $prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters('avf_postgrid_excerpt_length', 60), apply_filters('avf_postgrid_excerpt_delimiter', " "), "…", true, ''); if ($format == 'link') { $current_post = array(); $current_post['content'] = $entry->post_content; $current_post['title'] = $entry->post_title; if (function_exists('avia_link_content_filter')) { $current_post = avia_link_content_filter($current_post); } $link = $current_post['url']; } switch ($contents) { case "excerpt": $excerpt = $prepare_excerpt; $title = $entry->post_title; break; case "excerpt_read_more": $excerpt = $prepare_excerpt; $excerpt .= $permalink; $title = $entry->post_title; break; case "title": $excerpt = ''; $title = $entry->post_title; break; case "title_read_more": $excerpt = $permalink; $title = $entry->post_title; break; case "only_excerpt": $excerpt = $prepare_excerpt; $title = ''; break; case "only_excerpt_read_more": $excerpt = $prepare_excerpt; $excerpt .= $permalink; $title = ''; break; case "no": $excerpt = ''; $title = ''; break; } if ($loop_counter == 1) { $output .= "<div class='slide-entry-wrap'>"; } $post_format = get_post_format($the_id) ? get_post_format($the_id) : 'standard'; $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'id' => $the_id, 'custom_markup' => $custom_markup)); $output .= "<article class='slide-entry flex_column {$style} {$post_class} {$grid} {$extraClass} {$thumb_class}' {$markup}>"; $output .= $thumbnail ? "<a href='{$link}' data-rel='slide-" . avia_post_slider::$slide . "' class='slide-image' title=''>{$thumbnail}</a>" : ""; if ($post_format == "audio") { $current_post = array(); $current_post['content'] = $entry->post_content; $current_post['title'] = $entry->post_title; $current_post = apply_filters('post-format-' . $post_format, $current_post); if (!empty($current_post['before_content'])) { $output .= '<div class="big-preview single-big audio-preview">' . $current_post['before_content'] . '</div>'; } } $output .= "<div class='slide-content'>"; $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false, 'id' => $the_id, 'custom_markup' => $custom_markup)); $output .= '<header class="entry-content-header">'; $output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' {$markup}><a href='{$link}' title='" . esc_attr(strip_tags($title)) . "'>" . $title . "</a></h3>" : ''; $output .= '</header>'; if ($show_meta && !empty($excerpt)) { $output .= "<div class='slide-meta'>"; if ($commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio') { $link_add = $commentCount === "0" ? "#respond" : "#comments"; $text_add = $commentCount === "1" ? __('Comment', 'avia_framework') : __('Comments', 'avia_framework'); $output .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a></div><div class='slide-meta-del'>/</div>"; } $markup = avia_markup_helper(array('context' => 'entry_time', 'echo' => false, 'id' => $the_id, 'custom_markup' => $custom_markup)); $output .= "<time class='slide-meta-time updated' {$markup}>" . get_the_time(get_option('date_format'), $the_id) . "</time>"; $output .= "</div>"; } $markup = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'id' => $the_id, 'custom_markup' => $custom_markup)); $excerpt = apply_filters('avf_post_slider_entry_excerpt', $excerpt, $prepare_excerpt, $permalink, $entry); $output .= !empty($excerpt) ? "<div class='slide-entry-excerpt entry-content' {$markup}>" . $excerpt . "</div>" : ""; $output .= "</div>"; $output .= '<footer class="entry-footer"></footer>'; $output .= "</article>"; $loop_counter++; $post_loop_count++; $extraClass = ""; if ($loop_counter > $columns) { $loop_counter = 1; $extraClass = 'first'; } if ($loop_counter == 1 || !empty($last)) { $output .= "</div>"; } } $output .= "</div>"; if ($post_loop_count - 1 > $columns && $type == 'slider') { $output .= $this->slide_navigation_arrows(); } if ($use_main_query_pagination == 'yes' && $paginate == "yes") { global $wp_query; $avia_pagination = avia_pagination($wp_query->max_num_pages, 'nav'); } else { if ($paginate == "yes") { $avia_pagination = avia_pagination($this->entries->max_num_pages, 'nav'); } } if (!empty($avia_pagination)) { $output .= "<div class='pagination-wrap pagination-slider'>{$avia_pagination}</div>"; } $output .= "</div>"; $output = str_replace('{{thumbnail}}', $thumb_fallback, $output); wp_reset_query(); return $output; }
/** * default code to create a sortable item for your editor */ public function create_sortable_editor_element($params) { $extraClass = ""; $defaults = array('class' => 'avia_default_container', 'innerHtml' => ''); $params = array_merge($defaults, $params); extract($params); $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = $this->config['name']; $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if (isset($this->config['shortcode_nested'])) { $data['allowed-shortcodes'] = $this->config['shortcode_nested']; $data['allowed-shortcodes'][] = $this->config['shortcode']; $data['allowed-shortcodes'] = implode(",", $data['allowed-shortcodes']); } if (!empty($this->config['modal_on_load'])) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string($data); $output = "<div class='avia_sortable_element avia_pop_class " . $class . " " . $this->config['shortcode'] . " av_drag' " . $dataString . ">"; $output .= "<div class='avia_sorthandle menu-item-handle'>"; if (!empty($this->config['popup_editor'])) { $extraClass = 'avia-edit-element'; $output .= "<a class='{$extraClass}' href='#edit-element' title='" . __('Edit Element', 'avia_framework') . "'>edit</a>"; } //$output .= "<a class='avia-new-target' href='#new-target' title='".__('Move Element','avia_framework' )."'>+</a>"; $output .= "<a class='avia-delete' href='#delete' title='" . __('Delete Element', 'avia_framework') . "'>x</a>"; $output .= "<a class='avia-clone' href='#clone' title='" . __('Clone Element', 'avia_framework') . "' >" . __('Clone Element', 'avia_framework') . "</a></div>"; $output .= "<div class='avia_inner_shortcode {$extraClass}'>"; $output .= $innerHtml; $output .= "<textarea data-name='text-shortcode' cols='20' rows='4'>" . ShortcodeHelper::create_shortcode_by_array($this->config['shortcode'], $content, $args) . "</textarea>"; $output .= "</div></div>"; return $output; }
public function html() { global $woocommerce, $woocommerce_loop; $output = ""; global $avia_config; $output = ""; avia_post_slider::$slide++; extract($this->atts); $extraClass = 'first'; $grid = 'one_third'; $image_size = 'portfolio'; $post_loop_count = 1; $loop_counter = 1; $autoplay = $autoplay == "no" ? false : true; $total = $columns % 2 ? "odd" : "even"; $woocommerce_loop['columns'] = $columns; switch ($columns) { case "1": $grid = 'av_fullwidth'; $image_size = 'large'; break; case "2": $grid = 'av_one_half'; break; case "3": $grid = 'av_one_third'; break; case "4": $grid = 'av_one_fourth'; $image_size = 'portfolio_small'; break; case "5": $grid = 'av_one_fifth'; $image_size = 'portfolio_small'; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'hoverpause' => 1)); ob_start(); if (have_posts()) { echo "<div {$data} class='template-shop avia-content-slider avia-content-{$type}-active avia-content-slider" . avia_post_slider::$slide . " avia-content-slider-{$total} {$class} shop_columns_{$columns}' >"; if ($sort == "dropdown") { avia_woocommerce_frontend_search_params(); } echo "<div class='avia-content-slider-inner'>"; if ($type == 'grid') { echo '<ul class="products">'; } while (have_posts()) { the_post(); if ($loop_counter == 1 && $type == 'slider') { echo '<ul class="products slide-entry-wrap">'; } woocommerce_get_template_part('content', 'product'); $loop_counter++; $post_loop_count++; if ($loop_counter > $columns) { $loop_counter = 1; } if ($loop_counter == 1 && $type == 'slider') { echo '</ul>'; } } // end of the loop. if ($loop_counter != 1 || $type == 'grid') { echo '</ul>'; } echo "</div>"; if ($post_loop_count - 1 > $columns && $type == 'slider') { echo $this->slide_navigation_arrows(); } echo "</div>"; } else { if (!woocommerce_product_subcategories(array('before' => '<ul class="products">', 'after' => '</ul>'))) { echo "<p>" . __('No products found which match your selection.', 'woocommerce') . "</p>"; } } echo '<div class="clear"></div>'; $products = ob_get_clean(); $output .= $products; if ($paginate == "yes" && ($avia_pagination = avia_pagination('', 'nav'))) { $output .= "<div class='pagination-wrap pagination-slider'>{$avia_pagination}</div>"; } wp_reset_query(); return $output; }
function load_more_button() { $data_string = AviaHelper::create_data_string($this->atts); $output = ""; $output .= "<a class='av-masonry-pagination av-masonry-load-more' href='#load-more' {$data_string}>" . __('Load more', 'avia_framework') . "</a>"; return $output; }
/** * * The multi_image method allows us to insert many images into a modal template at once * @param array $element the array holds data like type, value, id, class, description which are necessary to render the whole option-section * @return string $output the string returned contains the html code generated within the method */ static function multi_image($element) { if (empty($element['data'])) { $fetch = isset($element['fetch']) ? $element['fetch'] : "template"; $state = isset($element['state']) ? $element['state'] : "avia_insert_multi"; $class = $fetch == "template" ? "avia-media-img-only-no-sidebars" : "avia-media-img-only"; $element['data'] = array('target' => $element['id'], 'title' => $element['title'], 'type' => $element['type'], 'button' => $element['button'], 'class' => 'media-frame ' . $class . ' ' . $element['container_class'], 'frame' => 'select', 'state' => $state, 'fetch' => $fetch); } $data = AviaHelper::create_data_string($element['data']); $class = 'button aviabuilder-image-upload avia-builder-image-insert ' . $element['class']; $output = ' <a href="#" class="' . $class . '" ' . $data . ' title="' . esc_attr($element['title']) . '"> <span class="wp-media-buttons-icon"></span>' . $element['title'] . '</a>'; return $output; }
/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { $atts = shortcode_atts(array('style' => "grid", 'columns' => "2", "autoplay" => true, "interval" => 5, 'font_color' => '', 'custom_title' => '', 'custom_content' => ''), $atts, $this->config['shortcode']); $custom_class = !empty($meta['custom_class']) ? $meta['custom_class'] : ""; extract($atts); $this->title_styling = ""; $this->content_styling = ""; $this->content_class = ""; $this->subtitle_class = ""; if ($font_color == "custom") { $this->title_styling .= !empty($custom_title) ? "color:{$custom_title}; " : ""; $this->content_styling .= !empty($custom_content) ? "color:{$custom_content}; " : ""; if ($this->title_styling) { $this->title_styling = " style='{$this->title_styling}'"; $this->subtitle_class = "av_opacity_variation"; } if ($this->content_styling) { $this->content_class = "av_inherit_color"; $this->content_styling = " style='{$this->content_styling}'"; } } $output = ""; switch ($columns) { case 1: $columnClass = "av_one_full flex_column no_margin"; break; case 2: $columnClass = "av_one_half flex_column no_margin"; break; case 3: $columnClass = "av_one_third flex_column no_margin"; break; case 4: $columnClass = "av_one_fourth flex_column no_margin"; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => 'fade', 'hoverpause' => true)); $controls = false; if ($style == "slider_large") { $style = "slider"; $custom_class .= " av-large-testimonial-slider"; $controls = true; } $output .= "<div {$data} class='avia-testimonial-wrapper avia-{$style}-testimonials avia-{$style}-{$columns}-testimonials avia_animate_when_almost_visible {$custom_class}'>"; avia_sc_testimonial::$counter = 1; avia_sc_testimonial::$rows = 1; avia_sc_testimonial::$columnClass = $columnClass; avia_sc_testimonial::$columns = $columns; avia_sc_testimonial::$style = $style; //if we got a slider we only need a single row wrpper if ($style != "grid") { avia_sc_testimonial::$columns = 100000; } $output .= ShortcodeHelper::avia_remove_autop($content, true); //close unclosed wrapper containers if (avia_sc_testimonial::$counter != 1) { $output .= "</section>"; } if ($controls) { $output .= $this->slide_navigation_arrows(); } $output .= "</div>"; return $output; }
public function html() { $output = ""; $counter = 0; avia_content_slider::$slider++; if (empty($this->config['content'])) { return $output; } //$html .= empty($this->subslides) ? $this->default_slide() : $this->advanced_slide(); extract($this->config); $extraClass = 'first'; $grid = 'one_third'; $slide_loop_count = 1; $loop_counter = 1; $total = $columns % 2 ? "odd" : "even"; $heading = !empty($this->config['heading']) ? '<h3>' . $this->config['heading'] . '</h3>' : " "; $slide_count = count($content); switch ($columns) { case "1": $grid = 'av_fullwidth'; break; case "2": $grid = 'av_one_half'; break; case "3": $grid = 'av_one_third'; break; case "4": $grid = 'av_one_fourth'; break; case "5": $grid = 'av_one_fifth'; break; case "6": $grid = 'av_one_sixth'; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'show_slide_delay' => 30)); $thumb_fallback = ""; $output .= "<div {$data} class='avia-content-slider-element-container avia-content-slider-element-{$type} avia-content-slider avia-smallarrow-slider avia-content-{$type}-active avia-content-slider" . avia_content_slider::$slider . " avia-content-slider-{$total} {$class}' >"; $heading_class = ''; if ($navigation == 'no') { $heading_class .= ' no-content-slider-navigation '; } if ($heading == ' ') { $heading_class .= ' no-content-slider-heading '; } $output .= "<div class='avia-smallarrow-slider-heading {$heading_class}'>"; $output .= "<div class='new-special-heading'>" . $heading . "</div>"; if ($slide_count > $columns && $type == 'slider' && $navigation != 'no') { if ($navigation == 'dots') { $output .= $this->slide_navigation_dots(); } if ($navigation == 'arrows') { $output .= $this->slide_navigation_arrows(); } } $output .= "</div>"; $output .= "<div class='avia-content-slider-inner'>"; foreach ($content as $key => $value) { $link = $linktarget = ""; extract($value['attr']); $link = aviaHelper::get_url($link); $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $parity = $loop_counter % 2 ? 'odd' : 'even'; $last = $slide_count == $slide_loop_count ? " post-entry-last " : ""; $post_class = "post-entry slide-entry-overview slide-loop-{$slide_loop_count} slide-parity-{$parity} {$last}"; if ($loop_counter == 1) { $output .= "<div class='slide-entry-wrap'>"; } $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false)); $output .= "<section class='slide-entry flex_column {$post_class} {$grid} {$extraClass}' {$markup}>"; $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false)); $output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' {$markup}>" : ''; $output .= !empty($link) && !empty($title) ? "<a href='{$link}' {$blank} title='" . esc_attr($title) . "'>" . $title . "</a>" : $title; $output .= !empty($title) ? '</h3>' : ''; $markup = avia_markup_helper(array('context' => 'entry_content', 'echo' => false)); $output .= !empty($value['content']) ? "<div class='slide-entry-excerpt entry-content' {$markup}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($value['content'])) . "</div>" : ""; $output .= '</section>'; $loop_counter++; $slide_loop_count++; $extraClass = ""; if ($loop_counter > $columns) { $loop_counter = 1; $extraClass = 'first'; } if ($loop_counter == 1 || !empty($last)) { $output .= "</div>"; } } $output .= "</div>"; $output .= "</div>"; return $output; }
public function html() { $html = ""; $counter = 0; $style = ""; $extraClass = ""; $style = ""; avia_feature_image_slider::$slider++; if ($this->slide_count == 0) { return $html; } if (!empty($this->atts['default-height'])) { $style = "style='padding-bottom: {{av-default-heightvar}}%;'"; $extraClass .= " av-default-height-applied"; } if (strpos($this->atts['slider_size'], ":") !== false) { $ratio = explode(':', trim($this->atts['slider_size'])); if (empty($ratio[0])) { $ratio[0] = 16; } if (empty($ratio[1])) { $ratio[1] = 9; } $final_ratio = (int) $ratio[0] / (int) $ratio[1]; $def_height = "padding-bottom:" . 100 / $final_ratio . "%"; } else { $def_height = (int) $this->atts['slider_size']; $def_height = "height: {$def_height}px"; } $style = "style='{$def_height}'"; if (!empty($this->atts['control_layout'])) { $extraClass .= " " . $this->atts['control_layout']; } $markup = avia_markup_helper(array('context' => 'image', 'echo' => false, 'custom_markup' => $this->atts['custom_markup'])); $data = AviaHelper::create_data_string($this->atts); $html .= "<div {$data} class='avia-slideshow avia-featureimage-slideshow avia-animated-caption avia-slideshow-" . avia_sc_featureimage_slider::$slide_count . " {$extraClass} avia-slideshow-" . $this->atts['image_size'] . " " . $this->atts['class'] . " avia-" . $this->atts['animation'] . "-slider ' {$markup}>"; $html .= "<ul class='avia-slideshow-inner avia-slideshow-fixed-height' {$style}>"; $html .= $this->default_slide(); $html .= "</ul>"; if ($this->slide_count > 1) { $html .= $this->slide_navigation_arrows(); $html .= $this->slide_navigation_dots(); } if (!empty($this->atts['caption_override'])) { $html .= $this->atts['caption_override']; } $html .= "</div>"; if (!empty($this->atts['default-height'])) { $html = str_replace('{{av-default-heightvar}}', $this->atts['default-height'], $html); } return $html; }
public function html() { $html = ""; $counter = 0; avia_slideshow::$slider++; if ($this->slide_count == 0) { return $html; } $data = AviaHelper::create_data_string($this->config); $html .= "<div {$data} class='avia-slideshow avia-slideshow-" . avia_slideshow::$slider . " avia-slideshow-" . $this->config['size'] . " " . $this->config['handle'] . " " . $this->config['class'] . " avia-" . $this->config['animation'] . "-slider ' >"; $html .= "<ul class='avia-slideshow-inner'>"; $html .= empty($this->subslides) ? $this->default_slide() : $this->advanced_slide(); $html .= "</ul>"; if ($this->slide_count > 1) { $html .= $this->slide_navigation_arrows(); $html .= $this->slide_navigation_dots(); } $html .= "</div>"; return $html; }