Plugin Directory

Changeset 211980


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

Legend:

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

    r211919 r211980  
    44 *
    55 * @author      Geraint Palmer
    6  * @version     1.0.1     
     6 * @version     1.0.2     
    77 */
    88class GcpOptions
     
    2626        {
    2727            // tries to create a cache from wordpress DB options table.// uses plugin preset options not in db
    28             $this->_optioncache =  unserialize( get_option( $this->options_key, false ));
     28            $this->_optioncache = unserialize( get_option( $this->options_key , false ));
    2929            if (!$this->_optioncache) $this->_optioncache = $this->_options;
    3030        }
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/ttd_file_proxy.php

    r211903 r211980  
    2020        'url-key'       => 'file',
    2121        'cache'         => 'off',
     22        'permalinks'    => 'off',
    2223    );
    2324   
     
    257258        $id = intval($id);
    258259        $file_name = $wpdb->get_var( $wpdb->prepare( "SELECT guid FROM {$wpdb->prefix}posts WHERE id=%d", $id ));
    259         $file_name = $file_name = explode( DS , $file_name );
     260        $file_name = explode( DS , $file_name );
    260261        $file_name = $file_name[( count($file_name)-1 )];
    261        
    262         $link =  get_bloginfo('url') .'/index.php?'. $this->options->get_option('url-key') .'='. $id;
     262   
     263       
    263264        $title = empty($content) ? $file_name : $content ;
    264265       
     
    267268        echo "<a href='{$link}' alt='{$alt}'>{$title}</a>";
    268269    }
     270   
     271    /**
     272     * Constructs the correct Download URI
     273     *
     274     * @return String
     275     * @author Geraint Palmer
     276     * @since 0.5
     277     **/
     278    private function generate_url($id)
     279    {
     280        global $wp_rewrite;
     281       
     282        $link =  get_bloginfo('url') .'/index.php?'. $this->options->get_option('url-key') .'='. $id;
     283       
     284        if ( $this->get_option('permalink') == 'on' )
     285        {   
     286            if( $wp_rewrite->using_permalinks() )
     287                $link =  get_bloginfo('url') .'/'. $this->get_option('url-key') .'/'. $id ."/";
     288            else if( $wp_rewite->using_index_permalinks() )
     289                $link =  get_bloginfo('url') .'/index.php/'. $this->get_option('url-key') .'/'. $id ."/";
     290        }
     291        return $link;
     292    }
    269293}
    270294?>
Note: See TracChangeset for help on using the changeset viewer.