WordPress.org

Plugin Directory

Changeset 527691


Ignore:
Timestamp:
04/05/12 15:47:08 (2 years ago)
Author:
webord
Message:

Better Readme.txt and Version 0.0.2

Location:
extend-upload/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extend-upload/trunk/extend-upload.php

    r525551 r527691  
    33Plugin Name: Extend WordPress Upload 
    44Plugin URI: http://bordoni.me/wp/plugins/extend-upload 
    5 Version: 0.0.1 
     5Version: 0.0.2 
    66Description: A WordPress plugin to Extend the default WordPress upload 
    77Author: Quatix 
     
    2727        $pluginurl = preg_replace( '/^https/', 'http', $pluginurl ); 
    2828 
    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' ); 
    3131}, 5 ); 
    3232 
     
    3535    return $html; 
    3636}, 10, 8 ); 
     37 
     38add_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  
    55Requires at least: 3.0 
    66Tested up to: 3.3.1 
    7 Stable tag: 0.0.1 
     7Stable tag: 0.0.2 
    88 
    99A plugin for developers to Extend WordPress upload to be able to use it at any place. 
     
    1313I 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. 
    1414 
     15To 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 
     22Then 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` 
     30And 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` 
     43Having 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 
     45All 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 = 
     59To add the possibility to change the Insert to Post button on the thickbox 
     60 
     61= 0.0.1 = 
     62This is the first version, give the plugin a try! 
     63 
    1564 
    1665If 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.