Plugin Directory

Changeset 213105


Ignore:
Timestamp:
03/04/2010 06:10:11 PM (16 years ago)
Author:
geraint
Message:
 
Location:
file-proxy/trunk/com/twothirdsdesign/file-proxy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/admin/admin.php

    r213089 r213105  
    3939   
    4040    function upload_form_filter( $form_fields, $post ){
    41         $link = $this->m->generate_url( $post->ID );
     41        $link = "[file-proxy-url]{$post->ID}[/file-proxy-url]";
    4242        $form_fields['url']['html'] = $form_fields['url']['html'] . "<button type='button' class='button urlfileproxy' title='" . esc_attr($link) . "'>" . __( 'File Proxy', $this->domain ) . "</button>";
    4343        return $form_fields;
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/ttd_file_proxy.php

    r212172 r213105  
    4848       
    4949        // shortcodes
    50         add_shortcode('file-proxy', array(&$this, 'return_proxy_url'));
     50        add_shortcode('file-proxy', array(&$this, 'return_proxy_link'));
     51        add_shortcode('file-proxy-url', array(&$this, 'return_proxy_url'));
    5152       
    5253        // adds proxy rewrite rule & query_var
     
    278279     * @since 0.1
    279280     **/
    280     public function return_proxy_url($atts, $content = '')
     281    public function return_proxy_link($atts, $content = '')
    281282    {   
    282283        global $wpdb;
    283284       
    284285        extract(shortcode_atts(array(
    285                 'id' => '',
    286                 'alt' => 'Some Really Great File',
     286                'id' => '0',
     287                'alt' => '',
     288                'type' => 'link',
    287289            ), $atts));
    288290           
     
    298300        //if( !is_user_logged_in() )
    299301        //  $title = $title . " - Login to download this file.";
    300         echo "<a href='{$link}' alt='{$alt}'>{$title}</a>";
    301     }
     302        switch( $type )
     303        {   
     304            case 'url':
     305                echo $link;
     306                break;
     307               
     308            case 'link':
     309            default:
     310                echo "<a href='{$link}' alt='{$alt}'>{$title}</a>";
     311                break;
     312        }
     313    }
     314   
     315    public function return_proxy_url($atts, $content = '')
     316    {   
     317        global $wpdb;
     318        $id = intval($content);
     319       
     320        $link = $this->generate_url($id);
     321        echo $link;
     322    }
     323       
    302324   
    303325    /**
Note: See TracChangeset for help on using the changeset viewer.