$charitable_picture ) { if ( false === strpos( $charitable_picture, 'img' ) && ! wp_attachment_is_image( $charitable_picture ) ) { unset( $charitable_pictures[ $charitable_i ] ); } } /* * Ask the same question the AJAX endpoint asks. Without this the field draws a fully * working drag-and-drop zone for a logged-out visitor whose uploads charitable_plupload_ * image_upload() will always refuse - the visitor picks a file and gets an error with no * way to succeed. Say so up front instead. Mirrors the disabled state Ambassadors renders * for its own gallery field. */ $charitable_uploads_enabled = charitable_picture_uploads_enabled( $charitable_field['key'], isset( $charitable_field['parent_id'] ) ? absint( $charitable_field['parent_id'] ) : 0 ); $charitable_has_max_uploads = count( $charitable_pictures ) >= $charitable_max_uploads; $charitable_params = array( 'runtimes' => 'html5,silverlight,flash,html4', 'file_data_name' => 'async-upload', 'container' => $charitable_field['key'] . '-dragdrop', 'browse_button' => $charitable_field['key'] . '-browse-button', 'drop_element' => $charitable_field['key'] . '-dragdrop-dropzone', 'multiple_queues' => true, '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' ), 'multipart' => true, 'urlstream_upload' => true, 'filters' => array( array( 'title' => _x( 'Allowed Image Files', 'image upload', 'charitable' ), 'extensions' => 'jpg,jpeg,gif,png,webp', ), ), 'multipart_params' => array( 'field_id' => $charitable_field['key'], 'action' => 'charitable_plupload_image_upload', '_ajax_nonce' => wp_create_nonce( "charitable-upload-images-{$charitable_field[ 'key' ]}" ), 'post_id' => isset( $charitable_field['parent_id'] ) && strlen( $charitable_field['parent_id'] ) ? $charitable_field['parent_id'] : '0', 'size' => $charitable_size, 'max_uploads' => $charitable_max_uploads, ), ); if ( $charitable_uploads_enabled ) { wp_enqueue_script( 'charitable-plup-fields' ); } wp_enqueue_style( 'charitable-plup-styles' ); ?>

>