Settings Page for more options. Follow me on Twitter for plugin updates and news. Author: Jacob Dubail Author URI: http://jacobdubail.com Version: 0.6.4.2 */ // URL to the /js directory define( 'JTD_INSERTJS', plugin_dir_url( __FILE__ ) . 'js' ); define( 'JTD_INSERTCSS', plugin_dir_url( __FILE__ ) . 'css' ); if ( is_admin() ) { include('insert.php'); } // add script to the front end add_action( 'template_redirect', 'jtd_insertjs_front' ); function jtd_insertjs_front() { $options = get_option( 'jtd_anything_slides_options' ); $video = $options['video']; $easing = $options['easing']; wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery.anythingslider', JTD_INSERTJS . '/jquery.anythingslider.min.js', array( 'jquery' ), '1.7.8' ); // If video is selected, load the video extension if ( $video !== 'false' ) { wp_enqueue_script( 'jquery.anythingslider.video', JTD_INSERTJS . '/jquery.anythingslider.video.min.js', array( 'jquery' ), '1.7.8' ); wp_enqueue_script( 'swfobject', JTD_INSERTJS . '/swfobject.js', '', '2.2' ); } // If advanced Easing is required, load the easing library if ( $easing !== 'swing' && $easing !== 'linear' ) { wp_enqueue_script( 'jquery.easing', JTD_INSERTJS . '/jquery.easing.1.2.js', array( 'jquery' ), '1.2' ); } } // add style to the front end add_action( 'wp_print_styles', 'jtd_insertcss_front' ); function jtd_insertcss_front() { //wp_register_style( 'anythingslider', JTD_INSERTCSS . '/anythingslider.css', '', '1.5.10' ); // Check for custom theme css - load it if it exists if ( file_exists( get_stylesheet_directory()."/anythingslider.css" ) ) { wp_register_style( 'anythingslider-base', get_stylesheet_directory_uri() . '/anythingslider.css' ); } elseif ( file_exists( get_template_directory()."/anythingslider.css" ) ) { wp_register_style( 'anythingslider-base', get_template_directory_uri() . '/anythingslider.css' ); } else { wp_register_style( 'anythingslider-base', JTD_INSERTCSS . '/anythingslider.css' ); } wp_enqueue_style( 'anythingslider-base' ); $options = get_option( 'jtd_anything_slides_options' ); $theme = $options['theme']; wp_register_style( 'anythingslider-theme', JTD_INSERTCSS . '/theme-' . $theme . '.css', '', '1.7.8' ); if ( $theme != '' && $theme != 'default' ) { wp_enqueue_style( 'anythingslider-theme' ); } } // Add theme support for Post Thumbnails add_theme_support( 'post-thumbnails' ); if ( function_exists( 'add_image_size' ) ) { add_image_size( 'jtd_anythingslide_thumb', 960, 280, true ); } // register the post type add_action( 'init', 'jtd_anythingslider_register_cpt' ); function jtd_anythingslider_register_cpt() { $slide_args = array ( 'public' => true, 'query_var' => 'anything_slides', 'supports' => array( 'title', 'editor', 'custom-fields', 'page-attributes' ), 'labels' => array( 'name' => 'Slides', 'singular_name' => 'Slide', 'add_new' => 'Add New Slide', 'add_new_item' => 'Add New Slide', 'edit_item' => 'Edit Slide', 'new_item' => 'New Slide', 'view_item' => 'View Slide', 'search_items' => 'Search Slides', 'not_found' => 'No Slides Found' ) ); register_post_type( 'anything_slides', $slide_args ); } // register custom taxonomy for slide categorization add_action( 'init', 'jtd_anythingslider_register_tax' ); function jtd_anythingslider_register_tax() { $tax_args = array( 'hierarchical' => true, 'query_var' => 'slide_cat', 'labels' => array( 'name' => 'Slide Categories', 'edit_item' => 'Edit Category', 'add_new_item' => 'Add New Slide Category', 'all_items' => 'All Slide Categories' ) ); register_taxonomy( 'slide_cat', array( 'anything_slides' ), $tax_args ); } // Add meta box on Slide page for Navigation Formatting add_action( 'add_meta_boxes', 'jtd_anythingslider_create_metabox' ); function jtd_anythingslider_create_metabox() { add_meta_box( 'jtd_anythingslider_advanced', 'Advanced Slide Functions', 'jtd_anythingslider_display_advanced_metabox', 'anything_slides', 'normal', 'high' ); } function jtd_anythingslider_display_advanced_metabox( $post ) { // get the meta value if it exists $anything_slides_nav_format = get_post_meta( $post->ID, '_jtd_anything_slides_nav_format', true ); echo "
Customize the text used for the slide navigation
"; } add_action( 'save_post', 'jtd_anythingslider_save_metabox' ); function jtd_anythingslider_save_metabox( $post_id ) { if ( isset( $_POST['_jtd_anything_slides_nav_format'] ) ) { update_post_meta( $post_id, '_jtd_anything_slides_nav_format', strip_tags( $_POST['_jtd_anything_slides_nav_format'] ) ); } } // register shortcode for retrieving slides add_action( 'init', 'jtd_anythingslider_register_shortcodes' ); function jtd_anythingslider_register_shortcodes() { add_shortcode( 'anything_slides', 'jtd_anything_slides_shortcode' ); } function jtd_anything_slides_shortcode( $attr ) { // setup slide query $loop = new WP_Query( array( 'post_type' => 'anything_slides', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'slide_cat' => $attr['cat'] ) ); $options = get_option( 'jtd_anything_slides_options' ); // Appearance $width = ( isset( $attr['width'] ) ) ? $attr['width'] : ( ( $options['width'] ) ? $options['width'] : 570 ); $height = ( isset( $attr['height'] ) ) ? $attr['height'] : ( ( $options['height'] ) ? $options['height'] : 300 ); $theme = ( isset( $options['theme'] ) ) ? $options['theme'] : 'default'; $expand = ( isset( $attr['expand'] ) ) ? $attr['expand'] : ( ( $options['expand'] ) ? $options['expand'] : 'false' ); $resizeContents = ( isset( $attr['resizeContents'] ) ) ? $attr['resizeContents'] : ( ( $options['resizeContents'] ) ? $options['resizeContents'] : 'true' ); $showMultiple = ( isset( $attr['showMultiple'] ) ) ? $attr['showMultiple'] : ( ( $options['showMultiple'] ) ? $options['showMultiple'] : 'false' ); $easing = ( isset( $options['easing'] ) ) ? $options['easing'] : 'swing'; $buildArrows = ( isset( $options['arrows'] ) ) ? $options['arrows'] : 'true'; $buildNav = ( isset( $options['navigation'] ) ) ? $options['navigation'] : 'true'; $startStopped = ( isset( $options['startStop'] ) ) ? $options['startStop'] : 'false'; $toggleArrows = ( isset( $options['toggleArrows'] ) ) ? $options['toggleArrows'] : 'false'; $toggleControls = ( isset( $options['toggleControls'] ) ) ? $options['toggleControls'] : 'false'; $startText = ( isset( $options['startText'] ) ) ? $options['startText'] : 'Start'; $stopText = ( isset( $options['stopText'] ) ) ? $options['stopText'] : 'Stop'; $forwardText = ( isset( $options['forwardText'] ) ) ? $options['forwardText'] : '»'; $backText = ( isset( $options['backText'] ) ) ? $options['backText'] : '«'; $tooltipClass = ( isset( $attr['tooltipClass'] ) ) ? $attr['tooltipClass'] : ( ( $options['tooltipClass'] ) ? $options['tooltipClass'] : 'tooltip' ); // Function Settings $enableArrows = ( isset( $options['enableArrows'] ) ) ? $options['enableArrows'] : 'true'; $enableNav = ( isset( $options['enableNav'] ) ) ? $options['enableNav'] : 'true'; $enablePlay = ( isset( $options['enablePlay'] ) ) ? $options['enablePlay'] : 'true'; $enableKeyboard = ( isset( $options['keyboard'] ) ) ? $options['keyboard'] : 'true'; // Navigation Settings $startPanel = ( isset( $options['startPanel'] ) ) ? $options['startPanel'] : '1'; $changeBy = ( isset( $options['changeBy'] ) ) ? $options['changeBy'] : '1'; $hashTags = ( isset( $options['hashTags'] ) ) ? $options['hashTags'] : 'false'; $infiniteSlides = ( isset( $options['infinite'] ) ) ? $options['infinite'] : 'true'; // Slideshow options $autoPlay = ( isset( $options['autoPlay'] ) ) ? $options['autoPlay'] : 'true'; $autoPlayLocked = ( isset( $options['autoPlayLocked'] ) ) ? $options['autoPlayLocked'] : 'false'; $autoPlayDelayed = ( isset( $options['autoPlayDelayed'] ) ) ? $options['autoPlayDelayed'] : 'false'; $pauseOnHover = ( isset( $options['pauseOnHover'] ) ) ? $options['pauseOnHover'] : 'true'; $stopAtEnd = ( isset( $options['stopAtEnd'] ) ) ? $options['stopAtEnd'] : 'false'; $playRtl = ( isset( $options['playRtl'] ) ) ? $options['playRtl'] : 'false'; // Timing Settings $delay = ( isset( $attr['delay'] ) ) ? $attr['delay'] : ( ( $options['delay'] ) ? $options['delay'] : 5000 ); $resumeDelay = ( isset( $attr['resume'] ) ) ? $attr['resume'] : ( ( $options['resume'] ) ? $options['resume'] : 9000 ); $animation = ( isset( $attr['animation'] ) ) ? $attr['animation'] : ( ( $options['animation'] ) ? $options['animation'] : 800 ); // Interactivity Settings $clickForwardArrow = ( isset( $options['clickForwardArrow'] ) ) ? $options['clickForwardArrow'] : 'click'; $clickBackArrow = ( isset( $options['clickBackArrow'] ) ) ? $options['clickBackArrow'] : 'click'; $clickControls = ( isset( $options['clickControls'] ) ) ? $options['clickControls'] : 'click'; $clickSlideshow = ( isset( $options['clickSlideshow'] ) ) ? $options['clickSlideshow'] : 'click focusin'; // Video $video = ( isset( $options['video'] ) ) ? $options['video'] : 'false'; $addWmode = ( isset( $options['wmode'] ) ) ? $options['wmode'] : 'NULL'; // do we have results if ( $loop->have_posts() ) { $i = 0; $rand = rand(5, 500); $output = ""; // output the jquery plugin code $output .= " "; } return $output; } // Add Admin Options Page add_action( 'admin_menu', 'jtd_anything_slides_create_settings_menu' ); function jtd_anything_slides_create_settings_menu() { $settings = add_options_page( 'Anything Slider Settings', 'AnythingSlider', 'manage_options', 'anything_slider', 'jtd_anything_slides_settingspage' ); // Add admin CSS add_action( 'load-'.$settings, 'jtd_anything_slides_insert_admin_css' ); } function jtd_anything_slides_insert_admin_css() { wp_enqueue_style( 'anything_slider_admin', JTD_INSERTCSS . '/admin.css' ); wp_enqueue_script( 'anything_slider_admin', JTD_INSERTJS . '/admin.js' ); } function jtd_anything_slides_settingspage() { ?>

Anything Slider for WordPress

', 'jtd_anything_slides_option_appearance_text', 'anything_slider_appearance' ); add_settings_section( 'jtd_anything_slides_option_section', '

Function Settings

', 'jtd_anything_slides_option_function_text', 'anything_slider_function' ); add_settings_section( 'jtd_anything_slides_option_section', '

Navigation Settings

', 'jtd_anything_slides_option_navigation_text', 'anything_slider_navigation' ); add_settings_section( 'jtd_anything_slides_option_section', '

Slideshow Options

', 'jtd_anything_slides_option_options_text', 'anything_slider_options' ); add_settings_section( 'jtd_anything_slides_option_section', '

Timing Options

', 'jtd_anything_slides_option_timing_text', 'anything_slider_timing' ); add_settings_section( 'jtd_anything_slides_option_section', '

Interactivity Settings (advanced and beta)

', 'jtd_anything_slides_option_interactivity_text', 'anything_slider_interactivity' ); add_settings_section( 'jtd_anything_slides_option_section', '

Video Settings

', 'jtd_anything_slides_option_video_text', 'anything_slider_video' ); // Register each of the fields that will be displayed on the options page -> set a callback for each setting to spit out the actual form field // Appearance Settings add_settings_field( 'jtd_anything_slides-width', '', 'jtd_anything_slides_width_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-height', '', 'jtd_anything_slides_height_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-theme', '', 'jtd_anything_slides_theme_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-expand', '', 'jtd_anything_slides_expand_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-resizeContents','', 'jtd_anything_slides_resize_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-showMultiple', '', 'jtd_anything_slides_showMultiple_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-easing', '', 'jtd_anything_slides_easing_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-arrows', '', 'jtd_anything_slides_arrows_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-navigation', '', 'jtd_anything_slides_navigation_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-startStop', '', 'jtd_anything_slides_startStop_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-toggleArrows', '', 'jtd_anything_slides_toggleArrows_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-toggleContr', '', 'jtd_anything_slides_toggleContr_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-startText', '', 'jtd_anything_slides_startText_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-stopText', '', 'jtd_anything_slides_stopText_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-forwardText', '', 'jtd_anything_slides_forwardText_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-backText', '', 'jtd_anything_slides_backText_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-tooltipClass', '', 'jtd_anything_slides_tooltipClass_callback', 'anything_slider_appearance', 'jtd_anything_slides_option_section' ); /* // ** Appearance ** theme : "default", // Theme name expand : false, // If true, the entire slider will expand to fit the parent element resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport showMultiple : false, // Set this value to a number and it will show that many slides at once easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI buildArrows : true, // If true, builds the forwards and backwards buttons buildNavigation : true, // If true, builds a list of anchor links to link to each panel buildStartStop : true, // ** If true, builds the start/stop button toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times startText : "Start", // Start button text stopText : "Stop", // Stop button text forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) */ // Function Settings add_settings_field( 'jtd_anything_slides-enableArrows', '', 'jtd_anything_slides_enableArrows_callback', 'anything_slider_function', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-enableNav', '', 'jtd_anything_slides_enableNav_callback', 'anything_slider_function', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-enablePlay', '', 'jtd_anything_slides_enablePlay_callback', 'anything_slider_function', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-keyboard', '', 'jtd_anything_slides_keyboard_callback', 'anything_slider_function', 'jtd_anything_slides_option_section' ); /* // Function enableArrows : true, // if false, arrows will be visible, but not clickable. enableNavigation : true, // if false, navigation links will still be visible, but not clickable. enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay" enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider. */ // Navigation Settings add_settings_field( 'jtd_anything_slides-startPanel', '', 'jtd_anything_slides_startPanel_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-changeBy', '', 'jtd_anything_slides_changeBy_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-hashTags', '', 'jtd_anything_slides_hashTags_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-infinite', '', 'jtd_anything_slides_infinite_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); // add_settings_field( 'jtd_anything_slides-navFormatter', '', 'jtd_anything_slides_navFormatter_callback', 'anything_slider_navigation', 'jtd_anything_slides_option_section' ); /* // Navigation startPanel : 1, // This sets the initial panel changeBy : 1, // Amount to go forward or back when changing panels. hashTags : true, // Should links change the hashtag in the URL? infiniteSlides : true, // if false, the slider will not wrap & not clone any panels navigationFormatter : null, // Details at the top of the file on this use (advanced use) */ // Slideshow Options add_settings_field( 'jtd_anything_slides-autoPlay', '', 'jtd_anything_slides_autoPlay_callback', 'anything_slider_options', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-autoPlayLocked', '', 'jtd_anything_slides_autoPlayLocked_callback', 'anything_slider_options', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-autoPlayDelayed', '', 'jtd_anything_slides_autoPlayDelayed_callback', 'anything_slider_options', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-pauseOnHover', '', 'jtd_anything_slides_pauseOnHover_callback', 'anything_slider_options', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-stopAtEnd', '', 'jtd_anything_slides_stopAtEnd_callback', 'anything_slider_options', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-playRtl', '', 'jtd_anything_slides_playRtl_callback', 'anything_slider_options', 'jtd_anything_slides_option_section' ); /* // Slideshow options autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option autoPlayLocked : false, // If true, user changing slides will not stop the slideshow autoPlayDelayed : false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. playRtl : false, // If true, the slideshow will move right-to-left */ // Timing Options add_settings_field( 'jtd_anything_slides-delay', '', 'jtd_anything_slides_delay_callback', 'anything_slider_timing', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-resume', '', 'jtd_anything_slides_resume_callback', 'anything_slider_timing', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-animation', '', 'jtd_anything_slides_animation_callback', 'anything_slider_timing', 'jtd_anything_slides_option_section' ); /* // Times delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). animationTime : 600, // How long the slideshow transition takes (in milliseconds) */ // Interactivity Options -- Very Beta add_settings_field( 'jtd_anything_slides-clickForwardArrow', '', 'jtd_anything_slides_clickForwardArrow_callback', 'anything_slider_interactivity', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-clickBackArrow', '', 'jtd_anything_slides_clickBackArrow_callback', 'anything_slider_interactivity', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-clickControls', '', 'jtd_anything_slides_clickControls_callback', 'anything_slider_interactivity', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-clickSlideshow', '', 'jtd_anything_slides_clickSlideshow_callback', 'anything_slider_interactivity', 'jtd_anything_slides_option_section' ); /* // Interactivity clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight") clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft") clickControls : "click focusin", // Events used to activate navigation control functionality clickSlideshow : "click", // Event used to activate slideshow play/stop button */ // Video Options // add_settings_field( 'jtd_anything_slides-resumeOnVideo', '','jtd_anything_slides_resumeOnVideo_callback', 'anything_slider', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-video', '', 'jtd_anything_slides_video_callback', 'anything_slider_video', 'jtd_anything_slides_option_section' ); add_settings_field( 'jtd_anything_slides-wmode', '', 'jtd_anything_slides_wmode_callback', 'anything_slider_video', 'jtd_anything_slides_option_section' ); /* // Video resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension */ } // Draw the section header function jtd_anything_slides_option_appearance_text() { echo '
'; } function jtd_anything_slides_option_function_text() { echo '
'; } function jtd_anything_slides_option_navigation_text() { echo '
'; } function jtd_anything_slides_option_options_text() { echo '
'; } function jtd_anything_slides_option_timing_text() { echo '
'; } function jtd_anything_slides_option_interactivity_text() { echo '
'; } function jtd_anything_slides_option_video_text() { echo '
'; } // Display and fill the form field /* ******************** Appearance Settings ******************** */ function jtd_anything_slides_width_callback() { $options = get_option( 'jtd_anything_slides_options' ); $width = $options['width']; echo ""; echo "Override the default CSS width"; } function jtd_anything_slides_height_callback() { $options = get_option( 'jtd_anything_slides_options' ); $height = $options['height']; echo ""; echo "Override the default CSS height"; } function jtd_anything_slides_theme_callback() { $options = get_option( 'jtd_anything_slides_options' ); $theme = $options['theme']; echo ""; echo "Select a theme, or leave blank for default"; } function jtd_anything_slides_expand_callback() { $options = get_option( 'jtd_anything_slides_options' ); $expand = $options['expand']; echo "
"; echo ""; echo "If yes, the entire slider will expand to fit the parent element"; } function jtd_anything_slides_resize_callback() { $options = get_option( 'jtd_anything_slides_options' ); $resize = $options['resizeContents']; echo "
"; echo ""; echo "If yes, solitary images/objects in the panel will expand to fit the viewport"; } function jtd_anything_slides_showMultiple_callback() { $options = get_option( 'jtd_anything_slides_options' ); $multiple = $options['showMultiple']; echo ""; echo "Set this value to a number and it will show that many slides at once"; } function jtd_anything_slides_easing_callback() { $options = get_option( 'jtd_anything_slides_options' ); $easing = $options['easing']; echo ""; echo "Anything other than 'linear' or 'swing' requires the easing plugin or jQuery UI"; } function jtd_anything_slides_arrows_callback() { $options = get_option( 'jtd_anything_slides_options' ); $arrows = $options['arrows']; echo "
"; echo ""; echo "If yes, builds the forwards and backwards buttons"; } function jtd_anything_slides_navigation_callback() { $options = get_option( 'jtd_anything_slides_options' ); $navigation = $options['navigation']; echo "
"; echo ""; echo "If yes, builds a list of anchor links to link to each panel"; } function jtd_anything_slides_startStop_callback() { $options = get_option( 'jtd_anything_slides_options' ); $startStop = $options['startStop']; echo "
"; echo ""; echo "If yes, builds the start/stop button"; } function jtd_anything_slides_toggleArrows_callback() { $options = get_option( 'jtd_anything_slides_options' ); $toggleArrows = $options['toggleArrows']; echo "
"; echo ""; echo "if yes, side navigation arrows will slide out on hovering & hide @ other times"; } function jtd_anything_slides_toggleContr_callback() { $options = get_option( 'jtd_anything_slides_options' ); $toggleContr = $options['toggleContr']; echo "
"; echo ""; echo "if yes, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times"; } function jtd_anything_slides_startText_callback() { $options = get_option( 'jtd_anything_slides_options' ); $startText = $options['startText']; echo ""; echo "Start button text"; } function jtd_anything_slides_stopText_callback() { $options = get_option( 'jtd_anything_slides_options' ); $stopText = $options['stopText']; echo ""; echo "Stop button text"; } function jtd_anything_slides_forwardText_callback() { $options = get_option( 'jtd_anything_slides_options' ); $forwardText = $options['forwardText']; echo ""; echo "Link text used to move the slider forward (hidden by CSS, replaced with arrow image)"; } function jtd_anything_slides_backText_callback() { $options = get_option( 'jtd_anything_slides_options' ); $backText = $options['backText']; echo ""; echo "Link text used to move the slider back (hidden by CSS, replace with arrow image)"; } function jtd_anything_slides_tooltipClass_callback() { $options = get_option( 'jtd_anything_slides_options' ); $tooltip = $options['tooltipClass']; echo ""; echo "Set this value to a number and it will show that many slides at once"; } /* ****************** Function Settings ****************** */ function jtd_anything_slides_enableArrows_callback() { $options = get_option( 'jtd_anything_slides_options' ); $enableArrows = $options['enableArrows']; echo "
"; echo ""; echo "if no, arrows will be visible, but not clickable."; } function jtd_anything_slides_enableNav_callback() { $options = get_option( 'jtd_anything_slides_options' ); $enableNav = $options['enableNav']; echo "
"; echo ""; echo "if no, navigation links will still be visible, but not clickable."; } function jtd_anything_slides_enablePlay_callback() { $options = get_option( 'jtd_anything_slides_options' ); $enablePlay = $options['enablePlay']; echo "
"; echo ""; echo "if no, the play/stop button will still be visible, but not clickable."; } function jtd_anything_slides_keyboard_callback() { $options = get_option( 'jtd_anything_slides_options' ); $keyboard = $options['keyboard']; echo "
"; echo ""; echo "If no, keyboard arrow keys will not work for the current panel"; } /* ******************** Navigation Settings ******************** */ function jtd_anything_slides_startPanel_callback() { $options = get_option( 'jtd_anything_slides_options' ); $startPanel = $options['startPanel']; echo ""; echo "This sets the initial panel"; } function jtd_anything_slides_changeBy_callback() { $options = get_option( 'jtd_anything_slides_options' ); $changeBy = $options['changeBy']; echo ""; echo "Amount to go forward or back when changing panels."; } function jtd_anything_slides_hashTags_callback() { $options = get_option( 'jtd_anything_slides_options' ); $hashTags = $options['hashTags']; echo "
"; echo ""; echo "Should links change the hashtag in the URL?"; } function jtd_anything_slides_infinite_callback() { $options = get_option( 'jtd_anything_slides_options' ); $infinite = $options['infinite']; echo "
"; echo ""; echo "if no, the slider will not wrap"; } /* ***************** Slidshow Options ***************** */ function jtd_anything_slides_autoPlay_callback() { $options = get_option( 'jtd_anything_slides_options' ); $autoPlay = $options['autoPlay']; echo "
"; echo ""; echo "If yes, the slideshow will start running"; } function jtd_anything_slides_autoPlayLocked_callback() { $options = get_option( 'jtd_anything_slides_options' ); $autoPlayLocked = $options['autoPlayLocked']; echo "
"; echo ""; echo "If yes, user changing slides will not stop the slideshow"; } function jtd_anything_slides_autoPlayDelayed_callback() { $options = get_option( 'jtd_anything_slides_options' ); $autoPlayDelayed = $options['autoPlayDelayed']; echo "
"; echo ""; echo "If yes, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts"; } function jtd_anything_slides_pauseOnHover_callback() { $options = get_option( 'jtd_anything_slides_options' ); $pauseOnHover = $options['pauseOnHover']; echo "
"; echo ""; echo "If yes & the slideshow is active, the slideshow will pause on hover"; } function jtd_anything_slides_stopAtEnd_callback() { $options = get_option( 'jtd_anything_slides_options' ); $stopAtEnd = $options['stopAtEnd']; echo "
"; echo ""; echo "If yes & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false."; } function jtd_anything_slides_playRtl_callback() { $options = get_option( 'jtd_anything_slides_options' ); $playRtl = $options['playRtl']; echo "
"; echo ""; echo "If yes, the slideshow will move right-to-left"; } /* *************** Timing Options *************** */ function jtd_anything_slides_delay_callback() { $options = get_option( 'jtd_anything_slides_options' ); $delay = $options['delay']; echo ""; echo "How long between slideshow transitions in AutoPlay mode (in milliseconds)"; } function jtd_anything_slides_resume_callback() { $options = get_option( 'jtd_anything_slides_options' ); $resume = $options['resume']; echo ""; echo "Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds)"; } function jtd_anything_slides_animation_callback() { $options = get_option( 'jtd_anything_slides_options' ); $animation = $options['animation']; echo ""; echo "How long the slideshow transition takes (in milliseconds)"; } /* ********************** Interactivity Options ********************** */ function jtd_anything_slides_clickForwardArrow_callback() { $options = get_option( 'jtd_anything_slides_options' ); $clickForwardArrow = $options['clickForwardArrow']; echo ""; echo "Event used to activate forward arrow functionality (e.g. add jQuery mobile's 'swiperight')"; } function jtd_anything_slides_clickBackArrow_callback() { $options = get_option( 'jtd_anything_slides_options' ); $clickBackArrow = $options['clickBackArrow']; echo ""; echo "Event used to activate back arrow functionality (e.g. add jQuery mobile's 'swipeleft')"; } function jtd_anything_slides_clickControls_callback() { $options = get_option( 'jtd_anything_slides_options' ); $clickControls = $options['clickControls']; echo ""; echo "Events used to activate navigation control functionality"; } function jtd_anything_slides_clickSlideshow_callback() { $options = get_option( 'jtd_anything_slides_options' ); $clickSlideshow = $options['clickSlideshow']; echo ""; echo "Event used to activate slideshow play/stop button"; } /* *************** Video Settings *************** */ function jtd_anything_slides_video_callback() { $options = get_option( 'jtd_anything_slides_options' ); $video = $options['video']; echo "
"; echo ""; echo "If yes & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete. visit GitHub for more info."; } function jtd_anything_slides_wmode_callback() { $options = get_option( 'jtd_anything_slides_options' ); $wmode = $options['wmode']; echo ""; echo "If your slider has an embedded object, the script will automatically add a wmode parameter with this setting"; } // Validate user input (we want numbers only) function jtd_anything_slides_validate_options($input) { $easing = array( 'swing', 'linear', 'easeInQuad', 'easeOutQuad', 'easeInOutQuad', 'easeInCubic', 'easeOutCubic', 'easeInOutCubic', 'easeInQuart', 'easeOutQuart', 'easeInOutQuart', 'easeInQuint', 'easeOutQuint', 'easeInOutQuint', 'easeInSine', 'easeOutSine', 'easeInOutSine', 'easeInExpo', 'easeOutExpo', 'easeInOutExpo', 'easeInCirc', 'easeOutCirc', 'easeInOutCirc', 'easeInElastic', 'easeOutElastic', 'easeInOutElastic', 'easeInBack', 'easeOutBack', 'easeInOutBack', 'easeInBounce', 'easeOutBounce', 'easeInOutBounce' ); $themes = array( 'construction', 'cs-portfolio', 'metallic', 'minimalist-round', 'minimalist-square' ); $wmodes = array( '', 'opaque', 'transparent' ); $boolean = array( 'true', 'false' ); $allowed = array( ); $valid = array(); // Appearance Settings $valid['width'] = preg_replace( '/[^0-9]/', '', $input['width'] ); $valid['height'] = preg_replace( '/[^0-9]/', '', $input['height'] ); $valid['theme'] = ( in_array( mysql_real_escape_string($input['theme']), $themes ) ) ? $input['theme'] : 'default'; $valid['expand'] = ( in_array( mysql_real_escape_string($input['expand']), $boolean ) ) ? $input['expand'] : 'false'; $valid['resizeContents'] = ( in_array( mysql_real_escape_string($input['resizeContents']), $boolean ) ) ? $input['resizeContents'] : 'false'; $valid['showMultiple'] = preg_replace( '/[^0-9]/', '', $input['showMultiple'] ); $valid['easing'] = ( in_array( mysql_real_escape_string($input['easing']), $easing ) ) ? $input['easing'] : 'swing'; //$valid['easing'] = esc_html( $input['easing'] ); $valid['arrows'] = ( in_array( mysql_real_escape_string($input['arrows']), $boolean ) ) ? $input['arrows'] : 'false'; $valid['navigation'] = ( in_array( mysql_real_escape_string($input['navigation']), $boolean ) ) ? $input['navigation'] : 'false'; $valid['startStop'] = ( in_array( mysql_real_escape_string($input['startStop']), $boolean ) ) ? $input['startStop'] : 'false'; $valid['toggleArrows'] = ( in_array( mysql_real_escape_string($input['toggleArrows']), $boolean ) ) ? $input['toggleArrows'] : 'false'; $valid['toggleContr'] = ( in_array( mysql_real_escape_string($input['toggleContr']), $boolean ) ) ? $input['toggleContr'] : 'false'; $valid['startText'] = esc_html( $input['startText'] ); $valid['stopText'] = esc_html( $input['stopText'] ); $valid['forwardText'] = esc_html( $input['forwardText'] ); $valid['backText'] = esc_html( $input['backText'] ); $valid['tooltipClass'] = preg_replace( '/[^A-Za-z0-9_]/', '', $input['tooltipClass'] ); // Function Settings $valid['enableArrows'] = ( in_array( mysql_real_escape_string($input['enableArrows']), $boolean ) ) ? $input['enableArrows'] : 'false'; $valid['enableNav'] = ( in_array( mysql_real_escape_string($input['enableNav']), $boolean ) ) ? $input['enableNav'] : 'false'; $valid['enablePlay'] = ( in_array( mysql_real_escape_string($input['enablePlay']), $boolean ) ) ? $input['enablePlay'] : 'false'; $valid['keyboard'] = ( in_array( mysql_real_escape_string($input['keyboard']), $boolean ) ) ? $input['keyboard'] : 'false'; // Navigation Settings $valid['startPanel'] = preg_replace( '/[^0-9]/', '', $input['startPanel'] ); $valid['changeBy'] = preg_replace( '/[^0-9]/', '', $input['changeBy'] ); $valid['hashTags'] = ( in_array( mysql_real_escape_string($input['hashTags']), $boolean ) ) ? $input['hashTags'] : 'false'; $valid['infinite'] = ( in_array( mysql_real_escape_string($input['infinite']), $boolean ) ) ? $input['infinite'] : 'false'; // Slideshow options $valid['autoPlay'] = ( in_array( mysql_real_escape_string($input['autoPlay']), $boolean ) ) ? $input['autoPlay'] : 'false'; $valid['autoPlayLocked'] = ( in_array( mysql_real_escape_string($input['autoPlayLocked']), $boolean ) ) ? $input['autoPlayLocked'] : 'false'; $valid['autoPlayDelayed'] = ( in_array( mysql_real_escape_string($input['autoPlayDelayed']), $boolean ) ) ? $input['autoPlayDelayed'] : 'false'; $valid['pauseOnHover'] = ( in_array( mysql_real_escape_string($input['pauseOnHover']), $boolean ) ) ? $input['pauseOnHover'] : 'false'; $valid['stopAtEnd'] = ( in_array( mysql_real_escape_string($input['stopAtEnd']), $boolean ) ) ? $input['stopAtEnd'] : 'false'; $valid['playRtl'] = ( in_array( mysql_real_escape_string($input['playRtl']), $boolean ) ) ? $input['playRtl'] : 'false'; // Timing Settings $valid['delay'] = preg_replace( '/[^0-9]/', '', $input['delay'] ); $valid['resume'] = preg_replace( '/[^0-9]/', '', $input['resume'] ); $valid['animation'] = preg_replace( '/[^0-9]/', '', $input['animation'] ); // Interactivity Settings $valid['clickForwardArrow'] = esc_html( $input['clickForwardArrow'] ); $valid['clickBackArrow'] = esc_html( $input['clickBackArrow'] ); $valid['clickControls'] = esc_html( $input['clickControls'] ); $valid['clickSlideshow'] = esc_html( $input['clickSlideshow'] ); // Video Settings $valid['video'] = ( in_array( mysql_real_escape_string($input['video']), $boolean ) ) ? $input['video'] : 'false'; $valid['wmode'] = ( in_array( mysql_real_escape_string($input['wmode']), $wmodes ) ) ? $input['wmode'] : 'false'; return $valid; } // Set default options at activation function jtd_anything_slides_set_defaults() { $tmp = get_option( 'jtd_anything_slides_options' ); if ( ( !is_array( $tmp ) ) ) { $o = array( 'width' => '570', 'height' => '190', 'theme' => "default", 'expand' => false, 'resizeContents' => true, 'showMultiple' => '1', 'easing' => "swing", 'arrows' => true, 'navigation' => true, 'StartStop' => true, 'toggleArrows' => false, 'toggleContr' => false, 'startText' => "Start", 'stopText' => "Stop", 'forwardText' => "»", 'backText' => "«", 'tooltipClass' => "tooltip", 'enableArrows' => true, 'enableNav' => true, 'enablePlay' => true, 'keyboard' => true, 'startPanel' => '1', 'changeBy' => '1', 'hashTags' => true, 'infinite' => true, 'autoPlay' => false, 'autoPlayLocked' => false, 'autoPlayDelayed' => false, 'pauseOnHover' => true, 'stopAtEnd' => false, 'playRtl' => false, 'delay' => 3000, 'resume' => 15000, 'animation' => 750, 'clickForwardArrow' => "click", 'clickBackArrow' => "click", 'clickControls' => "click focusin", 'clickSlideshow' => "click", 'video' => true, 'wmode' => "opaque" ); } update_option( 'jtd_anything_slides_options', $o ); } register_activation_hook(__FILE__, 'jtd_anything_slides_set_defaults'); // Add an upgrade warning /* if ( is_admin() ) { add_action( 'in_plugin_update_message-' . plugin_basename(__FILE__), 'jtd_anything_slides_upgrade_notice' ); } function jtd_anything_slides_upgrade_notice() { $info = __( '  ATTENTION! After updating this plugin, you will need to update your settings on the the Settings Page.', MY_TEXTDOMAIN ); echo '' . strip_tags( $info, '
' ) . ''; } */