=== Uploadify Integration === Contributors: Mike Allen Website: http://anchorwave.com/ Tags: shortcode, upload, uploader, uploading, uploadify, flash uploader, file uploader Requires at least: 3.0 Tested up to: 3.2.0 Stable tag: 0.9.2 Uploadify Integartion allows you to insert a jQuery uploadify uploader into your forms. == Description == Uploadify Integration is an attempt to ease the very common task of including an upload field within a custom post type, options page, or user profile page. = Features = * Shortcode generator in options page * Automatically saves to post meta, user meta, or as an option depending on the metaType selected by the shortcode. = Intended Audience = Uploadify Integration is intended to be a tool for developers needing to include an uploader within a form. Because uploaded files can only be retrieved through code, this plugin may not be useful to anyone without knowledge of PHP. = Important Notes = Please check out the `Installation` and `Other Notes` tabs to see important details on how to use Uploadify Integration. You will not be able to use this plugin without reading those pages. = Feedback = Please let me know how you would like this plugin to be improved, either by posting on the forum, or by email: mikeleonardallen@gmail.com == Installation == 1. Download and unpack plugin files to **/wp-content/plugins/uploadify-integration/** 2. Activate the plugin through the 'Plugins' menu in WordPress 3. Go to the *Options/Uploadify Integration* page in *Site Admin* and change the plugins options as you wish. 4. Place the `[uploadify]` shortcode in your content. = Usage = Embed the `[uploadify]` shortcode to include the uploader in a page or post. See the shortcode generator in the settings page to modify the default settings. = Options = * **inputName** : The key that will be used to save the meta data. Defualt = 'files' * **metaType** : What to associate the uploaded files with. Available options are `post`, `user`, and `option`. Default = `post` * **uploadMode** : Allow multiple uploads or replace the previous upload. Available options are `multiple` and `single`. Setting this option to `multiple` will also enable the Uplodify multi setting. Default = 'single' * **fileSizeLimit** : Restriction on allowed file size in MB. * **fileTypeExts** : Restrict allowed file types. Default is `*.*` * **fileTypeDesc** : Used in conjunction with `fileTypeExts` to tell the user what types of files should be uploaded. * **buttonText** : Text to display on upload button. Default is `Upload File` = Retrieving Files = Files are stored as post meta, user meta, or option meta stored under the inputName specified with the shortcode. For example, with the shortcode: `[uploadify inputName="images" fileTypeExts="*.jpg;*.png;*.gif;" fileTypeDesc="Image Files" metaType="post"]` The information for retrieving the files is retrieved like so: $images = get_post_meta( $post_id, 'images', true ); Now images will contain an array of post ids. Those posts contain information about the files uploaded. There are two functions provided to retrieve path and url information given a post id. Those are: `Uploadify_Model_Posttype_File::getFilePath($file_id);` and `Uploadify_Model_Posttype_File::getFileUrl($file_id);` For example, to print out the above images: while( $file_id = array_shift( $images ) ) { $url = Uploadify_Model_Posttype_File::getFileUrl( $file_id ); echo sprintf( '', $url ); } == Frequently Asked Questions == None at this time. == Screenshots == 1. Settings Page 2. Uploadify Integration used within a page. == Changelog == = 0.9.3 (September 18 2011) = * Provided the Uploadify multi setting when `uploadMode` is set to `multiple`. * Added the uploadify_get_file_view filter to allow users to override the default view used to display uploaded files. * Now using spl_autoload_register to include plugin files. * Removed Taxonomy associated with file meta type. Did not serve a purpose. * Removed shortcode generator in favor documenting options to allow for less maintanance with future options. * Removed file size limit description in settings page in favor of an external article providing more thourough examples. = 0.9.2 (September 9 2011) = * Included saving the upload path, so that you may change the upload path without breaking the links to previously uploaded files. * By default scripts will now be included in all pages. There is an option in the settings page to turn this off. * Added screenshots. = 0.9.1 (September 2 2011) = * Fixed incorrect paths and urls. Removed hard coded urls from the JavaScript. Replaced AwTemplate with correct version of this class. = 0.9 (August 28 2011) = * Beta release. == Upgrade Notice == = 0.9.1 = Version 0.9.1 fixes several bugs that prevented Uploadify Integration from working correctly. == Extending/Customization == = Meta Type = By default Uploadify Integration can save to post, user, or option meta. Custom meta handlers are added with the `uploadify_get_file_meta_handler` filter. add_filter( 'uploadify_get_file_meta_handler', 'my_custom_meta_handler', 10, 3 ); function my_custom_meta_handler( $handler, $meta_name ) { if ( $meta_name != "MY_CUSTOM_META_TYPE" ) return $handler; $handler = new MyCustomMetaHandler(); return $handler; } Where `MyCustomMetaHandler` must extend `Uploadify_Model_FileMeta_Abstract`. Review the existing meta handlers under `/uploadify-integration/models/FileMeta/` to determine how to define your class. = Uploaded File HTML = Uploadify Integration provides the `uploadify_get_file_view` filter to override the default view file used to generate the HTML for uploaded files. Review `/uploadify-integration/views/scripts/partials/file_single_line.php` to see an example of what your view file might look like. add_filter( 'uploadify_get_file_view', 'my_custom_file_view' ); function my_custom_file_view( $path, $fileid ) { // you can use information about the file to determine what template you want to load // ie: images could have thumbnails, etc $path = get_bloginfo( 'template_directory' ) . '/my_custom_file_view.php'; return $path; } = CSS = To override the default css use the `uploadify_get_css_url` filter. add_filter( 'get_uploadify_css_url', 'my_custom_uploadify_css_url' ); function my_custom_uploadify_css_url() { return "MY_CUSTOM_UPLOADIFY_CSS_URL"; }