Example #1
0
	public function __construct($unique_id = '', $create_unique_id = false) 
	{
		if(!isset(self::$objects))
		{
			self::$objects = array();
		}
		
		if(!isset(self::$plupload_params))
		{
			self::$plupload_params = array(
				'runtimes'				=> 'html5,silverlight,flash,html4',
				'file_data_name'		=> self::VALUE_UPLOADED_FILE_NAME,
				'multiple_queues'		=> true,
//				'max_file_size'			=> wp_max_upload_size() . 'b',      must be set later - function not exists now
				'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( array(
						'title'				=> 'Allowed all Files',
						'extensions'		=> '*'
						)),
				'multipart'				=> true,
				'multipart_params'		=> array(
						'action'			=> self::VALUE_AJAX_ACTION
							),
				'urlstream_upload'		=> true,
			);
		};
		
		if(!isset(self::$show_on_pages))
		{
			self::$show_on_pages = self::ADMINPAGE_ONLY;
		}
		
		$this->unique_id = $this->create_unique_id($unique_id, $create_unique_id);
		self::$objects[$this->unique_id] = &$this;
		
			//	initialise standard values
		$this->data = array(
						self::ID_NONCE => '',
						self::ID_UPLOADED_FILE_KEY => self::VALUE_UPLOADED_FILE_NAME,
						self::ID_UNIQUE_ID => $this->unique_id,
						self::ID_MAX_FILE_UPLOAD => 0,
						self::ID_HIDE_ON_MAX_FILE => 1,			//	1 = true, 0 = false
						self::ID_ACTION_CALLBACK => '',
						self::ID_JAVA_INIT => '',
						self::ID_JAVA_FILES_ADDED => '',
						self::ID_JAVA_ERROR => '',
						self::ID_JAVA_UPLOAD_PROGRESS => '',
						self::ID_JAVA_FILE_UPLOADED => '',
						self::ID_SHOW_UPLOADED_IMAGES => 1,			//	1 = true, 0 = false
						self::ID_POST_ID => 0
				);
	
		$this->messages = array(
				'delete_this_file' => 'Delete this file',
				'delete' => 'Delete',
				'edit' => 'Edit',
				'files uploading' => 'Files in uploading queue',
				'uploaded files' => 'Uploaded files',
				'upload files' => 'Upload files',
				'drop images here' => 'Drop images here',
				'or' => 'or',
				'title browse button' => 'Click to select files with browser',
				'text browse button' => 'Select Files'
			);	
	}