Changeset 548694
- Timestamp:
- 05/24/2012 08:12:08 PM (14 years ago)
- Location:
- pretty-file-links/trunk
- Files:
-
- 2 added
- 7 edited
-
PrettyFileLinks.php (modified) (8 diffs)
-
images/silk_icons/ipod.png (added)
-
images/silk_icons/music.png (added)
-
readme.txt (modified) (3 diffs)
-
styles/prettylinks.css (modified) (1 diff)
-
styles/prettylinks_fully_inline.css (modified) (1 diff)
-
styles/prettylinks_inline.css (modified) (1 diff)
-
styles/prettylinks_shiny.css (modified) (1 diff)
-
styles/prettylinks_split.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pretty-file-links/trunk/PrettyFileLinks.php
r535407 r548694 4 4 Plugin URI: http://www.smartredfox.com/prettylinks 5 5 Description: A plugin that makes file links in pages much prettier. 6 Version: 0. 66 Version: 0.7 7 7 Author: James Botham 8 8 Author URI: http://www.smartredfox.com … … 21 21 if(!is_admin()) 22 22 { 23 add_shortcode('prettyfilelink', array($this, 'prettyfilelinks_shortcode'));23 add_shortcode('prettyfilelink', array($this, 'prettyfilelinks_shortcode')); 24 24 } 25 25 } 26 26 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 */ 30 30 function plugin_defines() 31 {31 { 32 32 define( 'PRETTY_FILE_LINK_PATH', trailingslashit( WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__ ),"",plugin_basename( __FILE__ ) ) ) ); 33 33 define( 'PRETTY_FILE_LINK_URL' , trailingslashit( WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__ ),"",plugin_basename( __FILE__ ) ) ) ); 34 34 } 35 35 36 /** 36 /** 37 37 * Setup the actions to hook the plugin into WordPress at the appropriate places 38 38 */ 39 39 function setup_actions(){ 40 if(!is_admin())41 {42 //Add stylesheets43 add_action('init', array($this,'prettyfilelinks_stylesheets'));44 }45 else46 {47 //Add option to media upload page in admin48 add_filter( 'attachment_fields_to_edit', array($this,'srf_attachment_field_prettylinks'), 10, 2 );49 //Filter to add shortcode into content from admin50 add_filter('media_send_to_editor', array($this,'srf_add_prettylinks_shortcode_to_editor'), 20, 3);51 //Attach the settings menu52 add_action('admin_menu', array($this,'srf_prettylinks_admin_menu'));53 //Attach save event for Settings page54 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 } 57 57 58 58 //Output shortcode … … 61 61 extract(shortcode_atts(array( 62 62 "type" => "note", 63 "src" => "#" 63 "src" => "#", 64 "newwindow" => false 64 65 ), $atts)); 65 66 66 $returnString = '<a class="prettylink ' . $type . '"href="' . $src .'">' . $content .'</a>';67 $returnString = '<a class="prettylink ' . $type . '" ' . ($newwindow ? 'target="_blank"' : '') . ' href="' . $src .'">' . $content .'</a>'; 67 68 68 69 return $returnString; … … 78 79 79 80 //Add our prettylist stylesheet 80 if($option s['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 first84 //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 version91 $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 } 93 94 } 94 95 … … 143 144 144 145 //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) { 146 147 147 148 //See if we need to make it pretty … … 172 173 $type = "video"; 173 174 break; 175 case "audio/mpeg3": 176 case "audio/x-mpeg-3": 177 $type = "mp3"; 178 break; 174 179 case "application/doc": 175 180 case "'application/vnd.msword": … … 202 207 203 208 //If we matched a type create our shortcode 204 if( type != "")209 if($type != "") 205 210 { 206 211 $src = wp_get_attachment_url( $id ); … … 293 298 echo '</select></p><p><input type="submit" class="button-primary" value="Save Changes" /></p> 294 299 <h3 style="clear:both;width:100%;">Current style example:</h3> 295 <a href="#" class="prettylink pdf">A pdfexample pretty file link</a>300 <a href="#" class="prettylink doc">A Word document example pretty file link</a> 296 301 <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> 299 306 <a href="#" class="prettylink zip">A Zip file example pretty file link</a> 300 307 </form> -
pretty-file-links/trunk/readme.txt
r535407 r548694 1 1 === Plugin Name === 2 2 Contributors: smartredfox 3 Tags: download link, pdf, doc, xls, zip, file links3 Tags: file download link, pdf, doc, xls, zip, file links 4 4 Requires at least: 3.0.0 5 Tested up to: 3.3. 16 Stable tag: 0. 65 Tested up to: 3.3.2 6 Stable tag: 0.7 7 7 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/).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/). 9 9 10 10 == Description == … … 27 27 6. An example of a pretty file link using the fully inline style. 28 28 29 == Usage == 30 31 1. Upload a file to a post/page. 32 2. Before clicking insert into post choose the "Make pretty link option". 33 3. Click insert into post or page. 34 35 Alternatively 36 37 Copy and past the shortcode directly into your page - [prettyfilelink src="http://www,smartredfox.com" type="pdf" newwindow="false"]The link text[/prettyfilelink] 38 29 39 == Changelog == 30 40 … … 44 54 = 0.6 = 45 55 * 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. 46 59 47 60 == Upgrade Notice == -
pretty-file-links/trunk/styles/prettylinks.css
r535406 r548694 72 72 73 73 /*Set icons*/ 74 a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;} 75 a.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 */ 74 77 a.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;} 78 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;} 79 a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;} 80 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;} 76 81 /*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/ 77 82 a.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 36 36 } 37 37 38 39 38 /*Set icons*/ 39 a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;} 40 a.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 */ 40 42 a.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;} 43 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;} 44 a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;} 45 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;} 42 46 /*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/ 43 47 a.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 72 72 73 73 /*Set icons*/ 74 a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;} 75 a.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 */ 74 77 a.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;} 78 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;} 79 a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;} 80 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;} 76 81 /*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/ 77 82 a.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 69 69 } 70 70 71 72 71 /*Set icons*/ 72 a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 0 0;} 73 a.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 */ 73 75 a.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;} 76 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 0 0;} 77 a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 0 0;} 78 a.video:after{background:transparent url(../images/silk_icons/film.png) no-repeat 0 0;} 75 79 /*a.zip:after{background:transparent url(../images/silk_icons/page_white_compressed.png) no-repeat 0 0;} - Alternative icon*/ 76 80 a.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 81 81 82 82 /*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%;} 83 a.doc:after{background:transparent url(../images/silk_icons/page_word.png) no-repeat 50% 50%;} 84 a.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 */ 86 a.pdf:after{background:transparent url(../images/silk_icons/page_white_acrobat.png) no-repeat 50% 50%;} 87 a.ppt:after{background:transparent url(../images/silk_icons/page_white_powerpoint.png) no-repeat 50% 50%;} 88 a.xls:after{background:transparent url(../images/silk_icons/page_excel.png) no-repeat 50% 50%;} 89 a.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*/ 91 a.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.