Plugin Directory

Changeset 548694


Ignore:
Timestamp:
05/24/2012 08:12:08 PM (14 years ago)
Author:
smartredfox
Message:

Added two new mime types - mp3 and quicktime video.
Added option for opening in a new window.
Fixed a few bugs.

Location:
pretty-file-links/trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • pretty-file-links/trunk/PrettyFileLinks.php

    r535407 r548694  
    44   Plugin URI: http://www.smartredfox.com/prettylinks
    55   Description: A plugin that makes file links in pages much prettier.
    6    Version: 0.6
     6   Version: 0.7
    77   Author: James Botham
    88   Author URI: http://www.smartredfox.com
     
    2121        if(!is_admin())
    2222        {
    23             add_shortcode('prettyfilelink', array($this, 'prettyfilelinks_shortcode'));
     23                    add_shortcode('prettyfilelink', array($this, 'prettyfilelinks_shortcode'));
    2424        }
    2525    } 
    2626
    27     /**
    28      * Defines to be used anywhere in WordPress after the plugin has been initiated.
    29      */ 
     27    /**
     28    * Defines to be used anywhere in WordPress after the plugin has been initiated.
     29    */ 
    3030    function plugin_defines()
    31     {
     31    {
    3232        define( 'PRETTY_FILE_LINK_PATH', trailingslashit( WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__ ),"",plugin_basename( __FILE__ ) ) ) ); 
    3333        define( 'PRETTY_FILE_LINK_URL' , trailingslashit( WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__ ),"",plugin_basename( __FILE__ ) ) ) );   
    3434    } 
    3535 
    36     /** 
     36    /**
    3737     * Setup the actions to hook the plugin into WordPress at the appropriate places
    3838     */ 
    3939    function setup_actions(){
    40         if(!is_admin())
    41         {
    42             //Add stylesheets
    43             add_action('init', array($this,'prettyfilelinks_stylesheets'));
    44         }
    45         else
    46         {           
    47             //Add option to media upload page in admin
    48             add_filter( 'attachment_fields_to_edit', array($this,'srf_attachment_field_prettylinks'), 10, 2 );
    49             //Filter to add shortcode into content from admin
    50             add_filter('media_send_to_editor', array($this,'srf_add_prettylinks_shortcode_to_editor'), 20, 3);
    51             //Attach the settings menu
    52             add_action('admin_menu', array($this,'srf_prettylinks_admin_menu'));
    53             //Attach save event for Settings page
    54             add_filter( 'attachment_fields_to_save', array($this,'srf_attachment_field_prettylinks_save'), 10, 2 );             
    55         }
    56    
     40            if(!is_admin())
     41            {
     42                //Add stylesheets
     43                add_action('init', array($this,'prettyfilelinks_stylesheets'));
     44            }
     45            else
     46            {           
     47                //Add option to media upload page in admin
     48                add_filter( 'attachment_fields_to_edit', array($this,'srf_attachment_field_prettylinks'), 10, 2 );
     49                //Filter to add shortcode into content from admin
     50                add_filter('media_send_to_editor', array($this,'srf_add_prettylinks_shortcode_to_editor'), 20, 3);
     51                //Attach the settings menu
     52                add_action('admin_menu', array($this,'srf_prettylinks_admin_menu'));
     53                //Attach save event for Settings page
     54                add_filter( 'attachment_fields_to_save', array($this,'srf_attachment_field_prettylinks_save'), 10, 2 );             
     55            }
     56
    5757     
    5858    //Output shortcode
     
    6161        extract(shortcode_atts(array( 
    6262            "type" => "note",
    63             "src" => "#"
     63            "src" => "#",
     64                        "newwindow" => false
    6465        ), $atts));
    6566       
    66         $returnString = '<a class="prettylink '. $type . '" href="' . $src .'">' . $content .'</a>';
     67        $returnString = '<a class="prettylink ' . $type . '" ' . ($newwindow ? 'target="_blank"' : '') . ' href="' . $src .'">' . $content .'</a>';
    6768
    6869        return $returnString;
     
    7879
    7980        //Add our prettylist stylesheet
    80         if($options['stylesheet_to_use'] != ""){
    81             //See if the selected style has a hash in it (this means it's an alt style)
    82             if(strpos($options['stylesheet_to_use'],'#') > 0){
    83                 //See if the file exists in the template directory first
    84                 //if(!file_exists($stylesheet_url)){
    85                 $cleanOption = str_replace("#", "", $option);
    86                 $stylesheet_url = (get_bloginfo('template_url') . '/prettystyles/' . $cleanOption);
    87                 //}
    88             }
    89             else{
    90                 //If not, fallback to plugin version
    91                 $stylesheet_url = PRETTY_FILE_LINK_URL . '/styles/' . $options['stylesheet_to_use'];   
    92             }
     81        if($option != ""){
     82                    //See if the selected style has a hash in it (this means it's an alt style)
     83                    if(strpos($option,'#') > 0){
     84                        //See if the file exists in the template directory first
     85                        //if(!file_exists($stylesheet_url)){
     86                        $cleanOption = str_replace("#", "", $option);
     87                        $stylesheet_url = (get_bloginfo('template_url') . '/prettystyles/' . $cleanOption);
     88                        //}
     89                    }
     90                    else{
     91                        //If not, fallback to plugin version
     92                        $stylesheet_url = PRETTY_FILE_LINK_URL . '/styles/' . $option
     93                    }
    9394        }
    9495       
     
    143144   
    144145    //Insert shortcode into the editor
    145     function srf_add_prettylinks_shortcode_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) {   
     146    function srf_add_prettylinks_shortcode_to_editor($html, $id, $attachment) {   
    146147
    147148      //See if we need to make it pretty
     
    172173            $type = "video";
    173174            break;
     175                  case "audio/mpeg3":
     176                  case  "audio/x-mpeg-3":
     177                        $type = "mp3";
     178                        break;
    174179          case "application/doc":
    175180          case "'application/vnd.msword":
     
    202207       
    203208        //If we matched a type create our shortcode
    204         if(type != "")
     209        if($type != "")
    205210        {
    206211          $src = wp_get_attachment_url( $id );   
     
    293298      echo '</select></p><p><input type="submit" class="button-primary" value="Save Changes" /></p>
    294299        <h3 style="clear:both;width:100%;">Current style example:</h3>
    295         <a href="#" class="prettylink pdf">A pdf example pretty file link</a>
     300        <a href="#" class="prettylink doc">A Word document example pretty file link</a>
    296301        <a href="#" class="prettylink xls">An Excel spreadsheet example pretty file link</a>
    297         <a href="#" class="prettylink ppt">A PowerPoint example pretty file link</a>
    298         <a href="#" class="prettylink doc">A Word document example pretty file link</a>
     302                <a href="#" class="prettylink mp3">An mp3 file example pretty file link</a>     
     303                <a href="#" class="prettylink pdf">A pdf example pretty file link</a>
     304                <a href="#" class="prettylink ppt">A PowerPoint example pretty file link</a>
     305        <a href="#" class="prettylink video">A video file example pretty file link</a>
    299306        <a href="#" class="prettylink zip">A Zip file example pretty file link</a>
    300307        </form>   
  • pretty-file-links/trunk/readme.txt

    r535407 r548694  
    11=== Plugin Name ===
    22Contributors: smartredfox
    3 Tags: download link, pdf, doc, xls, zip, file links
     3Tags: file download link, pdf, doc, xls, zip, file links
    44Requires at least: 3.0.0
    5 Tested up to: 3.3.1
    6 Stable tag: 0.6
     5Tested up to: 3.3.2
     6Stable tag: 0.7
    77
    8 The Pretty file links plugin makes your links to files look great without you having to do any work. It’s designed to be very easy to use, and even comes with built in styles for different set ups. You can see examples of Pretty File Links at [www.SmartRedFox.com](http://www.smartredfox.com/pretty-file-links-wordpress-plugin/).
     8The Pretty file links plugin makes your links to files look great without you having to do any work. Its designed to be very easy to use, and even comes with built in styles for different set ups. You can see examples of Pretty File Links at [www.SmartRedFox.com](http://www.smartredfox.com/pretty-file-links-wordpress-plugin/).
    99
    1010== Description ==
     
    27276. An example of a pretty file link using the fully inline style.
    2828
     29== Usage ==
     30
     311. Upload a file to a post/page.
     322. Before clicking insert into post choose the "Make pretty link option".
     333. Click insert into post or page.
     34
     35Alternatively
     36
     37Copy and past the shortcode directly into your page - [prettyfilelink src="http://www,smartredfox.com" type="pdf" newwindow="false"]The link text[/prettyfilelink]
     38
    2939== Changelog ==
    3040
     
    4454= 0.6 =
    4555* Fixed bug stopping users from picking styles in the admin.
     56= 0.7 =
     57* Added option to make links open in new window.
     58* Added two new file types - mp3 and video.
    4659
    4760== Upgrade Notice ==
  • pretty-file-links/trunk/styles/prettylinks.css

    r535406 r548694  
    7272
    7373/*Set icons*/
     74a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;}
     75a.mp3:after{background:transparent url(../images/silk_icons/music.png) no-repeat 0 0;}
     76/*a.mp3:after{background:transparent url(../images/silk_icons/ipod.png) no-repeat 0 0;} - Alternative icon */
    7477a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat 0 0;}
    75 a.doc:after{background:transparent url(../images/silk_icons/page_white_word.png) no-repeat 0 0;}
     78a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
     79a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;}
     80a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
    7681/*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/
    7782a.zip:after{background:transparent url(../images/silk_icons/page_white_zip.png) no-repeat 0 0;}
    78 a.xls:after{background:transparent url(../images/silk_icons/page_white_excel.png) no-repeat 0 0;}
    79 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
    80 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
  • pretty-file-links/trunk/styles/prettylinks_fully_inline.css

    r536084 r548694  
    3636}
    3737
    38 
    3938/*Set icons*/
     39a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;}
     40a.mp3:after{background:transparent url(../images/silk_icons/music.png) no-repeat 0 0;}
     41/*a.mp3:after{background:transparent url(../images/silk_icons/ipod.png) no-repeat 0 0;} - Alternative icon */
    4042a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat 0 0;}
    41 a.doc:after{background:transparent url(../images/silk_icons/page_white_word.png) no-repeat 0 0;}
     43a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
     44a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;}
     45a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
    4246/*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/
    4347a.zip:after{background:transparent url(../images/silk_icons/page_white_zip.png) no-repeat 0 0;}
    44 a.xls:after{background:transparent url(../images/silk_icons/page_white_excel.png) no-repeat 0 0;}
    45 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
    46 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
  • pretty-file-links/trunk/styles/prettylinks_inline.css

    r535406 r548694  
    7272
    7373/*Set icons*/
     74a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;}
     75a.mp3:after{background:transparent url(../images/silk_icons/music.png) no-repeat 0 0;}
     76/*a.mp3:after{background:transparent url(../images/silk_icons/ipod.png) no-repeat 0 0;} - Alternative icon */
    7477a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat 0 0;}
    75 a.doc:after{background:transparent url(../images/silk_icons/page_white_word.png) no-repeat 0 0;}
     78a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
     79a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;}
     80a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
    7681/*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/
    7782a.zip:after{background:transparent url(../images/silk_icons/page_white_zip.png) no-repeat 0 0;}
    78 a.xls:after{background:transparent url(../images/silk_icons/page_white_excel.png) no-repeat 0 0;}
    79 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
    80 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
  • pretty-file-links/trunk/styles/prettylinks_shiny.css

    r535406 r548694  
    6969}
    7070
    71 
    7271/*Set icons*/
     72a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;}
     73a.mp3:after{background:transparent url(../images/silk_icons/music.png) no-repeat 0 0;}
     74/*a.mp3:after{background:transparent url(../images/silk_icons/ipod.png) no-repeat 0 0;} - Alternative icon */
    7375a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat 0 0;}
    74 a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;}
     76a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
     77a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;}
     78a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
    7579/*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/
    7680a.zip:after{background:transparent url(../images/silk_icons/page_white_zip.png) no-repeat 0 0;}
    77 a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;}
    78 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;}
    79 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;}
    80 
  • pretty-file-links/trunk/styles/prettylinks_split.css

    r535406 r548694  
    8181
    8282/*Set icons*/
    83 a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat 50% 50%;}
    84 a.doc:after{background:transparent url(../images/silk_icons/page_white_word.png) no-repeat 50% 50%;}
    85 /*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 50% 50%;} - Alternative icon*/
    86 a.zip:after{background:transparent url(../images/silk_icons/page_white_zip.png) no-repeat 50% 50%;}
    87 a.xls:after{background:transparent url(../images/silk_icons/page_white_excel.png) no-repeat 50% 50%;}
    88 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 50% 50%;}
    89 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 50% 50%;}
     83a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 50% 50%;}
     84a.mp3:after{background:transparent url(../images/silk_icons/music.png) no-repeat  50% 50%;}
     85/*a.mp3:after{background:transparent url(../images/silk_icons/ipod.png) no-repeat  50% 50%;} - Alternative icon */
     86a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat  50% 50%;}
     87a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat  50% 50%;}
     88a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat  50% 50%;}
     89a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat  50% 50%;}
     90/*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat  50% 50%;} - Alternative icon*/
     91a.zip:after{background:transparent url(../images/silk_icons/page_white_zip.png) no-repeat  50% 50%;}
Note: See TracChangeset for help on using the changeset viewer.