Tribe_Meta_Box::check_field_upload()


Source

File: lib/tribe-meta-box.php

	public function check_field_upload() {
		if ( ! $this->has_field( 'image' ) && ! $this->has_field( 'file' ) ) {
			return;
		}

		add_action( 'post_edit_form_tag', array( $this, 'add_enctype' ) );				// add data encoding type for file uploading

		// make upload feature works even when custom post type doesn't support 'editor'
		wp_enqueue_script( 'media-upload' );
		add_thickbox();
		wp_enqueue_script( 'jquery-ui-core' );
		wp_enqueue_script( 'jquery-ui-sortable' );

		add_filter( 'media_upload_gallery', array( $this, 'insert_images' ) );			// process adding multiple images to image meta field
		add_filter( 'media_upload_library', array( $this, 'insert_images' ) );
		add_filter( 'media_upload_image', array( $this, 'insert_images' ) );

		add_action( 'wp_ajax_tribe_delete_file', array( $this, 'delete_file' ) );		// ajax delete files
		add_action( 'wp_ajax_tribe_reorder_images', array( $this, 'reorder_images' ) );	// ajax reorder images
	}