function widget($args, $instance) { // outputs the content of the widget extract($instance); if (!is_array($style)) { $style = 's1' == $style ? array('tall') : array(); } echo '<hr class="' . spyropress_clean_cssclass($style) . '" />'; }
function row_wrapper($row_ID, $row) { $section_class = array('map-section'); if (isset($row['options']['custom_container_class']) && !empty($row['options']['custom_container_class'])) { $section_class[] = $row['options']['custom_container_class']; } $row_html = sprintf(' <div id="%1$s" class="%2$s"> <section class="featured_section footer map"> <div class="container"> <div class="%3$s"> %4$s </div> </div> </section> </div>', $row_ID, spyropress_clean_cssclass($section_class), get_row_class(true), builder_render_frontend_columns($row['columns'])); return $row_html; }
/** * Generate column classes */ function builder_column_class(&$prev_width, $col, $extra_class = '') { global $spyropress_builder; $classes = array(); // grid col size class $classes[] = 'span' . str_replace('/', 'by', $col->config['size']); if ('skt' == get_html_framework()) { $classes[] = get_skeleton_class($col->config['size']); } if ('fd3' == get_html_framework()) { $classes[] = get_foundation3_class($col->config['size']); } if ('bs3' == get_html_framework()) { $classes[] = 'col-md-' . $col->config['size']; } // add span_first class $width = is_string($col->config['size']) ? (int) 1 / 3 * 16 : (int) $col->config['size']; $new_width = $prev_width + $width; if ($prev_width == 0) { $classes[] = get_first_column_class(); $prev_width = $new_width; } elseif (get_grid_columns() - $new_width < 0) { $prev_width = $width; $classes[] = get_first_column_class(); } else { $prev_width = $new_width; } if (get_grid_columns() == $new_width) { $prev_width = 0; $classes[] = get_last_column_class(); } // extra class define by row block if ($extra_class != '') { $classes[] = $extra_class; } return spyropress_clean_cssclass($classes); }
<?php if (is_str_contain('[rotate_words]', $heading)) { $styles[] = 'word-rotator-title'; } printf('<h%1$s%3$s class="%4$s">%2$s</h%1$s>', $html_tag, do_shortcode($heading), spyropress_build_atts(array('animation' => $animation), 'data-appear-'), spyropress_clean_cssclass($styles));
/** * Generate section css class */ function build_section_class($class = '', $item, $base_class = 'section') { $all = array(); $all[] = $base_class; if (!empty($class)) { $all[] = $class; } if (isset($item['class']) && !empty($item['class'])) { $all[] = $item['class']; } return 'class="' . spyropress_clean_cssclass($all) . '"'; }
/** * Output Builder Module */ function spyropress_the_builder_module($widget_id, $widget) { global $wp_widget_factory, $spyropress_builder; $widget_type = $widget['type']; $instance = $widget['instance']; if ('SpyropressBuilderModule' == get_parent_class($widget_type)) { $widget_obj = $spyropress_builder->modules->get_module($widget_type); } else { $widget_obj = $wp_widget_factory->widgets[$widget_type]; } // check for null if (!is_a($widget_obj, 'WP_Widget')) { return; } // widget css classes $widget_class = array(); $widget_class[] = 'module'; $widget_class[] = $widget_obj->widget_options['classname']; if (isset($instance['custom_container_class'])) { $widget_class[] = $instance['custom_container_class']; } if (isset($instance['template']) && !empty($instance['template'])) { $template = $instance['template']; $widget_class[] = isset($widget_obj->templates[$template]['class']) ? $widget_obj->templates[$template]['class'] : ''; } if (isset($instance['custom_container_id']) && $instance['custom_container_id']) { $widget_id = $instance['custom_container_id']; } if (empty($args)) { $args = array('before_widget' => sprintf('<div%1$s class="%2$s">', $widget_id ? ' id="' . $widget_id . '"' : '', spyropress_clean_cssclass($widget_class)), 'after_widget' => '</div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'); } do_action('the_widget', $widget, $instance, $args); $widget_obj->_set(-1); $widget_obj->widget($args, $instance); }
/** * @see Walker::start_el() */ function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $indent = $depth ? str_repeat("\t", $depth) : ''; if (0 === $depth) { $this->has_megamenu = $item->isMega; $this->columns = $item->mega_columns; } if (1 === $depth) { $this->is_column = $item->is_mega_column; } if ('phone' == $item->title) { $output .= $indent . '<li class="phone"><span><i class="fa fa-phone"></i>' . get_setting('topbar_ph') . '</span>'; } elseif (is_str_contain('divider', $item->title)) { $output .= $indent . '<li class="divider">'; } elseif ('[sigin-form]' == $item->attr_title) { ob_start(); $templates = array('woocommerce/nav-signin-form.php'); include_once locate_template($templates, false); $nav_output = ob_get_clean(); $output .= $nav_output; } elseif ('[mini-cart]' == $item->attr_title) { //check cart empty if (sizeof(WC()->cart->get_cart()) < 1 && get_setting('mini_cart_hide_if_empty', false)) { return; } ob_start(); $templates = array('woocommerce/nav-mini-cart.php'); include_once locate_template($templates, false); $nav_output = ob_get_clean(); $output .= $nav_output; } else { $classes = empty($item->classes) ? array() : (array) $item->classes; $classes = apply_filters('nav_menu_css_class', array_filter($classes), $item, $args); if ($item->current && 'secondary' != $args->theme_location || in_array('current-menu-parent', $classes) || in_array('current-menu-ancestor', $classes)) { $classes[] = 'active'; } if ($item->isMega || $item->bucket_id) { $classes[] = 'mega-menu-item mega-menu-fullwidth'; } if ($item->bucket_id) { $classes[] = 'dropdown'; } if ($this->has_children && $depth > 0) { $classes[] = 'dropdown-submenu'; } else { if ($this->has_children && $depth === 0) { $classes[] = 'dropdown'; } } $class_names = spyropress_clean_cssclass($classes); $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; if ($depth === 1 && $this->has_megamenu) { $output .= $indent . '<div class="{col_class}"><ul class="sub-menu"><li>'; } elseif ($depth === 2 && $this->has_megamenu && $this->is_column) { } else { $output .= $indent . '<li' . $class_names . '>'; } $item_output = ''; if ($depth === 1 && $this->has_megamenu && $this->is_column) { // do nothing } elseif ($depth === 1 && $this->has_megamenu || $depth === 2 && $this->has_megamenu && $this->is_column) { $item_output .= '<span class="mega-menu-sub-title">' . apply_filters('the_title', $item->title, $item->ID) . '</span>'; } else { $atts = array(); $atts['title'] = !empty($item->attr_title) ? esc_attr($item->attr_title) : ''; $atts['target'] = !empty($item->target) ? esc_attr($item->target) : ''; $atts['rel'] = !empty($item->xfn) ? esc_attr($item->xfn) : ''; $atts['href'] = !empty($item->url) ? esc_url($item->url) : ''; if ($this->has_children && $depth == 0 || $item->bucket_id) { $atts['class'] = 'dropdown-toggle'; } $attributes = apply_filters('nav_menu_link_attributes', spyropress_build_atts($atts), $item, $args); if (is_str_contain('#HOME_URL#', $item->url)) { $attributes .= ' data-hash'; } $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if ($this->has_children && $depth == 0) { $item_output .= ' <i class="fa fa-angle-down"></i>'; } $item_output .= '</a>'; $item_output .= $args->after; } $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); if ($item->bucket_id) { $output .= '<ul class="dropdown-menu"><li><div class="mega-menu-content">'; $con = do_shortcode('[bucket id=' . $item->bucket_id . ']'); $output .= str_replace('class="container"', '', $con); $output .= '</div></li></ul>'; } } }
/** * Define the row wrapper html */ function spyropress_row_wrapper($row_ID, $row) { extract($row['options']); $section_class = array(); $parallax = $video = $mp4 = $ogg = ''; // CssClass if (isset($custom_container_class) && !empty($custom_container_class)) { $section_class[] = $custom_container_class; } if (isset($container_skin) && !empty($container_skin)) { $section_class[] = $container_skin; if ('parallax' == $container_skin) { $parallax = ' data-stellar-background-ratio="0.5" style="background-image: url(' . $parallax_bg . ');"'; } if ('video_section' == $container_skin) { if ($video_mp4) { $mp4 = 'mp4: ' . $video_mp4 . ', '; } if ($video_ogg) { $ogg = 'ogv: ' . $video_ogg . ', '; } if ($video_poster) { $poster = 'poster: ' . $video_poster; } if ($video_mp4 || $video_ogg) { $parallax = ' data-video-path="' . $mp4 . $ogg . $poster . '" data-plugin-video-background data-plugin-options=\'{"posterType": "' . end(explode('.', $video_poster)) . '", "position": "50% 50%" }\''; } } } $row_html = sprintf(' <div id="%1$s" class="%2$s"%5$s> <div class="container"> <div class="%3$s"> %4$s </div> </div> %6$s </div>', $row_ID, spyropress_clean_cssclass($section_class), get_row_class(true), builder_render_frontend_columns($row['columns']), $parallax, $video); return $row_html; }
function spyropress_sc_tables($atts, $content = null) { $default = array('cls' => ''); extract(shortcode_atts($default, $atts)); // class $class = array(); $class[] = 'table'; if ($cls != '') { $class[] = str_replace(',', ' ', $cls); } return str_replace('<table', '<table class="' . spyropress_clean_cssclass($class) . '"', spyropress_remove_formatting($content)); }
/** * Query Generator * Generate query and loop through it, with column logic enabled. */ function spyropress_query_generator($atts, $content = null) { // default setting $default = array('callback' => '', 'row' => 1, 'row_container' => 'div', 'row_class' => get_row_class(true), 'column_class' => '', 'columns' => 1, 'pagination' => false); $atts = wp_parse_args($atts, $default); $output = ''; $counter = $column_counter = 0; $columns = $atts['columns']; $callback = $atts['callback']; $close = false; // Add Pagination if ($atts['limit']) { $atts['posts_per_page'] = $atts['limit']; unset($atts['limit']); if ($atts['pagination']) { $atts['paged'] = get_page_query(); } } // set column cssClass $colclass = array(); $colclass[] = get_column_class($columns); $colclass[] = $atts['column_class']; // if is archive merge wp_query if (is_archive() || is_search()) { global $wp_query; if (!empty($wp_query->query)) { $atts = array_merge($wp_query->query, $atts); } } // init wp_query $posts = new WP_Query($atts); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); $counter++; // if has column defined if ($columns) { $column_counter++; $colclass_fl = array(); if ($column_counter == 1) { if ($atts['row']) { $output .= '<' . $atts['row_container'] . ' class="' . $atts['row_class'] . '">'; $close = true; } $colclass_fl[] = get_first_column_class(); } if ($column_counter == $columns) { $colclass_fl[] = get_last_column_class(); } $atts['column_class'] = spyropress_clean_cssclass(array_merge($colclass, $colclass_fl)); // get the item using the defined callback function if ($callback) { $output .= call_user_func_array($callback, array(get_the_ID(), $atts, $counter, $column_counter)); } if ($column_counter == $columns) { $column_counter = 0; if ($atts['row']) { $output .= '</' . $atts['row_container'] . '>'; $close = false; } } } else { if ($callback) { $output .= call_user_func_array($callback, array(get_the_ID(), $atts, $counter, $column_counter)); } } } // close last unclosed row if (isset($atts['row']) && $atts['row'] && $close) { $output .= '</' . $atts['row_container'] . '>'; } wp_reset_query(); // get pagination for query if enabled $pagination = ''; if ($atts['pagination']) { $pagination = wp_pagenavi(array('query' => $posts, 'echo' => false)); } return array('content' => $output, 'pagination' => $pagination); } else { wp_reset_query(); return; } }