. * For any other query please contact us at contact[at]eleopard[dot]in */ if (!class_exists('EDS_Mobile_Detect')): include_once 'assets/helper/Mobile_Detect.php'; endif; include_once 'eds_tinymce.php'; function detectDevice() { static $deviceType = null; if(!$deviceType) { $detect = new EDS_Mobile_Detect(); $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); } return $deviceType; } function set_edsanimate_options(){ add_option('scroll_offset' ,'75' ,'Percentage height of the element '. 'after which animation should get applied' ); add_option('enable_on_phone' ,'0' ,'Animation should work on smartphones or not.'); add_option('enable_on_tab' ,'1' ,'Animation should work on tablets or not.'); } function unset_edsanimate_options(){ delete_option('scroll_offset'); delete_option('enable_on_phone'); delete_option('enable_on_tab'); } function admin_edsanimate_options(){ ?>

Animate It! Options

Options saved.

Failed to save options.

(Animation should work on Smartphones or not)

(Animation should work on Tablets or not)

get_option('scroll_offset')); wp_localize_script( 'edsanimate-script', 'scroll_offset', $offset); wp_enqueue_style( 'animate-css' ); wp_enqueue_script( 'viewpointcheck-script'); wp_enqueue_script( 'edsanimate-script'); endif; } function edsanimate_handler( $attributes, $content = null ) { $deviceType = detectDevice(); $enableSmartPhone = get_option('enable_on_phone'); $enableTablet = get_option('enable_on_tab'); $enable= ($deviceType=='phone' && intval($enableSmartPhone)) || ($deviceType =='tablet' && intval($enableTablet)) || ($deviceType =='computer'); if($enable): extract( shortcode_atts( array( 'animation' => '', 'delay' => '', 'duration' => '', 'infinite_animation' =>'', 'animate_on' => '', 'scroll_offset' => '' ), $attributes ) ); $classString = "animated"; if($animation == '') { return $content; } $classString .= " " . $animation; if(strcasecmp($infinite_animation, 'yes')==0) $classString .= " infinite"; if($delay!= '' && is_int((int)$delay) && $delay>=0 && $delay <=12) $classString .= " delay" . $delay; if($duration!= '' && is_int((int)$duration) && $duration>=0 && $duration <=12) $classString .= " duration" . $duration; if(strcasecmp($animate_on, 'scroll')==0) $classString .= " eds-on-scroll"; else if(strcasecmp($animate_on, 'click')==0) $classString .= " eds-on-click"; else if(strcasecmp($animate_on, 'hover')==0) $classString .= " eds-on-hover"; if(isset($scroll_offset) && $scroll_offset!=''){ return '
'.do_shortcode($content).'
'; }else return '
'.do_shortcode($content).'
'; else: return do_shortcode($content); endif; } function eds_add_custom_class_field($t,$return,$instance){ $instance = wp_parse_args( (array) $instance, array( 'eds_animation_class' => '') ); if ( !isset($instance['eds_animation_class']) ) $instance['eds_animation_class'] = null; ?>

option_name); $widget_num = $widget_obj['params'][0]['number']; if (isset($widget_opt[$widget_num]['eds_animation_class'])){ $eds_animation_class = $widget_opt[$widget_num]['eds_animation_class']; $params[0]['before_widget'] = preg_replace('/class="/', 'class=" '.$eds_animation_class , $params[0]['before_widget'], 1); } return $params; } //Admin Menu Options Filters add_filter('widget_text', 'do_shortcode'); register_activation_hook(__FILE__, 'set_edsanimate_options'); register_deactivation_hook(__FILE__, 'unset_edsanimate_options'); add_action('in_widget_form', 'eds_add_custom_class_field',5,3); add_filter('widget_update_callback', 'eds_update_widget_animation_class',5,3); add_filter('dynamic_sidebar_params', 'eds_add_widget_animation_class'); add_action('admin_menu', 'modify_menu'); add_shortcode('edsanimate', 'edsanimate_handler'); add_action('wp_enqueue_scripts', 'add_eds_script_and_css');