Deprecated
This function has been deprecated.
ap_upload_js_init()
Description #
Initialize AnsPress uploader settings.
Source #
File: includes/deprecated.php
function ap_upload_js_init() { _deprecated_function( __FUNCTION__, '4.1.0' ); if ( ap_user_can_upload() ) { $mimes = []; foreach ( ap_allowed_mimes() as $ext => $mime ) { $mimes[] = [ 'title' => $mime, 'extensions' => str_replace( '|', ',', $ext ), ]; } $plupload_init = array( 'runtimes' => 'html5,flash,silverlight,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'ap-drop-area', 'file_data_name' => 'async-upload', 'url' => admin_url( 'admin-ajax.php' ), 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ), 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ), 'filters' => array( 'mime_types' => $mimes, 'max_file_size' => (int) ap_opt( 'max_upload_size' ) . 'b', 'prevent_duplicates' => true, ), // 'maxfiles' => ap_opt( 'uploads_per_post' ), 'multipart_params' => [ '_wpnonce' => wp_create_nonce( 'media-upload' ), 'action' => 'ap_image_submission', ], ); echo '<script type="text/javascript"> wpUploaderInit =' . wp_json_encode( $plupload_init ) . ';</script>'; echo '<script type="text/html" id="ap-upload-template"> <span class="apicon-check"> ' . esc_attr__( 'Uploaded', 'anspress-question-answer' ) . '</span> <span class="apicon-stop"> ' . esc_attr__( 'Failed', 'anspress-question-answer' ) . '</span> <span class="ap-upload-name"></span> <a href="#" class="insert-to-post">' . esc_attr__( 'Insert to post', 'anspress-question-answer' ) . '</a> <a href="#" class="apicon-trashcan"></a> <div class="ap-progress"></div> </script>'; } }
Expand full source code Collapse full source code View on GitHub: includes/deprecated.php:94
Add your comment