Exemple #1
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $title = !empty($title) ? $before_title . $title . $after_title : $title;
     echo $before_widget, $title, LS_Shortcode::handleShortcode($instance), $after_widget;
 }
Exemple #2
0
function layerslider($id = 0, $filters = '')
{
    echo LS_Shortcode::handleShortcode(array('id' => $id, 'filters' => $filters));
}
Exemple #3
0
}
if (!defined('TAB')) {
    define("TAB", "\t");
}
// Shared
include LS_ROOT_PATH . '/wp/scripts.php';
include LS_ROOT_PATH . '/wp/menus.php';
include LS_ROOT_PATH . '/wp/hooks.php';
include LS_ROOT_PATH . '/wp/widgets.php';
include LS_ROOT_PATH . '/wp/compatibility.php';
include LS_ROOT_PATH . '/classes/class.ls.posts.php';
include LS_ROOT_PATH . '/classes/class.ls.sliders.php';
include LS_ROOT_PATH . '/classes/class.ls.sources.php';
// Register WP shortcode
include LS_ROOT_PATH . '/wp/shortcodes.php';
LS_Shortcode::registerShortcode();
// Add demo sliders and skins
LS_Sources::addDemoSlider(LS_ROOT_PATH . '/demos/');
LS_Sources::addSkins(LS_ROOT_PATH . '/static/skins/');
LS_Sources::removeSkin('preview');
// Back-end only
if (is_admin()) {
    include LS_ROOT_PATH . '/wp/activation.php';
    include LS_ROOT_PATH . '/wp/tinymce.php';
    include LS_ROOT_PATH . '/wp/notices.php';
    include LS_ROOT_PATH . '/wp/actions.php';
    // Front-end only
} else {
}
// Auto update
if (!class_exists('KM_PluginUpdatesV3')) {
 /**
  * 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 = "")
 {
     $output = "";
     $skipSecond = false;
     avia_sc_layerslider::$slide_count++;
     //check if we got a layerslider
     global $wpdb;
     // Table name
     $table_name = $wpdb->prefix . "layerslider";
     // Get slider
     $slider = $wpdb->get_row("SELECT * FROM {$table_name}\n\t\t\t\t\t\t\t\t\t\tWHERE id = " . (int) $atts['id'] . " AND flag_hidden = '0'\n\t\t\t\t\t\t\t\t\t\tAND flag_deleted = '0'\n\t\t\t\t\t\t\t\t\t\tORDER BY date_c DESC LIMIT 1", ARRAY_A);
     if (!empty($slider)) {
         $slides = json_decode($slider['data'], true);
         $height = $slides['properties']['height'];
         $width = $slides['properties']['width'];
         $responsive = !empty($slides['properties']['responsive']) ? $slides['properties']['responsive'] : '';
         $responsiveunder = !empty($slides['properties']['responsiveunder']) ? $slides['properties']['responsiveunder'] : '';
         $params['style'] = " style='height: " . ($height + 1) . "px;' ";
     }
     $params['class'] = "avia-layerslider main_color avia-shadow " . $meta['el_class'];
     $params['open_structure'] = false;
     //we dont need a closing structure if the element is the first one or if a previous fullwidth element was displayed before
     if (empty($meta['index'])) {
         $params['close'] = false;
     }
     if (!empty($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) {
         $params['close'] = false;
     }
     if (!empty($meta['index'])) {
         $params['class'] .= " slider-not-first";
     }
     $params['id'] = "layer_slider_" . avia_sc_layerslider::$slide_count;
     $output .= avia_new_section($params);
     if (class_exists('LS_Shortcode') && method_exists('LS_Shortcode', 'handleShortcode')) {
         $output .= LS_Shortcode::handleShortcode($atts);
     } else {
         if (function_exists('layerslider_init')) {
             $output .= layerslider_init($atts);
         }
     }
     $output .= "</div>";
     //close section
     //if the next tag is a section dont create a new section from this shortcode
     if (!empty($meta['siblings']['next']['tag']) && in_array($meta['siblings']['next']['tag'], AviaBuilder::$full_el)) {
         $skipSecond = true;
     }
     //if there is no next element dont create a new section.
     if (empty($meta['siblings']['next']['tag'])) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $output .= avia_new_section(array('close' => false, 'id' => "after_layer_slider_" . avia_sc_layerslider::$slide_count));
     }
     return $output;
 }