Changeset 527691
- Timestamp:
- 04/05/2012 03:47:08 PM (14 years ago)
- Location:
- extend-upload/trunk
- Files:
-
- 2 edited
-
extend-upload.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
extend-upload/trunk/extend-upload.php
r525551 r527691 3 3 Plugin Name: Extend WordPress Upload 4 4 Plugin URI: http://bordoni.me/wp/plugins/extend-upload 5 Version: 0.0. 15 Version: 0.0.2 6 6 Description: A WordPress plugin to Extend the default WordPress upload 7 7 Author: Quatix … … 27 27 $pluginurl = preg_replace( '/^https/', 'http', $pluginurl ); 28 28 29 wp_register_script( 'extend-upload', $pluginurl . "/js/extend-upload.js", array( 'json2', 'jquery', 'thickbox', 'media-upload' ), '0.0. 1', true );30 wp_register_style( 'extend-upload', $pluginurl . "/css/extend-upload.css", array( 'thickbox' ), '0.0. 1', 'screen' );29 wp_register_script( 'extend-upload', $pluginurl . "/js/extend-upload.js", array( 'json2', 'jquery', 'thickbox', 'media-upload' ), '0.0.2', true ); 30 wp_register_style( 'extend-upload', $pluginurl . "/css/extend-upload.css", array( 'thickbox' ), '0.0.2', 'screen' ); 31 31 }, 5 ); 32 32 … … 35 35 return $html; 36 36 }, 10, 8 ); 37 38 add_action( 'admin_head-media-upload-popup', function() { 39 if( isset($_GET['button']) && !empty($_GET['button']) ) { 40 ?> 41 <script type='text/javascript'>/* <![CDATA[ */ 42 (function($) { 43 $(window).load(function () { 44 var extup = { 'selector': {}, '$': {} }; 45 extup.selector.item = '#media-items .media-item'; 46 extup.selector.button = '#media-items .media-item td.savesend input.button[id^="send"]'; 47 extup.selector.strictbutton = 'td.savesend input.button[id^="send"]'; 48 extup.$.button = $(extup.selector.button); 49 extup.$.button.val("<?php echo esc_attr($_GET['button']); ?>"); 50 $(document).on({ 51 'hover': function() { 52 var $this = $(this), 53 $button = $this.find( extup.selector.strictbutton ), 54 attr = $this.attr('id'); 55 $button.val("<?php echo esc_attr($_GET['button']); ?>"); 56 } 57 }, extup.selector.item ); 58 }); 59 })(jQuery); 60 /* ]]> */</script> 61 <?php 62 } 63 }, 20 ); -
extend-upload/trunk/readme.txt
r525561 r527691 5 5 Requires at least: 3.0 6 6 Tested up to: 3.3.1 7 Stable tag: 0.0. 17 Stable tag: 0.0.2 8 8 9 9 A plugin for developers to Extend WordPress upload to be able to use it at any place. … … 13 13 I had a problem that most of the time I had to upload a file, and I had to use a HTML upload, and that's kind of bad, so I created something to use the Thickbox and the WordPress Uploader. 14 14 15 To use you must enqueue in the page used both the style and the script of the plugin: 16 ` 17 <?php 18 wp_enqueue_script( 'extend-upload' ); 19 wp_enqueue_style( 'extend-upload' ); 20 ` 21 22 Then you can use the plugin by calling the jQuery Extends: 23 ` 24 (function($) { 25 $(document).ready(function () { 26 $('.uc-call').callUpload(); 27 }); 28 })(jQuery.noConflict()); 29 ` 30 And the HTML/PHP output should be something like that: 31 ` 32 <?php 33 $args = array( 34 'url' => admin_url( 'media-upload.php?post_id=0&button=' . rawurlencode('Use as Avatar') . '&TB_iframe=1&width=640&height=253' ) 35 ) 36 ?> 37 <p class='uc-container'> 38 <label><?php echo _e( "Avatar:" ); ?></label><a target='_blank' class='uc-call' data='<?php echo json_encode( $args ); ?>'><small>" . __( "Upload the Photo" ) . "</small></a>"; ?> 39 <input class="uc-answer" type="text" value="<?php echo ( is_numeric( absint( $avatar ) ) ? absint( $avatar ) : esc_url($avatar) ); ?>" /> 40 </p> 41 42 ` 43 Having the `uc-call` for the link, `uc-answer` with the input field and `uc-container` for the box with both the link and the input field. 44 45 All the stuff is customizable by passing the variables in to the array `$args`, some stuff must be passed in the url, but later on I will add a easier way to do it. 46 47 == Backlog == 48 49 = 0.0.2 = 50 * Added the javascript to change the Insert to Post text on the thickbox 51 52 = 0.0.1 = 53 * Using the the thickbox with the uploader iFrame inside you can call this from any page that has the script enqueued 54 55 56 == Upgrade Notice == 57 58 = 0.0.2 = 59 To add the possibility to change the Insert to Post button on the thickbox 60 61 = 0.0.1 = 62 This is the first version, give the plugin a try! 63 15 64 16 65 If you want you can check the plugin on GitHub, I will update there then I will commmit here.
Note: See TracChangeset
for help on using the changeset viewer.