Changeset 535687
- Timestamp:
- 04/24/2012 06:06:36 PM (14 years ago)
- Location:
- ribbon-maker
- Files:
-
- 2 added
- 6 edited
- 14 copied
-
tags/1.0 (copied) (copied from ribbon-maker/trunk)
-
tags/1.0/readme.txt (copied) (copied from ribbon-maker/trunk/readme.txt) (5 diffs)
-
tags/1.0/readme.txt~ (copied) (copied from ribbon-maker/trunk/readme.txt~) (5 diffs)
-
tags/1.0/ribbon-maker.php (copied) (copied from ribbon-maker/trunk/ribbon-maker.php) (5 diffs)
-
tags/1.0/ribbon-maker.php~ (copied) (copied from ribbon-maker/trunk/ribbon-maker.php~) (5 diffs)
-
tags/1.0/ribbon-maker.png (copied) (copied from ribbon-maker/trunk/ribbon-maker.png)
-
tags/1.0/ribbon_maker_ribbon.png (copied) (copied from ribbon-maker/trunk/ribbon_maker_ribbon.png)
-
tags/1.0/screenshot-1.png (copied) (copied from ribbon-maker/trunk/screenshot-1.png)
-
tags/1.0/screenshot-2.png (copied) (copied from ribbon-maker/trunk/screenshot-2.png)
-
tags/1.0/screenshot-3.png (added)
-
tags/1.0/the-image.php (copied) (copied from ribbon-maker/trunk/the-image.php)
-
tags/1.0/the-image.php~ (copied) (copied from ribbon-maker/trunk/the-image.php~)
-
tags/1.0/the-image2.php (copied) (copied from ribbon-maker/trunk/the-image2.php)
-
tags/1.0/the-image3.php (copied) (copied from ribbon-maker/trunk/the-image3.php)
-
tags/1.0/the-image3.php~ (copied) (copied from ribbon-maker/trunk/the-image3.php~)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/readme.txt~ (modified) (5 diffs)
-
trunk/ribbon-maker.php (modified) (5 diffs)
-
trunk/ribbon-maker.php~ (modified) (5 diffs)
-
trunk/screenshot-1.png (modified) (previous)
-
trunk/screenshot-2.png (modified) (previous)
-
trunk/screenshot-3.png (added)
Legend:
- Unmodified
- Added
- Removed
-
ribbon-maker/tags/1.0/readme.txt
r535518 r535687 5 5 Requires at Least: 3.0.0 6 6 Tested Up To: 3.3.2 7 Stable tag: 0.17 Stable tag: 1.0 8 8 9 9 Make your own ribbon now without waiting for a plugin designer to do it for you. … … 11 11 == Description == 12 12 13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text.13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. You can also control the visibility of the of ribbon so you don't have to deactivate when it is not in use. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text. 14 14 15 15 == Installation == … … 24 24 25 25 == Changelog == 26 = 1.0 = 27 Cropping has been achieved. Also added a radio button to control the visibility of the ribbon. Ribbon generates only during the configuration and not constantly as in v0.1. Added a preview of the ribbon, so you can view it before you make it active. 26 28 27 29 = 0.1 = … … 47 49 48 50 == Upgrade Notice == 51 = 1.0 = 52 Now with cropping, ribbon hiding on demand, and preview. 53 54 = 0.1 = 49 55 Considered to be an upgrade for anyone having a static ribbon created by another ribbon plugin. 50 56 … … 52 58 This plugin requires the GD image library in your PHP 5.x installation to be enabled and fully operational. 53 59 == TODO == 54 1. Dynamically resample the image (crop) so that it is properly clipped appears nicely on your blog. -- Needed to Achieve Release 1.0 55 2. Add an option that you can use to turn off cropping. 56 3. Fix transparency issue. 57 4. Allow you to create multiple ribbons. 58 5. Allow you to have multiple ribbons on a page. 59 6. Allow ribbons to be scheduled. 60 1. Give you more control of how the ribbon graphic looks. 61 2. Fix transparency issue. 62 3. Allow you to create multiple ribbons. 63 4. Allow you to have multiple ribbons on a page. 64 5. Allow ribbons to be scheduled. -
ribbon-maker/tags/1.0/readme.txt~
r535518 r535687 5 5 Requires at Least: 3.0.0 6 6 Tested Up To: 3.3.2 7 Stable tag: 0.17 Stable tag: 1.0 8 8 9 9 Make your own ribbon now without waiting for a plugin designer to do it for you. … … 11 11 == Description == 12 12 13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text.13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. You can also control the visibility of the of ribbon so you don't have to deactivate when it is not in use. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text. 14 14 15 15 == Installation == … … 20 20 21 21 == Screenshots == 22 1. Here's how the ribbon will appear on your website. Will link to the http://www.avaaz.org/en/stop_cispa/ website. 22 1. The configuration screen found under Tools -> Ribbon Maker 23 2. Here's how the ribbon will appear on your website. 23 24 24 25 == Changelog == 26 = 1.0 = 27 Cropping has been achieved. Also added a radio button to control the visibility of the ribbon. Ribbon generates only during the configuration and not constantly as in v0.1 25 28 26 29 = 0.1 = … … 46 49 47 50 == Upgrade Notice == 51 = 1.0 = 52 Now with cropping and ribbon hiding on demand. 53 54 = 0.1 = 48 55 Considered to be an upgrade for anyone having a static ribbon created by another ribbon plugin. 49 56 … … 51 58 This plugin requires the GD image library in your PHP 5.x installation to be enabled and fully operational. 52 59 == TODO == 53 1. Dynamically resample the image (crop) so that it is properly clipped appears nicely on your blog. -- Needed to Achieve Release 1.0 54 2. Add an option that you can use to turn off cropping. 55 3. Fix transparency issue. 56 4. Allow you to create multiple ribbons. 57 5. Allow you to have multiple ribbons on a page. 58 6. Allow ribbons to be scheduled. 60 1. Give you more control of how the ribbon graphic looks. 61 2. Fix transparency issue. 62 3. Allow you to create multiple ribbons. 63 4. Allow you to have multiple ribbons on a page. 64 5. Allow ribbons to be scheduled. -
ribbon-maker/tags/1.0/ribbon-maker.php
r535518 r535687 5 5 Description: When activated, this plugin will put a ribbon of your design, message and custom link on the top right corner of your website. 6 6 Author: Al Lamb 7 Version: 0.17 Version: 1.0 8 8 License: GPLv2 9 9 Author URI: http://bowierocks.com … … 12 12 function ribbon_maker_admin() { 13 13 add_submenu_page( 'tools.php', 'Ribbon Maker Settings', 'Ribbon Maker', 10, __FILE__, 'ribbon_maker_admin_menu' ); 14 } 15 16 function ribbon_maker_isChecked($test,$string) { 17 if($test==$string) return "checked"; 18 return ""; 14 19 } 15 20 … … 34 39 $str = strtr( $_POST['ribbon_maker_fgcolor'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 35 40 $ribbon_maker .= update_option( 'ribbon_maker_fgcolor', $str ); 41 $str = strtr( $_POST['ribbon_maker_active'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 42 $ribbon_maker .= update_option( 'ribbon_maker_active', $str ); 36 43 if ( $ribbon_maker ) 37 44 echo('<div class="updated"><p><strong>Your setting have been saved.</strong></p></div>'); 38 45 else 39 46 echo('<div class="error"><p><strong>Your setting have not been saved.</strong></p></div>'); 47 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 40 48 } 41 49 50 echo "<hr>Ribbon Preview: <img valign='top' src='".plugins_url("ribbon_maker_ribbon.png",__FILE__)."'><br>"; 42 51 echo(' 43 52 <form action="" method="post"> … … 63 72 <tr><td>User Vertical Offset<br/><span class="ribbon_maker_hint">Enter a positive number to push the ribbon down, negative for up. Suggest 28 to offset the USER bar.</span></td> 64 73 <td><input type="text" name="ribbon_maker_user_offset" size="5" maxlength=5 value="'.get_option( 'ribbon_maker_user_offset','0' ).'"></td> 74 </tr> 75 <tr><td>Make Ribbon Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will be visible on your blog.</span></td> 76 <td><input type="radio" name="ribbon_maker_active" value="active" '.ribbon_maker_isChecked('active',get_option('ribbon_maker_active')).'></td> 77 </tr> 78 <tr><td>Make Ribbon In-Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will NOT be visible on your blog.</span></td> 79 <td><input type="radio" name="ribbon_maker_active" value="inactive" '.ribbon_maker_isChecked('inactive',get_option('ribbon_maker_active')).'></td> 65 80 </tr> 66 81 <hr /> … … 114 129 $text_color = imagecolorallocate ($im, (int)ribbon_maker_get_color($fgcolor,"red"), (int)ribbon_maker_get_color($fgcolor,"green"), (int)ribbon_maker_get_color($fgcolor,"blue")); 115 130 131 imagesetthickness($im,2); 116 132 imageline($im, 0,2,$width,2,$draw_color); 117 133 134 imagesetthickness($im,1); 118 135 imagefilledrectangle($im,0,4,$width,$height-5,$draw_color); 119 136 137 imagesetthickness($im,2); 120 138 imageline($im, 0,$height-3,$width,$height-3,$draw_color); 121 139 140 imagesetthickness($im,1); 122 141 imagestring ($im, $font, ImageFontWidth($font)*2, 3, $string, $text_color); 123 142 124 143 $new_img = imagerotate ($im, 360-45, 0); 125 144 126 imagecolortransparent($new_img,$back); 145 //now we shall try and crop the image, increase its dpi and thus make the ribbon flush 146 //all in one go 147 imagedestroy ($im); 148 $newWidth=imagesx($new_img)-ImageFontWidth($font); 149 $newHeight=imagesy($new_img)-ImageFontHeight($font); 150 $im = imagecreatetruecolor($newWidth,$newHeight); 151 152 /* 153 bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) 154 */ 155 imagecopyresampled($im,$new_img,0,0,0,ImageFontHeight($font),$newWidth,$newHeight,imagesx($new_img)-ImageFontWidth($font)*2,imagesy($new_img)-ImageFontHeight($font)); 127 156 157 imagecolortransparent($im,$back); 128 158 129 imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 159 //imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 160 imagepng ($im,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 161 imagedestroy ($new_img); 130 162 imagedestroy ($im); 131 imagedestroy ($new_img);132 163 } 133 164 134 165 function render_ribbon_maker() { 135 if(is_admin_bar_showing()) 136 $offset = get_option("ribbon_maker_admin_offset"); 137 else 138 $offset = get_option("ribbon_maker_user_offset"); 139 140 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 166 if(get_option("ribbon_maker_active")=="active") { 167 if(is_admin_bar_showing()) 168 $offset = get_option("ribbon_maker_admin_offset"); 169 else 170 $offset = get_option("ribbon_maker_user_offset"); 171 172 // ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 141 173 142 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__);174 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__); 143 175 144 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 176 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 177 } 145 178 } 146 179 -
ribbon-maker/tags/1.0/ribbon-maker.php~
r535518 r535687 5 5 Description: When activated, this plugin will put a ribbon of your design, message and custom link on the top right corner of your website. 6 6 Author: Al Lamb 7 Version: 0.17 Version: 1.0 8 8 License: GPLv2 9 9 Author URI: http://bowierocks.com … … 12 12 function ribbon_maker_admin() { 13 13 add_submenu_page( 'tools.php', 'Ribbon Maker Settings', 'Ribbon Maker', 10, __FILE__, 'ribbon_maker_admin_menu' ); 14 } 15 16 function ribbon_maker_isChecked($test,$string) { 17 if($test==$string) return "checked"; 18 return ""; 14 19 } 15 20 … … 34 39 $str = strtr( $_POST['ribbon_maker_fgcolor'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 35 40 $ribbon_maker .= update_option( 'ribbon_maker_fgcolor', $str ); 41 $str = strtr( $_POST['ribbon_maker_active'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 42 $ribbon_maker .= update_option( 'ribbon_maker_active', $str ); 36 43 if ( $ribbon_maker ) 37 44 echo('<div class="updated"><p><strong>Your setting have been saved.</strong></p></div>'); 38 45 else 39 46 echo('<div class="error"><p><strong>Your setting have not been saved.</strong></p></div>'); 47 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 40 48 } 41 49 50 echo "<hr>Ribbon Preview: <img valign='top' src='".plugins_url("ribbon_maker_ribbon.png",__FILE__)."'><br>"; 42 51 echo(' 43 52 <form action="" method="post"> … … 63 72 <tr><td>User Vertical Offset<br/><span class="ribbon_maker_hint">Enter a positive number to push the ribbon down, negative for up. Suggest 28 to offset the USER bar.</span></td> 64 73 <td><input type="text" name="ribbon_maker_user_offset" size="5" maxlength=5 value="'.get_option( 'ribbon_maker_user_offset','0' ).'"></td> 74 </tr> 75 <tr><td>Make Ribbon Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will be visible on your blog.</span></td> 76 <td><input type="radio" name="ribbon_maker_active" value="active" '.ribbon_maker_isChecked('active',get_opton('ribbon_maker_active')).'></td> 77 </tr> 78 <tr><td>Make Ribbon In-Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will NOT be visible on your blog.</span></td> 79 <td><input type="radio" name="ribbon_maker_active" value="inactive" '.ribbon_maker_isChecked('inactive',get_opton('ribbon_maker_active')).'></td> 65 80 </tr> 66 81 <hr /> … … 110 125 $im = imagecreatetruecolor ($width,$height); 111 126 112 $back = imagecolorallocate($im, (int)18, (int)52, (int)86);127 $back = imagecolorallocate($im, 0,0,0); 113 128 $draw_color = imagecolorallocate ($im, (int)ribbon_maker_get_color($bgcolor,"red"), (int)ribbon_maker_get_color($bgcolor,"green"), (int)ribbon_maker_get_color($bgcolor,"blue")); 114 129 $text_color = imagecolorallocate ($im, (int)ribbon_maker_get_color($fgcolor,"red"), (int)ribbon_maker_get_color($fgcolor,"green"), (int)ribbon_maker_get_color($fgcolor,"blue")); 115 130 131 imagesetthickness($im,2); 116 132 imageline($im, 0,2,$width,2,$draw_color); 117 133 134 imagesetthickness($im,1); 118 135 imagefilledrectangle($im,0,4,$width,$height-5,$draw_color); 119 136 137 imagesetthickness($im,2); 120 138 imageline($im, 0,$height-3,$width,$height-3,$draw_color); 121 139 140 imagesetthickness($im,1); 122 141 imagestring ($im, $font, ImageFontWidth($font)*2, 3, $string, $text_color); 123 142 124 143 $new_img = imagerotate ($im, 360-45, 0); 125 144 126 imagecolortransparent($new_img,$back); 145 //now we shall try and crop the image, increase its dpi and thus make the ribbon flush 146 //all in one go 147 imagedestroy ($im); 148 $newWidth=imagesx($new_img)-ImageFontWidth($font); 149 $newHeight=imagesy($new_img)-ImageFontHeight($font); 150 $im = imagecreatetruecolor($newWidth,$newHeight); 151 152 /* 153 bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) 154 */ 155 imagecopyresampled($im,$new_img,0,0,0,ImageFontHeight($font),$newWidth,$newHeight,imagesx($new_img)-ImageFontWidth($font)*2,imagesy($new_img)-ImageFontHeight($font)); 127 156 157 imagecolortransparent($im,$back); 128 158 129 imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 159 //imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 160 imagepng ($im,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 161 imagedestroy ($new_img); 130 162 imagedestroy ($im); 131 imagedestroy ($new_img);132 163 } 133 164 134 165 function render_ribbon_maker() { 135 if(is_admin_bar_showing()) 136 $offset = get_option("ribbon_maker_admin_offset"); 137 else 138 $offset = get_option("ribbon_maker_user_offset"); 139 140 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 166 if(get_option("ribbon_maker_active")=="active") { 167 if(is_admin_bar_showing()) 168 $offset = get_option("ribbon_maker_admin_offset"); 169 else 170 $offset = get_option("ribbon_maker_user_offset"); 171 172 // ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 141 173 142 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__);174 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__); 143 175 144 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 176 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 177 } 145 178 } 146 179 -
ribbon-maker/trunk/readme.txt
r535518 r535687 5 5 Requires at Least: 3.0.0 6 6 Tested Up To: 3.3.2 7 Stable tag: 0.17 Stable tag: 1.0 8 8 9 9 Make your own ribbon now without waiting for a plugin designer to do it for you. … … 11 11 == Description == 12 12 13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text.13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. You can also control the visibility of the of ribbon so you don't have to deactivate when it is not in use. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text. 14 14 15 15 == Installation == … … 24 24 25 25 == Changelog == 26 = 1.0 = 27 Cropping has been achieved. Also added a radio button to control the visibility of the ribbon. Ribbon generates only during the configuration and not constantly as in v0.1. Added a preview of the ribbon, so you can view it before you make it active. 26 28 27 29 = 0.1 = … … 47 49 48 50 == Upgrade Notice == 51 = 1.0 = 52 Now with cropping, ribbon hiding on demand, and preview. 53 54 = 0.1 = 49 55 Considered to be an upgrade for anyone having a static ribbon created by another ribbon plugin. 50 56 … … 52 58 This plugin requires the GD image library in your PHP 5.x installation to be enabled and fully operational. 53 59 == TODO == 54 1. Dynamically resample the image (crop) so that it is properly clipped appears nicely on your blog. -- Needed to Achieve Release 1.0 55 2. Add an option that you can use to turn off cropping. 56 3. Fix transparency issue. 57 4. Allow you to create multiple ribbons. 58 5. Allow you to have multiple ribbons on a page. 59 6. Allow ribbons to be scheduled. 60 1. Give you more control of how the ribbon graphic looks. 61 2. Fix transparency issue. 62 3. Allow you to create multiple ribbons. 63 4. Allow you to have multiple ribbons on a page. 64 5. Allow ribbons to be scheduled. -
ribbon-maker/trunk/readme.txt~
r535518 r535687 5 5 Requires at Least: 3.0.0 6 6 Tested Up To: 3.3.2 7 Stable tag: 0.17 Stable tag: 1.0 8 8 9 9 Make your own ribbon now without waiting for a plugin designer to do it for you. … … 11 11 == Description == 12 12 13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text.13 A ribbon creation plugin that will allow you to generate your own ribbons in real time. They have all of the features of the static ribbons you have enjoyed so far with the exception that you can set the Message, the Link, the Link Title (hover message), toolbar offset, no toolbar offset, the background color and the foreground color. You can also control the visibility of the of ribbon so you don't have to deactivate when it is not in use. The background color is the color of the shapes that make up the ribbon and the foreground color is the color of the text. 14 14 15 15 == Installation == … … 20 20 21 21 == Screenshots == 22 1. Here's how the ribbon will appear on your website. Will link to the http://www.avaaz.org/en/stop_cispa/ website. 22 1. The configuration screen found under Tools -> Ribbon Maker 23 2. Here's how the ribbon will appear on your website. 23 24 24 25 == Changelog == 26 = 1.0 = 27 Cropping has been achieved. Also added a radio button to control the visibility of the ribbon. Ribbon generates only during the configuration and not constantly as in v0.1 25 28 26 29 = 0.1 = … … 46 49 47 50 == Upgrade Notice == 51 = 1.0 = 52 Now with cropping and ribbon hiding on demand. 53 54 = 0.1 = 48 55 Considered to be an upgrade for anyone having a static ribbon created by another ribbon plugin. 49 56 … … 51 58 This plugin requires the GD image library in your PHP 5.x installation to be enabled and fully operational. 52 59 == TODO == 53 1. Dynamically resample the image (crop) so that it is properly clipped appears nicely on your blog. -- Needed to Achieve Release 1.0 54 2. Add an option that you can use to turn off cropping. 55 3. Fix transparency issue. 56 4. Allow you to create multiple ribbons. 57 5. Allow you to have multiple ribbons on a page. 58 6. Allow ribbons to be scheduled. 60 1. Give you more control of how the ribbon graphic looks. 61 2. Fix transparency issue. 62 3. Allow you to create multiple ribbons. 63 4. Allow you to have multiple ribbons on a page. 64 5. Allow ribbons to be scheduled. -
ribbon-maker/trunk/ribbon-maker.php
r535518 r535687 5 5 Description: When activated, this plugin will put a ribbon of your design, message and custom link on the top right corner of your website. 6 6 Author: Al Lamb 7 Version: 0.17 Version: 1.0 8 8 License: GPLv2 9 9 Author URI: http://bowierocks.com … … 12 12 function ribbon_maker_admin() { 13 13 add_submenu_page( 'tools.php', 'Ribbon Maker Settings', 'Ribbon Maker', 10, __FILE__, 'ribbon_maker_admin_menu' ); 14 } 15 16 function ribbon_maker_isChecked($test,$string) { 17 if($test==$string) return "checked"; 18 return ""; 14 19 } 15 20 … … 34 39 $str = strtr( $_POST['ribbon_maker_fgcolor'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 35 40 $ribbon_maker .= update_option( 'ribbon_maker_fgcolor', $str ); 41 $str = strtr( $_POST['ribbon_maker_active'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 42 $ribbon_maker .= update_option( 'ribbon_maker_active', $str ); 36 43 if ( $ribbon_maker ) 37 44 echo('<div class="updated"><p><strong>Your setting have been saved.</strong></p></div>'); 38 45 else 39 46 echo('<div class="error"><p><strong>Your setting have not been saved.</strong></p></div>'); 47 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 40 48 } 41 49 50 echo "<hr>Ribbon Preview: <img valign='top' src='".plugins_url("ribbon_maker_ribbon.png",__FILE__)."'><br>"; 42 51 echo(' 43 52 <form action="" method="post"> … … 63 72 <tr><td>User Vertical Offset<br/><span class="ribbon_maker_hint">Enter a positive number to push the ribbon down, negative for up. Suggest 28 to offset the USER bar.</span></td> 64 73 <td><input type="text" name="ribbon_maker_user_offset" size="5" maxlength=5 value="'.get_option( 'ribbon_maker_user_offset','0' ).'"></td> 74 </tr> 75 <tr><td>Make Ribbon Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will be visible on your blog.</span></td> 76 <td><input type="radio" name="ribbon_maker_active" value="active" '.ribbon_maker_isChecked('active',get_option('ribbon_maker_active')).'></td> 77 </tr> 78 <tr><td>Make Ribbon In-Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will NOT be visible on your blog.</span></td> 79 <td><input type="radio" name="ribbon_maker_active" value="inactive" '.ribbon_maker_isChecked('inactive',get_option('ribbon_maker_active')).'></td> 65 80 </tr> 66 81 <hr /> … … 114 129 $text_color = imagecolorallocate ($im, (int)ribbon_maker_get_color($fgcolor,"red"), (int)ribbon_maker_get_color($fgcolor,"green"), (int)ribbon_maker_get_color($fgcolor,"blue")); 115 130 131 imagesetthickness($im,2); 116 132 imageline($im, 0,2,$width,2,$draw_color); 117 133 134 imagesetthickness($im,1); 118 135 imagefilledrectangle($im,0,4,$width,$height-5,$draw_color); 119 136 137 imagesetthickness($im,2); 120 138 imageline($im, 0,$height-3,$width,$height-3,$draw_color); 121 139 140 imagesetthickness($im,1); 122 141 imagestring ($im, $font, ImageFontWidth($font)*2, 3, $string, $text_color); 123 142 124 143 $new_img = imagerotate ($im, 360-45, 0); 125 144 126 imagecolortransparent($new_img,$back); 145 //now we shall try and crop the image, increase its dpi and thus make the ribbon flush 146 //all in one go 147 imagedestroy ($im); 148 $newWidth=imagesx($new_img)-ImageFontWidth($font); 149 $newHeight=imagesy($new_img)-ImageFontHeight($font); 150 $im = imagecreatetruecolor($newWidth,$newHeight); 151 152 /* 153 bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) 154 */ 155 imagecopyresampled($im,$new_img,0,0,0,ImageFontHeight($font),$newWidth,$newHeight,imagesx($new_img)-ImageFontWidth($font)*2,imagesy($new_img)-ImageFontHeight($font)); 127 156 157 imagecolortransparent($im,$back); 128 158 129 imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 159 //imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 160 imagepng ($im,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 161 imagedestroy ($new_img); 130 162 imagedestroy ($im); 131 imagedestroy ($new_img);132 163 } 133 164 134 165 function render_ribbon_maker() { 135 if(is_admin_bar_showing()) 136 $offset = get_option("ribbon_maker_admin_offset"); 137 else 138 $offset = get_option("ribbon_maker_user_offset"); 139 140 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 166 if(get_option("ribbon_maker_active")=="active") { 167 if(is_admin_bar_showing()) 168 $offset = get_option("ribbon_maker_admin_offset"); 169 else 170 $offset = get_option("ribbon_maker_user_offset"); 171 172 // ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 141 173 142 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__);174 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__); 143 175 144 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 176 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 177 } 145 178 } 146 179 -
ribbon-maker/trunk/ribbon-maker.php~
r535518 r535687 5 5 Description: When activated, this plugin will put a ribbon of your design, message and custom link on the top right corner of your website. 6 6 Author: Al Lamb 7 Version: 0.17 Version: 1.0 8 8 License: GPLv2 9 9 Author URI: http://bowierocks.com … … 12 12 function ribbon_maker_admin() { 13 13 add_submenu_page( 'tools.php', 'Ribbon Maker Settings', 'Ribbon Maker', 10, __FILE__, 'ribbon_maker_admin_menu' ); 14 } 15 16 function ribbon_maker_isChecked($test,$string) { 17 if($test==$string) return "checked"; 18 return ""; 14 19 } 15 20 … … 34 39 $str = strtr( $_POST['ribbon_maker_fgcolor'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 35 40 $ribbon_maker .= update_option( 'ribbon_maker_fgcolor', $str ); 41 $str = strtr( $_POST['ribbon_maker_active'], array( '"' => '"', '\\' => '', '\'' => ''' ) ); 42 $ribbon_maker .= update_option( 'ribbon_maker_active', $str ); 36 43 if ( $ribbon_maker ) 37 44 echo('<div class="updated"><p><strong>Your setting have been saved.</strong></p></div>'); 38 45 else 39 46 echo('<div class="error"><p><strong>Your setting have not been saved.</strong></p></div>'); 47 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 40 48 } 41 49 50 echo "<hr>Ribbon Preview: <img valign='top' src='".plugins_url("ribbon_maker_ribbon.png",__FILE__)."'><br>"; 42 51 echo(' 43 52 <form action="" method="post"> … … 63 72 <tr><td>User Vertical Offset<br/><span class="ribbon_maker_hint">Enter a positive number to push the ribbon down, negative for up. Suggest 28 to offset the USER bar.</span></td> 64 73 <td><input type="text" name="ribbon_maker_user_offset" size="5" maxlength=5 value="'.get_option( 'ribbon_maker_user_offset','0' ).'"></td> 74 </tr> 75 <tr><td>Make Ribbon Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will be visible on your blog.</span></td> 76 <td><input type="radio" name="ribbon_maker_active" value="active" '.ribbon_maker_isChecked('active',get_opton('ribbon_maker_active')).'></td> 77 </tr> 78 <tr><td>Make Ribbon In-Active<br/><span class="ribbon_maker_hint">If checked, the Ribbon will NOT be visible on your blog.</span></td> 79 <td><input type="radio" name="ribbon_maker_active" value="inactive" '.ribbon_maker_isChecked('inactive',get_opton('ribbon_maker_active')).'></td> 65 80 </tr> 66 81 <hr /> … … 110 125 $im = imagecreatetruecolor ($width,$height); 111 126 112 $back = imagecolorallocate($im, (int)18, (int)52, (int)86);127 $back = imagecolorallocate($im, 0,0,0); 113 128 $draw_color = imagecolorallocate ($im, (int)ribbon_maker_get_color($bgcolor,"red"), (int)ribbon_maker_get_color($bgcolor,"green"), (int)ribbon_maker_get_color($bgcolor,"blue")); 114 129 $text_color = imagecolorallocate ($im, (int)ribbon_maker_get_color($fgcolor,"red"), (int)ribbon_maker_get_color($fgcolor,"green"), (int)ribbon_maker_get_color($fgcolor,"blue")); 115 130 131 imagesetthickness($im,2); 116 132 imageline($im, 0,2,$width,2,$draw_color); 117 133 134 imagesetthickness($im,1); 118 135 imagefilledrectangle($im,0,4,$width,$height-5,$draw_color); 119 136 137 imagesetthickness($im,2); 120 138 imageline($im, 0,$height-3,$width,$height-3,$draw_color); 121 139 140 imagesetthickness($im,1); 122 141 imagestring ($im, $font, ImageFontWidth($font)*2, 3, $string, $text_color); 123 142 124 143 $new_img = imagerotate ($im, 360-45, 0); 125 144 126 imagecolortransparent($new_img,$back); 145 //now we shall try and crop the image, increase its dpi and thus make the ribbon flush 146 //all in one go 147 imagedestroy ($im); 148 $newWidth=imagesx($new_img)-ImageFontWidth($font); 149 $newHeight=imagesy($new_img)-ImageFontHeight($font); 150 $im = imagecreatetruecolor($newWidth,$newHeight); 151 152 /* 153 bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) 154 */ 155 imagecopyresampled($im,$new_img,0,0,0,ImageFontHeight($font),$newWidth,$newHeight,imagesx($new_img)-ImageFontWidth($font)*2,imagesy($new_img)-ImageFontHeight($font)); 127 156 157 imagecolortransparent($im,$back); 128 158 129 imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 159 //imagepng ($new_img,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 160 imagepng ($im,plugin_dir_path(__FILE__)."ribbon_maker_ribbon.png");//this actually writes out the image! 161 imagedestroy ($new_img); 130 162 imagedestroy ($im); 131 imagedestroy ($new_img);132 163 } 133 164 134 165 function render_ribbon_maker() { 135 if(is_admin_bar_showing()) 136 $offset = get_option("ribbon_maker_admin_offset"); 137 else 138 $offset = get_option("ribbon_maker_user_offset"); 139 140 ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 166 if(get_option("ribbon_maker_active")=="active") { 167 if(is_admin_bar_showing()) 168 $offset = get_option("ribbon_maker_admin_offset"); 169 else 170 $offset = get_option("ribbon_maker_user_offset"); 171 172 // ribbon_maker_create_ribbon(get_option('ribbon_maker_message'),get_option('ribbon_maker_bgcolor'),get_option('ribbon_maker_fgcolor')); 141 173 142 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__);174 $img = plugins_url('ribbon_maker_ribbon.png',__FILE__); 143 175 144 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 176 echo "<a target='_blank' class='ribbon-maker' href='". get_option("ribbon_maker_url")."' title='".get_option("ribbon_maker_title")."'><img src='{$img}' alt='Ribbon Maker' style='position: fixed; top: {$offset}px; right: 0; z-index: 100000; cursor: pointer;' /></a>"; 177 } 145 178 } 146 179
Note: See TracChangeset
for help on using the changeset viewer.