Plugin Directory

Changeset 330482


Ignore:
Timestamp:
01/09/2011 08:05:47 PM (15 years ago)
Author:
mrefghi
Message:

0.4.2

Location:
all-due-credit/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • all-due-credit/trunk/all-due-credit.php

    r319487 r330482  
    44Plugin URI: http://www.mattrefghi.com/projects/allduecredit/
    55Description: 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.0
     6Version: 0.4.2
    77Author: Matt Refghi
    88Author URI: http://www.mattrefghi.com
     
    2828//Wordpress 2.7 is required for the all_due_credit_add_styles method.
    2929//Wordpress 2.8 for esc_url
     30//Wordpress 2.9 for WP_PLUGIN_URL.
    3031
    3132include 'class-all-due-credit.php';
     
    3839define('CRLF', "\r\n");
    3940define('TAB', "\t");
     41define('DROPDOWN_OPTION_SELECTED', 'selected="selected"');
    4042
    4143//Default option constants
     
    5860//call register settings function
    5961add_action( 'admin_init', 'all_due_credit_register_settings' );
    60    
     62
    6163function all_due_credit_menu() {
    6264
     
    7173
    7274<form method="post" action="options.php">
    73     <?php
    74     settings_fields( 'adc-settings-group' );
     75<?php
     76    settings_fields('adc-settings-group');
    7577   
    7678    //Handle defaults
    77 
     79   
    7880    $columns_per_row = get_option('columns_per_row');
    7981    $gravatar_size = get_option('gravatar_size');
    8082    $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   
    8190   
    8291    if(empty($columns_per_row))
     
    8897    if(empty($gravatar_default_image))
    8998        $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   
    90122    ?>
    91    
    92     <table class="form-table">
     123   <table class="form-table">
    93124        <tr valign="top">
    94125            <th scope="row">
     
    118149            </td>
    119150        </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>
    120175    </table>
    121176   
     
    123178    <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
    124179    </p>
    125 
    126180</form>
    127181</div>
    128 <?php }
     182<?php
     183}
    129184
    130185function all_due_credit_register_settings() {
     
    133188    register_setting( 'adc-settings-group', 'gravatar_size' );
    134189    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' );
    135192}
    136193
  • all-due-credit/trunk/class-all-due-credit.php

    r319487 r330482  
    2020    const GRAVATAR_DEFAULT_IMAGE = 'mm';
    2121    const MAXIMUM_COLS = 3;
     22    const SHOW_ON_HOME_PAGE = false;
     23    const SHOW_IN_FEED = true;
    2224   
    2325    private $option_columns_per_row;
    2426    private $option_gravatar_size;
    2527    private $option_gravatar_default_image;
     28    private $option_show_on_home_page;
     29    private $option_show_in_feed;
    2630    private $width_row_percentage;
    2731   
     
    241245        if(empty($this->option_gravatar_default_image))
    242246            $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        }
    245261   
    246262    }
     
    255271        $int_arr_count = 0;
    256272        $this->num_of_values = 0;
    257        
     273        $abort = false;
    258274        $this->all_due_credit_load_options();
    259275       
    260276        $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){
    265289            $row_cells_used = 0;
    266290           
  • all-due-credit/trunk/readme.txt

    r319490 r330482  
    44Tags: credits, reviewer, editor, writer, co-writer, thanks
    55Requires at least: 2.8
    6 Tested up to: 3.0.1
    7 Stable tag: 0.4.0
     6Tested up to: 3.0.4
     7Stable tag: 0.4.2
    88
    99Credit those who helped by including a stylish list of names after any post, potentially including a Gravatar and link for each.
     
    8585>   `John Doe,jdoe@hisemail.com,jdoeswebsite.com;Jane Doe,jane@heremail.com,janeswebsite.com`
    8686
    87 I'll be continuing my work on All Due Credit, with an emphasis on reducing manual steps.
     87== Changelog ==
    8888
    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.
    9091
    9192= 0.4.0 =
     
    106107== Upgrade Notice ==
    107108
     109= 0.4.2 =
     110Added two new options.
     111
    108112= 0.4.0 =
    109113Added three options, two of which are useful for theme compatibility.
     
    120124== Frequently Asked Questions ==
    121125
    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 
    130126= Will this plugin change my post contents? =
    131127
    132128No. The All Due Credit control is generated on-the-fly, and it is added right after the post content. Furthermore, All
    133129Due 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
     133There 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.
    134134
    135135= Can I have multiple names per label, in the same post? =
     
    139139 support this.
    140140
     141= If I enter an e-mail, will it ever be seen by my readers? =
     142
     143No. The e-mail is encrypted right before we use it, and is only used to request the person's Gravatar.
     144
    141145== Screenshots ==
    142146
Note: See TracChangeset for help on using the changeset viewer.