";
while ( $loop->have_posts() ) {
$loop->the_post();
// setup the NavigationFormatter object based on the custom field value for each slide
if ( $attr['navformat'] ) {
global $post;
if ( get_post_meta( $post->ID, '_jtd_anything_slides_nav_format', true ) ) {
$navArray[$i] = get_post_meta( $post->ID, '_jtd_anything_slides_nav_format', true );
} else {
$navArray[$i] = get_the_title();
}
$setupNavFormat = true;
} else { // if no the navFormat attribute is not present in the shortcode, return NULL
$navFormat = "'NULL'";
$setupNavFormat = false;
}
$i++;
$content = get_the_content();
$output .= "
";
if ( $content ) {
$output .= "
" . do_shortcode($content) . "
";
}
$output .= "
";
}
// Have to build the NavigationFormatter function outside of the Loop
if ( $setupNavFormat ) {
$navArray = json_encode($navArray);
$navFormat = "function(index, panel){
return {$navArray}[index - 1];
}";
}
$output .= "
', '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, ' ' ) . '';
}
*/