to_translate = array( "Here's your uploaded media URI:", "Error occured while processing your file. Please try again.", "upload", "choose file", "remove", "Extension \"%s\" not allowed. Allowed extensions are \"%s\"", "Maximum file size \"%s\" KB breached. Your file size was \"%s\" KB", "You must be logged-in to upload", "Permissions don't allow you to upload", "Error occured while processing your file" ); $AJAX_file_upload = new AJAX_file_upload(); $this->translations = array(); foreach( $this->to_translate as $i => $string ) { $this->translations[$i] = $AJAX_file_upload->translate( $string ); } } public function _init() { add_action('admin_menu', array( &$this, 'admin_menu' ) ); add_filter( "ajax_file_upload_settings", array( &$this, "filter_settings" ), 0 ); add_filter( "admin_init", array( &$this, "redirect" ) ); } public static function init() { $class = null == self::$instance ? new self : self::$instance; return $class->_init(); } public function admin_menu() { add_options_page( 'AJAX file upload', 'AJAX file upload', 'manage_options', 'ajax-file-upload', array( &$this, 'screen' ) ); add_submenu_page( '', "Welcome to AJAX File Upload", '', 'manage_options', 'afu-about', array( &$this, 'about_screen' ) ); } public function about_screen() { require 'afu-about.php'; } public function update() { if( ! isset( $_POST['_afu_nonce'] ) || !wp_verify_nonce( $_POST['_afu_nonce'], '_afu_nonce' ) ) { return; } $settings = isset( $_POST["settings"] ) ? $_POST["settings"] : array(); if( ! empty( $settings["max"] ) ) { if( (int) $settings["max"] > 0 ) { $settings["max"] = (int) $settings["max"]; } } if( ! empty( $settings["ext"] ) ) { $settings["ext"] = explode( ",", $settings["ext"] ); foreach( $settings["ext"] as $i => $ext ) { $settings["ext"][$i] = preg_replace('/\s+/', '', $ext); } } if( empty( $settings["permission"] ) ) { unset( $settings["permission"] ); } else { $settings["permission"] = sanitize_text_field( $settings["permission"] ); } update_option( "afu_settings", json_encode( $settings ) ); if( ! empty( $_POST["translate"] ) ) { $object = array(); foreach( $_POST["translate"] as $i => $string ) { $object[ $this->to_translate[$i] ] = sanitize_text_field( str_replace( "\"", """, $string ) ); } update_option( "afu_transaltions", base64_encode( json_encode( $object ) ) ); wp_redirect( "options-general.php?page=ajax-file-upload&updated=true" ); exit; } echo '

Settings saved successfully.

'; } public function filter_settings( $settings ) { $meta = get_option( "afu_settings"); if( $meta ) { $meta = json_decode( $meta ); if( ! empty( $meta->max ) ) { $settings->max_size = (int) $meta->max; } if( ! empty( $meta->ext ) ) { $settings->extensions = (array) $meta->ext; } if( ! empty( $meta->permission ) ) { $settings->default_permission = (string) $meta->permission; } } return $settings; } public function screen() { $this->update(); ?>

AJAX file upload Documentation

Hello there! The following are only default settings which can be totally ignored when you set the shortcode attributes. For example, you have [ajax-file-upload unique_identifier=upload_cover_photo max_size=5000] in this case the max. upload size will be the one set in the shortcode attribute which is 5000 kb (5 MB)

In other words, these settings will be used only when they are not added to shortcode attribute or a unique_identifier attribute is not set. This attribute is used to get settings for the current shortcode from the database (security procedure, anyone can manipulate settings if you call them through the markup)

Some basic optional translations:
to_translate as $i => $string ) : ?>

More: AFU custom DOM events (JavaScript) - Using ajax_file_upload() function