';
}
function jtd_anything_slides_option_navigation_text() {
echo '
';
}
function jtd_anything_slides_option_slideshow_text() {
echo '
';
}
function jtd_anything_slides_option_video_text() {
echo '
';
}
// Display and fill the form field
/*
** Appearance
*/
/* Appearance
width : null, // Override the default CSS width
height : null, // Override the default CSS height
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
tooltipClass : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
theme : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
*/
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_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_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 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";
}
/*
** Navigation
*/
/* Navigation
startPanel : 1, // This sets the initial panel
hashTags : true, // Should links change the hashtag in the URL?
infiniteSlides : true, // if false, the slider will not wrap
enableKeyboard : true, // if false, keyboard arrow keys will not work for the current panel.
buildArrows : true, // If true, builds the forwards and backwards buttons
toggleArrows : false, // if true, side navigation arrows will slide out on hovering & hide @ other times
buildNavigation : true, // If true, builds a list of anchor links to link to each panel
enableNavigation : true, // if false, navigation links will still be visible, but not clickable.
toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
appendControlsTo : null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
navigationFormatter : null, // Details at the top of the file on this use (advanced use)
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)
*/
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_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";
}
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";
}
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_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_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_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_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_navFormatter_callback() {
$options = get_option( 'jtd_anything_slides_options' );
$navFormatter = $options['navFormatter'];
echo " ";
echo "";
echo "Details at the top of the file on this use (advanced use).";
}
*/
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)";
}
/*
** Slideshow options
*/
/* Slideshow options
enablePlay : true, // if false, the play/stop button will still be visible, but not clickable.
autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
autoPlayLocked : false, // If true, user changing slides will not stop the slideshow
startStopped : false, // If autoPlay is on, this can force it to start stopped
pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, the autoplay will pause until the video completes
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
startText : "Start", // Start button text
stopText : "Stop", // Stop button text
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)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
*/
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_autoPlay_callback() {
$options = get_option( 'jtd_anything_slides_options' );
$autoPlay = $options['autoPlay'];
echo " ";
echo "";
echo "This turns off the entire slideshow functionality, not just if it starts running or not";
}
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_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)";
}
/*
** 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) {
$themes = array( 'construction', 'cs-portfolio', 'metallic', 'minimalist-round', 'minimalist-square' );
$wmodes = array( '', 'opaque', 'transparent' );
$boolean = array( 'true', 'false' );
$valid = array();
// Appearance
$valid['width'] = preg_replace( '/[^0-9]/', '', $input['width'] );
$valid['height'] = preg_replace( '/[^0-9]/', '', $input['height'] );
$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['tooltipClass'] = preg_replace( '/[^A-Za-z0-9_]/', '', $input['tooltipClass'] );
$valid['theme'] = ( in_array( mysql_real_escape_string($input['theme']), $themes ) ) ? $input['theme'] : 'default';
// Navigation
$valid['startPanel'] = preg_replace( '/[^0-9]/', '', $input['startPanel'] );
$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';
$valid['keyboard'] = ( in_array( mysql_real_escape_string($input['keyboard']), $boolean ) ) ? $input['keyboard'] : 'false';
$valid['arrows'] = ( in_array( mysql_real_escape_string($input['arrows']), $boolean ) ) ? $input['arrows'] : 'false';
$valid['toggleArrows'] = ( in_array( mysql_real_escape_string($input['toggleArrows']), $boolean ) ) ? $input['toggleArrows'] : 'false';
$valid['navigation'] = ( in_array( mysql_real_escape_string($input['navigation']), $boolean ) ) ? $input['navigation'] : 'false';
$valid['enableNav'] = ( in_array( mysql_real_escape_string($input['enableNav']), $boolean ) ) ? $input['enableNav'] : 'false';
$valid['toggleContr'] = ( in_array( mysql_real_escape_string($input['toggleContr']), $boolean ) ) ? $input['toggleContr'] : 'false';
$valid['forwardText'] = preg_replace( '/[^A-Za-z0-9_]/', '', $input['forwardText'] );
$valid['backText'] = preg_replace( '/[^A-Za-z0-9_]/', '', $input['backText'] );
// Slideshow options
$valid['enablePlay'] = ( in_array( mysql_real_escape_string($input['enablePlay']), $boolean ) ) ? $input['enablePlay'] : 'false';
$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['delay'] = preg_replace( '/[^0-9]/', '', $input['delay'] );
$valid['resume'] = preg_replace( '/[^0-9]/', '', $input['resume'] );
$valid['animation'] = preg_replace( '/[^0-9]/', '', $input['animation'] );
// 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';
/*
// Slideshow options
startStopped : false, // If autoPlay is on, this can force it to start stopped
pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, the autoplay will pause until the video completes
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
startText : "Start", // Start button text
stopText : "Stop", // Stop button text
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)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
*/
if( $valid['width'] != $input['width'] ) {
add_settings_error(
'jtd_anything_slides-width',
'jtd_anything_slides_texterror',
'Incorrect value entered!',
'error'
);
}
if( $valid['height'] != $input['height'] ) {
add_settings_error(
'jtd_anything_slides-height',
'jtd_anything_slides_texterror',
'Incorrect value entered!',
'error'
);
}
if( $valid['delay'] != $input['delay'] ) {
add_settings_error(
'jtd_anything_slides-delay',
'jtd_anything_slides_texterror',
'Incorrect value entered!',
'error'
);
}
if( $valid['resume'] != $input['resume'] ) {
add_settings_error(
'jtd_anything_slides-resume',
'jtd_anything_slides_texterror',
'Incorrect value entered!',
'error'
);
}
if( $valid['animation'] != $input['animation'] ) {
add_settings_error(
'jtd_anything_slides-animation',
'jtd_anything_slides_texterror',
'Incorrect value entered!',
'error'
);
}
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', // Override the default CSS width
'height' => '190', // Override the default CSS height
'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' => 1, // Set this value to a number and it will show that many slides at once
'tooltipClass' => 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
'theme' => 'default',
'startPanel' => 1, // This sets the initial panel
'hashTags' => 'true', // Should links change the hashtag in the URL?
'infinite' => 'true', // if false, the slider will not wrap
'keyboard' => 'true', // if false, keyboard arrow keys will not work for the current panel.
'arrows' => 'true', // If 'true', builds the forwards and backwards buttons
'toggleArrows' => 'false', // if 'true', side navigation arrows will slide out on hovering & hide @ other times
'navigation' => 'true', // If 'true', builds a list of anchor links to link to each panel
'enableNav' => 'true', // if 'false', navigation links will still be visible, but not clickable.
'toggleControls' => 'false', // if 'true', slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
'appendControlsTo' => null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
'navigationFormatter' => null, // Details at the top of the file on this use (advanced use)
'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)
'enablePlay' => 'true', // if 'false', the play/stop button will still be visible, but not clickable.
'autoPlay' => 'true', // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
'autoPlayLocked' => 'false', // If 'true', user changing slides will not stop the slideshow
'startStopped' => 'false', // If autoPlay is on, this can force it to start stopped
'pauseOnHover' => 'true', // If 'true' & the slideshow is active, the slideshow will pause on hover
'resumeOnVideo' => 'true', // If 'true' & the slideshow is active & a youtube video is playing, the autoplay will pause until the video completes
'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
'startText' => "Start", // Start button text
'stopText' => "Stop", // Stop button text
'delay' => 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
'resume' => 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
'animation' => 600, // How long the slideshow transition takes (in milliseconds)
'easing' => "swing", // Anything other than "linear" or "swing" requires the easing plugin
'video' => 'false',
'wmode' => 'disabled'
);
}
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, ' ' ) . '';
}
*/