Changeset 330482
- Timestamp:
- 01/09/2011 08:05:47 PM (15 years ago)
- Location:
- all-due-credit/trunk
- Files:
-
- 3 edited
-
all-due-credit.php (modified) (9 diffs)
-
class-all-due-credit.php (modified) (3 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
all-due-credit/trunk/all-due-credit.php
r319487 r330482 4 4 Plugin URI: http://www.mattrefghi.com/projects/allduecredit/ 5 5 Description: Credit those who helped by including a stylish list of names after any post, potentially including a Gravatar and link for each. 6 Version: 0.4. 06 Version: 0.4.2 7 7 Author: Matt Refghi 8 8 Author URI: http://www.mattrefghi.com … … 28 28 //Wordpress 2.7 is required for the all_due_credit_add_styles method. 29 29 //Wordpress 2.8 for esc_url 30 //Wordpress 2.9 for WP_PLUGIN_URL. 30 31 31 32 include 'class-all-due-credit.php'; … … 38 39 define('CRLF', "\r\n"); 39 40 define('TAB', "\t"); 41 define('DROPDOWN_OPTION_SELECTED', 'selected="selected"'); 40 42 41 43 //Default option constants … … 58 60 //call register settings function 59 61 add_action( 'admin_init', 'all_due_credit_register_settings' ); 60 62 61 63 function all_due_credit_menu() { 62 64 … … 71 73 72 74 <form method="post" action="options.php"> 73 <?php 74 settings_fields( 'adc-settings-group');75 <?php 76 settings_fields('adc-settings-group'); 75 77 76 78 //Handle defaults 77 79 78 80 $columns_per_row = get_option('columns_per_row'); 79 81 $gravatar_size = get_option('gravatar_size'); 80 82 $gravatar_default_image = get_option('gravatar_default_image'); 83 $show_on_home_page = get_option('show_on_home_page'); 84 $show_on_home_page_yes = STRING_EMPTY; 85 $show_on_home_page_no = STRING_EMPTY; 86 $show_in_feed = get_option('show_in_feed'); 87 $show_in_feed_yes = STRING_EMPTY; 88 $show_in_feed_no = STRING_EMPTY; 89 81 90 82 91 if(empty($columns_per_row)) … … 88 97 if(empty($gravatar_default_image)) 89 98 $gravatar_default_image = OPTION_DEFAULT_GRAVATAR_DEF_IMAGE; 99 100 if($show_on_home_page == STRING_EMPTY){ 101 102 $show_on_home_page_no = DROPDOWN_OPTION_SELECTED; 103 }else{ 104 if($show_on_home_page){ 105 $show_on_home_page_yes = DROPDOWN_OPTION_SELECTED; 106 }else{ 107 $show_on_home_page_no = DROPDOWN_OPTION_SELECTED; 108 } 109 } 110 111 if($show_in_feed == STRING_EMPTY){ 112 113 $show_in_feed_yes = DROPDOWN_OPTION_SELECTED; 114 }else{ 115 if($show_in_feed){ 116 $show_in_feed_yes = DROPDOWN_OPTION_SELECTED; 117 }else{ 118 $show_in_feed_no = DROPDOWN_OPTION_SELECTED; 119 } 120 } 121 90 122 ?> 91 92 <table class="form-table"> 123 <table class="form-table"> 93 124 <tr valign="top"> 94 125 <th scope="row"> … … 118 149 </td> 119 150 </tr> 151 <tr valign="top"> 152 <th scope="row"> 153 Show on home page? 154 </th> 155 <td> 156 <select name="show_on_home_page" id="show_on_home_page"> 157 <option value="1" <?php echo $show_on_home_page_yes ?>>Yes</option> 158 <option value="0" <?php echo $show_on_home_page_no ?>>No</option> 159 </select> 160 <p style="font-size: 10px">By default, All Due Credit will not be visible when you view the blog home page. It will, however, be visible when you are viewing an individual blog post. Select "Yes" if you want All Due Credit to appear on the home page as well.</p> 161 </td> 162 </tr> 163 <tr valign="top"> 164 <th scope="row"> 165 Show in RSS feed? 166 </th> 167 <td> 168 <select name="show_in_feed" id="show_in_feed"> 169 <option value="1" <?php echo $show_in_feed_yes ?>>Yes</option> 170 <option value="0" <?php echo $show_in_feed_no ?>>No</option> 171 </select> 172 <p style="font-size: 10px">By default, All Due Credit will be included in the RSS Feed. Select "No" to disable this feature.</p> 173 </td> 174 </tr> 120 175 </table> 121 176 … … 123 178 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 124 179 </p> 125 126 180 </form> 127 181 </div> 128 <?php } 182 <?php 183 } 129 184 130 185 function all_due_credit_register_settings() { … … 133 188 register_setting( 'adc-settings-group', 'gravatar_size' ); 134 189 register_setting( 'adc-settings-group', 'gravatar_default_image' ); 190 register_setting( 'adc-settings-group', 'show_on_home_page' ); 191 register_setting( 'adc-settings-group', 'show_in_feed' ); 135 192 } 136 193 -
all-due-credit/trunk/class-all-due-credit.php
r319487 r330482 20 20 const GRAVATAR_DEFAULT_IMAGE = 'mm'; 21 21 const MAXIMUM_COLS = 3; 22 const SHOW_ON_HOME_PAGE = false; 23 const SHOW_IN_FEED = true; 22 24 23 25 private $option_columns_per_row; 24 26 private $option_gravatar_size; 25 27 private $option_gravatar_default_image; 28 private $option_show_on_home_page; 29 private $option_show_in_feed; 26 30 private $width_row_percentage; 27 31 … … 241 245 if(empty($this->option_gravatar_default_image)) 242 246 $this->option_gravatar_default_image = self::GRAVATAR_DEFAULT_IMAGE; 243 244 247 248 //Show on home page 249 try{ 250 $this->option_show_on_home_page = (boolean) get_option('show_on_home_page'); 251 }catch (Exception $e){ 252 $this->option_show_on_home_page = self::SHOW_ON_HOME_PAGE; 253 } 254 255 //Show in RSS Feed 256 try{ 257 $this->option_show_in_feed = (boolean) get_option('show_in_feed'); 258 }catch (Exception $e){ 259 $this->option_show_in_feed = self::SHOW_IN_FEED; 260 } 245 261 246 262 } … … 255 271 $int_arr_count = 0; 256 272 $this->num_of_values = 0; 257 273 $abort = false; 258 274 $this->all_due_credit_load_options(); 259 275 260 276 $this->arr_types = $this->all_due_credit_generate_data_array($post, $this->arr_types, $this->num_of_values, $this->num_of_types); 261 262 //Only continue if we're not on the home page. 263 //ADC should only appear on a specific post page. 264 if(!is_home()){ 277 278 //Consider aborting if we detect the homepage. 279 if(is_home() && !$this->option_show_on_home_page){ 280 $abort = true; 281 } 282 283 //Consider aborting if we detect that we're in the feed. 284 if(is_feed() && !$this->option_show_in_feed){ 285 $abort = true; 286 } 287 288 if(!$abort){ 265 289 $row_cells_used = 0; 266 290 -
all-due-credit/trunk/readme.txt
r319490 r330482 4 4 Tags: credits, reviewer, editor, writer, co-writer, thanks 5 5 Requires at least: 2.8 6 Tested up to: 3.0. 17 Stable tag: 0.4. 06 Tested up to: 3.0.4 7 Stable tag: 0.4.2 8 8 9 9 Credit those who helped by including a stylish list of names after any post, potentially including a Gravatar and link for each. … … 85 85 > `John Doe,jdoe@hisemail.com,jdoeswebsite.com;Jane Doe,jane@heremail.com,janeswebsite.com` 86 86 87 I'll be continuing my work on All Due Credit, with an emphasis on reducing manual steps. 87 == Changelog == 88 88 89 == Changelog == 89 = 0.4.2 = 90 * Added two new options. These allow you to control whether All Due Credit should appear within the RSS Feed, or on the home page. 90 91 91 92 = 0.4.0 = … … 106 107 == Upgrade Notice == 107 108 109 = 0.4.2 = 110 Added two new options. 111 108 112 = 0.4.0 = 109 113 Added three options, two of which are useful for theme compatibility. … … 120 124 == Frequently Asked Questions == 121 125 122 = Why is All Due Credit appear broken in my blog? =123 124 There are a huge variety of Wordpress themes available out there, some of which make major modifications to the styles of Wordpress. Since All Due Credit inherits these styles, sometimes this results in layout issues. I've been progressing on handling differences introduced by themes, so keep an eye out for new versions. If you have problems with a specific theme, I'd be happy to take a look and see if I can help.125 126 = If I enter an e-mail, will it ever be seen by my readers? =127 128 No. The e-mail is encrypted right before we use it, and is only used to request the person's Gravatar.129 130 126 = Will this plugin change my post contents? = 131 127 132 128 No. The All Due Credit control is generated on-the-fly, and it is added right after the post content. Furthermore, All 133 129 Due Credit will never appear on the home page of your blog, only when you view a specific post. 130 131 = Why does All Due Credit appear broken in my blog? = 132 133 There are a huge variety of Wordpress themes available out there, some of which make major modifications to the styles of Wordpress. Since All Due Credit inherits these styles, sometimes this results in layout issues. I've been progressing on handling differences introduced by themes, so keep an eye out for new versions. If you have problems with a specific theme, I'd be happy to take a look and see if I can help. 134 134 135 135 = Can I have multiple names per label, in the same post? = … … 139 139 support this. 140 140 141 = If I enter an e-mail, will it ever be seen by my readers? = 142 143 No. The e-mail is encrypted right before we use it, and is only used to request the person's Gravatar. 144 141 145 == Screenshots == 142 146
Note: See TracChangeset
for help on using the changeset viewer.