Plugin Directory

Changeset 2853103


Ignore:
Timestamp:
01/23/2023 09:35:42 PM (3 years ago)
Author:
wpweaver
Message:

Update to 1.6

Location:
show-sliders
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • show-sliders/tags/1.6/atw-show-sliders.php

    r2428756 r2853103  
    66Author: wpweaver
    77Author URI: http://weavertheme.com/about/
    8 Version: 1.5.1
     8Version: 1.6
    99
    1010License: GPL3
    1111
    1212Weaver Show Sliders
    13 Copyright (C) 2014-2021, Bruce E. Wampler - [email protected]
     13Copyright (C) 2014-2023, Bruce E. Wampler - [email protected]
    1414
    1515This program is free software: you can redistribute it and/or modify
     
    2828
    2929
    30 define ( 'WEAVER_SLIDER_PI_VERSION','1.5.1');
    31 define ( 'WEAVER_SLIDER_PI_PRO', true);            // change this and the Plugin Name above when building Pro version
    32 define ( 'WEAVER_SLIDER_PI_MINIFY','.min');     // '' for dev, '.min' for production
     30const WEAVER_SLIDER_PI_VERSION = '1.6';
     31const WEAVER_SLIDER_PI_PRO = true;            // change this and the Plugin Name above when building Pro version
     32const WEAVER_SLIDER_PI_MINIFY = '.min';        // '' for dev, '.min' for production
    3333
    3434if (function_exists('atw_slider_installed')) {
    35     wp_die('Both Weaver Show Sliders and Weaver Show Sliders Pro installed. You can only activate one version or the other!','You can have only one activated version of Weaver Show Sliders!');
     35    wp_die('Both Weaver Show Sliders and Weaver Show Sliders Pro installed. You can only activate one version or the other!', 'You can have only one activated version of Weaver Show Sliders!');
    3636}
    3737
    3838// ===============================>>> REGISTER ACTIONS <<<===============================
    39     add_action( 'plugins_loaded', 'atw_slider_plugins_loaded');
    40     add_action( 'atw_show_sliders_post_pager','atw_slider_post_pager');
     39add_action('plugins_loaded', 'atw_slider_plugins_loaded');
     40add_action('atw_show_sliders_post_pager', 'atw_slider_post_pager');
    4141
    4242// ===============================>>> DEFINE ACTIONS <<<===============================
    4343
    44 function atw_slider_plugins_loaded() {
     44function atw_slider_plugins_loaded()
     45{
    4546    // these need to be done like this to avoid installation interaction issues with Show Posts
    4647    // we really don't define any Show Sliders stuff until all the plugins have been installed
    4748
    4849
    49 $show_posts = false;
    50 if ( function_exists('atw_showposts_installed') ) {         // for simple case where show_posts gets installed first
    51     $show_posts = true;
    52 } else {
    53     require_once (ABSPATH . 'wp-admin/includes/plugin.php');    // need this for is_plugin_active
    54     $show_posts = is_plugin_active('show-posts/atw-show-posts.php');
    55 }
    56 
    57 if ( $show_posts )  {
    58 
    59     function atw_slider_installed() {
    60         return true;
     50    $show_posts = false;
     51    if (function_exists('atw_showposts_installed')) {            // for simple case where show_posts gets installed first
     52        $show_posts = true;
     53    } else {
     54        require_once(ABSPATH . 'wp-admin/includes/plugin.php');    // need this for is_plugin_active
     55        $show_posts = is_plugin_active('show-posts/atw-show-posts.php');
    6156    }
    6257
    63     add_action( 'init', 'atw_slider_register_post_cpt' );
    64     add_action( 'init', 'atw_slider_setup_shortcodes');
    65     add_action( 'add_meta_boxes', 'atw_slider_add_meta_box' );
    66     add_action( 'wp_enqueue_scripts', 'atw_slider_enqueue_scripts' );
    67     add_action( 'wp_footer','atw_slider_the_footer', 9);    // make it 9 so we can dequeue scripts
    68     add_action( 'admin_enqueue_scripts','atw_slider_add_admin_scripts');
    69     require_once(dirname( __FILE__ ) . '/includes/slider-widgets.php'); // need this for is_plugin_active
    70 
    71 
    72 function atw_slider_add_admin_scripts() {
    73     wp_enqueue_script('atw-combined-scripts',
    74         atw_slider_plugins_url('/includes/js/jquery.ddslick', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    75         WEAVER_SLIDER_PI_VERSION, true);
    76 }
     58    if ($show_posts) {
     59
     60        function atw_slider_installed()
     61        {
     62            return true;
     63        }
     64
     65        add_action('init', 'atw_slider_register_post_cpt');
     66        add_action('init', 'atw_slider_setup_shortcodes');
     67        add_action('add_meta_boxes', 'atw_slider_add_meta_box');
     68        add_action('wp_enqueue_scripts', 'atw_slider_enqueue_scripts');
     69        add_action('wp_footer', 'atw_slider_the_footer', 9);    // make it 9 so we can dequeue scripts
     70        add_action('admin_enqueue_scripts', 'atw_slider_add_admin_scripts');
     71        require_once(dirname(__FILE__) . '/includes/slider-widgets.php');    // need this for is_plugin_active
     72
     73
     74        function atw_slider_add_admin_scripts()
     75        {
     76            wp_enqueue_script('atw-combined-scripts',
     77                atw_slider_plugins_url('/includes/js/jquery.ddslick', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     78                WEAVER_SLIDER_PI_VERSION, true);
     79        }
    7780
    7881// ========================================= >>> atw_slider_register_post_cpt <<< ===============================
    79 /**
    80 * Registers the atw_slider_post custom post type
    81 */
    82 function atw_slider_register_post_cpt() {
    83     $singular_item = __('Weaver Slider Post', 'show-sliders');
    84     $plural_item = __('Weaver Slider Posts', 'show-sliders');
    85 
    86     $capabilities = array(
    87         'edit_post'          => 'edit_post',
    88         'edit_posts'         => 'edit_posts',
    89         'edit_others_posts'  => 'edit_others_posts',
    90         'publish_posts'      => 'publish_posts',
    91         'read_post'          => 'read_post',
    92         'read_private_posts' => 'read_private_posts',
    93         'delete_post'        => 'delete_post'
    94     );
    95 
    96     $labels = array(
    97         'name'               =>  $singular_item,
    98         'singular_name'      => 'Slider',
    99         'add_new'            => __('New', 'show-sliders') . ' ' .  $singular_item,
    100         'add_new_item'       => __('New', 'show-sliders') . ' ' .  $singular_item,
    101         'edit_item'          => __('Edit', 'show-sliders') . ' ' .  $singular_item,
    102         'new_item'           => __('New', 'show-sliders') . ' ' .  $singular_item,
    103         'all_items'          => __('All', 'show-sliders') . ' ' .  $plural_item,
    104         'view_item'          => __('View', 'show-sliders') . ' ' .  $singular_item,
    105         'search_items'       => __('Search', 'show-sliders') . ' ' .  $plural_item,
    106         'not_found'          => sprintf( __( 'No %s found', 'show-sliders' ), $plural_item ),
    107         'not_found_in_trash' => sprintf( __( 'No %s found in trash', 'show-sliders' ), $plural_item ),
    108         'parent_item_colon'  => '',
    109         'menu_name'          => $plural_item,
    110     );
    111 
    112     $args = array(
    113         'labels'             => $labels,
    114         'description'       =>  __('Auxiliary Custom Post Type to use for defining sliders.', 'show-sliders'),
    115         'exclude_from_search'   => true,
    116         'public'             => true,
    117         'publicly_queryable' => true,
    118         'show_ui'            => true,
    119         'show_in_menu'       => true,
    120         'query_var'          => true,
    121         'capability_type'    => 'post',
    122         'has_archive'        => true,
    123         'hierarchical'       => false,
    124         'taxonomies'         => array('atw_slider_group','category','post_tag'),
    125         'menu_position'      => 64,
    126         'menu_icon'           => 'dashicons-images-alt',
    127         'supports'           => array( 'title', 'editor', 'page-attributes','thumbnail','excerpt','custom-fields','comments','revisions','post-formats','author')
    128     );
    129 
    130   register_post_type( 'atw_slider_post', $args );
    131   add_post_type_support( 'atw_slider_post', 'excerpt'); // even though listed in the 'supports' list, needs this explicit add...
    132 
    133 
    134 
    135     $tlabels = array(
    136         'name'                       => _x( 'Slider Group', 'Taxonomy General Name', 'show-sliders' ),
    137         'singular_name'              => _x( 'Slider Group', 'Taxonomy Singular Name', 'show-sliders' ),
    138         'menu_name'                  => __( 'Slider Groups', 'show-sliders' ),
    139         'all_items'                  => __( 'All Slider Groups', 'show-sliders' ),
    140         'parent_item'                => __( 'Parent Slider Group', 'show-sliders' ),
    141         'parent_item_colon'          => __( 'Parent Slider Group:', 'show-sliders' ),
    142         'new_item_name'              => __( 'New Slider Group', 'show-sliders' ),
    143         'add_new_item'               => __( 'Add New Slider Group', 'show-sliders' ),
    144         'edit_item'                  => __( 'Edit Slider Group', 'show-sliders' ),
    145         'update_item'                => __( 'Update Slider Group', 'show-sliders' ),
    146         'separate_items_with_commas' => __( 'Separate Slider Groups with commas', 'show-sliders' ),
    147         'search_items'               => __( 'Search Slider Groups', 'show-sliders' ),
    148         'add_or_remove_items'        => __( 'Add or remove Groups', 'show-sliders' ),
    149         'choose_from_most_used'      => __( 'Choose from the most used groups', 'show-sliders' ),
    150     );
    151     $targs = array(
    152         'labels'                     => $tlabels,
    153         'hierarchical'               => true,
    154         'public'                     => true,
    155         'show_ui'                    => true,
    156         'rewrite'                    => array( 'slug' => atw_slider_get_default_category_slug() ),
    157         'show_admin_column'          => true,
    158         'show_in_nav_menus'          => true,
    159         'show_tagcloud'              => true,
    160     );
    161     register_taxonomy( 'atw_slider_group', 'atw_slider_post', $targs );
    162 }
     82        /**
     83         * Registers the atw_slider_post custom post type
     84         */
     85        function atw_slider_register_post_cpt()
     86        {
     87            $singular_item = __('Weaver Slider Post', 'show-sliders');
     88            $plural_item = __('Weaver Slider Posts', 'show-sliders');
     89
     90            $capabilities = array(
     91                'edit_post' => 'edit_post',
     92                'edit_posts' => 'edit_posts',
     93                'edit_others_posts' => 'edit_others_posts',
     94                'publish_posts' => 'publish_posts',
     95                'read_post' => 'read_post',
     96                'read_private_posts' => 'read_private_posts',
     97                'delete_post' => 'delete_post',
     98            );
     99
     100            $labels = array(
     101                'name' => $singular_item,
     102                'singular_name' => 'Slider',
     103                'add_new' => __('New', 'show-sliders') . ' ' . $singular_item,
     104                'add_new_item' => __('New', 'show-sliders') . ' ' . $singular_item,
     105                'edit_item' => __('Edit', 'show-sliders') . ' ' . $singular_item,
     106                'new_item' => __('New', 'show-sliders') . ' ' . $singular_item,
     107                'all_items' => __('All', 'show-sliders') . ' ' . $plural_item,
     108                'view_item' => __('View', 'show-sliders') . ' ' . $singular_item,
     109                'search_items' => __('Search', 'show-sliders') . ' ' . $plural_item,
     110                'not_found' => sprintf(__('No %s found', 'show-sliders'), $plural_item),
     111                'not_found_in_trash' => sprintf(__('No %s found in trash', 'show-sliders'), $plural_item),
     112                'parent_item_colon' => '',
     113                'menu_name' => $plural_item,
     114            );
     115
     116            $args = array(
     117                'labels' => $labels,
     118                'description' => __('Auxiliary Custom Post Type to use for defining sliders.', 'show-sliders'),
     119                'exclude_from_search' => true,
     120                'public' => true,
     121                'publicly_queryable' => true,
     122                'show_ui' => true,
     123                'show_in_menu' => true,
     124                'query_var' => true,
     125                'capability_type' => 'post',
     126                'has_archive' => true,
     127                'hierarchical' => false,
     128                'taxonomies' => array('atw_slider_group', 'category', 'post_tag'),
     129                'menu_position' => 64,
     130                'menu_icon' => 'dashicons-images-alt',
     131                /* 'show_in_rest'        => true,  // block editor not helpful... */
     132                'supports' => array('title', 'editor', 'page-attributes', 'thumbnail', 'excerpt', 'custom-fields', 'comments', 'revisions', 'post-formats', 'author'),
     133            );
     134
     135            register_post_type('atw_slider_post', $args);
     136            add_post_type_support('atw_slider_post', 'excerpt'); // even though listed in the 'supports' list, needs this explicit add...
     137
     138
     139            $tlabels = array(
     140                'name' => _x('Slider Group', 'Taxonomy General Name', 'show-sliders'),
     141                'singular_name' => _x('Slider Group', 'Taxonomy Singular Name', 'show-sliders'),
     142                'menu_name' => __('Slider Groups', 'show-sliders'),
     143                'all_items' => __('All Slider Groups', 'show-sliders'),
     144                'parent_item' => __('Parent Slider Group', 'show-sliders'),
     145                'parent_item_colon' => __('Parent Slider Group:', 'show-sliders'),
     146                'new_item_name' => __('New Slider Group', 'show-sliders'),
     147                'add_new_item' => __('Add New Slider Group', 'show-sliders'),
     148                'edit_item' => __('Edit Slider Group', 'show-sliders'),
     149                'update_item' => __('Update Slider Group', 'show-sliders'),
     150                'separate_items_with_commas' => __('Separate Slider Groups with commas', 'show-sliders'),
     151                'search_items' => __('Search Slider Groups', 'show-sliders'),
     152                'add_or_remove_items' => __('Add or remove Groups', 'show-sliders'),
     153                'choose_from_most_used' => __('Choose from the most used groups', 'show-sliders'),
     154            );
     155            $targs = array(
     156                'labels' => $tlabels,
     157                'hierarchical' => true,
     158                'public' => true,
     159                'show_ui' => true,
     160                'rewrite' => array('slug' => atw_slider_get_default_category_slug()),
     161                'show_admin_column' => true,
     162                'show_in_nav_menus' => true,
     163                'show_tagcloud' => true,
     164            );
     165            register_taxonomy('atw_slider_group', 'atw_slider_post', $targs);
     166        }
    163167
    164168// ========================================= >>> atw_slider_get_default_post_slug <<< ===============================
    165 /**
    166 * Get the default post slug
    167 */
    168 function atw_slider_get_default_post_slug(){
    169     $gallery_options_array = get_option( 'atw_slider_manager_options' );
    170     $default_slug = 'show-sliders'; // ??
    171     if( $gallery_options_array ){
    172         if( is_array($gallery_options_array) && array_key_exists( 'post_slug', $gallery_options_array ) ){
    173             $user_defined_slug = $gallery_options_array['post_slug'];
    174             if($user_defined_slug!=''){
    175                 $default_slug = $user_defined_slug;
    176             }
    177         }
    178     }
    179     return $default_slug;
    180 }
     169        /**
     170         * Get the default post slug
     171         */
     172        function atw_slider_get_default_post_slug()
     173        {
     174            $gallery_options_array = get_option('atw_slider_manager_options');
     175            $default_slug = 'show-sliders'; // ??
     176            if ($gallery_options_array) {
     177                if (is_array($gallery_options_array) && array_key_exists('post_slug', $gallery_options_array)) {
     178                    $user_defined_slug = $gallery_options_array['post_slug'];
     179                    if ($user_defined_slug != '') {
     180                        $default_slug = $user_defined_slug;
     181                    }
     182                }
     183            }
     184
     185            return $default_slug;
     186        }
    181187
    182188// ========================================= >>> atw_slider_get_default_category_slug <<< ===============================
    183 /**
    184 * Get the default category slug
    185 */
    186 function atw_slider_get_default_category_slug() {
    187     $gallery_options_array = get_option( 'atw_slider_manager_options' );
    188     $default_slug = 'show-sliders'; // ??
    189     if( $gallery_options_array ){
    190         if( is_array($gallery_options_array) && array_key_exists( 'category_slug', $gallery_options_array ) ){
    191             $user_defined_slug = $gallery_options_array['category_slug'];
    192             if($user_defined_slug!=''){
    193                 $default_slug = $user_defined_slug;
    194             }
    195         }
    196     }
    197     return $default_slug;
    198 }
     189        /**
     190         * Get the default category slug
     191         */
     192        function atw_slider_get_default_category_slug()
     193        {
     194            $gallery_options_array = get_option('atw_slider_manager_options');
     195            $default_slug = 'show-sliders';    // ??
     196            if ($gallery_options_array) {
     197                if (is_array($gallery_options_array) && array_key_exists('category_slug', $gallery_options_array)) {
     198                    $user_defined_slug = $gallery_options_array['category_slug'];
     199                    if ($user_defined_slug != '') {
     200                        $default_slug = $user_defined_slug;
     201                    }
     202                }
     203            }
     204
     205            return $default_slug;
     206        }
    199207
    200208
    201209// ========================================= >>> atw_slider_add_meta_box <<< ===============================
    202 /**
    203 * Adds the intro meta box container
    204 */
    205 function atw_slider_add_meta_box() {
    206 
    207    add_meta_box(
    208        'atw_slider_intro',
    209        __( 'Weaver Slider Post Introduction', 'show-sliders' ),
    210        'atw_slider_render_meta_box_intro',
    211        'atw_slider_post',
    212        'normal',
    213        'high'
    214        );
    215 }
     210        /**
     211         * Adds the intro meta box container
     212         */
     213        function atw_slider_add_meta_box()
     214        {
     215
     216            add_meta_box(
     217                'atw_slider_intro',
     218                __('Weaver Slider Post Introduction', 'show-sliders'),
     219                'atw_slider_render_meta_box_intro',
     220                'atw_slider_post',
     221                'normal',
     222                'high'
     223            );
     224        }
    216225
    217226// ========================================= >>> atw_slider_render_meta_box_intro <<< ===============================
    218 /**
    219 * Render Shortcode Info Meta Box content.
    220 *
    221 * @param WP_Post $post The post object.
    222 */
    223 function atw_slider_render_meta_box_intro( $post ) {
    224 ?>
    225 <p>
    226 <?php _e('The <em>Weaver Slider Post</em> is a custom post type that is intended to help define Weaver Slider/Slideshows.
     227        /**
     228         * Render Shortcode Info Meta Box content.
     229         *
     230         * @param WP_Post $post The post object.
     231         */
     232        function atw_slider_render_meta_box_intro($post)
     233        {
     234            ?>
     235            <p>
     236                <?php _e('The <em>Weaver Slider Post</em> is a custom post type that is intended to help define Weaver Slider/Slideshows.
    227237This post type has all the features of a standard post, but because it is a custom post type, posts created using it
    228238will <strong>not</strong> appear on any of your normal blogs, category lists, tag lists, searches, or other archive-like pages.
     
    231241You can group sliders, or create different slide shows by specifying a <em>Slider Group</em>.
    232242<br />Please see the <em>Weaver Posts/Slider</em> "Quick Start Help" tab for help on creating a slideshow.', 'show-sliders');
    233 ?>
    234 </p>
    235 <?php
    236 }
    237 
     243                ?>
     244            </p>
     245            <?php
     246        }
    238247
    239248
    240249// ========================================= >>> atw_slider_plugins_url <<< ===============================
    241250
    242 function atw_slider_plugins_url($file,$ext='') {
    243     return plugins_url($file,__FILE__) . $ext;
    244 }
     251        function atw_slider_plugins_url($file, $ext = '')
     252        {
     253            return plugins_url($file, __FILE__) . $ext;
     254        }
    245255
    246256// ========================================= >>> atw_slider_enqueue_scripts <<< ===============================
    247257
    248 function atw_slider_enqueue_scripts() { // enqueue runtime scripts
    249 
    250     // add plugin CSS here, too.
    251 
    252     // currently, there is no way to set global slider preferences - so we will put at the end always
    253     // $at_end = !atw_posts_get_slider_opt('scriptsAtTop', $slider);
    254     $at_end = true;
    255 
    256     wp_register_style('atw-flex-style-sheet', atw_slider_plugins_url('/flex/css/atwflexslider', WEAVER_SLIDER_PI_MINIFY.'.css'),null,WEAVER_SLIDER_PI_VERSION,'screen');
    257     wp_enqueue_style('atw-flex-style-sheet');
    258 
    259     if ( atw_posts_getopt( 'showLightbox')) {
    260         wp_register_style('atw-lightbox-style-sheet', atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY.'.css'),null,WEAVER_SLIDER_PI_VERSION,'screen');
    261         wp_enqueue_style('atw-lightbox-style-sheet');
    262 
    263         wp_enqueue_script('atw-lightbox-script',
    264             atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    265             WEAVER_SLIDER_PI_VERSION);//, $at_end);
    266     }
    267 
    268 
    269 
    270     /* use combined js file */
    271 
    272     /*
    273      wp_enqueue_script('atw-flex-easing',
    274         atw_slider_plugins_url('/flex/js/jquery.easing', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    275         WEAVER_SLIDER_PI_VERSION, $at_end);
    276     wp_enqueue_script('atw-flex-mousewheel',
    277         atw_slider_plugins_url('/flex/js/jquery.mousewheel', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    278         WEAVER_SLIDER_PI_VERSION, $at_end);
    279     wp_enqueue_script('atw-fitvids',
    280         atw_slider_plugins_url('/flex/js/jquery.fitvids', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    281         WEAVER_SLIDER_PI_VERSION, $at_end);
    282     */
    283 
    284     wp_enqueue_script('atw-combined-scripts',
    285         atw_slider_plugins_url('/flex/js/jquery.combined', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    286         WEAVER_SLIDER_PI_VERSION, $at_end);
    287 
    288 
    289 
    290     wp_enqueue_script('atw-flex',
    291         atw_slider_plugins_url('/flex/js/jquery.flexslider', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    292         WEAVER_SLIDER_PI_VERSION, $at_end);
    293 
    294 
    295 
    296 
    297 }
     258        function atw_slider_enqueue_scripts()
     259        {    // enqueue runtime scripts
     260
     261            // add plugin CSS here, too.
     262
     263            // currently, there is no way to set global slider preferences - so we will put at the end always
     264            $at_end = true;
     265
     266            wp_register_style('atw-flex-style-sheet', atw_slider_plugins_url('/flex/css/atwflexslider', WEAVER_SLIDER_PI_MINIFY . '.css'), null, WEAVER_SLIDER_PI_VERSION, 'screen');
     267            wp_enqueue_style('atw-flex-style-sheet');
     268
     269            if (atw_posts_getopt('showLightbox')) {
     270                wp_register_style('atw-lightbox-style-sheet', atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY . '.css'), null, WEAVER_SLIDER_PI_VERSION, 'screen');
     271                wp_enqueue_style('atw-lightbox-style-sheet');
     272
     273                wp_enqueue_script('atw-lightbox-script',
     274                    atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     275                    WEAVER_SLIDER_PI_VERSION);//, $at_end);
     276            }
     277
     278
     279            /* use combined js file */
     280
     281            /*
     282             wp_enqueue_script('atw-flex-easing',
     283                atw_slider_plugins_url('/flex/js/jquery.easing', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
     284                WEAVER_SLIDER_PI_VERSION, $at_end);
     285            wp_enqueue_script('atw-flex-mousewheel',
     286                atw_slider_plugins_url('/flex/js/jquery.mousewheel', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
     287                WEAVER_SLIDER_PI_VERSION, $at_end);
     288            wp_enqueue_script('atw-fitvids',
     289                atw_slider_plugins_url('/flex/js/jquery.fitvids', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
     290                WEAVER_SLIDER_PI_VERSION, $at_end);
     291            */
     292
     293            wp_enqueue_script('atw-combined-scripts',
     294                atw_slider_plugins_url('/flex/js/jquery.combined', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     295                WEAVER_SLIDER_PI_VERSION, $at_end);
     296
     297
     298            wp_enqueue_script('atw-flex',
     299                atw_slider_plugins_url('/flex/js/jquery.flexslider', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     300                WEAVER_SLIDER_PI_VERSION, $at_end);
     301
     302
     303        }
    298304
    299305// ========================================= >>> atw_slider_the_footer <<< ===============================
    300306
    301 function atw_slider_the_footer() {
    302     if ( !isset($GLOBALS['atw_sliders_count']) ) {  // dequeue scripts if not used
    303         echo "<!-- No Weaver Sliders used on this page -->\n";
    304         /*
    305         wp_dequeue_script( 'atw-flex-easing' );
    306         wp_dequeue_script( 'atw-flex-mousewheel' );
    307         wp_dequeue_script( 'atw-fitvids');
     307        function atw_slider_the_footer()
     308        {
     309            if (!isset($GLOBALS['atw_sliders_count'])) {  // dequeue scripts if not used
     310                echo "<!-- No Weaver Sliders used on this page -->\n";
     311                /*
     312                wp_dequeue_script( 'atw-flex-easing' );
     313                wp_dequeue_script( 'atw-flex-mousewheel' );
     314                wp_dequeue_script( 'atw-fitvids');
     315                */
     316                wp_dequeue_script('atw-lightbox-script');
     317                wp_dequeue_script('atw-combined-scripts');
     318                wp_dequeue_script('atw-flex');
     319                if (atw_posts_getopt('showLoading')) {
     320                    echo '<script type="text/javascript">jQuery(window).ready(function(slider){jQuery(\'body\').removeClass(\'atwkloading\');});</script>', "\n";
     321                }
     322
     323                return;
     324            }
     325
     326            require_once(dirname(__FILE__) . '/includes/atw-slider-shortcode.php');
     327
     328            atw_slider_do_footer();
     329        }
     330
     331// ========================================= >>> atw_slider_setup_shortcodes <<< ===============================
     332
     333        function atw_slider_setup_shortcodes()
     334        {
     335            if (function_exists('atw_posts_getopt') && atw_posts_getopt('enable_gallery_slider')) {
     336                add_filter('post_gallery', 'atw_gallery_sc_filter', 10, 2);
     337            }
     338
     339            remove_shortcode('show_slider');
     340            add_shortcode('show_slider', 'atw_slider_sc');
     341        }
     342
     343// ========================================= >>> atw_slider_sc <<< ===============================
     344
     345
     346        function atw_slider_sc($args = '')
     347        {
     348            require_once(dirname(__FILE__) . '/includes/atw-slider-shortcode.php');
     349
     350            return atw_slider_shortcode($args);
     351        }
     352
     353// ========================================= >>> atw_gallery_sc_filter <<< ===============================
     354
     355        function atw_gallery_sc_filter($content, $args = '')
     356        {
     357            require_once(dirname(__FILE__) . '/includes/atw-slider-shortcode.php');
     358
     359            return atw_gallery_shortcode_filter($args);
     360        }
     361
     362// ========================================= >>> atw_slider_load_admin <<< ===============================
     363
     364        function atw_slider_load_admin()
     365        {
     366            require_once(dirname(__FILE__) . '/includes/atw-slider-slider-admin.php'); // NOW - load the admin stuff
     367            require_once(dirname(__FILE__) . '/includes/atw-slider-pro-admin.php'); // NOW - load the admin stuff
     368            require_once(dirname(__FILE__) . '/includes/atw-slider-help-admin.php'); // NOW - load the admin stuff
     369        }
     370
     371// ========================================= >>> atw_slider_do_slider_admin <<< ===============================
     372
     373        function atw_slider_do_slider_admin()
     374        {
     375            atw_slider_load_admin();
     376            atw_slider_slider_admin();
     377        }
     378
     379// ========================================= >>> atw_slider_gallery_admin <<< ===============================
     380
     381        function atw_slider_gallery_admin()
     382        {
     383            atw_slider_load_admin();
     384            atw_slider_gallery_admin_page();
     385        }
     386
     387        function atw_slider_pro()
     388        {
     389            // This code is leftver from the former split Pro version. These versions have been merges and are all now free.
     390            return WEAVER_SLIDER_PI_PRO;
     391        }
     392
     393// ====================================== >>> atw_slider_do_gallery <<< ======================================
     394
     395        function atw_slider_do_gallery($qargs, $slider, $ids = null)
     396        {
     397
     398            $content = "\n<!-- **** Slider Images: " . $slider . " **** -->\n";
     399            $style = '';
     400
     401
     402            if (isset($GLOBALS['atw_slider_thumbs'])) {
     403                unset($GLOBALS['atw_slider_thumbs']);
     404            }
     405            $GLOBALS['atw_slider_thumbs'] = array();        // save our thumbs...
     406
     407            /* $margin = atw_posts_get_slider_opt( 'slideMargin', $slider );
     408
     409            if ( $margin  != '') { // change default image margin?
     410                $style = ' style="margin:' . $margin . 'em;"';
     411            } */
     412
     413            $img_class = 'slide-image';
     414            if (atw_posts_get_slider_opt('addImageBorder', $slider)) {
     415                $img_class = 'slide-image-border';
     416            }
     417
     418            $lead_class = 'class="atwk-slide"';
     419            $lead_div = '<div class="slide-content ' . $img_class . '"' . $style . '>';
     420
     421            if (!$qargs || !empty($ids)) {
     422                //$content .= '<-- ********** atw_slider_get_gallery  ************** -->';
     423                $content .= atw_slider_get_gallery('', $slider, $ids, $lead_class, $lead_div);
     424            } else {
     425
     426                // get posts
     427                if (!$qargs->have_posts()) {
     428                    $content .= '<em>' . __('No posts found.', 'show-sliders') . ' ' . __('Slider Post slug: `', 'show-sliders') . $qargs->query['name'] .
     429                        __('` - Slider: `', 'show-sliders') . $slider . '`.</em>';
     430
     431                }
     432                while ($qargs->have_posts()) {
     433                    $qargs->the_post();
     434                    $post_content = get_the_content();
     435                    $gallery = atw_slider_get_gallery($post_content, $slider, null, $lead_class, $lead_div);
     436
     437                    if ($gallery != '') {
     438                        $content .= $gallery;
     439                    } else {
     440                        $img = atw_slider_get_first_post_image($post_content, $slider, $lead_class, $lead_div);
     441
     442                        if ($img != '') {
     443
     444                            $content .= $img;
     445                        }
     446                    }
     447                }
     448            }
     449
     450            echo $content;
     451        }
     452
     453// ====================================== >>> atw_slider_get_gallery <<< ======================================
     454
     455        function atw_slider_get_gallery($content, $slider, $ids = array(), $lead_class = 'class="atwk-slide"', $lead_div = '<div class="slide-content slide-image">')
     456        {
     457            // we will pass in either content, or a list of ids grabbed from the [gallery] shortcode replacement
     458
     459            $gallery = '';
     460
     461            // @@@@@@@@@@ need to use get_shortcode_regex
     462
     463            if ($content != ''
     464                && !atw_posts_get_slider_opt('noGallery', $slider)       // skip looking for [gallery]
     465                && preg_match('/\[gallery(.*?)\]/i', $content, $sc)) {  // find the first [gallery]  ************************
     466                // sc[0] = full match
     467                // sc[1] = content of [gallery];
     468                $attr = shortcode_parse_atts($sc[1]);
     469                if (empty($attr['ids']))                            // will only work with [gallery ids="1,2,3"] form of shortcode
     470                {
     471                    return '';
     472                }
     473                $gal_link = '';                                         // default is attachment
     474                if (!empty($attr['link'])) {
     475                    $gal_link = $attr['link'];
     476                }
     477
     478                $orderby = 'post__in';
     479
     480                if (!empty($attr['orderby']) && $attr['orderby'] == 'rand') {
     481                    $orderby = 'rand';
     482                }
     483
     484                $img_list = explode(',', $attr['ids']);        // build our list of attachment ids
     485
     486                $attachments = get_posts(array('include' => $img_list, 'orderby' => $orderby, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
     487
     488                foreach ($attachments as $attachment => $attachment_obj) {
     489                    $gallery .= atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
     490                }
     491
     492            } elseif ($content == '' && !empty($ids)) {        // we got passed a list of attachment images  *********************
     493                $gal_link = '';
     494
     495                $attachments = get_posts(array('include' => $ids, 'orderby' => 'post__in', 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
     496
     497                foreach ($attachments as $attachment => $attachment_obj) {
     498                    $gallery .= atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
     499                }
     500
     501
     502            } elseif ($content == '') {                        // look for first image **********************
     503
     504                $post = get_post();
     505                $id = $post ? $post->ID : 0;
     506                $gal_link = '';
     507
     508                $attachments = get_children(array(
     509                    'post_parent' => $id,
     510                    'post_status' => 'inherit',
     511                    'post_type' => 'attachment',
     512                    'post_mime_type' => 'image',
     513                    'order' => 'ASC',
     514                    'orderby' => 'menu_order ID',
     515                ));
     516
     517                foreach ($attachments as $attachment => $attachment_obj) {
     518                    $gallery .= atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // add each image
     519                }
     520
     521            }
     522
     523            return $gallery;
     524        }
     525
     526// ====================================== >>> atw_slider_get_title_class <<< ======================================
     527
     528        function atw_slider_get_title_class($slider)
     529        {
     530
     531            return atw_posts_get_slider_opt('titleOverlay', $slider) ? 'atwk-title-overlay' : 'atwk-title';
     532
     533        }
     534
     535// ====================================== >>> atw_slider_get_slide_image <<< ======================================
     536
     537        function atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link = '', $use_post_info = false)
     538        {
     539
     540            // Get an image for the slide, and its pager index image
     541
     542            $image_code = '';
     543
     544            $attachment_id = $attachment_obj->ID;
     545
     546            $img_size = atw_posts_get_slider_opt('imageSize');
     547            if ($img_size == '') {
     548                $img_size = 'full';
     549            }
     550
     551            if (function_exists('wp_get_attachment_image_srcset')) {            // WP 4.4 or later
     552                $src = wp_get_attachment_image_url($attachment_id, $img_size);
     553                $srcset = apply_filters('atw_slider_no_http', wp_get_attachment_image_srcset($attachment_id, $img_size));
     554                $sizes = wp_get_attachment_image_sizes($attachment_id, $img_size);
     555            } else {
     556                $src = $attachment_obj->guid;
     557                $srcset = '';
     558                $sizes = '';
     559            }
     560
     561            if (strpos($src, 'GDML-Mapping') !== false) {        // hack for Google Drive Media Library
     562                $full = image_downsize($attachment_id, 'thumbnail');
     563                $src = $full[0];
     564            }
     565
     566            $caption = $attachment_obj->post_excerpt;      // Media Library Caption field
     567            $description = $attachment_obj->post_content;  // Media Library description field
     568
     569            if ($use_post_info) {
     570                $title = the_title('', '', false);            // get the post title
     571            } else {
     572                $title = $attachment_obj->post_title;       // title field of image
     573            }
     574
     575            $alts = get_post_meta($attachment_id, '_wp_attachment_image_alt');
     576
     577            if (count($alts)) {
     578                $alt = $alts[0];
     579            } else {
     580                if (strlen($title)) {
     581                    $alt = $title;
     582                } else {
     583                    $alt = 'slider image';
     584                }
     585            }
     586
     587
     588            $title_div = '';
     589            if ($title && atw_posts_get_slider_opt('showTitle', $slider)) {
     590                $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . $title . '</div>';
     591            }
     592
     593            $link_begin = '';
     594            $link_end = '';                     // No links by default
     595
     596            $style = '';
     597            if (atw_posts_getopt('showLightbox')) {
     598                $style = ' style="cursor:pointer;"';
     599            }
     600
     601            if ($gal_link != 'none' && atw_posts_get_slider_opt('showLinks', $slider)) {
     602                if ($use_post_info) {
     603                    if ($gal_link != '' && atw_posts_get_slider_opt('inlineLink', $slider)) {
     604                        $attachment_link = $gal_link;
     605                    } else {
     606                        $attachment_link = get_permalink(get_the_ID());       // link is to post
     607                    }
     608                } else {
     609                    $attachment_link = home_url('/?attachment_id=' . $attachment_id);
     610                    if ($attachment_link == '' || $gal_link == 'file') {
     611                        $attachment_link = $src;
     612                    }    // just use raw link if not available
     613                }
     614
     615                $link_begin = '<a href="' . $attachment_link . '" alt="' . $alt . '">'; //  REMOVE TITLE: '" title="' . $title . '">';
     616                $link_end = '</a>';
     617            }
     618
     619            $lead = atw_slider_set_pager_img($attachment_id, $src, $lead_class, $lead_div . $title_div, $slider);
     620
     621            $srcset_code = ($srcset != '') ? ' srcset="' . $srcset . '"' : '';
     622            $sizes_code = ($sizes != '') ? ' sizes="' . $sizes . '"' : '';
     623
     624
     625            $image_code .= $lead . $link_begin .
     626                '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http', $src) . '" alt="' . $alt . '"' . $srcset_code . $sizes_code . ' />' . $link_end . "\n";
     627
     628            if ($caption && atw_posts_get_slider_opt('showCaptions', $slider)) {
     629                if ($description
     630                    && atw_posts_get_slider_opt('showDescription', $slider)
     631                    && atw_posts_get_slider_opt('captionOverlay', $slider)) {        // move it to the top if description, too
     632                    $image_code .= '<div class="atwk-caption-description">' . $caption . '</div>';
     633                } else {
     634                    if (atw_posts_get_slider_opt('captionOverlay', $slider)) {
     635                        $image_code .= '<div class="atwk-caption-overlay">' . $caption . '</div>';
     636                    } else {
     637                        $image_code .= '<div class="atwk-caption">' . $caption . '</div>';
     638                    }
     639                }
     640            }
     641
     642            if ($description && atw_posts_get_slider_opt('showDescription', $slider)) {
     643                $image_code .= '<div class="atwk-description">' . $description . '</div>';
     644            }
     645            $image_code .= "</div></div>\n";
     646
     647            return $image_code;
     648        }
     649
     650// ====================================== >>> atw_slider_get_first_post_image <<< ======================================
     651
     652        function atw_slider_get_first_post_image($content = '', $slider = '', $lead_class = 'class="atwk-slide"', $lead_div = '<div class="slide-content slide-image">')
     653        {
     654
     655            // We're getting this image from a post, so we will use the Post's Title and link to the post instead of the image.
     656
     657            $use_post_info = true;
     658
     659            // Priority 1: Featured Image
     660
     661            if (!atw_posts_get_slider_opt('fiOnlyforThumbs', $slider) && has_post_thumbnail() && !atw_posts_get_slider_opt('video', $slider)) {
     662                $attachment_obj = get_post(get_post_thumbnail_id());
     663                if (!empty($attachment_obj)) {
     664                    return atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, '', $use_post_info);
     665                }
     666            }
     667
     668            if ($content == '') {
     669                $content = get_the_content('');
     670            }
     671
     672            $content = do_shortcode(apply_filters('the_content', $content));    // get images - even those generated by a shortcode
     673
     674            // Priority 2: First image with an attachment class - e.g., wp-image-2793
     675
     676            if (preg_match('/wp-image-([\d]+)/', $content, $img_id)) {        // look for the first image with an attachment
     677                $attachment_obj = get_post($img_id[1]);
     678                if (!empty($attachment_obj)) {
     679                    $link = '';
     680                    if (atw_posts_get_slider_opt('inlineLink', $slider) && preg_match('/<a[^>]*href="([^"]*)"[^>]*>.*<\/a>/', $content, $img_link)) {
     681                        $link = $img_link[1];
     682                    }
     683
     684                    return atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $link, $use_post_info);
     685                }
     686            }
     687
     688            // Priority 3: any other image there
     689
     690            if (preg_match('/<img[^>]+>/i', $content, $images)) {        // grab <img>s
     691
     692                $src = '';
     693                if (preg_match('/src="([^"]*)"/', $images[0], $srcs)) {
     694                    $src = $srcs[1];
     695                } elseif (preg_match("/src='([^']*)'/", $images[0], $srcs)) {
     696                    $src = $srcs[1];
     697                }
     698
     699                $title_div = '';
     700                if (atw_posts_get_slider_opt('showTitle', $slider)) {
     701                    $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('', '', false) . '</div>';
     702                }
     703
     704                $style = '';
     705                if (atw_posts_getopt('showLightbox')) {
     706                    $style = ' style="cursor:pointer;"';
     707                }
     708
     709                $lead = atw_slider_set_pager_img(null, $src, $lead_class, $lead_div . $title_div, $slider);
     710
     711                if (atw_posts_get_slider_opt('showLinks', $slider)) {
     712                    return $lead . '<a href="' . get_permalink(get_the_ID()) .
     713                        '"><img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http', $src) . '" alt="post image" /></a></div></div>';
     714                } else {
     715                    return $lead . '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http', $src) . '" alt="post image" /></div></div>';
     716                }
     717
     718            } else { // assume post has a video or something else to show
     719                $title_div = '';
     720                if (atw_posts_get_slider_opt('showTitle', $slider)) {
     721                    $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('', '', false) . '</div>';
     722                }
     723
     724                $lead = atw_slider_set_pager_img(get_the_ID(), null, $lead_class, $lead_div . $title_div, $slider);
     725
     726                return $lead . $content . '</div></div>';
     727            }
     728
     729            return '';
     730        }
     731
     732// ====================================== >>> atw_slider_get_pager_img <<< ======================================
     733
     734        function atw_slider_set_pager_img($id, $src, $lead_class, $lead_div, $slider)
     735        {
     736
     737            // find and set the slider image
     738            //echo '<!-- @@@@@@@@@@@@@ SET PAGER: ' . $id . '/' . $lead_class . '/' . $lead_div . '/' . $slider . '/' . $who . ' -->' . "\n";
     739            $lead = "\n<div " . $lead_class . '>' . $lead_div;
     740
     741            $pager = atw_posts_get_slider_opt('pager', $slider);
     742
     743            if ($pager == 'thumbnails' || $pager == 'sliding') {          // set the pager image
     744                if ($id == null) {
     745                    $id = get_the_ID();
     746                }
     747
     748                $thumbnail = image_downsize($id, 'thumbnail');
     749
     750                //echo '<pre>'; print_r($thumbnail); echo '</pre>';
     751                $img = $thumbnail[0];
     752                if ($img == '') {     // not at the first level
     753                    if (has_post_thumbnail()) {
     754                        $attachment_obj = get_post(get_post_thumbnail_id());
     755                        if (!empty($attachment_obj)) {
     756                            $attachment_id = $attachment_obj->ID;
     757                            $thumbnail = image_downsize($attachment_id, 'thumbnail');
     758                            $img = $thumbnail[0];
     759                        }
     760                    }
     761                }
     762
     763                if ($img == '') {
     764                    $img = $src;
     765                }            // final fall back
     766
     767                if ($img == '') {
     768                    $img = plugins_url('images/image-pager.png', __FILE__);
     769                }
     770
     771
     772                if ($pager == 'thumbnails') {
     773                    $lead = "\n<div " . $lead_class . ' ' . 'data-thumb="' . $img . '">' . $lead_div;
     774                } else {
     775                    $GLOBALS['atw_slider_thumbs'][] = $img;
     776                }
     777            }
     778
     779            return $lead;               //  return the $lead
     780
     781        }
     782
     783// ====================================== >>> atw_slider_post_pager <<< ======================================
     784        function atw_slider_post_pager($slider)
     785        {
     786
     787            if (atw_posts_get_slider_opt('pager', $slider) != 'sliding') {
     788                return;
     789            }
     790
     791            $id = get_the_ID();
     792            $thumbnail = image_downsize($id, 'thumbnail');
     793
     794            $img = $thumbnail[0];
     795            if ($img == '') {     // not at the first level
     796                if (has_post_thumbnail()) {
     797                    $attachment_obj = get_post(get_post_thumbnail_id());
     798                    if (!empty($attachment_obj)) {
     799                        $attachment_id = $attachment_obj->ID;
     800                        $thumbnail = image_downsize($attachment_id, 'thumbnail');
     801                        $img = $thumbnail[0];
     802                    }
     803                }
     804            }
     805            if ($img == '') {
     806                $img = plugins_url('images/post-pager.png', __FILE__);
     807            }
     808            $GLOBALS['atw_slider_thumbs'][] = $img;
     809        }
     810
     811// ====================================== >>> atw_slider_body_classes <<< ======================================
     812
     813        function atw_slider_body_classes($classes)
     814        {
     815            $classes[] = 'atwkloading';
     816
     817            return $classes;
     818        }
     819
     820        if (function_exists('atw_posts_getopt') && atw_posts_getopt('showLoading')) {
     821            add_filter('body_class', 'atw_slider_body_classes');
     822        }
     823
     824
     825// ====================================== >>> atw_slider_kill_header_image <<< ======================================
     826
     827        /* function atw_slider_kill_header_image($args = '') {
     828            if ( !isset($GLOBALS['atw_slider_header'])) {
     829                $GLOBALS['atw_slider_header'] = true;   // only emit the code once.
     830
     831                echo atw_slider_sc(array('name' => 'header'));
     832            }
     833            return 'remove-header';
     834        }
     835
     836        add_filter( 'theme_mod_header_image' , 'atw_slider_kill_header_image');
    308837        */
    309         wp_dequeue_script( 'atw-lightbox-script' );
    310         wp_dequeue_script( 'atw-combined-scripts' );
    311         wp_dequeue_script( 'atw-flex' );
    312         if ( atw_posts_getopt('showLoading') ) {
    313             echo '<script type="text/javascript">jQuery(window).ready(function(slider){jQuery(\'body\').removeClass(\'atwkloading\');});</script>' ,"\n";
    314         }
    315         return;
    316     }
    317 
    318     require_once(dirname( __FILE__ ) . '/includes/atw-slider-shortcode.php');
    319 
    320     atw_slider_do_footer();
    321 }
    322 
    323 // ========================================= >>> atw_slider_setup_shortcodes <<< ===============================
    324 
    325 function atw_slider_setup_shortcodes() {
    326     if ( function_exists('atw_posts_getopt') && atw_posts_getopt('enable_gallery_slider') ) {
    327         add_filter( 'post_gallery', 'atw_gallery_sc_filter', 10, 2);
    328     }
    329 
    330     remove_shortcode('show_slider');
    331     add_shortcode('show_slider', 'atw_slider_sc');
    332 }
    333 
    334 // ========================================= >>> atw_slider_sc <<< ===============================
    335 
    336 
    337 function atw_slider_sc( $args = '' ) {
    338     require_once(dirname( __FILE__ ) . '/includes/atw-slider-shortcode.php');
    339     return atw_slider_shortcode( $args );
    340 }
    341 
    342 // ========================================= >>> atw_gallery_sc_filter <<< ===============================
    343 
    344 function atw_gallery_sc_filter( $content, $args = '' ) {
    345     require_once(dirname( __FILE__ ) . '/includes/atw-slider-shortcode.php');
    346     return atw_gallery_shortcode_filter( $args );
    347 }
    348 
    349 // ========================================= >>> atw_slider_load_admin <<< ===============================
    350 
    351 function atw_slider_load_admin() {
    352     require_once(dirname( __FILE__ ) . '/includes/atw-slider-slider-admin.php'); // NOW - load the admin stuff
    353     require_once(dirname( __FILE__ ) . '/includes/atw-slider-pro-admin.php'); // NOW - load the admin stuff
    354     require_once(dirname( __FILE__ ) . '/includes/atw-slider-help-admin.php'); // NOW - load the admin stuff
    355 }
    356 
    357 // ========================================= >>> atw_slider_do_slider_admin <<< ===============================
    358 
    359 function atw_slider_do_slider_admin() {
    360     atw_slider_load_admin();
    361     atw_slider_slider_admin();
    362 }
    363 
    364 // ========================================= >>> atw_slider_gallery_admin <<< ===============================
    365 
    366 function atw_slider_gallery_admin() {
    367     atw_slider_load_admin();
    368     atw_slider_gallery_admin_page();
    369 }
    370 
    371 function atw_slider_pro() {
    372     // This code is leftver from the former split Pro version. These versions have been merges and are all now free.
    373     return WEAVER_SLIDER_PI_PRO;
    374 }
    375 
    376 // ====================================== >>> atw_slider_do_gallery <<< ======================================
    377 
    378 function atw_slider_do_gallery( $qargs, $slider, $ids = null) {
    379 
    380     $content = "\n<!-- **** Slider Images: " . $slider . " **** -->\n";
    381     $style = '';
    382 
    383 
    384     if ( isset($GLOBALS['atw_slider_thumbs']))
    385         unset($GLOBALS['atw_slider_thumbs']);
    386     $GLOBALS['atw_slider_thumbs'] = array();        // save our thumbs...
    387 
    388     /* $margin = atw_posts_get_slider_opt( 'slideMargin', $slider );
    389 
    390     if ( $margin  != '') { // change default image margin?
    391         $style = ' style="margin:' . $margin . 'em;"';
    392     } */
    393 
    394     $img_class = 'slide-image';
    395     if (atw_posts_get_slider_opt( 'addImageBorder', $slider ))
    396         $img_class = 'slide-image-border';
    397 
    398     $lead_class = 'class="atwk-slide"';
    399     $lead_div = '<div class="slide-content ' . $img_class . '"' . $style . '>';
    400 
    401     if ( !$qargs || !empty( $ids ) ) {
    402         //$content .= '<-- ********** atw_slider_get_gallery  ************** -->';
    403         $content .= atw_slider_get_gallery( '' , $slider, $ids, $lead_class, $lead_div);
    404     } else {
    405 
    406         // get posts
    407         if ( !$qargs->have_posts()) {
    408             $content .= '<em>' . __('No posts found.','show-sliders') . ' ' . __('Slider Post slug: `', 'show-sliders') . $qargs->query['name'] .
    409                 __('` - Slider: `', 'show-sliders') . $slider . '`.</em>';
    410 
    411         }
    412         while ( $qargs->have_posts() ) {
    413             $qargs->the_post();
    414             $post_content =  get_the_content();
    415             $gallery = atw_slider_get_gallery( $post_content , $slider, null, $lead_class, $lead_div);
    416 
    417             if ($gallery != '' ) {
    418                 $content .= $gallery;
    419             }  else {
    420                 $img = atw_slider_get_first_post_image( $post_content, $slider, $lead_class, $lead_div );
    421 
    422                 if ( $img != '' ) {
    423 
    424                     $content .= $img ;
    425                 }
    426             }
    427         }
    428     }
    429 
    430     echo $content;
    431 }
    432 
    433 // ====================================== >>> atw_slider_get_gallery <<< ======================================
    434 
    435 function atw_slider_get_gallery( $content, $slider, $ids = array(), $lead_class='class="atwk-slide"', $lead_div='<div class="slide-content slide-image">' ) {
    436     // we will pass in either content, or a list of ids grabbed from the [gallery] shortcode replacement
    437 
    438      $gallery = '';
    439 
    440     // @@@@@@@@@@ need to use get_shortcode_regex
    441 
    442     if ( $content != ''
    443         && !atw_posts_get_slider_opt('noGallery', $slider)       // skip looking for [gallery]
    444         && preg_match( '/\[gallery(.*?)\]/i', $content, $sc)) {  // find the first [gallery]  ************************
    445         // sc[0] = full match
    446         // sc[1] = content of [gallery];
    447         $attr = shortcode_parse_atts( $sc[1] );
    448         if ( empty( $attr['ids'] ) )                            // will only work with [gallery ids="1,2,3"] form of shortcode
    449             return '';
    450         $gal_link = '';                                         // default is attachment
    451         if ( !empty( $attr['link']) )
    452             $gal_link = $attr['link'];
    453 
    454         $orderby = 'post__in';
    455 
    456         if ( !empty( $attr['orderby']) && $attr['orderby'] == 'rand' ) {
    457             $orderby = 'rand';
    458         }
    459 
    460         $img_list = explode( ',', $attr['ids']);        // build our list of attachment ids
    461 
    462         $attachments = get_posts( array('include' => $img_list, 'orderby' => $orderby,  'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image') );
    463 
    464         foreach ($attachments as $attachment => $attachment_obj) {
    465             $gallery .= atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
    466         }
    467 
    468     } else if ($content == '' && !empty($ids) ) {        // we got passed a list of attachment images  *********************
    469         $gal_link = '';
    470 
    471         $attachments = get_posts( array('include' => $ids, 'orderby' => 'post__in',  'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image') );
    472 
    473         foreach ($attachments as $attachment => $attachment_obj) {
    474             $gallery .= atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
    475         }
    476 
    477 
    478 
    479     } else if ($content == '') {                        // look for first image **********************
    480 
    481         $post = get_post();
    482         $id = $post ? $post->ID : 0;
    483         $gal_link = '';
    484 
    485         $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment',
    486                                            'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
    487 
    488         foreach ($attachments as $attachment => $attachment_obj) {
    489             $gallery .= atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // add each image
    490         }
    491 
    492     }
    493     return $gallery;
    494 }
    495 
    496 // ====================================== >>> atw_slider_get_title_class <<< ======================================
    497 
    498 function atw_slider_get_title_class($slider) {
    499 
    500     return atw_posts_get_slider_opt( 'titleOverlay', $slider) ? 'atwk-title-overlay' : 'atwk-title';
    501 
    502 }
    503 
    504 // ====================================== >>> atw_slider_get_slide_image <<< ======================================
    505 
    506 function atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link = '', $use_post_info = false) {
    507 
    508     // Get an image for the slide, and its pager index image
    509 
    510     $image_code = '';
    511 
    512     $attachment_id = $attachment_obj->ID;
    513 
    514     $img_size = atw_posts_get_slider_opt('imageSize');
    515     if ($img_size == '')
    516         $img_size = 'full';
    517 
    518     if (function_exists('wp_get_attachment_image_srcset')) {            // WP 4.4 or later
    519         $src = wp_get_attachment_image_url( $attachment_id, $img_size);
    520         $srcset = apply_filters( 'atw_slider_no_http', wp_get_attachment_image_srcset( $attachment_id, $img_size) );
    521         $sizes = wp_get_attachment_image_sizes( $attachment_id, $img_size);
    522     } else {
    523         $src = $attachment_obj->guid;
    524         $srcset = '';
    525         $sizes = '';
    526     }
    527 
    528     if (strpos($src, 'GDML-Mapping') !== false) {       // hack for Google Drive Media Library
    529         $full = image_downsize($attachment_id, 'thumbnail');
    530         $src = $full[0];
    531     }
    532 
    533     $caption = $attachment_obj->post_excerpt;      // Media Library Caption field
    534     $description = $attachment_obj->post_content;  // Media Library description field
    535 
    536     if ( $use_post_info ) {
    537         $title = the_title('','',false);            // get the post title
    538     } else {
    539         $title = $attachment_obj->post_title;       // title field of image
    540     }
    541 
    542     $alts = get_post_meta($attachment_id, '_wp_attachment_image_alt');
    543 
    544     if ( count($alts) )
    545         $alt = $alts[0];
    546     else {
    547         if (strlen($title))
    548             $alt = $title;
    549         else
    550             $alt = 'slider image';
    551     }
    552 
    553 
    554     $title_div = '';
    555     if ($title && atw_posts_get_slider_opt('showTitle',$slider) ) {
    556         $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . $title . '</div>';
    557     }
    558 
    559     $link_begin = '';
    560     $link_end = '';                     // No links by default
    561 
    562     $style='';
    563     if ( atw_posts_getopt( 'showLightbox')) {
    564         $style = ' style="cursor:pointer;"';
    565     }
    566 
    567     if ( $gal_link != 'none' && atw_posts_get_slider_opt( 'showLinks', $slider) ) {
    568         if ( $use_post_info ) {
    569             if ($gal_link != '' && atw_posts_get_slider_opt('inlineLink', $slider)) {
    570                 $attachment_link = $gal_link;
    571             } else {
    572                 $attachment_link = get_permalink( get_the_ID() );       // link is to post
    573             }
    574         } else {
    575             $attachment_link = home_url( '/?attachment_id=' . $attachment_id );
    576             if ( $attachment_link == '' || $gal_link == 'file' )
    577                 $attachment_link = $src;    // just use raw link if not available
    578         }
    579 
    580         $link_begin = '<a href="' . $attachment_link . '" alt="' . $alt .  '">'; // REMOVE TITLE: '" title="' . $title . '">';
    581         $link_end = '</a>';
    582     }
    583 
    584     $lead = atw_slider_set_pager_img( $attachment_id, $src, $lead_class, $lead_div . $title_div, $slider );
    585 
    586     $srcset_code = ($srcset != '') ? ' srcset="' . $srcset . '"' : '';
    587     $sizes_code = ($sizes != '') ? ' sizes="' . $sizes . '"' : '';
    588 
    589 
    590 
    591     $image_code .= $lead . $link_begin .
    592     '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http',$src) . '" alt="' . $alt . '"' . $srcset_code . $sizes_code . ' />' . $link_end . "\n";
    593 
    594 
    595     if ( $caption && atw_posts_get_slider_opt('showCaptions',$slider) ) {
    596         if ( $description
    597             && atw_posts_get_slider_opt('showDescription',$slider)
    598             && atw_posts_get_slider_opt( 'captionOverlay', $slider ) ) {        // move it to the top if description, too
    599             $image_code .= '<div class="atwk-caption-description">' . $caption . '</div>';
    600         } else {
    601             if ( atw_posts_get_slider_opt( 'captionOverlay', $slider ) )
    602                 $image_code .= '<div class="atwk-caption-overlay">' . $caption . '</div>';
    603             else
    604                 $image_code .= '<div class="atwk-caption">' . $caption . '</div>';
    605         }
    606     }
    607 
    608     if ( $description && atw_posts_get_slider_opt('showDescription',$slider) ) {
    609         $image_code .= '<div class="atwk-description">' . $description . '</div>';
    610     }
    611     $image_code .= "</div></div>\n";
    612     return $image_code;
    613 }
    614 
    615 // ====================================== >>> atw_slider_get_first_post_image <<< ======================================
    616 
    617 function atw_slider_get_first_post_image( $content='', $slider,  $lead_class='class="atwk-slide"', $lead_div='<div class="slide-content slide-image">' ) {
    618 
    619     // We're getting this image from a post, so we will use the Post's Title and link to the post instead of the image.
    620 
    621     $use_post_info = true;
    622 
    623     // Priority 1: Featured Image
    624 
    625     if ( !atw_posts_get_slider_opt('fiOnlyforThumbs', $slider) && has_post_thumbnail() && !atw_posts_get_slider_opt( 'video', $slider) ) {
    626         $attachment_obj = get_post( get_post_thumbnail_id( ) );
    627         if (!empty( $attachment_obj ))
    628             return atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, '', $use_post_info);
    629     }
    630 
    631     if ($content == '')
    632         $content = get_the_content('');
    633 
    634     $content = do_shortcode(apply_filters( 'the_content', $content ));    // get images - even those generated by a shortcode
    635 
    636     // Priority 2: First image with an attachment class - e.g., wp-image-2793
    637 
    638     if ( preg_match('/wp-image-([\d]+)/', $content, $img_id) ) {        // look for the first image with an attachment
    639         $attachment_obj = get_post( $img_id[1] );
    640         if (!empty( $attachment_obj )) {
    641             $link = '';
    642             if ( atw_posts_get_slider_opt('inlineLink', $slider) && preg_match('/<a[^>]*href="([^"]*)"[^>]*>.*<\/a>/', $content, $img_link) )
    643                 $link = $img_link[1];
    644 
    645             return atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $link, $use_post_info);
    646         }
    647     }
    648 
    649     // Priority 3: any other image there
    650 
    651     if (preg_match('/<img[^>]+>/i',$content, $images)) {        // grab <img>s
    652 
    653         $src = '';
    654         if (preg_match('/src="([^"]*)"/', $images[0], $srcs)) {
    655             $src = $srcs[1];
    656         } else if (preg_match("/src='([^']*)'/", $images[0], $srcs)) {
    657             $src = $srcs[1];
    658         }
    659 
    660         $title_div = '';
    661         if ( atw_posts_get_slider_opt('showTitle',$slider) ) {
    662             $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('','',false) . '</div>';
    663         }
    664 
    665         $style='';
    666         if ( atw_posts_getopt( 'showLightbox')) {
    667             $style = ' style="cursor:pointer;"';
    668         }
    669 
    670         $lead = atw_slider_set_pager_img( null, $src, $lead_class, $lead_div . $title_div, $slider );
    671 
    672         if ( atw_posts_get_slider_opt( 'showLinks', $slider)) {
    673             return $lead . '<a href="' . get_permalink( get_the_ID() ) .
    674                     '"><img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http',$src) . '" alt="post image" /></a></div></div>';
    675         }
    676         else {
    677             return $lead . '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http',$src) . '" alt="post image" /></div></div>';
    678         }
    679 
    680     } else  { // assume post has a video or something else to show
    681         $title_div = '';
    682         if ( atw_posts_get_slider_opt('showTitle',$slider) ) {
    683             $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('','',false) . '</div>';
    684         }
    685 
    686         $lead = atw_slider_set_pager_img( get_the_ID(), null, $lead_class, $lead_div . $title_div, $slider );
    687 
    688         return $lead . $content . '</div></div>';
    689     }
    690     return '';
    691 }
    692 
    693 // ====================================== >>> atw_slider_get_pager_img <<< ======================================
    694 
    695 function atw_slider_set_pager_img( $id, $src, $lead_class, $lead_div, $slider ) {
    696 
    697     // find and set the slider image
    698     //echo '<!-- @@@@@@@@@@@@@ SET PAGER: ' . $id . '/' . $lead_class . '/' . $lead_div . '/' . $slider . '/' . $who . ' -->' . "\n";
    699     $lead = "\n<div ". $lead_class . '>'. $lead_div;
    700 
    701     $pager = atw_posts_get_slider_opt( 'pager', $slider );
    702 
    703     if ( $pager == 'thumbnails' || $pager == 'sliding' ) {          // set the pager image
    704         if ( $id == null )
    705             $id = get_the_ID();
    706 
    707         $thumbnail = image_downsize($id, 'thumbnail');
    708 
    709         //echo '<pre>'; print_r($thumbnail); echo '</pre>';
    710         $img = $thumbnail[0];
    711         if ( $img == '' ) {     // not at the first level
    712             if (has_post_thumbnail()) {
    713                 $attachment_obj = get_post( get_post_thumbnail_id( ) );
    714                 if (!empty( $attachment_obj )) {
    715                     $attachment_id = $attachment_obj->ID;
    716                     $thumbnail = image_downsize($attachment_id, 'thumbnail');
    717                     $img = $thumbnail[0];
    718                 }
    719             }
    720         }
    721 
    722         if ($img == '')
    723             $img = $src;            // final fall back
    724 
    725         if ( $img == '' )
    726             $img = plugins_url('images/image-pager.png', __FILE__);
    727 
    728 
    729         if ( $pager == 'thumbnails' )
    730             $lead = "\n<div " . $lead_class . ' ' . 'data-thumb="' . $img . '">' . $lead_div;
    731         else
    732             $GLOBALS['atw_slider_thumbs'][] = $img;
    733     }
    734     return $lead;               //  return the $lead
    735 
    736 }
    737 
    738 // ====================================== >>> atw_slider_post_pager <<< ======================================
    739 function atw_slider_post_pager($slider) {
    740 
    741     if ( atw_posts_get_slider_opt( 'pager', $slider ) != 'sliding')
    742         return;
    743 
    744     $id = get_the_ID();
    745     $thumbnail = image_downsize($id, 'thumbnail');
    746 
    747     $img = $thumbnail[0];
    748     if ( $img == '' ) {     // not at the first level
    749         if (has_post_thumbnail()) {
    750             $attachment_obj = get_post( get_post_thumbnail_id( ) );
    751             if (!empty( $attachment_obj )) {
    752                 $attachment_id = $attachment_obj->ID;
    753                 $thumbnail = image_downsize($attachment_id, 'thumbnail');
    754                 $img = $thumbnail[0];
    755             }
    756         }
    757     }
    758     if ( $img == '' )
    759         $img = plugins_url('images/post-pager.png', __FILE__);
    760     $GLOBALS['atw_slider_thumbs'][] = $img;
    761 }
    762 
    763 // ====================================== >>> atw_slider_body_classes <<< ======================================
    764 
    765 function atw_slider_body_classes( $classes ) {
    766     $classes[] = 'atwkloading';
    767     return $classes;
    768 }
    769 
    770 if ( function_exists('atw_posts_getopt') && atw_posts_getopt('showLoading')) {
    771         add_filter( 'body_class', 'atw_slider_body_classes' );
    772     }
    773 
    774 
    775 
    776 
    777 // ====================================== >>> atw_slider_kill_header_image <<< ======================================
    778 
    779 /* function atw_slider_kill_header_image($args = '') {
    780     if ( !isset($GLOBALS['atw_slider_header'])) {
    781         $GLOBALS['atw_slider_header'] = true;   // only emit the code once.
    782 
    783         echo atw_slider_sc(array('name' => 'header'));
    784     }
    785     return 'remove-header';
    786 }
    787 
    788 add_filter( 'theme_mod_header_image' , 'atw_slider_kill_header_image');
    789 */
    790 
    791 } else {    // !!!! Show Posts NOT installed !!!!!
    792 
    793     add_action('admin_menu', 'atw_slider_admin_menu');  // let them know they need show_posts
     838
     839    } else {    // !!!! Show Posts NOT installed !!!!!
     840
     841        add_action('admin_menu', 'atw_slider_admin_menu');  // let them know they need show_posts
    794842
    795843// ========================================= >>> atw_slider_admin_menu <<< ===============================
    796844
    797 function atw_slider_admin_menu() {
    798        $page = add_menu_page(
    799       'Weaver Show Sliders by WeaverTheme.com','Weaver Slider','install_plugins',
    800       'atw_slider_page', 'atw_slider_admin','',62);
    801 
    802     /* using registered $page handle to hook stylesheet loading for this admin page */
    803 
    804     add_action('admin_print_styles-'.$page, 'atw_slider_admin_scripts');
    805 }
     845        function atw_slider_admin_menu()
     846        {
     847            $page = add_menu_page(
     848                'Weaver Show Sliders by WeaverTheme.com', 'Weaver Slider', 'install_plugins',
     849                'atw_slider_page', 'atw_slider_admin', '', 62);
     850
     851            /* using registered $page handle to hook stylesheet loading for this admin page */
     852
     853            add_action('admin_print_styles-' . $page, 'atw_slider_admin_scripts');
     854        }
    806855
    807856// ========================================= >>> atw_slider_admin <<< ===============================
    808857
    809 function atw_slider_admin() {
    810     if ( !function_exists('atw_showposts_installed')) {
    811 
    812         echo '<h2 style="text-align:center;">You must first install and activate the Weaver Show Posts plugin!</h2>';
    813         if ( is_multisite() ) {
    814             echo '<h2 style="color:red;">IMPORTANT! This is a WP MultiSite Installation. You MUST follow these special instructions:</h2>';
    815             echo '<p>For MultiSite sites, you MUST disable Weaver Show Sliders first. Then install and activate Weaver Show Posts. After that, you
     858        function atw_slider_admin()
     859        {
     860            if (!function_exists('atw_showposts_installed')) {
     861
     862                echo '<h2 style="text-align:center;">You must first install and activate the Weaver Show Posts plugin!</h2>';
     863                if (is_multisite()) {
     864                    echo '<h2 style="color:red;">IMPORTANT! This is a WP MultiSite Installation. You MUST follow these special instructions:</h2>';
     865                    echo '<p>For MultiSite sites, you MUST disable Weaver Show Sliders first. Then install and activate Weaver Show Posts. After that, you
    816866            can activate Weaver Show Sliders. Both plugins must be activated the same way - either both network activated, or both per site activation.
    817867            After in initial installation, sites with Per Site Activation can activate in any order.</p>';
    818         }
    819 
     868                }
     869
     870            }
     871        }
     872
     873// ========================================= >>> atw_slider_admin_scripts <<< ===============================
     874
     875        function atw_slider_admin_scripts()
     876        {
     877            /* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */
     878            //wp_enqueue_style('atw_sw_Stylesheet', atw_slider_plugins_url('/atw-admin-style', WEAVER_SLIDER_PI_MINIFY . '.css'), array(), WEAVER_SLIDER_PI_VERSION);
     879
     880        }
     881
     882        if (current_user_can('activate_plugins')) {
     883            require_once((dirname(__FILE__) . '/includes/atw-activate-show-posts.php'));
     884        }
     885
     886    }   // end Show Posts not installed
     887
     888    function atw_slider_no_http_filter($src)
     889    {
     890        return str_replace(array('http://', 'https://'), '//', $src);
    820891    }
    821 }
    822 
    823 // ========================================= >>> atw_slider_admin_scripts <<< ===============================
    824 
    825 function atw_slider_admin_scripts() {
    826     /* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */
    827     //wp_enqueue_style('atw_sw_Stylesheet', atw_slider_plugins_url('/atw-admin-style', WEAVER_SLIDER_PI_MINIFY . '.css'), array(), WEAVER_SLIDER_PI_VERSION);
    828 
    829 }
    830 
    831 if (current_user_can('activate_plugins')) {
    832     require_once((dirname( __FILE__ ) . '/includes/atw-activate-show-posts.php'));
    833 }
    834 
    835 }   // end Show Posts not installed
    836 
    837 function atw_slider_no_http_filter($src) {
    838     return str_replace(array('http://', 'https://'), '//', $src);
    839 }
    840 add_filter('atw_slider_no_http', 'atw_slider_no_http_filter');
     892
     893    add_filter('atw_slider_no_http', 'atw_slider_no_http_filter');
    841894}   // end of plugins_loaded action
    842895
  • show-sliders/tags/1.6/readme.txt

    r2428756 r2853103  
    99Tags: slider, slide show, recent posts, responsive, responsive slider, [gallery], gallery slide show, slider options, slider shortcode, FlexSlider
    1010Requires at least: 5.4
    11 Tested up to: 5.6
    12 Stable tag: 1.5.1
     11Tested up to: 6.1
     12Stable tag: 1.6
    1313
    1414== Description ==
     
    9191== Copyrights ==
    9292
    93 * Weaver Show Sliders is Copyright (c) 2014, 2105 by Bruce E. Wampler. It is licensed under GPL Version 2.
     93* Weaver Show Sliders is Copyright (c) 2014-2023 by Bruce E. Wampler. It is licensed under GPL Version 2.
    9494* FlexSlider is licensed under GPL Version 2.
    9595* jQuery Easing is licensed under BSD
     
    9898
    9999== Changelog ==
     100= 1.6 =
     101* WP 6.1 version update
     102
     103= 1.5.2 =
     104* WP 5.7 version update
     105* PHP 8 compatibility
     106
    100107= 1.5.1 =
    101108* WP 5.6 update
  • show-sliders/trunk/atw-show-sliders.php

    r2428756 r2853103  
    66Author: wpweaver
    77Author URI: http://weavertheme.com/about/
    8 Version: 1.5.1
     8Version: 1.6
    99
    1010License: GPL3
    1111
    1212Weaver Show Sliders
    13 Copyright (C) 2014-2021, Bruce E. Wampler - [email protected]
     13Copyright (C) 2014-2023, Bruce E. Wampler - [email protected]
    1414
    1515This program is free software: you can redistribute it and/or modify
     
    2828
    2929
    30 define ( 'WEAVER_SLIDER_PI_VERSION','1.5.1');
    31 define ( 'WEAVER_SLIDER_PI_PRO', true);            // change this and the Plugin Name above when building Pro version
    32 define ( 'WEAVER_SLIDER_PI_MINIFY','.min');     // '' for dev, '.min' for production
     30const WEAVER_SLIDER_PI_VERSION = '1.6';
     31const WEAVER_SLIDER_PI_PRO = true;            // change this and the Plugin Name above when building Pro version
     32const WEAVER_SLIDER_PI_MINIFY = '.min';        // '' for dev, '.min' for production
    3333
    3434if (function_exists('atw_slider_installed')) {
    35     wp_die('Both Weaver Show Sliders and Weaver Show Sliders Pro installed. You can only activate one version or the other!','You can have only one activated version of Weaver Show Sliders!');
     35    wp_die('Both Weaver Show Sliders and Weaver Show Sliders Pro installed. You can only activate one version or the other!', 'You can have only one activated version of Weaver Show Sliders!');
    3636}
    3737
    3838// ===============================>>> REGISTER ACTIONS <<<===============================
    39     add_action( 'plugins_loaded', 'atw_slider_plugins_loaded');
    40     add_action( 'atw_show_sliders_post_pager','atw_slider_post_pager');
     39add_action('plugins_loaded', 'atw_slider_plugins_loaded');
     40add_action('atw_show_sliders_post_pager', 'atw_slider_post_pager');
    4141
    4242// ===============================>>> DEFINE ACTIONS <<<===============================
    4343
    44 function atw_slider_plugins_loaded() {
     44function atw_slider_plugins_loaded()
     45{
    4546    // these need to be done like this to avoid installation interaction issues with Show Posts
    4647    // we really don't define any Show Sliders stuff until all the plugins have been installed
    4748
    4849
    49 $show_posts = false;
    50 if ( function_exists('atw_showposts_installed') ) {         // for simple case where show_posts gets installed first
    51     $show_posts = true;
    52 } else {
    53     require_once (ABSPATH . 'wp-admin/includes/plugin.php');    // need this for is_plugin_active
    54     $show_posts = is_plugin_active('show-posts/atw-show-posts.php');
    55 }
    56 
    57 if ( $show_posts )  {
    58 
    59     function atw_slider_installed() {
    60         return true;
     50    $show_posts = false;
     51    if (function_exists('atw_showposts_installed')) {            // for simple case where show_posts gets installed first
     52        $show_posts = true;
     53    } else {
     54        require_once(ABSPATH . 'wp-admin/includes/plugin.php');    // need this for is_plugin_active
     55        $show_posts = is_plugin_active('show-posts/atw-show-posts.php');
    6156    }
    6257
    63     add_action( 'init', 'atw_slider_register_post_cpt' );
    64     add_action( 'init', 'atw_slider_setup_shortcodes');
    65     add_action( 'add_meta_boxes', 'atw_slider_add_meta_box' );
    66     add_action( 'wp_enqueue_scripts', 'atw_slider_enqueue_scripts' );
    67     add_action( 'wp_footer','atw_slider_the_footer', 9);    // make it 9 so we can dequeue scripts
    68     add_action( 'admin_enqueue_scripts','atw_slider_add_admin_scripts');
    69     require_once(dirname( __FILE__ ) . '/includes/slider-widgets.php'); // need this for is_plugin_active
    70 
    71 
    72 function atw_slider_add_admin_scripts() {
    73     wp_enqueue_script('atw-combined-scripts',
    74         atw_slider_plugins_url('/includes/js/jquery.ddslick', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    75         WEAVER_SLIDER_PI_VERSION, true);
    76 }
     58    if ($show_posts) {
     59
     60        function atw_slider_installed()
     61        {
     62            return true;
     63        }
     64
     65        add_action('init', 'atw_slider_register_post_cpt');
     66        add_action('init', 'atw_slider_setup_shortcodes');
     67        add_action('add_meta_boxes', 'atw_slider_add_meta_box');
     68        add_action('wp_enqueue_scripts', 'atw_slider_enqueue_scripts');
     69        add_action('wp_footer', 'atw_slider_the_footer', 9);    // make it 9 so we can dequeue scripts
     70        add_action('admin_enqueue_scripts', 'atw_slider_add_admin_scripts');
     71        require_once(dirname(__FILE__) . '/includes/slider-widgets.php');    // need this for is_plugin_active
     72
     73
     74        function atw_slider_add_admin_scripts()
     75        {
     76            wp_enqueue_script('atw-combined-scripts',
     77                atw_slider_plugins_url('/includes/js/jquery.ddslick', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     78                WEAVER_SLIDER_PI_VERSION, true);
     79        }
    7780
    7881// ========================================= >>> atw_slider_register_post_cpt <<< ===============================
    79 /**
    80 * Registers the atw_slider_post custom post type
    81 */
    82 function atw_slider_register_post_cpt() {
    83     $singular_item = __('Weaver Slider Post', 'show-sliders');
    84     $plural_item = __('Weaver Slider Posts', 'show-sliders');
    85 
    86     $capabilities = array(
    87         'edit_post'          => 'edit_post',
    88         'edit_posts'         => 'edit_posts',
    89         'edit_others_posts'  => 'edit_others_posts',
    90         'publish_posts'      => 'publish_posts',
    91         'read_post'          => 'read_post',
    92         'read_private_posts' => 'read_private_posts',
    93         'delete_post'        => 'delete_post'
    94     );
    95 
    96     $labels = array(
    97         'name'               =>  $singular_item,
    98         'singular_name'      => 'Slider',
    99         'add_new'            => __('New', 'show-sliders') . ' ' .  $singular_item,
    100         'add_new_item'       => __('New', 'show-sliders') . ' ' .  $singular_item,
    101         'edit_item'          => __('Edit', 'show-sliders') . ' ' .  $singular_item,
    102         'new_item'           => __('New', 'show-sliders') . ' ' .  $singular_item,
    103         'all_items'          => __('All', 'show-sliders') . ' ' .  $plural_item,
    104         'view_item'          => __('View', 'show-sliders') . ' ' .  $singular_item,
    105         'search_items'       => __('Search', 'show-sliders') . ' ' .  $plural_item,
    106         'not_found'          => sprintf( __( 'No %s found', 'show-sliders' ), $plural_item ),
    107         'not_found_in_trash' => sprintf( __( 'No %s found in trash', 'show-sliders' ), $plural_item ),
    108         'parent_item_colon'  => '',
    109         'menu_name'          => $plural_item,
    110     );
    111 
    112     $args = array(
    113         'labels'             => $labels,
    114         'description'       =>  __('Auxiliary Custom Post Type to use for defining sliders.', 'show-sliders'),
    115         'exclude_from_search'   => true,
    116         'public'             => true,
    117         'publicly_queryable' => true,
    118         'show_ui'            => true,
    119         'show_in_menu'       => true,
    120         'query_var'          => true,
    121         'capability_type'    => 'post',
    122         'has_archive'        => true,
    123         'hierarchical'       => false,
    124         'taxonomies'         => array('atw_slider_group','category','post_tag'),
    125         'menu_position'      => 64,
    126         'menu_icon'           => 'dashicons-images-alt',
    127         'supports'           => array( 'title', 'editor', 'page-attributes','thumbnail','excerpt','custom-fields','comments','revisions','post-formats','author')
    128     );
    129 
    130   register_post_type( 'atw_slider_post', $args );
    131   add_post_type_support( 'atw_slider_post', 'excerpt'); // even though listed in the 'supports' list, needs this explicit add...
    132 
    133 
    134 
    135     $tlabels = array(
    136         'name'                       => _x( 'Slider Group', 'Taxonomy General Name', 'show-sliders' ),
    137         'singular_name'              => _x( 'Slider Group', 'Taxonomy Singular Name', 'show-sliders' ),
    138         'menu_name'                  => __( 'Slider Groups', 'show-sliders' ),
    139         'all_items'                  => __( 'All Slider Groups', 'show-sliders' ),
    140         'parent_item'                => __( 'Parent Slider Group', 'show-sliders' ),
    141         'parent_item_colon'          => __( 'Parent Slider Group:', 'show-sliders' ),
    142         'new_item_name'              => __( 'New Slider Group', 'show-sliders' ),
    143         'add_new_item'               => __( 'Add New Slider Group', 'show-sliders' ),
    144         'edit_item'                  => __( 'Edit Slider Group', 'show-sliders' ),
    145         'update_item'                => __( 'Update Slider Group', 'show-sliders' ),
    146         'separate_items_with_commas' => __( 'Separate Slider Groups with commas', 'show-sliders' ),
    147         'search_items'               => __( 'Search Slider Groups', 'show-sliders' ),
    148         'add_or_remove_items'        => __( 'Add or remove Groups', 'show-sliders' ),
    149         'choose_from_most_used'      => __( 'Choose from the most used groups', 'show-sliders' ),
    150     );
    151     $targs = array(
    152         'labels'                     => $tlabels,
    153         'hierarchical'               => true,
    154         'public'                     => true,
    155         'show_ui'                    => true,
    156         'rewrite'                    => array( 'slug' => atw_slider_get_default_category_slug() ),
    157         'show_admin_column'          => true,
    158         'show_in_nav_menus'          => true,
    159         'show_tagcloud'              => true,
    160     );
    161     register_taxonomy( 'atw_slider_group', 'atw_slider_post', $targs );
    162 }
     82        /**
     83         * Registers the atw_slider_post custom post type
     84         */
     85        function atw_slider_register_post_cpt()
     86        {
     87            $singular_item = __('Weaver Slider Post', 'show-sliders');
     88            $plural_item = __('Weaver Slider Posts', 'show-sliders');
     89
     90            $capabilities = array(
     91                'edit_post' => 'edit_post',
     92                'edit_posts' => 'edit_posts',
     93                'edit_others_posts' => 'edit_others_posts',
     94                'publish_posts' => 'publish_posts',
     95                'read_post' => 'read_post',
     96                'read_private_posts' => 'read_private_posts',
     97                'delete_post' => 'delete_post',
     98            );
     99
     100            $labels = array(
     101                'name' => $singular_item,
     102                'singular_name' => 'Slider',
     103                'add_new' => __('New', 'show-sliders') . ' ' . $singular_item,
     104                'add_new_item' => __('New', 'show-sliders') . ' ' . $singular_item,
     105                'edit_item' => __('Edit', 'show-sliders') . ' ' . $singular_item,
     106                'new_item' => __('New', 'show-sliders') . ' ' . $singular_item,
     107                'all_items' => __('All', 'show-sliders') . ' ' . $plural_item,
     108                'view_item' => __('View', 'show-sliders') . ' ' . $singular_item,
     109                'search_items' => __('Search', 'show-sliders') . ' ' . $plural_item,
     110                'not_found' => sprintf(__('No %s found', 'show-sliders'), $plural_item),
     111                'not_found_in_trash' => sprintf(__('No %s found in trash', 'show-sliders'), $plural_item),
     112                'parent_item_colon' => '',
     113                'menu_name' => $plural_item,
     114            );
     115
     116            $args = array(
     117                'labels' => $labels,
     118                'description' => __('Auxiliary Custom Post Type to use for defining sliders.', 'show-sliders'),
     119                'exclude_from_search' => true,
     120                'public' => true,
     121                'publicly_queryable' => true,
     122                'show_ui' => true,
     123                'show_in_menu' => true,
     124                'query_var' => true,
     125                'capability_type' => 'post',
     126                'has_archive' => true,
     127                'hierarchical' => false,
     128                'taxonomies' => array('atw_slider_group', 'category', 'post_tag'),
     129                'menu_position' => 64,
     130                'menu_icon' => 'dashicons-images-alt',
     131                /* 'show_in_rest'        => true,  // block editor not helpful... */
     132                'supports' => array('title', 'editor', 'page-attributes', 'thumbnail', 'excerpt', 'custom-fields', 'comments', 'revisions', 'post-formats', 'author'),
     133            );
     134
     135            register_post_type('atw_slider_post', $args);
     136            add_post_type_support('atw_slider_post', 'excerpt'); // even though listed in the 'supports' list, needs this explicit add...
     137
     138
     139            $tlabels = array(
     140                'name' => _x('Slider Group', 'Taxonomy General Name', 'show-sliders'),
     141                'singular_name' => _x('Slider Group', 'Taxonomy Singular Name', 'show-sliders'),
     142                'menu_name' => __('Slider Groups', 'show-sliders'),
     143                'all_items' => __('All Slider Groups', 'show-sliders'),
     144                'parent_item' => __('Parent Slider Group', 'show-sliders'),
     145                'parent_item_colon' => __('Parent Slider Group:', 'show-sliders'),
     146                'new_item_name' => __('New Slider Group', 'show-sliders'),
     147                'add_new_item' => __('Add New Slider Group', 'show-sliders'),
     148                'edit_item' => __('Edit Slider Group', 'show-sliders'),
     149                'update_item' => __('Update Slider Group', 'show-sliders'),
     150                'separate_items_with_commas' => __('Separate Slider Groups with commas', 'show-sliders'),
     151                'search_items' => __('Search Slider Groups', 'show-sliders'),
     152                'add_or_remove_items' => __('Add or remove Groups', 'show-sliders'),
     153                'choose_from_most_used' => __('Choose from the most used groups', 'show-sliders'),
     154            );
     155            $targs = array(
     156                'labels' => $tlabels,
     157                'hierarchical' => true,
     158                'public' => true,
     159                'show_ui' => true,
     160                'rewrite' => array('slug' => atw_slider_get_default_category_slug()),
     161                'show_admin_column' => true,
     162                'show_in_nav_menus' => true,
     163                'show_tagcloud' => true,
     164            );
     165            register_taxonomy('atw_slider_group', 'atw_slider_post', $targs);
     166        }
    163167
    164168// ========================================= >>> atw_slider_get_default_post_slug <<< ===============================
    165 /**
    166 * Get the default post slug
    167 */
    168 function atw_slider_get_default_post_slug(){
    169     $gallery_options_array = get_option( 'atw_slider_manager_options' );
    170     $default_slug = 'show-sliders'; // ??
    171     if( $gallery_options_array ){
    172         if( is_array($gallery_options_array) && array_key_exists( 'post_slug', $gallery_options_array ) ){
    173             $user_defined_slug = $gallery_options_array['post_slug'];
    174             if($user_defined_slug!=''){
    175                 $default_slug = $user_defined_slug;
    176             }
    177         }
    178     }
    179     return $default_slug;
    180 }
     169        /**
     170         * Get the default post slug
     171         */
     172        function atw_slider_get_default_post_slug()
     173        {
     174            $gallery_options_array = get_option('atw_slider_manager_options');
     175            $default_slug = 'show-sliders'; // ??
     176            if ($gallery_options_array) {
     177                if (is_array($gallery_options_array) && array_key_exists('post_slug', $gallery_options_array)) {
     178                    $user_defined_slug = $gallery_options_array['post_slug'];
     179                    if ($user_defined_slug != '') {
     180                        $default_slug = $user_defined_slug;
     181                    }
     182                }
     183            }
     184
     185            return $default_slug;
     186        }
    181187
    182188// ========================================= >>> atw_slider_get_default_category_slug <<< ===============================
    183 /**
    184 * Get the default category slug
    185 */
    186 function atw_slider_get_default_category_slug() {
    187     $gallery_options_array = get_option( 'atw_slider_manager_options' );
    188     $default_slug = 'show-sliders'; // ??
    189     if( $gallery_options_array ){
    190         if( is_array($gallery_options_array) && array_key_exists( 'category_slug', $gallery_options_array ) ){
    191             $user_defined_slug = $gallery_options_array['category_slug'];
    192             if($user_defined_slug!=''){
    193                 $default_slug = $user_defined_slug;
    194             }
    195         }
    196     }
    197     return $default_slug;
    198 }
     189        /**
     190         * Get the default category slug
     191         */
     192        function atw_slider_get_default_category_slug()
     193        {
     194            $gallery_options_array = get_option('atw_slider_manager_options');
     195            $default_slug = 'show-sliders';    // ??
     196            if ($gallery_options_array) {
     197                if (is_array($gallery_options_array) && array_key_exists('category_slug', $gallery_options_array)) {
     198                    $user_defined_slug = $gallery_options_array['category_slug'];
     199                    if ($user_defined_slug != '') {
     200                        $default_slug = $user_defined_slug;
     201                    }
     202                }
     203            }
     204
     205            return $default_slug;
     206        }
    199207
    200208
    201209// ========================================= >>> atw_slider_add_meta_box <<< ===============================
    202 /**
    203 * Adds the intro meta box container
    204 */
    205 function atw_slider_add_meta_box() {
    206 
    207    add_meta_box(
    208        'atw_slider_intro',
    209        __( 'Weaver Slider Post Introduction', 'show-sliders' ),
    210        'atw_slider_render_meta_box_intro',
    211        'atw_slider_post',
    212        'normal',
    213        'high'
    214        );
    215 }
     210        /**
     211         * Adds the intro meta box container
     212         */
     213        function atw_slider_add_meta_box()
     214        {
     215
     216            add_meta_box(
     217                'atw_slider_intro',
     218                __('Weaver Slider Post Introduction', 'show-sliders'),
     219                'atw_slider_render_meta_box_intro',
     220                'atw_slider_post',
     221                'normal',
     222                'high'
     223            );
     224        }
    216225
    217226// ========================================= >>> atw_slider_render_meta_box_intro <<< ===============================
    218 /**
    219 * Render Shortcode Info Meta Box content.
    220 *
    221 * @param WP_Post $post The post object.
    222 */
    223 function atw_slider_render_meta_box_intro( $post ) {
    224 ?>
    225 <p>
    226 <?php _e('The <em>Weaver Slider Post</em> is a custom post type that is intended to help define Weaver Slider/Slideshows.
     227        /**
     228         * Render Shortcode Info Meta Box content.
     229         *
     230         * @param WP_Post $post The post object.
     231         */
     232        function atw_slider_render_meta_box_intro($post)
     233        {
     234            ?>
     235            <p>
     236                <?php _e('The <em>Weaver Slider Post</em> is a custom post type that is intended to help define Weaver Slider/Slideshows.
    227237This post type has all the features of a standard post, but because it is a custom post type, posts created using it
    228238will <strong>not</strong> appear on any of your normal blogs, category lists, tag lists, searches, or other archive-like pages.
     
    231241You can group sliders, or create different slide shows by specifying a <em>Slider Group</em>.
    232242<br />Please see the <em>Weaver Posts/Slider</em> "Quick Start Help" tab for help on creating a slideshow.', 'show-sliders');
    233 ?>
    234 </p>
    235 <?php
    236 }
    237 
     243                ?>
     244            </p>
     245            <?php
     246        }
    238247
    239248
    240249// ========================================= >>> atw_slider_plugins_url <<< ===============================
    241250
    242 function atw_slider_plugins_url($file,$ext='') {
    243     return plugins_url($file,__FILE__) . $ext;
    244 }
     251        function atw_slider_plugins_url($file, $ext = '')
     252        {
     253            return plugins_url($file, __FILE__) . $ext;
     254        }
    245255
    246256// ========================================= >>> atw_slider_enqueue_scripts <<< ===============================
    247257
    248 function atw_slider_enqueue_scripts() { // enqueue runtime scripts
    249 
    250     // add plugin CSS here, too.
    251 
    252     // currently, there is no way to set global slider preferences - so we will put at the end always
    253     // $at_end = !atw_posts_get_slider_opt('scriptsAtTop', $slider);
    254     $at_end = true;
    255 
    256     wp_register_style('atw-flex-style-sheet', atw_slider_plugins_url('/flex/css/atwflexslider', WEAVER_SLIDER_PI_MINIFY.'.css'),null,WEAVER_SLIDER_PI_VERSION,'screen');
    257     wp_enqueue_style('atw-flex-style-sheet');
    258 
    259     if ( atw_posts_getopt( 'showLightbox')) {
    260         wp_register_style('atw-lightbox-style-sheet', atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY.'.css'),null,WEAVER_SLIDER_PI_VERSION,'screen');
    261         wp_enqueue_style('atw-lightbox-style-sheet');
    262 
    263         wp_enqueue_script('atw-lightbox-script',
    264             atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    265             WEAVER_SLIDER_PI_VERSION);//, $at_end);
    266     }
    267 
    268 
    269 
    270     /* use combined js file */
    271 
    272     /*
    273      wp_enqueue_script('atw-flex-easing',
    274         atw_slider_plugins_url('/flex/js/jquery.easing', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    275         WEAVER_SLIDER_PI_VERSION, $at_end);
    276     wp_enqueue_script('atw-flex-mousewheel',
    277         atw_slider_plugins_url('/flex/js/jquery.mousewheel', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    278         WEAVER_SLIDER_PI_VERSION, $at_end);
    279     wp_enqueue_script('atw-fitvids',
    280         atw_slider_plugins_url('/flex/js/jquery.fitvids', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    281         WEAVER_SLIDER_PI_VERSION, $at_end);
    282     */
    283 
    284     wp_enqueue_script('atw-combined-scripts',
    285         atw_slider_plugins_url('/flex/js/jquery.combined', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    286         WEAVER_SLIDER_PI_VERSION, $at_end);
    287 
    288 
    289 
    290     wp_enqueue_script('atw-flex',
    291         atw_slider_plugins_url('/flex/js/jquery.flexslider', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
    292         WEAVER_SLIDER_PI_VERSION, $at_end);
    293 
    294 
    295 
    296 
    297 }
     258        function atw_slider_enqueue_scripts()
     259        {    // enqueue runtime scripts
     260
     261            // add plugin CSS here, too.
     262
     263            // currently, there is no way to set global slider preferences - so we will put at the end always
     264            $at_end = true;
     265
     266            wp_register_style('atw-flex-style-sheet', atw_slider_plugins_url('/flex/css/atwflexslider', WEAVER_SLIDER_PI_MINIFY . '.css'), null, WEAVER_SLIDER_PI_VERSION, 'screen');
     267            wp_enqueue_style('atw-flex-style-sheet');
     268
     269            if (atw_posts_getopt('showLightbox')) {
     270                wp_register_style('atw-lightbox-style-sheet', atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY . '.css'), null, WEAVER_SLIDER_PI_VERSION, 'screen');
     271                wp_enqueue_style('atw-lightbox-style-sheet');
     272
     273                wp_enqueue_script('atw-lightbox-script',
     274                    atw_slider_plugins_url('/includes/js/featherlight/featherlight', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     275                    WEAVER_SLIDER_PI_VERSION);//, $at_end);
     276            }
     277
     278
     279            /* use combined js file */
     280
     281            /*
     282             wp_enqueue_script('atw-flex-easing',
     283                atw_slider_plugins_url('/flex/js/jquery.easing', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
     284                WEAVER_SLIDER_PI_VERSION, $at_end);
     285            wp_enqueue_script('atw-flex-mousewheel',
     286                atw_slider_plugins_url('/flex/js/jquery.mousewheel', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
     287                WEAVER_SLIDER_PI_VERSION, $at_end);
     288            wp_enqueue_script('atw-fitvids',
     289                atw_slider_plugins_url('/flex/js/jquery.fitvids', WEAVER_SLIDER_PI_MINIFY . '.js'),array('jquery'),
     290                WEAVER_SLIDER_PI_VERSION, $at_end);
     291            */
     292
     293            wp_enqueue_script('atw-combined-scripts',
     294                atw_slider_plugins_url('/flex/js/jquery.combined', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     295                WEAVER_SLIDER_PI_VERSION, $at_end);
     296
     297
     298            wp_enqueue_script('atw-flex',
     299                atw_slider_plugins_url('/flex/js/jquery.flexslider', WEAVER_SLIDER_PI_MINIFY . '.js'), array('jquery'),
     300                WEAVER_SLIDER_PI_VERSION, $at_end);
     301
     302
     303        }
    298304
    299305// ========================================= >>> atw_slider_the_footer <<< ===============================
    300306
    301 function atw_slider_the_footer() {
    302     if ( !isset($GLOBALS['atw_sliders_count']) ) {  // dequeue scripts if not used
    303         echo "<!-- No Weaver Sliders used on this page -->\n";
    304         /*
    305         wp_dequeue_script( 'atw-flex-easing' );
    306         wp_dequeue_script( 'atw-flex-mousewheel' );
    307         wp_dequeue_script( 'atw-fitvids');
     307        function atw_slider_the_footer()
     308        {
     309            if (!isset($GLOBALS['atw_sliders_count'])) {  // dequeue scripts if not used
     310                echo "<!-- No Weaver Sliders used on this page -->\n";
     311                /*
     312                wp_dequeue_script( 'atw-flex-easing' );
     313                wp_dequeue_script( 'atw-flex-mousewheel' );
     314                wp_dequeue_script( 'atw-fitvids');
     315                */
     316                wp_dequeue_script('atw-lightbox-script');
     317                wp_dequeue_script('atw-combined-scripts');
     318                wp_dequeue_script('atw-flex');
     319                if (atw_posts_getopt('showLoading')) {
     320                    echo '<script type="text/javascript">jQuery(window).ready(function(slider){jQuery(\'body\').removeClass(\'atwkloading\');});</script>', "\n";
     321                }
     322
     323                return;
     324            }
     325
     326            require_once(dirname(__FILE__) . '/includes/atw-slider-shortcode.php');
     327
     328            atw_slider_do_footer();
     329        }
     330
     331// ========================================= >>> atw_slider_setup_shortcodes <<< ===============================
     332
     333        function atw_slider_setup_shortcodes()
     334        {
     335            if (function_exists('atw_posts_getopt') && atw_posts_getopt('enable_gallery_slider')) {
     336                add_filter('post_gallery', 'atw_gallery_sc_filter', 10, 2);
     337            }
     338
     339            remove_shortcode('show_slider');
     340            add_shortcode('show_slider', 'atw_slider_sc');
     341        }
     342
     343// ========================================= >>> atw_slider_sc <<< ===============================
     344
     345
     346        function atw_slider_sc($args = '')
     347        {
     348            require_once(dirname(__FILE__) . '/includes/atw-slider-shortcode.php');
     349
     350            return atw_slider_shortcode($args);
     351        }
     352
     353// ========================================= >>> atw_gallery_sc_filter <<< ===============================
     354
     355        function atw_gallery_sc_filter($content, $args = '')
     356        {
     357            require_once(dirname(__FILE__) . '/includes/atw-slider-shortcode.php');
     358
     359            return atw_gallery_shortcode_filter($args);
     360        }
     361
     362// ========================================= >>> atw_slider_load_admin <<< ===============================
     363
     364        function atw_slider_load_admin()
     365        {
     366            require_once(dirname(__FILE__) . '/includes/atw-slider-slider-admin.php'); // NOW - load the admin stuff
     367            require_once(dirname(__FILE__) . '/includes/atw-slider-pro-admin.php'); // NOW - load the admin stuff
     368            require_once(dirname(__FILE__) . '/includes/atw-slider-help-admin.php'); // NOW - load the admin stuff
     369        }
     370
     371// ========================================= >>> atw_slider_do_slider_admin <<< ===============================
     372
     373        function atw_slider_do_slider_admin()
     374        {
     375            atw_slider_load_admin();
     376            atw_slider_slider_admin();
     377        }
     378
     379// ========================================= >>> atw_slider_gallery_admin <<< ===============================
     380
     381        function atw_slider_gallery_admin()
     382        {
     383            atw_slider_load_admin();
     384            atw_slider_gallery_admin_page();
     385        }
     386
     387        function atw_slider_pro()
     388        {
     389            // This code is leftver from the former split Pro version. These versions have been merges and are all now free.
     390            return WEAVER_SLIDER_PI_PRO;
     391        }
     392
     393// ====================================== >>> atw_slider_do_gallery <<< ======================================
     394
     395        function atw_slider_do_gallery($qargs, $slider, $ids = null)
     396        {
     397
     398            $content = "\n<!-- **** Slider Images: " . $slider . " **** -->\n";
     399            $style = '';
     400
     401
     402            if (isset($GLOBALS['atw_slider_thumbs'])) {
     403                unset($GLOBALS['atw_slider_thumbs']);
     404            }
     405            $GLOBALS['atw_slider_thumbs'] = array();        // save our thumbs...
     406
     407            /* $margin = atw_posts_get_slider_opt( 'slideMargin', $slider );
     408
     409            if ( $margin  != '') { // change default image margin?
     410                $style = ' style="margin:' . $margin . 'em;"';
     411            } */
     412
     413            $img_class = 'slide-image';
     414            if (atw_posts_get_slider_opt('addImageBorder', $slider)) {
     415                $img_class = 'slide-image-border';
     416            }
     417
     418            $lead_class = 'class="atwk-slide"';
     419            $lead_div = '<div class="slide-content ' . $img_class . '"' . $style . '>';
     420
     421            if (!$qargs || !empty($ids)) {
     422                //$content .= '<-- ********** atw_slider_get_gallery  ************** -->';
     423                $content .= atw_slider_get_gallery('', $slider, $ids, $lead_class, $lead_div);
     424            } else {
     425
     426                // get posts
     427                if (!$qargs->have_posts()) {
     428                    $content .= '<em>' . __('No posts found.', 'show-sliders') . ' ' . __('Slider Post slug: `', 'show-sliders') . $qargs->query['name'] .
     429                        __('` - Slider: `', 'show-sliders') . $slider . '`.</em>';
     430
     431                }
     432                while ($qargs->have_posts()) {
     433                    $qargs->the_post();
     434                    $post_content = get_the_content();
     435                    $gallery = atw_slider_get_gallery($post_content, $slider, null, $lead_class, $lead_div);
     436
     437                    if ($gallery != '') {
     438                        $content .= $gallery;
     439                    } else {
     440                        $img = atw_slider_get_first_post_image($post_content, $slider, $lead_class, $lead_div);
     441
     442                        if ($img != '') {
     443
     444                            $content .= $img;
     445                        }
     446                    }
     447                }
     448            }
     449
     450            echo $content;
     451        }
     452
     453// ====================================== >>> atw_slider_get_gallery <<< ======================================
     454
     455        function atw_slider_get_gallery($content, $slider, $ids = array(), $lead_class = 'class="atwk-slide"', $lead_div = '<div class="slide-content slide-image">')
     456        {
     457            // we will pass in either content, or a list of ids grabbed from the [gallery] shortcode replacement
     458
     459            $gallery = '';
     460
     461            // @@@@@@@@@@ need to use get_shortcode_regex
     462
     463            if ($content != ''
     464                && !atw_posts_get_slider_opt('noGallery', $slider)       // skip looking for [gallery]
     465                && preg_match('/\[gallery(.*?)\]/i', $content, $sc)) {  // find the first [gallery]  ************************
     466                // sc[0] = full match
     467                // sc[1] = content of [gallery];
     468                $attr = shortcode_parse_atts($sc[1]);
     469                if (empty($attr['ids']))                            // will only work with [gallery ids="1,2,3"] form of shortcode
     470                {
     471                    return '';
     472                }
     473                $gal_link = '';                                         // default is attachment
     474                if (!empty($attr['link'])) {
     475                    $gal_link = $attr['link'];
     476                }
     477
     478                $orderby = 'post__in';
     479
     480                if (!empty($attr['orderby']) && $attr['orderby'] == 'rand') {
     481                    $orderby = 'rand';
     482                }
     483
     484                $img_list = explode(',', $attr['ids']);        // build our list of attachment ids
     485
     486                $attachments = get_posts(array('include' => $img_list, 'orderby' => $orderby, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
     487
     488                foreach ($attachments as $attachment => $attachment_obj) {
     489                    $gallery .= atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
     490                }
     491
     492            } elseif ($content == '' && !empty($ids)) {        // we got passed a list of attachment images  *********************
     493                $gal_link = '';
     494
     495                $attachments = get_posts(array('include' => $ids, 'orderby' => 'post__in', 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
     496
     497                foreach ($attachments as $attachment => $attachment_obj) {
     498                    $gallery .= atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
     499                }
     500
     501
     502            } elseif ($content == '') {                        // look for first image **********************
     503
     504                $post = get_post();
     505                $id = $post ? $post->ID : 0;
     506                $gal_link = '';
     507
     508                $attachments = get_children(array(
     509                    'post_parent' => $id,
     510                    'post_status' => 'inherit',
     511                    'post_type' => 'attachment',
     512                    'post_mime_type' => 'image',
     513                    'order' => 'ASC',
     514                    'orderby' => 'menu_order ID',
     515                ));
     516
     517                foreach ($attachments as $attachment => $attachment_obj) {
     518                    $gallery .= atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // add each image
     519                }
     520
     521            }
     522
     523            return $gallery;
     524        }
     525
     526// ====================================== >>> atw_slider_get_title_class <<< ======================================
     527
     528        function atw_slider_get_title_class($slider)
     529        {
     530
     531            return atw_posts_get_slider_opt('titleOverlay', $slider) ? 'atwk-title-overlay' : 'atwk-title';
     532
     533        }
     534
     535// ====================================== >>> atw_slider_get_slide_image <<< ======================================
     536
     537        function atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $gal_link = '', $use_post_info = false)
     538        {
     539
     540            // Get an image for the slide, and its pager index image
     541
     542            $image_code = '';
     543
     544            $attachment_id = $attachment_obj->ID;
     545
     546            $img_size = atw_posts_get_slider_opt('imageSize');
     547            if ($img_size == '') {
     548                $img_size = 'full';
     549            }
     550
     551            if (function_exists('wp_get_attachment_image_srcset')) {            // WP 4.4 or later
     552                $src = wp_get_attachment_image_url($attachment_id, $img_size);
     553                $srcset = apply_filters('atw_slider_no_http', wp_get_attachment_image_srcset($attachment_id, $img_size));
     554                $sizes = wp_get_attachment_image_sizes($attachment_id, $img_size);
     555            } else {
     556                $src = $attachment_obj->guid;
     557                $srcset = '';
     558                $sizes = '';
     559            }
     560
     561            if (strpos($src, 'GDML-Mapping') !== false) {        // hack for Google Drive Media Library
     562                $full = image_downsize($attachment_id, 'thumbnail');
     563                $src = $full[0];
     564            }
     565
     566            $caption = $attachment_obj->post_excerpt;      // Media Library Caption field
     567            $description = $attachment_obj->post_content;  // Media Library description field
     568
     569            if ($use_post_info) {
     570                $title = the_title('', '', false);            // get the post title
     571            } else {
     572                $title = $attachment_obj->post_title;       // title field of image
     573            }
     574
     575            $alts = get_post_meta($attachment_id, '_wp_attachment_image_alt');
     576
     577            if (count($alts)) {
     578                $alt = $alts[0];
     579            } else {
     580                if (strlen($title)) {
     581                    $alt = $title;
     582                } else {
     583                    $alt = 'slider image';
     584                }
     585            }
     586
     587
     588            $title_div = '';
     589            if ($title && atw_posts_get_slider_opt('showTitle', $slider)) {
     590                $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . $title . '</div>';
     591            }
     592
     593            $link_begin = '';
     594            $link_end = '';                     // No links by default
     595
     596            $style = '';
     597            if (atw_posts_getopt('showLightbox')) {
     598                $style = ' style="cursor:pointer;"';
     599            }
     600
     601            if ($gal_link != 'none' && atw_posts_get_slider_opt('showLinks', $slider)) {
     602                if ($use_post_info) {
     603                    if ($gal_link != '' && atw_posts_get_slider_opt('inlineLink', $slider)) {
     604                        $attachment_link = $gal_link;
     605                    } else {
     606                        $attachment_link = get_permalink(get_the_ID());       // link is to post
     607                    }
     608                } else {
     609                    $attachment_link = home_url('/?attachment_id=' . $attachment_id);
     610                    if ($attachment_link == '' || $gal_link == 'file') {
     611                        $attachment_link = $src;
     612                    }    // just use raw link if not available
     613                }
     614
     615                $link_begin = '<a href="' . $attachment_link . '" alt="' . $alt . '">'; //  REMOVE TITLE: '" title="' . $title . '">';
     616                $link_end = '</a>';
     617            }
     618
     619            $lead = atw_slider_set_pager_img($attachment_id, $src, $lead_class, $lead_div . $title_div, $slider);
     620
     621            $srcset_code = ($srcset != '') ? ' srcset="' . $srcset . '"' : '';
     622            $sizes_code = ($sizes != '') ? ' sizes="' . $sizes . '"' : '';
     623
     624
     625            $image_code .= $lead . $link_begin .
     626                '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http', $src) . '" alt="' . $alt . '"' . $srcset_code . $sizes_code . ' />' . $link_end . "\n";
     627
     628            if ($caption && atw_posts_get_slider_opt('showCaptions', $slider)) {
     629                if ($description
     630                    && atw_posts_get_slider_opt('showDescription', $slider)
     631                    && atw_posts_get_slider_opt('captionOverlay', $slider)) {        // move it to the top if description, too
     632                    $image_code .= '<div class="atwk-caption-description">' . $caption . '</div>';
     633                } else {
     634                    if (atw_posts_get_slider_opt('captionOverlay', $slider)) {
     635                        $image_code .= '<div class="atwk-caption-overlay">' . $caption . '</div>';
     636                    } else {
     637                        $image_code .= '<div class="atwk-caption">' . $caption . '</div>';
     638                    }
     639                }
     640            }
     641
     642            if ($description && atw_posts_get_slider_opt('showDescription', $slider)) {
     643                $image_code .= '<div class="atwk-description">' . $description . '</div>';
     644            }
     645            $image_code .= "</div></div>\n";
     646
     647            return $image_code;
     648        }
     649
     650// ====================================== >>> atw_slider_get_first_post_image <<< ======================================
     651
     652        function atw_slider_get_first_post_image($content = '', $slider = '', $lead_class = 'class="atwk-slide"', $lead_div = '<div class="slide-content slide-image">')
     653        {
     654
     655            // We're getting this image from a post, so we will use the Post's Title and link to the post instead of the image.
     656
     657            $use_post_info = true;
     658
     659            // Priority 1: Featured Image
     660
     661            if (!atw_posts_get_slider_opt('fiOnlyforThumbs', $slider) && has_post_thumbnail() && !atw_posts_get_slider_opt('video', $slider)) {
     662                $attachment_obj = get_post(get_post_thumbnail_id());
     663                if (!empty($attachment_obj)) {
     664                    return atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, '', $use_post_info);
     665                }
     666            }
     667
     668            if ($content == '') {
     669                $content = get_the_content('');
     670            }
     671
     672            $content = do_shortcode(apply_filters('the_content', $content));    // get images - even those generated by a shortcode
     673
     674            // Priority 2: First image with an attachment class - e.g., wp-image-2793
     675
     676            if (preg_match('/wp-image-([\d]+)/', $content, $img_id)) {        // look for the first image with an attachment
     677                $attachment_obj = get_post($img_id[1]);
     678                if (!empty($attachment_obj)) {
     679                    $link = '';
     680                    if (atw_posts_get_slider_opt('inlineLink', $slider) && preg_match('/<a[^>]*href="([^"]*)"[^>]*>.*<\/a>/', $content, $img_link)) {
     681                        $link = $img_link[1];
     682                    }
     683
     684                    return atw_slider_get_slide_image($attachment_obj, $slider, $lead_class, $lead_div, $link, $use_post_info);
     685                }
     686            }
     687
     688            // Priority 3: any other image there
     689
     690            if (preg_match('/<img[^>]+>/i', $content, $images)) {        // grab <img>s
     691
     692                $src = '';
     693                if (preg_match('/src="([^"]*)"/', $images[0], $srcs)) {
     694                    $src = $srcs[1];
     695                } elseif (preg_match("/src='([^']*)'/", $images[0], $srcs)) {
     696                    $src = $srcs[1];
     697                }
     698
     699                $title_div = '';
     700                if (atw_posts_get_slider_opt('showTitle', $slider)) {
     701                    $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('', '', false) . '</div>';
     702                }
     703
     704                $style = '';
     705                if (atw_posts_getopt('showLightbox')) {
     706                    $style = ' style="cursor:pointer;"';
     707                }
     708
     709                $lead = atw_slider_set_pager_img(null, $src, $lead_class, $lead_div . $title_div, $slider);
     710
     711                if (atw_posts_get_slider_opt('showLinks', $slider)) {
     712                    return $lead . '<a href="' . get_permalink(get_the_ID()) .
     713                        '"><img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http', $src) . '" alt="post image" /></a></div></div>';
     714                } else {
     715                    return $lead . '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http', $src) . '" alt="post image" /></div></div>';
     716                }
     717
     718            } else { // assume post has a video or something else to show
     719                $title_div = '';
     720                if (atw_posts_get_slider_opt('showTitle', $slider)) {
     721                    $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('', '', false) . '</div>';
     722                }
     723
     724                $lead = atw_slider_set_pager_img(get_the_ID(), null, $lead_class, $lead_div . $title_div, $slider);
     725
     726                return $lead . $content . '</div></div>';
     727            }
     728
     729            return '';
     730        }
     731
     732// ====================================== >>> atw_slider_get_pager_img <<< ======================================
     733
     734        function atw_slider_set_pager_img($id, $src, $lead_class, $lead_div, $slider)
     735        {
     736
     737            // find and set the slider image
     738            //echo '<!-- @@@@@@@@@@@@@ SET PAGER: ' . $id . '/' . $lead_class . '/' . $lead_div . '/' . $slider . '/' . $who . ' -->' . "\n";
     739            $lead = "\n<div " . $lead_class . '>' . $lead_div;
     740
     741            $pager = atw_posts_get_slider_opt('pager', $slider);
     742
     743            if ($pager == 'thumbnails' || $pager == 'sliding') {          // set the pager image
     744                if ($id == null) {
     745                    $id = get_the_ID();
     746                }
     747
     748                $thumbnail = image_downsize($id, 'thumbnail');
     749
     750                //echo '<pre>'; print_r($thumbnail); echo '</pre>';
     751                $img = $thumbnail[0];
     752                if ($img == '') {     // not at the first level
     753                    if (has_post_thumbnail()) {
     754                        $attachment_obj = get_post(get_post_thumbnail_id());
     755                        if (!empty($attachment_obj)) {
     756                            $attachment_id = $attachment_obj->ID;
     757                            $thumbnail = image_downsize($attachment_id, 'thumbnail');
     758                            $img = $thumbnail[0];
     759                        }
     760                    }
     761                }
     762
     763                if ($img == '') {
     764                    $img = $src;
     765                }            // final fall back
     766
     767                if ($img == '') {
     768                    $img = plugins_url('images/image-pager.png', __FILE__);
     769                }
     770
     771
     772                if ($pager == 'thumbnails') {
     773                    $lead = "\n<div " . $lead_class . ' ' . 'data-thumb="' . $img . '">' . $lead_div;
     774                } else {
     775                    $GLOBALS['atw_slider_thumbs'][] = $img;
     776                }
     777            }
     778
     779            return $lead;               //  return the $lead
     780
     781        }
     782
     783// ====================================== >>> atw_slider_post_pager <<< ======================================
     784        function atw_slider_post_pager($slider)
     785        {
     786
     787            if (atw_posts_get_slider_opt('pager', $slider) != 'sliding') {
     788                return;
     789            }
     790
     791            $id = get_the_ID();
     792            $thumbnail = image_downsize($id, 'thumbnail');
     793
     794            $img = $thumbnail[0];
     795            if ($img == '') {     // not at the first level
     796                if (has_post_thumbnail()) {
     797                    $attachment_obj = get_post(get_post_thumbnail_id());
     798                    if (!empty($attachment_obj)) {
     799                        $attachment_id = $attachment_obj->ID;
     800                        $thumbnail = image_downsize($attachment_id, 'thumbnail');
     801                        $img = $thumbnail[0];
     802                    }
     803                }
     804            }
     805            if ($img == '') {
     806                $img = plugins_url('images/post-pager.png', __FILE__);
     807            }
     808            $GLOBALS['atw_slider_thumbs'][] = $img;
     809        }
     810
     811// ====================================== >>> atw_slider_body_classes <<< ======================================
     812
     813        function atw_slider_body_classes($classes)
     814        {
     815            $classes[] = 'atwkloading';
     816
     817            return $classes;
     818        }
     819
     820        if (function_exists('atw_posts_getopt') && atw_posts_getopt('showLoading')) {
     821            add_filter('body_class', 'atw_slider_body_classes');
     822        }
     823
     824
     825// ====================================== >>> atw_slider_kill_header_image <<< ======================================
     826
     827        /* function atw_slider_kill_header_image($args = '') {
     828            if ( !isset($GLOBALS['atw_slider_header'])) {
     829                $GLOBALS['atw_slider_header'] = true;   // only emit the code once.
     830
     831                echo atw_slider_sc(array('name' => 'header'));
     832            }
     833            return 'remove-header';
     834        }
     835
     836        add_filter( 'theme_mod_header_image' , 'atw_slider_kill_header_image');
    308837        */
    309         wp_dequeue_script( 'atw-lightbox-script' );
    310         wp_dequeue_script( 'atw-combined-scripts' );
    311         wp_dequeue_script( 'atw-flex' );
    312         if ( atw_posts_getopt('showLoading') ) {
    313             echo '<script type="text/javascript">jQuery(window).ready(function(slider){jQuery(\'body\').removeClass(\'atwkloading\');});</script>' ,"\n";
    314         }
    315         return;
    316     }
    317 
    318     require_once(dirname( __FILE__ ) . '/includes/atw-slider-shortcode.php');
    319 
    320     atw_slider_do_footer();
    321 }
    322 
    323 // ========================================= >>> atw_slider_setup_shortcodes <<< ===============================
    324 
    325 function atw_slider_setup_shortcodes() {
    326     if ( function_exists('atw_posts_getopt') && atw_posts_getopt('enable_gallery_slider') ) {
    327         add_filter( 'post_gallery', 'atw_gallery_sc_filter', 10, 2);
    328     }
    329 
    330     remove_shortcode('show_slider');
    331     add_shortcode('show_slider', 'atw_slider_sc');
    332 }
    333 
    334 // ========================================= >>> atw_slider_sc <<< ===============================
    335 
    336 
    337 function atw_slider_sc( $args = '' ) {
    338     require_once(dirname( __FILE__ ) . '/includes/atw-slider-shortcode.php');
    339     return atw_slider_shortcode( $args );
    340 }
    341 
    342 // ========================================= >>> atw_gallery_sc_filter <<< ===============================
    343 
    344 function atw_gallery_sc_filter( $content, $args = '' ) {
    345     require_once(dirname( __FILE__ ) . '/includes/atw-slider-shortcode.php');
    346     return atw_gallery_shortcode_filter( $args );
    347 }
    348 
    349 // ========================================= >>> atw_slider_load_admin <<< ===============================
    350 
    351 function atw_slider_load_admin() {
    352     require_once(dirname( __FILE__ ) . '/includes/atw-slider-slider-admin.php'); // NOW - load the admin stuff
    353     require_once(dirname( __FILE__ ) . '/includes/atw-slider-pro-admin.php'); // NOW - load the admin stuff
    354     require_once(dirname( __FILE__ ) . '/includes/atw-slider-help-admin.php'); // NOW - load the admin stuff
    355 }
    356 
    357 // ========================================= >>> atw_slider_do_slider_admin <<< ===============================
    358 
    359 function atw_slider_do_slider_admin() {
    360     atw_slider_load_admin();
    361     atw_slider_slider_admin();
    362 }
    363 
    364 // ========================================= >>> atw_slider_gallery_admin <<< ===============================
    365 
    366 function atw_slider_gallery_admin() {
    367     atw_slider_load_admin();
    368     atw_slider_gallery_admin_page();
    369 }
    370 
    371 function atw_slider_pro() {
    372     // This code is leftver from the former split Pro version. These versions have been merges and are all now free.
    373     return WEAVER_SLIDER_PI_PRO;
    374 }
    375 
    376 // ====================================== >>> atw_slider_do_gallery <<< ======================================
    377 
    378 function atw_slider_do_gallery( $qargs, $slider, $ids = null) {
    379 
    380     $content = "\n<!-- **** Slider Images: " . $slider . " **** -->\n";
    381     $style = '';
    382 
    383 
    384     if ( isset($GLOBALS['atw_slider_thumbs']))
    385         unset($GLOBALS['atw_slider_thumbs']);
    386     $GLOBALS['atw_slider_thumbs'] = array();        // save our thumbs...
    387 
    388     /* $margin = atw_posts_get_slider_opt( 'slideMargin', $slider );
    389 
    390     if ( $margin  != '') { // change default image margin?
    391         $style = ' style="margin:' . $margin . 'em;"';
    392     } */
    393 
    394     $img_class = 'slide-image';
    395     if (atw_posts_get_slider_opt( 'addImageBorder', $slider ))
    396         $img_class = 'slide-image-border';
    397 
    398     $lead_class = 'class="atwk-slide"';
    399     $lead_div = '<div class="slide-content ' . $img_class . '"' . $style . '>';
    400 
    401     if ( !$qargs || !empty( $ids ) ) {
    402         //$content .= '<-- ********** atw_slider_get_gallery  ************** -->';
    403         $content .= atw_slider_get_gallery( '' , $slider, $ids, $lead_class, $lead_div);
    404     } else {
    405 
    406         // get posts
    407         if ( !$qargs->have_posts()) {
    408             $content .= '<em>' . __('No posts found.','show-sliders') . ' ' . __('Slider Post slug: `', 'show-sliders') . $qargs->query['name'] .
    409                 __('` - Slider: `', 'show-sliders') . $slider . '`.</em>';
    410 
    411         }
    412         while ( $qargs->have_posts() ) {
    413             $qargs->the_post();
    414             $post_content =  get_the_content();
    415             $gallery = atw_slider_get_gallery( $post_content , $slider, null, $lead_class, $lead_div);
    416 
    417             if ($gallery != '' ) {
    418                 $content .= $gallery;
    419             }  else {
    420                 $img = atw_slider_get_first_post_image( $post_content, $slider, $lead_class, $lead_div );
    421 
    422                 if ( $img != '' ) {
    423 
    424                     $content .= $img ;
    425                 }
    426             }
    427         }
    428     }
    429 
    430     echo $content;
    431 }
    432 
    433 // ====================================== >>> atw_slider_get_gallery <<< ======================================
    434 
    435 function atw_slider_get_gallery( $content, $slider, $ids = array(), $lead_class='class="atwk-slide"', $lead_div='<div class="slide-content slide-image">' ) {
    436     // we will pass in either content, or a list of ids grabbed from the [gallery] shortcode replacement
    437 
    438      $gallery = '';
    439 
    440     // @@@@@@@@@@ need to use get_shortcode_regex
    441 
    442     if ( $content != ''
    443         && !atw_posts_get_slider_opt('noGallery', $slider)       // skip looking for [gallery]
    444         && preg_match( '/\[gallery(.*?)\]/i', $content, $sc)) {  // find the first [gallery]  ************************
    445         // sc[0] = full match
    446         // sc[1] = content of [gallery];
    447         $attr = shortcode_parse_atts( $sc[1] );
    448         if ( empty( $attr['ids'] ) )                            // will only work with [gallery ids="1,2,3"] form of shortcode
    449             return '';
    450         $gal_link = '';                                         // default is attachment
    451         if ( !empty( $attr['link']) )
    452             $gal_link = $attr['link'];
    453 
    454         $orderby = 'post__in';
    455 
    456         if ( !empty( $attr['orderby']) && $attr['orderby'] == 'rand' ) {
    457             $orderby = 'rand';
    458         }
    459 
    460         $img_list = explode( ',', $attr['ids']);        // build our list of attachment ids
    461 
    462         $attachments = get_posts( array('include' => $img_list, 'orderby' => $orderby,  'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image') );
    463 
    464         foreach ($attachments as $attachment => $attachment_obj) {
    465             $gallery .= atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
    466         }
    467 
    468     } else if ($content == '' && !empty($ids) ) {        // we got passed a list of attachment images  *********************
    469         $gal_link = '';
    470 
    471         $attachments = get_posts( array('include' => $ids, 'orderby' => 'post__in',  'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image') );
    472 
    473         foreach ($attachments as $attachment => $attachment_obj) {
    474             $gallery .= atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // adeach image
    475         }
    476 
    477 
    478 
    479     } else if ($content == '') {                        // look for first image **********************
    480 
    481         $post = get_post();
    482         $id = $post ? $post->ID : 0;
    483         $gal_link = '';
    484 
    485         $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment',
    486                                            'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
    487 
    488         foreach ($attachments as $attachment => $attachment_obj) {
    489             $gallery .= atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link);   // add each image
    490         }
    491 
    492     }
    493     return $gallery;
    494 }
    495 
    496 // ====================================== >>> atw_slider_get_title_class <<< ======================================
    497 
    498 function atw_slider_get_title_class($slider) {
    499 
    500     return atw_posts_get_slider_opt( 'titleOverlay', $slider) ? 'atwk-title-overlay' : 'atwk-title';
    501 
    502 }
    503 
    504 // ====================================== >>> atw_slider_get_slide_image <<< ======================================
    505 
    506 function atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $gal_link = '', $use_post_info = false) {
    507 
    508     // Get an image for the slide, and its pager index image
    509 
    510     $image_code = '';
    511 
    512     $attachment_id = $attachment_obj->ID;
    513 
    514     $img_size = atw_posts_get_slider_opt('imageSize');
    515     if ($img_size == '')
    516         $img_size = 'full';
    517 
    518     if (function_exists('wp_get_attachment_image_srcset')) {            // WP 4.4 or later
    519         $src = wp_get_attachment_image_url( $attachment_id, $img_size);
    520         $srcset = apply_filters( 'atw_slider_no_http', wp_get_attachment_image_srcset( $attachment_id, $img_size) );
    521         $sizes = wp_get_attachment_image_sizes( $attachment_id, $img_size);
    522     } else {
    523         $src = $attachment_obj->guid;
    524         $srcset = '';
    525         $sizes = '';
    526     }
    527 
    528     if (strpos($src, 'GDML-Mapping') !== false) {       // hack for Google Drive Media Library
    529         $full = image_downsize($attachment_id, 'thumbnail');
    530         $src = $full[0];
    531     }
    532 
    533     $caption = $attachment_obj->post_excerpt;      // Media Library Caption field
    534     $description = $attachment_obj->post_content;  // Media Library description field
    535 
    536     if ( $use_post_info ) {
    537         $title = the_title('','',false);            // get the post title
    538     } else {
    539         $title = $attachment_obj->post_title;       // title field of image
    540     }
    541 
    542     $alts = get_post_meta($attachment_id, '_wp_attachment_image_alt');
    543 
    544     if ( count($alts) )
    545         $alt = $alts[0];
    546     else {
    547         if (strlen($title))
    548             $alt = $title;
    549         else
    550             $alt = 'slider image';
    551     }
    552 
    553 
    554     $title_div = '';
    555     if ($title && atw_posts_get_slider_opt('showTitle',$slider) ) {
    556         $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . $title . '</div>';
    557     }
    558 
    559     $link_begin = '';
    560     $link_end = '';                     // No links by default
    561 
    562     $style='';
    563     if ( atw_posts_getopt( 'showLightbox')) {
    564         $style = ' style="cursor:pointer;"';
    565     }
    566 
    567     if ( $gal_link != 'none' && atw_posts_get_slider_opt( 'showLinks', $slider) ) {
    568         if ( $use_post_info ) {
    569             if ($gal_link != '' && atw_posts_get_slider_opt('inlineLink', $slider)) {
    570                 $attachment_link = $gal_link;
    571             } else {
    572                 $attachment_link = get_permalink( get_the_ID() );       // link is to post
    573             }
    574         } else {
    575             $attachment_link = home_url( '/?attachment_id=' . $attachment_id );
    576             if ( $attachment_link == '' || $gal_link == 'file' )
    577                 $attachment_link = $src;    // just use raw link if not available
    578         }
    579 
    580         $link_begin = '<a href="' . $attachment_link . '" alt="' . $alt .  '">'; // REMOVE TITLE: '" title="' . $title . '">';
    581         $link_end = '</a>';
    582     }
    583 
    584     $lead = atw_slider_set_pager_img( $attachment_id, $src, $lead_class, $lead_div . $title_div, $slider );
    585 
    586     $srcset_code = ($srcset != '') ? ' srcset="' . $srcset . '"' : '';
    587     $sizes_code = ($sizes != '') ? ' sizes="' . $sizes . '"' : '';
    588 
    589 
    590 
    591     $image_code .= $lead . $link_begin .
    592     '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http',$src) . '" alt="' . $alt . '"' . $srcset_code . $sizes_code . ' />' . $link_end . "\n";
    593 
    594 
    595     if ( $caption && atw_posts_get_slider_opt('showCaptions',$slider) ) {
    596         if ( $description
    597             && atw_posts_get_slider_opt('showDescription',$slider)
    598             && atw_posts_get_slider_opt( 'captionOverlay', $slider ) ) {        // move it to the top if description, too
    599             $image_code .= '<div class="atwk-caption-description">' . $caption . '</div>';
    600         } else {
    601             if ( atw_posts_get_slider_opt( 'captionOverlay', $slider ) )
    602                 $image_code .= '<div class="atwk-caption-overlay">' . $caption . '</div>';
    603             else
    604                 $image_code .= '<div class="atwk-caption">' . $caption . '</div>';
    605         }
    606     }
    607 
    608     if ( $description && atw_posts_get_slider_opt('showDescription',$slider) ) {
    609         $image_code .= '<div class="atwk-description">' . $description . '</div>';
    610     }
    611     $image_code .= "</div></div>\n";
    612     return $image_code;
    613 }
    614 
    615 // ====================================== >>> atw_slider_get_first_post_image <<< ======================================
    616 
    617 function atw_slider_get_first_post_image( $content='', $slider,  $lead_class='class="atwk-slide"', $lead_div='<div class="slide-content slide-image">' ) {
    618 
    619     // We're getting this image from a post, so we will use the Post's Title and link to the post instead of the image.
    620 
    621     $use_post_info = true;
    622 
    623     // Priority 1: Featured Image
    624 
    625     if ( !atw_posts_get_slider_opt('fiOnlyforThumbs', $slider) && has_post_thumbnail() && !atw_posts_get_slider_opt( 'video', $slider) ) {
    626         $attachment_obj = get_post( get_post_thumbnail_id( ) );
    627         if (!empty( $attachment_obj ))
    628             return atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, '', $use_post_info);
    629     }
    630 
    631     if ($content == '')
    632         $content = get_the_content('');
    633 
    634     $content = do_shortcode(apply_filters( 'the_content', $content ));    // get images - even those generated by a shortcode
    635 
    636     // Priority 2: First image with an attachment class - e.g., wp-image-2793
    637 
    638     if ( preg_match('/wp-image-([\d]+)/', $content, $img_id) ) {        // look for the first image with an attachment
    639         $attachment_obj = get_post( $img_id[1] );
    640         if (!empty( $attachment_obj )) {
    641             $link = '';
    642             if ( atw_posts_get_slider_opt('inlineLink', $slider) && preg_match('/<a[^>]*href="([^"]*)"[^>]*>.*<\/a>/', $content, $img_link) )
    643                 $link = $img_link[1];
    644 
    645             return atw_slider_get_slide_image( $attachment_obj, $slider, $lead_class, $lead_div, $link, $use_post_info);
    646         }
    647     }
    648 
    649     // Priority 3: any other image there
    650 
    651     if (preg_match('/<img[^>]+>/i',$content, $images)) {        // grab <img>s
    652 
    653         $src = '';
    654         if (preg_match('/src="([^"]*)"/', $images[0], $srcs)) {
    655             $src = $srcs[1];
    656         } else if (preg_match("/src='([^']*)'/", $images[0], $srcs)) {
    657             $src = $srcs[1];
    658         }
    659 
    660         $title_div = '';
    661         if ( atw_posts_get_slider_opt('showTitle',$slider) ) {
    662             $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('','',false) . '</div>';
    663         }
    664 
    665         $style='';
    666         if ( atw_posts_getopt( 'showLightbox')) {
    667             $style = ' style="cursor:pointer;"';
    668         }
    669 
    670         $lead = atw_slider_set_pager_img( null, $src, $lead_class, $lead_div . $title_div, $slider );
    671 
    672         if ( atw_posts_get_slider_opt( 'showLinks', $slider)) {
    673             return $lead . '<a href="' . get_permalink( get_the_ID() ) .
    674                     '"><img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http',$src) . '" alt="post image" /></a></div></div>';
    675         }
    676         else {
    677             return $lead . '<img' . $style . ' class="atw-gallery-img" src="' . apply_filters('atw_slider_no_http',$src) . '" alt="post image" /></div></div>';
    678         }
    679 
    680     } else  { // assume post has a video or something else to show
    681         $title_div = '';
    682         if ( atw_posts_get_slider_opt('showTitle',$slider) ) {
    683             $title_div = '<div class="' . atw_slider_get_title_class($slider) . '">' . the_title('','',false) . '</div>';
    684         }
    685 
    686         $lead = atw_slider_set_pager_img( get_the_ID(), null, $lead_class, $lead_div . $title_div, $slider );
    687 
    688         return $lead . $content . '</div></div>';
    689     }
    690     return '';
    691 }
    692 
    693 // ====================================== >>> atw_slider_get_pager_img <<< ======================================
    694 
    695 function atw_slider_set_pager_img( $id, $src, $lead_class, $lead_div, $slider ) {
    696 
    697     // find and set the slider image
    698     //echo '<!-- @@@@@@@@@@@@@ SET PAGER: ' . $id . '/' . $lead_class . '/' . $lead_div . '/' . $slider . '/' . $who . ' -->' . "\n";
    699     $lead = "\n<div ". $lead_class . '>'. $lead_div;
    700 
    701     $pager = atw_posts_get_slider_opt( 'pager', $slider );
    702 
    703     if ( $pager == 'thumbnails' || $pager == 'sliding' ) {          // set the pager image
    704         if ( $id == null )
    705             $id = get_the_ID();
    706 
    707         $thumbnail = image_downsize($id, 'thumbnail');
    708 
    709         //echo '<pre>'; print_r($thumbnail); echo '</pre>';
    710         $img = $thumbnail[0];
    711         if ( $img == '' ) {     // not at the first level
    712             if (has_post_thumbnail()) {
    713                 $attachment_obj = get_post( get_post_thumbnail_id( ) );
    714                 if (!empty( $attachment_obj )) {
    715                     $attachment_id = $attachment_obj->ID;
    716                     $thumbnail = image_downsize($attachment_id, 'thumbnail');
    717                     $img = $thumbnail[0];
    718                 }
    719             }
    720         }
    721 
    722         if ($img == '')
    723             $img = $src;            // final fall back
    724 
    725         if ( $img == '' )
    726             $img = plugins_url('images/image-pager.png', __FILE__);
    727 
    728 
    729         if ( $pager == 'thumbnails' )
    730             $lead = "\n<div " . $lead_class . ' ' . 'data-thumb="' . $img . '">' . $lead_div;
    731         else
    732             $GLOBALS['atw_slider_thumbs'][] = $img;
    733     }
    734     return $lead;               //  return the $lead
    735 
    736 }
    737 
    738 // ====================================== >>> atw_slider_post_pager <<< ======================================
    739 function atw_slider_post_pager($slider) {
    740 
    741     if ( atw_posts_get_slider_opt( 'pager', $slider ) != 'sliding')
    742         return;
    743 
    744     $id = get_the_ID();
    745     $thumbnail = image_downsize($id, 'thumbnail');
    746 
    747     $img = $thumbnail[0];
    748     if ( $img == '' ) {     // not at the first level
    749         if (has_post_thumbnail()) {
    750             $attachment_obj = get_post( get_post_thumbnail_id( ) );
    751             if (!empty( $attachment_obj )) {
    752                 $attachment_id = $attachment_obj->ID;
    753                 $thumbnail = image_downsize($attachment_id, 'thumbnail');
    754                 $img = $thumbnail[0];
    755             }
    756         }
    757     }
    758     if ( $img == '' )
    759         $img = plugins_url('images/post-pager.png', __FILE__);
    760     $GLOBALS['atw_slider_thumbs'][] = $img;
    761 }
    762 
    763 // ====================================== >>> atw_slider_body_classes <<< ======================================
    764 
    765 function atw_slider_body_classes( $classes ) {
    766     $classes[] = 'atwkloading';
    767     return $classes;
    768 }
    769 
    770 if ( function_exists('atw_posts_getopt') && atw_posts_getopt('showLoading')) {
    771         add_filter( 'body_class', 'atw_slider_body_classes' );
    772     }
    773 
    774 
    775 
    776 
    777 // ====================================== >>> atw_slider_kill_header_image <<< ======================================
    778 
    779 /* function atw_slider_kill_header_image($args = '') {
    780     if ( !isset($GLOBALS['atw_slider_header'])) {
    781         $GLOBALS['atw_slider_header'] = true;   // only emit the code once.
    782 
    783         echo atw_slider_sc(array('name' => 'header'));
    784     }
    785     return 'remove-header';
    786 }
    787 
    788 add_filter( 'theme_mod_header_image' , 'atw_slider_kill_header_image');
    789 */
    790 
    791 } else {    // !!!! Show Posts NOT installed !!!!!
    792 
    793     add_action('admin_menu', 'atw_slider_admin_menu');  // let them know they need show_posts
     838
     839    } else {    // !!!! Show Posts NOT installed !!!!!
     840
     841        add_action('admin_menu', 'atw_slider_admin_menu');  // let them know they need show_posts
    794842
    795843// ========================================= >>> atw_slider_admin_menu <<< ===============================
    796844
    797 function atw_slider_admin_menu() {
    798        $page = add_menu_page(
    799       'Weaver Show Sliders by WeaverTheme.com','Weaver Slider','install_plugins',
    800       'atw_slider_page', 'atw_slider_admin','',62);
    801 
    802     /* using registered $page handle to hook stylesheet loading for this admin page */
    803 
    804     add_action('admin_print_styles-'.$page, 'atw_slider_admin_scripts');
    805 }
     845        function atw_slider_admin_menu()
     846        {
     847            $page = add_menu_page(
     848                'Weaver Show Sliders by WeaverTheme.com', 'Weaver Slider', 'install_plugins',
     849                'atw_slider_page', 'atw_slider_admin', '', 62);
     850
     851            /* using registered $page handle to hook stylesheet loading for this admin page */
     852
     853            add_action('admin_print_styles-' . $page, 'atw_slider_admin_scripts');
     854        }
    806855
    807856// ========================================= >>> atw_slider_admin <<< ===============================
    808857
    809 function atw_slider_admin() {
    810     if ( !function_exists('atw_showposts_installed')) {
    811 
    812         echo '<h2 style="text-align:center;">You must first install and activate the Weaver Show Posts plugin!</h2>';
    813         if ( is_multisite() ) {
    814             echo '<h2 style="color:red;">IMPORTANT! This is a WP MultiSite Installation. You MUST follow these special instructions:</h2>';
    815             echo '<p>For MultiSite sites, you MUST disable Weaver Show Sliders first. Then install and activate Weaver Show Posts. After that, you
     858        function atw_slider_admin()
     859        {
     860            if (!function_exists('atw_showposts_installed')) {
     861
     862                echo '<h2 style="text-align:center;">You must first install and activate the Weaver Show Posts plugin!</h2>';
     863                if (is_multisite()) {
     864                    echo '<h2 style="color:red;">IMPORTANT! This is a WP MultiSite Installation. You MUST follow these special instructions:</h2>';
     865                    echo '<p>For MultiSite sites, you MUST disable Weaver Show Sliders first. Then install and activate Weaver Show Posts. After that, you
    816866            can activate Weaver Show Sliders. Both plugins must be activated the same way - either both network activated, or both per site activation.
    817867            After in initial installation, sites with Per Site Activation can activate in any order.</p>';
    818         }
    819 
     868                }
     869
     870            }
     871        }
     872
     873// ========================================= >>> atw_slider_admin_scripts <<< ===============================
     874
     875        function atw_slider_admin_scripts()
     876        {
     877            /* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */
     878            //wp_enqueue_style('atw_sw_Stylesheet', atw_slider_plugins_url('/atw-admin-style', WEAVER_SLIDER_PI_MINIFY . '.css'), array(), WEAVER_SLIDER_PI_VERSION);
     879
     880        }
     881
     882        if (current_user_can('activate_plugins')) {
     883            require_once((dirname(__FILE__) . '/includes/atw-activate-show-posts.php'));
     884        }
     885
     886    }   // end Show Posts not installed
     887
     888    function atw_slider_no_http_filter($src)
     889    {
     890        return str_replace(array('http://', 'https://'), '//', $src);
    820891    }
    821 }
    822 
    823 // ========================================= >>> atw_slider_admin_scripts <<< ===============================
    824 
    825 function atw_slider_admin_scripts() {
    826     /* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */
    827     //wp_enqueue_style('atw_sw_Stylesheet', atw_slider_plugins_url('/atw-admin-style', WEAVER_SLIDER_PI_MINIFY . '.css'), array(), WEAVER_SLIDER_PI_VERSION);
    828 
    829 }
    830 
    831 if (current_user_can('activate_plugins')) {
    832     require_once((dirname( __FILE__ ) . '/includes/atw-activate-show-posts.php'));
    833 }
    834 
    835 }   // end Show Posts not installed
    836 
    837 function atw_slider_no_http_filter($src) {
    838     return str_replace(array('http://', 'https://'), '//', $src);
    839 }
    840 add_filter('atw_slider_no_http', 'atw_slider_no_http_filter');
     892
     893    add_filter('atw_slider_no_http', 'atw_slider_no_http_filter');
    841894}   // end of plugins_loaded action
    842895
  • show-sliders/trunk/readme.txt

    r2428756 r2853103  
    99Tags: slider, slide show, recent posts, responsive, responsive slider, [gallery], gallery slide show, slider options, slider shortcode, FlexSlider
    1010Requires at least: 5.4
    11 Tested up to: 5.6
    12 Stable tag: 1.5.1
     11Tested up to: 6.1
     12Stable tag: 1.6
    1313
    1414== Description ==
     
    9191== Copyrights ==
    9292
    93 * Weaver Show Sliders is Copyright (c) 2014, 2105 by Bruce E. Wampler. It is licensed under GPL Version 2.
     93* Weaver Show Sliders is Copyright (c) 2014-2023 by Bruce E. Wampler. It is licensed under GPL Version 2.
    9494* FlexSlider is licensed under GPL Version 2.
    9595* jQuery Easing is licensed under BSD
     
    9898
    9999== Changelog ==
     100= 1.6 =
     101* WP 6.1 version update
     102
     103= 1.5.2 =
     104* WP 5.7 version update
     105* PHP 8 compatibility
     106
    100107= 1.5.1 =
    101108* WP 5.6 update
Note: See TracChangeset for help on using the changeset viewer.