/** * 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('email' => get_option('admin_email'), 'button' => __("Submit", 'avia_framework'), 'autorespond' => '', 'captcha' => '', 'subject' => '', 'on_send' => '', 'link' => '', 'sent' => __("Your message has been sent!", 'avia_framework'), 'title' => __("Send us mail", 'avia_framework')), $atts, $this->config['shortcode']); extract($atts); $post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID(); $redirect = !empty($on_send) ? AviaHelper::get_url($link) : ""; $form_args = array("heading" => $title ? "<h3>" . $title . "</h3>" : "", "success" => "<h3 class='avia-form-success'>" . $sent . "</h3>", "submit" => $button, "myemail" => $email, "action" => get_permalink($post_id), "myblogname" => get_option('blogname'), "autoresponder" => $autorespond, "autoresponder_subject" => __('Thank you for your Message!', 'avia_framework'), "autoresponder_email" => $email, "subject" => $subject, "form_class" => $meta['el_class'], "multiform" => true, "label_first" => true, "redirect" => $redirect); if (trim($form_args['myemail']) == '') { $form_args['myemail'] = get_option('admin_email'); } //form fields passed by the user $form_fields = $this->helper_array2form_fields(ShortcodeHelper::shortcode2array($content, 1)); //fake username field that is not visible. if the field has a value a spam bot tried to send the form $elements['avia_username'] = array('type' => 'decoy', 'label' => '', 'check' => 'must_empty'); //captcha field for the user to verify that he is real if ($captcha) { $elements['avia_age'] = array('type' => 'captcha', 'check' => 'captcha', 'label' => __('Please prove that you are human by solving the equation', 'avia_framework')); } //merge all fields $form_fields = apply_filters('avia_contact_form_elements', array_merge($form_fields, $elements)); $form_args = apply_filters('avia_contact_form_args', $form_args, $post_id); $contact_form = new avia_form($form_args); $contact_form->create_elements($form_fields); $output = $contact_form->display_form(true); 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('label' => 'Click me', 'link' => '', 'link_target' => '', 'color' => 'theme-color', 'custom_bg' => '#444444', 'custom_font' => '#ffffff', 'size' => 'small', 'position' => 'center', 'icon_select' => 'yes', 'icon' => '', 'font' => ''), $atts); $display_char = av_icon($atts['icon'], $atts['font']); $style = ""; if ($atts['color'] == "custom") { $style .= "style='background-color:" . $atts['custom_bg'] . "; border-color:" . $atts['custom_bg'] . "; color:" . $atts['custom_font'] . "; '"; } $blank = strpos($atts['link_target'], '_blank') !== false ? ' target="_blank" ' : ""; $blank .= strpos($atts['link_target'], 'nofollow') !== false ? ' rel="nofollow" ' : ""; $link = AviaHelper::get_url($atts['link']); $link = $link == "http://" ? "" : $link; $output = ""; $output .= "<a href='{$link}' class='avia-button " . $this->class_by_arguments('icon_select, color, size, position', $atts, true) . "' {$blank} {$style} >"; $output .= "<span class='avia_button_icon' {$display_char}></span>"; $output .= "<span class='avia_iconbox_title' >" . $atts['label'] . "</span>"; $output .= "</a>"; $output = "<div class='avia-button-wrap avia-button-" . $atts['position'] . " " . $meta['el_class'] . "'>" . $output . "</div>"; return $output; }
protected function slideshow_cta_button($link, $link_target, $button_color, $button_label, $button_count) { $button_html = ""; $blank = strpos($link_target, '_blank') !== false || $link_target == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($link_target, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $link = AviaHelper::get_url($link); $button_html .= "<a href='{$link}' {$blank} class='avia-slideshow-button avia-button avia-color-{$button_color} {$button_count}' data-duration='800' data-easing='easeInOutQuad'>"; $button_html .= $button_label; $button_html .= "</a>"; return $button_html; }
function av_rotator_item($atts, $content = "", $shortcodename = "") { $atts = shortcode_atts(array('title' => '', 'link' => '', 'linktarget' => '', 'custom_title' => ''), $atts, 'av_rotator_item'); extract($atts); $this->count++; $style = AviaHelper::style_string($atts, 'custom_title', 'color'); $style = AviaHelper::style_string($style); $link = AviaHelper::get_url($link); $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $tags = !empty($link) ? array("a href='{$link}' {$blank} ", 'a') : array('span', 'span'); $output = ""; $output .= "<{$tags[0]} {$style} class='av-rotator-text-single av-rotator-text-single-{$this->count}'>"; $output .= ShortcodeHelper::avia_remove_autop($title, true); $output .= "</{$tags[1]}>"; return $output; }
function html() { $output = ""; $class = !empty($this->atts['first_big_pos']) ? " av-magazine-hero-" . $this->atts['first_big_pos'] : ""; $class .= " " . $this->atts['top_bar']; if (!empty($this->atts['tabs'])) { $class .= " av-magazine-tabs-active"; } $output .= "<div id='av-magazine-" . self::$magazine . "' class='av-magazine " . $this->atts['class'] . " {$class}' >"; if ($this->atts['top_bar']) { $link = AviaHelper::get_url($this->atts['heading_link']); $heading = $this->atts['heading']; $b_class = ""; $b_style = ""; if ($this->atts['heading_color'] != "theme-color") { if ($this->atts['heading_color'] == "custom") { $b_style = "style='color: " . $this->atts['heading_custom_color'] . ";'"; } $b_class .= "avia-font-color-" . $this->atts['heading_color'] . " avia-inherit-font-color"; } $output .= "<div class='av-magazine-top-bar {$b_class}' {$b_style}>"; if ($heading) { $output .= "<a href='{$link}' class='av-magazine-top-heading'>{$heading}</a>"; } if (!empty($this->atts['tabs'])) { $output .= $this->sort_buttons(); } $output .= "</div>"; } //magazine main loop $output .= $this->magazine_loop($this->entries); //magazine sub loops $output .= $this->magazine_sub_loop(); $output .= "</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 = "") { if (empty($this->api_key)) { return; } $lists = get_option('av_chimplist'); $newlist = array(); if (empty($lists)) { return; } foreach ($lists as $key => $list_item) { $newlist[$list_item['name']] = $key; } $lists = $newlist; $atts = shortcode_atts(apply_filters('avf_sc_mailchimp_atts', array('list' => "", 'email' => get_option('admin_email'), 'button' => __("Submit", 'avia_framework'), 'captcha' => '', 'subject' => '', 'on_send' => '', 'link' => '', 'sent' => __("Thank you for subscribing to our newsletter!", 'avia_framework'), 'color' => "", 'hide_labels' => "", 'form_align' => "", 'listonly' => false, 'double_opt_in' => "")), $atts, $this->config['shortcode']); if (empty($atts['list'])) { return; } //extract form fields if ($atts['listonly']) { $form_fields = $this->convert_fields_from_list($atts['list']); } else { $content = str_replace("\\,", ",", $content); $form_fields = $this->helper_array2form_fields(ShortcodeHelper::shortcode2array($content, 1)); } if (empty($form_fields)) { return; } extract($atts); $post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID(); $redirect = !empty($on_send) ? AviaHelper::get_url($link) : ""; if (!empty($form_align)) { $meta['el_class'] .= " av-centered-form "; } $form_args = array("heading" => "", "success" => "<h3 class='avia-form-success avia-mailchimp-success'>" . $sent . "</h3>", "submit" => $button, "myemail" => $email, "action" => get_permalink($post_id), "myblogname" => get_option('blogname'), "subject" => $subject, "form_class" => $meta['el_class'] . " " . $color . " avia-mailchimp-form", "form_data" => array('av-custom-send' => 'mailchimp_send'), "multiform" => true, "label_first" => true, "redirect" => $redirect, "placeholder" => $hide_labels, "mailchimp" => $atts['list'], "custom_send" => array($this, 'send'), "double_opt_in" => $atts['double_opt_in']); if (trim($form_args['myemail']) == '') { $form_args['myemail'] = get_option('admin_email'); } $content = str_replace("\\,", ",", $content); //fake username field that is not visible. if the field has a value a spam bot tried to send the form $elements['avia_username'] = array('type' => 'decoy', 'label' => '', 'check' => 'must_empty'); //captcha field for the user to verify that he is real if ($captcha) { $elements['avia_age'] = array('type' => 'captcha', 'check' => 'captcha', 'label' => __('Please prove that you are human by solving the equation', 'avia_framework')); } //merge all fields $form_fields = apply_filters('ava_mailchimp_contact_form_elements', array_merge($form_fields, $elements)); $form_fields = apply_filters('avf_sc_mailchimp_form_elements', $form_fields, $atts); $form_args = apply_filters('avia_mailchimp_form_args', $form_args, $post_id); $contact_form = new avia_form($form_args); $contact_form->create_elements($form_fields); $output = $contact_form->display_form(true); return $output; }
function av_submenu_item($atts, $content = "", $shortcodename = "", $meta = "") { $output = ""; $atts = shortcode_atts(array('title' => '', 'link' => '', 'linktarget' => '', 'button_style' => ''), $atts, 'av_rotator_item'); extract($atts); if (!empty($title)) { avia_sc_submenu::$custom_items++; $link = AviaHelper::get_url($link); $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $output .= "<li class='menu-item menu-item-top-level {$button_style} menu-item-top-level-" . avia_sc_submenu::$custom_items . "'>"; $output .= "<a href='{$link}' {$blank}><span class='avia-bullet'></span>"; $output .= "<span class='avia-menu-text'>" . $title . "</span></a>"; //$output .= "<span class='avia-menu-fx'><span class='avia-arrow-wrap'><span class='avia-arrow'></span></span></span>"; $output .= "</a>"; $output .= "</li>"; } return $output; }
function get_image_based_slides() { foreach ($this->config['content'] as $key => $slide) { $this->slides[$key] = new stdClass(); $this->slides[$key]->post_title = isset($slide['attr']['title']) ? $slide['attr']['title'] : ""; $this->slides[$key]->post_excerpt = $slide['content']; $this->slides[$key]->av_attachment = wp_get_attachment_image($slide['attr']['id'], $this->config['size'], false, array('class' => 'aviaccordion-image')); $this->slides[$key]->av_permalink = isset($slide['attr']['link']) ? AviaHelper::get_url($slide['attr']['link'], $slide['attr']['id']) : ""; $this->slides[$key]->av_target = empty($slide['attr']['link_target']) ? "" : "target='" . $slide['attr']['link_target'] . "'"; } }
/** * 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 = "") { avia_sc_button_full::$count++; $atts = shortcode_atts(array('label' => 'Click me', 'link' => '', 'link_target' => '', 'color' => 'theme-color', 'color_hover' => 'theme-color-subtle', 'custom_bg' => '#444444', 'custom_bg_hover' => '#444444', 'custom_font' => '#ffffff', 'position' => 'center', 'icon_select' => 'no', 'icon' => '', 'font' => '', 'icon_hover' => '', 'description_pos' => ''), $atts, $this->config['shortcode']); $display_char = av_icon($atts['icon'], $atts['font']); $style = "color:" . $atts['custom_font'] . "; "; $style_hover = ""; if ($atts['color'] == "custom") { $style .= "background-color:" . $atts['custom_bg'] . "; "; } if ($atts['color_hover'] == "custom") { $style_hover = "style='background-color:" . $atts['custom_bg_hover'] . "; '"; } $extraClass = $atts['icon_hover'] ? "av-icon-on-hover" : ""; $blank = strpos($atts['link_target'], '_blank') !== false ? ' target="_blank" ' : ""; $blank .= strpos($atts['link_target'], 'nofollow') !== false ? ' rel="nofollow" ' : ""; $link = AviaHelper::get_url($atts['link']); $link = $link == "http://" ? "" : $link; if ($style) { $style = "style='{$style}'"; } $content_html = ""; if ($content && $atts['description_pos'] == 'above') { $content_html .= "<div class='av-button-description av-button-description-above'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; } if ('yes-left-icon' == $atts['icon_select']) { $content_html .= "<span class='avia_button_icon avia_button_icon_left ' {$display_char}></span>"; } $content_html .= "<span class='avia_iconbox_title' >" . $atts['label'] . "</span>"; if ('yes-right-icon' == $atts['icon_select']) { $content_html .= "<span class='avia_button_icon avia_button_icon_right' {$display_char}></span>"; } if ($content && $atts['description_pos'] == 'below') { $content_html .= "<div class='av-button-description av-button-description-below'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; } $output = ""; $output .= "<a href='{$link}' class='avia-button avia-button-fullwidth {$extraClass} " . $this->class_by_arguments('icon_select, color', $atts, true) . "' {$blank} {$style} >"; $output .= $content_html; $output .= "<span class='avia_button_background avia-button avia-button-fullwidth avia-color-" . $atts['color_hover'] . "' {$style_hover}></span>"; $output .= "</a>"; $output = "<div class='avia-button-wrap avia-button-" . $atts['position'] . " " . $meta['el_class'] . "'>" . $output . "</div>"; $params['class'] = "main_color av-fullscreen-button avia-no-border-styling " . $meta['el_class']; $params['open_structure'] = false; $id = AviaHelper::save_string($atts['label'], '-'); $params['id'] = !empty($id) ? $id : "av-fullwidth-button-" . avia_sc_button_full::$count; $params['custom_markup'] = $meta['custom_markup']; //we dont need a closing structure if the element is the first one or if a previous fullwidth element was displayed before if ($meta['index'] == 0) { $params['close'] = false; } if (!empty($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) { $params['close'] = false; } if (!ShortcodeHelper::is_top_level()) { return $output; } $button_html = $output; $output = avia_new_section($params); $output .= $button_html; $output .= avia_section_after_element_content($meta, 'after_fullwidth_button'); return $output; 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('label' => 'Click me', 'link' => '', 'link_target' => '', 'color' => 'theme-color', 'custom_bg' => '#444444', 'custom_font' => '#ffffff', 'size' => 'small', 'position' => 'center', 'icon_select' => 'yes', 'icon' => '1'), $atts); $icon_el = end($this->elements); //last element is the icon container $chars = $icon_el['chars']; if (!is_array($chars)) { include $icon_el['chars']; } $style = ""; if ($atts['color'] == "custom") { $style .= "style='background-color:" . $atts['custom_bg'] . "; border-color:" . $atts['custom_bg'] . "; color:" . $atts['custom_font'] . "; '"; } $display_char = isset($chars[$atts['icon'] - 1]) ? $chars[$atts['icon'] - 1] : $chars[0]; $blank = $atts['link_target'] ? 'target="_blank" ' : ""; $link = AviaHelper::get_url($atts['link']); $link = $link == "http://" ? "" : $link; $output = ""; $output .= "<a href='{$link}' class='avia-button " . $this->class_by_arguments('icon_select, color, size, position', $atts, true) . "' {$blank} {$style} >"; $output .= "<span class='avia_button_icon avia-font-" . $icon_el['font'] . "'>" . $display_char . "</span>"; $output .= "<span class='avia_iconbox_title' >" . $atts['label'] . "</span>"; $output .= "</a>"; $output = "<div class='avia-button-wrap avia-button-" . $atts['position'] . " " . $meta['el_class'] . "'>" . $output . "</div>"; return $output; }