id ){ wp_enqueue_style( 'animated-admin-css', plugins_url( 'css/plugin-styles.css', __FILE__ ),'20140605', false ); wp_enqueue_script( 'js-animate', plugins_url('js/admin-animate.js', __FILE__), array( 'jquery' ), '20141905', true ); wp_enqueue_style( 'animate', plugins_url( 'css/animate.css', __FILE__ ),'20140605', false ); //wp_register_script( 'dlsnet-upload', plugins_url() .'/dls-network-manager/js/upload.js', array('jquery','media-upload','thickbox') ); wp_enqueue_style('thickbox'); wp_localize_script( 'js-animate', 'wpAdmin', array('url' => admin_url()) ); } } add_action( 'admin_enqueue_scripts', 'animated_em_add_files_to_adminPage' ); /** * Enqueue jQuery and Animated CSS on login page * */ function animated_em_add_files_to_loginPage(){ wp_enqueue_script( 'jquery' ); wp_enqueue_style( 'animated-frontend-css', plugins_url( 'css/animate.css', __FILE__ ),'20140605', false ); } add_action("login_enqueue_scripts", "animated_em_add_files_to_loginPage"); /** * Form for the settings page * */ function animated_em_add_jscript(){ if (get_option( 'animated_em_login_image' )) { $add_image = get_option( 'animated_em_login_image' ); $add_delay = get_option( 'animated_em_delay' ); $add_class = get_option( 'animated_em_animation_type' ); //$add_class .= " animated"; $bgimage = 'url(' . $add_image . ')'; //$style .= 'background-repeat:none;background-position:scroll center top;height: 133px;background-size: contain'; } else { $bgimage = 'url(' . plugins_url('/img/animated-login-default-img.png', __FILE__) . ')'; $add_class = 'tada'; $add_delay = '500'; } echo ''; } add_action("login_footer", "animated_em_add_jscript"); /** * Link logo to homepage (instead of wordpress.org) * */ function animated_em_link_to_home_page(){ if( get_option( 'animated_em_link_to_homepage' ) == 1){ return get_bloginfo('url'); } else { return 'www.wordpress.org'; } } add_filter( 'login_headerurl', 'animated_em_link_to_home_page' ); /** * Register settings page * */ function animated_em_create_menu(){ add_options_page( 'Plugin Settings', 'Animated Login', 'manage_options', 'animated-login', 'animated_em_options_page' ); } add_action( 'admin_menu', 'animated_em_create_menu' ); /** * Generate options page * */ function animated_em_options_page(){ //Add support for decimal numbers if (!current_user_can('manage_options')) { wp_die( _e('You do not have sufficient permissions to access this page.', 'animated-login') ); } // See if the user has posted us some information if( isset($_POST['submit']) ){ check_admin_referer( 'animiated_em_save_form', 'animated_em_name_of_nonce' ); $login_image = $_POST["login-image"]; $animation_delay = $_POST["animation-delay"]; $animation_type = $_POST["animation"]; $link_homepage = isset( $_POST["link-to-homepage"] ) && $_POST["link-to-homepage"] ? "1" : "0"; // Check if input is a numeric value if(intval($animation_delay) != ''){ $animation_delay = intval($animation_delay); //change $animation_delay into milliseconds 1000 // update options if($animation_delay < 200 || $animation_delay > 5000) { $animation_em_fail = 'Please choose a number between 200 and 5000 milli-seconds'; } else if(!filter_var($login_image, FILTER_VALIDATE_URL)) { $animation_em_fail = 'Please enter a valid URL'; } else { //Everything is cool, update options now update_option( 'animated_em_login_image', $login_image ); update_option( 'animated_em_delay', $animation_delay ); update_option( 'animated_em_animation_type', $animation_type ); update_option( 'animated_em_link_to_homepage', $link_homepage ); $animation_em_success = true; //issue success variable } // Fail if !is a numeric value } else { $animation_em_fail = 'Please enter a NUMBER for Animation Delay.'; // function is open until the end of the form // Output Message //echo "$animation_type"; } ?>

'; echo "

" . __( 'Animated Login - settings', 'animated-login' ) . "


" . __( 'Add an image, set the timeout, and choose your Animation.', 'animated-login') ."

"; ?>
' . __( 'Your image will replace this one', 'animated-login' ) . '→'; } else { echo ''; } ?>

No image yet.
' . __( 'Your Image', 'animated-login' ) . '→
Animated Login Image
/>