Plugin Directory

Changeset 510511


Ignore:
Timestamp:
02/25/2012 07:13:38 PM (14 years ago)
Author:
JonBishop
Message:

1.3 Update

Location:
wp-about-author
Files:
40 added
4 edited

Legend:

Unmodified
Added
Removed
  • wp-about-author/trunk/readme.txt

    r409518 r510511  
    44Tags: author, author bio, author box, post, widget, bio, twitter, facebook, about, about author
    55Requires at least: 3.0
    6 Tested up to: 3.2.1
    7 Stable tag: 1.2
     6Tested up to: 3.3.1
     7Stable tag: 1.3
    88
    99Easily display customizable author bios below your posts
     
    18181. Change background color with easy to use color picker
    19191. Display settings allow you to control when to display author bios
     201. Display text links or icons to a users social media profiles
    2021
    21 This plugin also expands your profile page by adding Twitter and Facebook fields so it's easier for readers to follow your authors.
     22This plugin also expands your profile page by adding popular social media fields so it's easier for readers to follow your authors.
    2223
    2324== Installation ==
     
    3536Of course your can. It's one of the options available to you in the settings panel.
    3637
     38= Can I change the layout of the content in the box? =
     39
     40As of version 1.3 you can. All you have to do is create your own HTML using the following templates tags and use a filter.
     41
     42Templates tags are: %%bordertype%%, %%borderbg%%, %%authorpic%% and %%content%%
     43
     44Example:
     45Add the following to a functionality plugin or your functions.php file
     46`<?php
     47function my_wp_about_author_template(){
     48    return '<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>';
     49}
     50add_filter('wp_about_author_template', 'my_wp_about_author_template');
     51?>`
     52
     53= Can I add additional social media links? =
     54
     55As of version 1.3 you can. Once again using a filter you can intercept the data that generates these links and add your own.
     56
     57Example:
     58Add the following to a functionality plugin or your functions.php file
     59`<?php
     60function my_wp_about_author_social($social){
     61    $social['my_service_key'] = array(
     62        'link'=>'http://www.myservice.com/%%username%%',
     63        'title'=>'My Service',
     64        'icon'=>'http://www.fullpathtoicon.com/icon.png'
     65    );
     66    return '<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>';
     67}
     68add_filter('wp_about_author_get_socials', 'my_wp_about_author_social');
     69?>`
     70
     71= Can I filter the author box from additional pages not listed in my settings? =
     72
     73Sure thing. Now there's a WordPress filter for that.
     74
     75Example:
     76Add the following to a functionality plugin or your functions.php file to exclude the author box from a page with the id equal to 100
     77`<?php
     78function my_wp_about_author_display($author_content){
     79    if(is_page(100))
     80        return "";
     81    return $author_content;
     82}
     83add_filter('wp_about_author_display', 'my_wp_about_author_display');
     84?>`
     85
     86
     87= Are there any other filters that let me modify the output? =
     88
     89The following filters have been added:
     90wp_about_author_name - Modify the output of the name in the author box
     91wp_about_author_description - Modify the output of the description in the author box
     92wp_about_author_more_posts - Modify the "More Posts" text in the author box
     93wp_about_author_website - Modify the "Website" text in the author box
     94wp_about_author_follow_me - Modify the "Follow Me:" text in the author box
     95wp_about_author_separator - Change the separator displayed between text links
     96
    3797
    3898== Screenshots ==
     
    44104== Changelog ==
    45105
    46 The current version is 1.2 (2011.7.13)
     106The current version is 1.3 (2012.2.23)
     107
     108= 1.3 (2012.2.23) =
     109* Added social media icons as an alternative to text links
     110* Optimized code and added actions and filters for developers to modify output
     111* Cleaned up settings area
     112
     113= 1.2 (2011.7.13) =
     114* Added option to display bio in feed
    47115
    48116= 1.1 (2010.11.30) =
     
    50118* Fixed formatting issues
    51119
    52 = 1.2 (2011.7.13) =
    53 * Added option to display bio in feed
    54 
    55 
    56120= 1.0 =
    57121* Plugin released
  • wp-about-author/trunk/wp-about-author-admin.php

    r409518 r510511  
    11<?PHP
     2
    23//=============================================
    34// Load admin styles
    45//=============================================
    56function add_wp_about_author_admin_styles() {
    6     global $pagenow;
    7     if ( $pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'],"wp-about-author")) {
    8         wp_enqueue_style('dashboard');
    9         wp_enqueue_style('global');
    10         wp_enqueue_style('wp-admin');
    11         wp_enqueue_style('farbtastic');
    12     }
     7    global $pagenow;
     8    if ($pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'], "wp-about-author")) {
     9        wp_enqueue_style('dashboard');
     10        wp_enqueue_style('global');
     11        wp_enqueue_style('wp-admin');
     12        wp_enqueue_style('farbtastic');
     13    }
    1314}
    1415
     
    1718//=============================================
    1819function add_wp_about_author_admin_scripts() {
    19     global $pagenow;
    20     if ( $pagenow == 'options-general.php' && isset($_GET['page']) &&  strstr($_GET['page'],"wp-about-author")) {
    21         wp_enqueue_script('postbox');
    22         wp_enqueue_script('dashboard');
    23         wp_enqueue_script('custom-background');
    24     }
     20    global $pagenow;
     21    if ($pagenow == 'options-general.php' && isset($_GET['page']) && strstr($_GET['page'], "wp-about-author")) {
     22        wp_enqueue_script('postbox');
     23        wp_enqueue_script('dashboard');
     24        wp_enqueue_script('custom-background');
     25    }
    2526}
    2627
     
    2930//=============================================
    3031function wp_about_author_show_plugin_support() {
    31     $content = '<p>Leave a comment on the <a target="_blank" href="http://www.jonbishop.com/downloads/wordpress-plugins/wp-about-author/#comments">WP About Author Plugin Page</a></p>
     32    $content = '<p>Leave a comment on the <a target="_blank" href="http://www.jonbishop.com/downloads/wordpress-plugins/wp-about-author/#comments">WP About Author Plugin Page</a></p>
    3233    <p style="text-align:center;">- or -</p>
    3334    <p>Create a new topic on the <a target="_blank" href="http://wordpress.org/tags/wp-about-author">WordPress Support Forum</a></p>';
    34     return wp_about_author_postbox('wp-about-author-support', 'Support', $content);
     35    return wp_about_author_postbox('wp-about-author-support', 'Support', $content);
    3536}
    3637
     
    3940//=============================================
    4041function wp_about_author_show_donate() {
    41     $content = '<p>If you like this plugin please consider donating a few bucks to support its development. If you can\'t spare any change you can also help by giving me a good rating on WordPress.org and tweeting this plugin to your followers.
     42    $content = '<p>If you like this plugin please consider donating a few bucks to support its development. If you can\'t spare any change you can also help by giving me a good rating on WordPress.org and tweeting this plugin to your followers.
    4243    <ul>
    4344        <li><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=jonbish%40gmail%2ecom&lc=US&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">Donate With PayPal</a></li>
     
    4546        <li><a target="_blank" href="http://twitter.com/?status=WordPress Plugin: Easily Display Customizable Author Bios Below Posts http://bit.ly/a5mDhh (via @jondbishop)">Share On Twitter</a></li>
    4647    </ul></p>';
    47     return wp_about_author_postbox('wp-about-author-donate', 'Donate & Share', $content);
     48    return wp_about_author_postbox('wp-about-author-donate', 'Donate & Share', $content);
    4849}
    4950
     
    5253//=============================================
    5354function wp_about_author_show_blogfeed() {
    54     include_once(ABSPATH . WPINC . '/feed.php');
    55     $content = "";
    56     $rss = fetch_feed("http://feeds.feedburner.com/JonBishop");
    57     if (!is_wp_error( $rss ) ) {
    58       $maxitems = $rss->get_item_quantity(5);
    59       $rss_items = $rss->get_items(0, $maxitems);
    60     }
    61    
    62     if ($maxitems == 0) {
    63         $content .= "<p>No Posts</p>";
    64     } else {
    65         $content .= "<ul>";
    66         foreach ( $rss_items as $item ) {
    67             $content .= "<li><a href='" . $item->get_permalink(). "' title='Posted ".$item->get_date('j F Y | g:i a') ."'>" . $item->get_title() . "</a></li>";
    68         }
    69         $content .= "</ul>";
    70         $content .= "<p><a href='" . $rss->get_permalink() . "'>More Posts &raquo;</a></p>";
    71     }
    72     return wp_about_author_postbox('wp-about-author-blog-rss', 'Tips and Tricks', $content);
     55    include_once(ABSPATH . WPINC . '/feed.php');
     56    $content = "";
     57    $rss = fetch_feed("http://feeds.feedburner.com/JonBishop");
     58    if (!is_wp_error($rss)) {
     59        $maxitems = $rss->get_item_quantity(5);
     60        $rss_items = $rss->get_items(0, $maxitems);
     61    }
     62
     63    if ($maxitems == 0) {
     64        $content .= "<p>No Posts</p>";
     65    } else {
     66        $content .= "<ul>";
     67        foreach ($rss_items as $item) {
     68            $content .= "<li><a href='" . $item->get_permalink() . "' title='Posted " . $item->get_date('j F Y | g:i a') . "'>" . $item->get_title() . "</a></li>";
     69        }
     70        $content .= "</ul>";
     71        $content .= "<p><a href='" . $rss->get_permalink() . "'>More Posts &raquo;</a></p>";
     72    }
     73    return wp_about_author_postbox('wp-about-author-blog-rss', 'Tips and Tricks', $content);
    7374}
    7475
     
    7677// Contact page options
    7778//=============================================
    78 function wp_about_author_general_settings(){
    79     $wp_about_author_settings = wp_about_author_process_settings();
    80    
    81     $wrapped_content = "";
    82     $general_content = ""; 
    83     $box_content = "";
    84    
    85     if ( function_exists('wp_nonce_field') ){ $general_content .= wp_nonce_field('wp-about-author-update-options','_wpnonce',true,false); }
    86     $general_content .= '<p><strong>' . __("Display On Front Page") . '</strong><br />
    87                 <input type="checkbox" name="wp_author_display_front" ' .checked($wp_about_author_settings['wp_author_display_front'], 'on', false) . ' />
    88                 <small>Display buttons on the front page at the top of each entry.</small></p>';           
    89     $general_content .= '<p><strong>' . __("Display In Archives") . '</strong><br />
    90                 <input type="checkbox" name="wp_author_display_archives" ' .checked($wp_about_author_settings['wp_author_display_archives'], 'on', false) . ' />
    91                 <small>Display buttons on the archive pages at the top of each entry.</small></p>';
    92     $general_content .= '<p><strong>' . __("Display In Search Results") . '</strong><br />
    93                 <input type="checkbox" name="wp_author_display_search" ' .checked($wp_about_author_settings['wp_author_display_search'], 'on', false) . ' />
    94                 <small>Display buttons on the search page at the top of each entry.</small></p>';   
    95     $general_content .= '<p><strong>' . __("Display On Individual Posts") . '</strong><br />
    96                 <input type="checkbox" name="wp_author_display_posts" ' .checked($wp_about_author_settings['wp_author_display_posts'], 'on', false) . ' />
    97                 <small>Display buttons on individual posts at the top of the entry.</small></p>';   
    98     $general_content .= '<p><strong>' . __("Display On Individual Pages") . '</strong><br />
    99                 <input type="checkbox" name="wp_author_display_pages" ' .checked($wp_about_author_settings['wp_author_display_pages'], 'on', false) . ' />
    100                 <small>Display buttons on individual pages at the top of the entry.</small></p>';
    101         $general_content .= '<p><strong>' . __("Display In RSS Feeds") . '</strong><br />
    102                 <input type="checkbox" name="wp_author_display_feed" ' .checked($wp_about_author_settings['wp_author_display_feed'], 'on', false) . ' />
    103                 <small>Display buttons in feeds at the top of each entry.</small></p>';
    104     $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-general', 'Display Settings', $general_content);
    105    
    106     $box_content .= '<p><strong>' . __("Box Background Color") . '</strong><br />
     79function wp_about_author_general_settings() {
     80    $wp_about_author_settings = wp_about_author_process_settings();
     81
     82    $wrapped_content = "";
     83    $general_content = "";
     84    $social_content = "";
     85    $box_content = "";
     86
     87    if (function_exists('wp_nonce_field')) {
     88        $general_content .= wp_nonce_field('wp-about-author-update-options', '_wpnonce', true, false);
     89    }
     90    $general_content .= '<p><strong>' . __("Display On Front Page") . '</strong><br />
     91                <input type="checkbox" name="wp_author_display_front" ' . checked($wp_about_author_settings['wp_author_display_front'], 'on', false) . ' />
     92                <small>Display author box on the front page at the top of each entry.</small></p>';
     93    $general_content .= '<p><strong>' . __("Display In Archives") . '</strong><br />
     94                <input type="checkbox" name="wp_author_display_archives" ' . checked($wp_about_author_settings['wp_author_display_archives'], 'on', false) . ' />
     95                <small>Display author box on the archive pages at the top of each entry.</small></p>';
     96    $general_content .= '<p><strong>' . __("Display In Search Results") . '</strong><br />
     97                <input type="checkbox" name="wp_author_display_search" ' . checked($wp_about_author_settings['wp_author_display_search'], 'on', false) . ' />
     98                <small>Display author box on the search page at the top of each entry.</small></p>';
     99    $general_content .= '<p><strong>' . __("Display On Individual Posts") . '</strong><br />
     100                <input type="checkbox" name="wp_author_display_posts" ' . checked($wp_about_author_settings['wp_author_display_posts'], 'on', false) . ' />
     101                <small>Display author box on individual posts at the top of the entry.</small></p>';
     102    $general_content .= '<p><strong>' . __("Display On Individual Pages") . '</strong><br />
     103                <input type="checkbox" name="wp_author_display_pages" ' . checked($wp_about_author_settings['wp_author_display_pages'], 'on', false) . ' />
     104                <small>Display author box on individual pages at the top of the entry.</small></p>';
     105    $general_content .= '<p><strong>' . __("Display In RSS Feeds") . '</strong><br />
     106                <input type="checkbox" name="wp_author_display_feed" ' . checked($wp_about_author_settings['wp_author_display_feed'], 'on', false) . ' />
     107                <small>Display author box in feeds at the top of each entry.</small></p>';
     108    $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-general', 'Display Settings', $general_content);
     109
     110    $social_content .= '<p><strong>' . __("Display Social Media Icons") . '</strong><br />
     111                <input type="checkbox" name="wp_author_social_images" ' . checked($wp_about_author_settings['wp_author_social_images'], 'on', false) . ' />
     112                <small>Display buttons instead of text links in the author box.</small></p>';
     113    $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-general', 'Social Links Display Settings', $social_content);
     114
     115    $box_content .= '<p><strong>' . __("Box Background Color") . '</strong><br />
    107116                <input type="text" name="wp_author_alert_bg" id="background-color" value="' . $wp_about_author_settings['wp_author_alert_bg'] . '" />
    108117                <a class="hide-if-no-js" href="#" id="pickcolor">' . __('Select a Color') . '</a>
    109118                <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
    110119                <small>By default, the background color of the box is a yellowish tone.</small></p>';
    111     $box_content .= '<p><strong>' . __("Box Border") . '</strong><br />
     120    $box_content .= '<p><strong>' . __("Box Border") . '</strong><br />
    112121                <select name="wp_author_alert_border">
    113                   <option value="top" ' .selected($wp_about_author_settings['wp_author_alert_border'], 'top', false) . '>Thick Top Border</option>
    114                   <option value="around" ' .selected($wp_about_author_settings['wp_author_alert_border'], 'around', false) . '>Thin Surrounding Border</option>
    115                   <option value="none" ' .selected($wp_about_author_settings['wp_author_alert_border'], 'none', false) . '>No Border</option>
     122                  <option value="top" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'top', false) . '>Thick Top Border</option>
     123                  <option value="around" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'around', false) . '>Thin Surrounding Border</option>
     124                  <option value="none" ' . selected($wp_about_author_settings['wp_author_alert_border'], 'none', false) . '>No Border</option>
    116125                </select><br /><small>By default, a thick black line is displayed above the author bio.</small></p>';
    117     $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-alert', 'Box Settings', $box_content);
    118    
    119     wp_about_author_admin_wrap('WP About Author Settings', $wrapped_content);
    120 }
     126    $wrapped_content .= wp_about_author_postbox('wp-about-author-settings-alert', 'Box Settings', $box_content);
     127
     128    wp_about_author_admin_wrap('WP About Author Settings', $wrapped_content);
     129}
     130//
     131function wp_about_author_get_options(){
     132    $fields = array(
     133        'wp_author_alert_border' => "",
     134        'wp_author_display_front' => "",
     135        'wp_author_display_archives' => "",
     136        'wp_author_display_search' => "",
     137        'wp_author_display_posts' => "",
     138        'wp_author_display_pages' => "",
     139        'wp_author_display_feed' => "",
     140        'wp_author_social_images' => ""
     141    );
     142    $wp_about_author_settings = get_option('wp_about_author_settings');
     143    return wp_parse_args( $wp_about_author_settings, $fields );
     144}
     145
    121146
    122147//=============================================
     
    124149//=============================================
    125150function wp_about_author_process_settings() {
    126     if ( !empty($_POST['wp_about_author_option_submitted']) ){
    127         $wp_about_author_settings = array();
    128        
    129         if(strstr($_GET['page'],"wp-about-author") && check_admin_referer('wp-about-author-update-options')){
    130             $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['wp_author_alert_bg']);
    131             if ((strlen($color)==6||strlen($color) == 3)&&isset($_POST['wp_author_alert_bg'])){ $wp_about_author_settings['wp_author_alert_bg']=$_POST['wp_author_alert_bg']; }
    132             if(isset($_POST['wp_author_alert_border'])){ $wp_about_author_settings['wp_author_alert_border']=$_POST['wp_author_alert_border']; }
    133             if(isset($_POST['wp_author_display_front'])){ $wp_about_author_settings['wp_author_display_front']=$_POST['wp_author_display_front']; }
    134             if(isset($_POST['wp_author_display_archives'])){ $wp_about_author_settings['wp_author_display_archives']=$_POST['wp_author_display_archives']; }
    135             if(isset($_POST['wp_author_display_search'])){ $wp_about_author_settings['wp_author_display_search']=$_POST['wp_author_display_search']; }
    136             if(isset($_POST['wp_author_display_posts'])){ $wp_about_author_settings['wp_author_display_posts']=$_POST['wp_author_display_posts']; }
    137             if(isset($_POST['wp_author_display_pages'])){ $wp_about_author_settings['wp_author_display_pages']=$_POST['wp_author_display_pages']; }
    138             if(isset($_POST['wp_author_display_feed'])){ $wp_about_author_settings['wp_author_display_feed']=$_POST['wp_author_display_feed']; }
    139            
    140             echo "<div id=\"updatemessage\" class=\"updated fade\"><p>WP About Author settings updated.</p></div>\n";
    141             echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
    142            
    143             update_option('wp_about_author_settings', $wp_about_author_settings);
    144         }
    145     }//updated
    146     $wp_about_author_settings=get_option('wp_about_author_settings');
    147     return $wp_about_author_settings;
     151    $fields = wp_about_author_get_options();
     152    if (!empty($_POST['wp_about_author_option_submitted'])) {
     153        $wp_about_author_settings = array();
     154
     155        if (strstr($_GET['page'], "wp-about-author") && check_admin_referer('wp-about-author-update-options')) {
     156            $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['wp_author_alert_bg']);
     157            if ((strlen($color) == 6 || strlen($color) == 3) && isset($_POST['wp_author_alert_bg'])) {
     158                $wp_about_author_settings['wp_author_alert_bg'] = $_POST['wp_author_alert_bg'];
     159            }
     160            foreach ($fields as $field_key=>$field_value) {
     161                if (isset($_POST[$field_key])) {
     162                    $wp_about_author_settings[$field_key] = $_POST[$field_key];
     163                } else {
     164                    $wp_about_author_settings[$field_key] = "";
     165                }
     166            }
     167            echo "<div id=\"updatemessage\" class=\"updated fade\"><p>WP About Author settings updated.</p></div>\n";
     168            echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
     169            update_option('wp_about_author_settings', $wp_about_author_settings);
     170        }
     171    }//updated
     172
     173    $wp_about_author_settings = get_option('wp_about_author_settings');
     174    $wp_about_author_settings = wp_parse_args( $wp_about_author_settings, $fields );
     175
     176    return $wp_about_author_settings;
    148177}
    149178
     
    152181//=============================================
    153182function add_wp_about_author_options_subpanel() {
    154     if (function_exists('add_options_page')) {
    155       add_options_page('WP About Author', 'WP About Author', 'manage_options', __FILE__, 'wp_about_author_general_settings');
    156     }
     183    if (function_exists('add_options_page')) {
     184        add_options_page('WP About Author', 'WP About Author', 'manage_options', __FILE__, 'wp_about_author_general_settings');
     185    }
    157186}
    158187
     
    161190//=============================================
    162191function wp_about_author_postbox($id, $title, $content) {
    163     $postbox_wrap = "";
    164     $postbox_wrap .= '<div id="' . $id . '" class="postbox">';
    165     $postbox_wrap .= '<div class="handlediv" title="Click to toggle"><br /></div>';
    166     $postbox_wrap .= '<h3 class="hndle"><span>' . $title . '</span></h3>';
    167     $postbox_wrap .= '<div class="inside">' . $content . '</div>';
    168     $postbox_wrap .= '</div>';
    169     return $postbox_wrap;
    170 }   
     192    $postbox_wrap = "";
     193    $postbox_wrap .= '<div id="' . $id . '" class="postbox">';
     194    $postbox_wrap .= '<div class="handlediv" title="Click to toggle"><br /></div>';
     195    $postbox_wrap .= '<h3 class="hndle"><span>' . $title . '</span></h3>';
     196    $postbox_wrap .= '<div class="inside">' . $content . '</div>';
     197    $postbox_wrap .= '</div>';
     198    return $postbox_wrap;
     199}
    171200
    172201//=============================================
     
    174203//=============================================
    175204function wp_about_author_admin_wrap($title, $content) {
    176 ?>
     205    ?>
    177206    <div class="wrap">
    178207        <h2><?php echo $title; ?></h2>
    179208        <form method="post" action="">
    180             <div class="postbox-container" style="width:60%;">
    181                 <div class="metabox-holder">   
    182                     <div class="meta-box-sortables">
    183                     <?php
    184                         echo $content;
    185                     ?>
    186                     <p class="submit">
    187                         <input type="submit" name="wp_about_author_option_submitted" class="button-primary" value="Save Changes" />
    188                     </p>
    189                     <br /><br />
     209            <div id="dashboard-widgets-wrap">
     210                <div id="dashboard-widgets" class="metabox-holder">
     211                    <div id="postbox-container-1" class="postbox-container" style="width:60%;">
     212                        <div id="normal-sortables" class="meta-box-sortables ui-sortable">
     213    <?php
     214    echo $content;
     215    ?>
     216                            <p class="submit">
     217                                <input type="submit" name="wp_about_author_option_submitted" class="button-primary" value="Save Changes" />
     218                            </p>
     219                        </div>
    190220                    </div>
    191                   </div>
    192                 </div>
    193                 <div class="postbox-container" style="width:30%;">
    194                   <div class="metabox-holder"> 
    195                     <div class="meta-box-sortables">
    196                     <?php
    197                         echo wp_about_author_show_donate();
    198                         echo wp_about_author_show_plugin_support();
    199                         echo wp_about_author_show_blogfeed();
    200                     ?>
     221                    <div id="postbox-container-2" class="postbox-container" style="width:30%;">
     222                        <div id="side-sortables" class="meta-box-sortables ui-sortable">
     223                            <?php
     224                            echo wp_about_author_show_donate();
     225                            echo wp_about_author_show_plugin_support();
     226                            echo wp_about_author_show_blogfeed();
     227                            ?>   
     228                        </div>
    201229                    </div>
    202230                </div>
     
    204232        </form>
    205233    </div>
    206 <?php
     234    <?php
    207235}
    208236?>
  • wp-about-author/trunk/wp-about-author.css

    r312633 r510511  
    4040.wp-about-author-pic img{
    4141    width: 100px;
     42        height: 100px;
     43        max-width: 100px;
    4244}
    4345.wp-about-author-text{
     
    4547    margin: 0 0 0 140px;
    4648}
     49.wp-about-author-text p {
     50        margin: 0 0 5px 0;
     51}
     52.wp-about-author-text p.wpa-nomargin {
     53        margin: 0;
     54}
     55.wpa-social-icons{
     56        margin:0 3px;
     57}
    4758
  • wp-about-author/trunk/wp-about-author.php

    r409518 r510511  
    44Plugin URI: http://www.jonbishop.com/downloads/wordpress-plugins/wp-about-author/
    55Description: Easily display customizable author bios below your posts
    6 Version: 1.2
     6Version: 1.3
    77Author: Jon Bishop
    88Author URI: http://www.jonbishop.com
     
    2323   
    2424    $wp_about_author_content = "";
     25        $wp_about_author_links = "";
     26        $wp_about_author_social = "";
    2527    $wp_about_author_author_pic =  "";
    2628    $wp_about_author_author = array();
    2729    $wp_about_author_author['name'] = get_the_author();
    2830    $wp_about_author_author['description'] = get_the_author_meta('description');
    29     $wp_about_author_author['twitter'] = get_the_author_meta('twitter');
    30     $wp_about_author_author['facebook'] = get_the_author_meta('facebook');
    3131    $wp_about_author_author['website'] = get_the_author_meta('url');
    3232    $wp_about_author_author['posts'] = (int)get_the_author_posts();
    3333    $wp_about_author_author['posts_url'] = get_author_posts_url(get_the_author_meta('ID'));
    34    
    35     $wp_about_author_author_pic = get_avatar(get_the_author_email(), '100');
     34    $wp_about_author_author_pic = get_avatar(get_the_author_meta('email'), '100');
     35       
     36        // About Author Title
     37    $wp_about_author_content .= "<h3><a href='" . $wp_about_author_author['posts_url']. "' title='". $wp_about_author_author['name'] ."'>". apply_filters( 'wp_about_author_name', $wp_about_author_author['name'] ) ."</a></h3>";
    3638   
    37     $wp_about_author_content .= "<h3><a href='" . $wp_about_author_author['posts_url']. "' title='". $wp_about_author_author['name'] ."'>". $wp_about_author_author['name'] ."</a></h3>";
    38    
    39     $wp_about_author_content .= "<p>"  .$wp_about_author_author['description'] . "</p>";
    40     $wp_about_author_link = '';
    41     if(!empty($wp_about_author_author['website'])||!empty($wp_about_author_author['twitter'])||!empty($wp_about_author_author['facebook'])){
    42         $wp_about_author_content .= "<p>";
    43         if(!empty($wp_about_author_author['website'])){
    44             $wp_about_author_link .= "<a href='" . $wp_about_author_author['website']. "' title='". $wp_about_author_author['name'] ."'>Website</a> ";
    45         }
    46         if(!empty($wp_about_author_author['twitter'])){
    47             if($wp_about_author_link!=""){ $wp_about_author_link .= "- "; }
    48             $wp_about_author_link .= "<a href='" . $wp_about_author_author['twitter']. "' title='". $wp_about_author_author['name'] ."on Twitter'>Twitter</a> ";
    49         }
    50         if(!empty($wp_about_author_author['facebook'])){
    51             if($wp_about_author_link!=""){ $wp_about_author_link .= "- "; }
    52             $wp_about_author_link .= "<a href='" . $wp_about_author_author['facebook']. "' title='". $wp_about_author_author['name'] ." on Facebook'>Facebook</a> ";
    53         }
    54         if(!empty($wp_about_author_author['posts_url'])){
    55             if($wp_about_author_link!=""){ $wp_about_author_link .= "- "; }
    56             $wp_about_author_link .= "<a href='" . $wp_about_author_author['posts_url']. "' title='More posts by ". $wp_about_author_author['name'] ."'>More Posts</a> ";
    57         }
    58         $wp_about_author_content .= $wp_about_author_link;
    59         $wp_about_author_content .= "</p>";
    60     }
     39        // About Author Description
     40        $wp_about_author_content .= "<p>"  .apply_filters( 'wp_about_author_description', $wp_about_author_author['description']) . "</p>";
     41       
     42        // About Author Links
     43        if(!empty($wp_about_author_author['posts_url'])){
     44            $wp_about_author_links .= "<a href='" . $wp_about_author_author['posts_url']. "' title='More posts by ". $wp_about_author_author['name'] ."'>".apply_filters( 'wp_about_author_more_posts', "More Posts")."</a> ";
     45        }
     46        if(!empty($wp_about_author_author['website'])){
     47            if($wp_about_author_links!=""){$wp_about_author_links.=apply_filters( 'wp_about_author_separator', " - ");}
     48            $wp_about_author_links .= "<a href='" . $wp_about_author_author['website']. "' title='". $wp_about_author_author['name'] ."'>".apply_filters( 'wp_about_author_website', "Website")."</a> ";
     49        }
     50       
     51        // About Author Social
     52        $wp_about_author_social .= wp_about_author_get_social_links($wp_about_author_settings);
     53        if(isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']){
     54            $wp_about_author_content .= "<p>"  .$wp_about_author_links . "</p>";
     55            if($wp_about_author_social != ""){
     56                $wp_about_author_content .= '<p class="wpa-nomargin">'.apply_filters( 'wp_about_author_follow_me', "Follow Me:").'<br />' . $wp_about_author_social.'</p>';
     57            }
     58        } else {
     59            $wp_about_author_content .= "<p class='wpa-nomargin'>";
     60            $wp_about_author_content .= $wp_about_author_links;
     61            if($wp_about_author_social != ""){
     62                $wp_about_author_content .= apply_filters( 'wp_about_author_separator', " - ") . $wp_about_author_social;
     63            }
     64            $wp_about_author_content .= "</p>";
     65        }
     66       
     67        // Create output
     68        $return_content = '';
     69        // Allow filters to create new templates for output
    6170        if (!$for_feed){
    62             return '<div class="wp-about-author-containter-'.$wp_about_author_settings['wp_author_alert_border'].'" style="background-color:'.$wp_about_author_settings['wp_author_alert_bg'].';"><div class="wp-about-author-pic">'.$wp_about_author_author_pic.'</div><div class="wp-about-author-text">'.$wp_about_author_content.'</div></div>';
     71            $return_content = apply_filters( 'wp_about_author_template','<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>');
    6372        } else {
    64             return '<p><div style="float:left; text-align:left;>'.$wp_about_author_author_pic.'</div>'.$wp_about_author_content.'</p>';
    65         }
     73            $return_content = apply_filters( 'wp_about_author_feed_template','<p><div style="float:left; text-align:left;>%%authorpic%%</div>%%content%%</p>');
     74        }
     75        $replace_array = array(
     76            '%%bordertype%%'=>$wp_about_author_settings['wp_author_alert_border'],
     77            '%%borderbg%%'=>$wp_about_author_settings['wp_author_alert_bg'],
     78            '%%authorpic%%'=>$wp_about_author_author_pic,
     79            '%%content%%'=>$wp_about_author_content
     80        );
     81        foreach($replace_array as $search=>$replace){
     82            $return_content = str_replace($search, $replace, $return_content);
     83        }
     84
     85        return apply_filters( 'wp_about_author_display', $return_content );
    6686}
    6787
     
    6989// Add buttons to page
    7090function insert_wp_about_author($content) {
    71     $wp_about_author_settings=array();
    72     $wp_about_author_settings=get_option('wp_about_author_settings');
    73 
    74     if(is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']){
    75         $content=$content.wp_about_author_display();
     91    $wp_about_author_settings=wp_about_author_get_options();
     92   
     93        if(is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']){
     94        $content.=wp_about_author_display();
    7695    } else if(is_archive() && isset($wp_about_author_settings['wp_author_display_archives']) && $wp_about_author_settings['wp_author_display_archives']){
    77         $content=$content.wp_about_author_display();
     96        $content.=wp_about_author_display();
    7897    } else if(is_search() && isset($wp_about_author_settings['wp_author_display_search']) && $wp_about_author_settings['wp_author_display_search']){
    79         $content=$content.wp_about_author_display();
     98        $content.=wp_about_author_display();
    8099    } else if(is_page() && isset($wp_about_author_settings['wp_author_display_pages']) && $wp_about_author_settings['wp_author_display_pages']){
    81         $content=$content.wp_about_author_display();
     100        $content.=wp_about_author_display();
    82101    } else if(is_single() && isset($wp_about_author_settings['wp_author_display_posts']) && $wp_about_author_settings['wp_author_display_posts']){
    83         $content=$content.wp_about_author_display();
     102        $content.=wp_about_author_display();
    84103        } else if(is_feed() && isset($wp_about_author_settings['wp_author_display_feed']) && $wp_about_author_settings['wp_author_display_feed']){
    85         $content=$content.wp_about_author_display(true);
     104        $content.=wp_about_author_display(true);
    86105    } else {
    87106        $content=$content; 
     
    90109}
    91110
     111// Generate social icons
     112function wp_about_author_get_social_links($wp_about_author_settings){
     113        $content="";
     114        $socials = wp_about_author_get_socials();
     115        foreach($socials as $social_key=>$social){
     116            if (get_the_author_meta($social_key)){
     117                if(isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']){
     118                    $content .= "<a class='wpa-social-icons' href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'><img src='". $social['icon']."' alt='".$social['title']."'/></a>";
     119                } else {
     120                    if($content != "")
     121                        $content .= apply_filters( 'wp_about_author_separator', " - ");
     122                    $content .= "<a href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";
     123                }
     124            }
     125        }
     126        return $content;
     127}
     128
     129function wp_about_author_get_socials() {
     130        $socials = array();
     131        $socials['twitter'] = array('title'=>'Twitter', 'link'=>'http://www.twitter.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/twitter.png');
     132        $socials['facebook'] = array('title'=>'Facebook', 'link'=>'http://www.facebook.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/facebook.png');
     133        $socials['linkedin'] = array('title'=>'LinkedIn', 'link'=>'http://www.linkedin.com/in/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/linkedin.png');
     134        $socials['pinterest'] = array('title'=>'Pinterest', 'link'=>'http://www.pinterest.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/pinterest.png');
     135        $socials['googleplus'] = array('title'=>'Google Plus', 'link'=>'https://plus.google.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/googleplus.png');
     136        $socials['digg'] = array('title'=>'Digg', 'link'=>'http://www.digg.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/digg.png');
     137        $socials['flickr'] = array('title'=>'Flickr', 'link'=>'http://www.flickr.com/people/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/flickr.png');
     138        $socials['stumbleupon'] = array('title'=>'StumbleUpon', 'link'=>'http://www.stumbleupon.com/stumbler/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/stumbleupon.png');
     139        $socials['youtube'] = array('title'=>'YouTube', 'link'=>'http://www.youtube.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/youtube.png');
     140        $socials['yelp'] = array('title'=>'Yelp', 'link'=>'http://www.yelp.com/user_details?userid=%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/yelp.png');
     141        $socials['reddit'] = array('title'=>'Reddit', 'link'=>'http://www.reddit.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/reddit.png');
     142        $socials['delicious'] = array('title'=>'Delicious', 'link'=>'http://www.delicious.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/delicious.png');
     143        return apply_filters( 'wp_about_author_get_socials', $socials );
     144}
     145
    92146// Add css to header
    93147function wp_about_author_style() {
    94     wp_enqueue_style('wp-sauthor-bio', WPAUTHORURL_URL . 'wp-about-author.css');   
     148    wp_enqueue_style('wp-author-bio', WPAUTHORURL_URL . 'wp-about-author.css');
    95149}
    96150
    97151function wp_about_author_filter_contact($contactmethods) {
    98 
    99152    unset($contactmethods['yim']);
    100153    unset($contactmethods['aim']);
    101154    unset($contactmethods['jabber']);
    102    
    103     $contactmethods['twitter'] = 'Twitter';
    104     $contactmethods['facebook'] = 'Facebook';
     155    $socials = wp_about_author_get_socials();
     156        foreach($socials as $social_key=>$social){
     157            $contactmethods[$social_key] = $social['title'];
     158        }
    105159    $contactmethods['yim'] = 'Yahoo IM';
    106160    $contactmethods['aim'] = 'AIM';
     
    108162
    109163    return $contactmethods;
    110 
    111164}
    112165
     
    118171        $tmp = array(
    119172                    "wp_author_installed"=>"on",
    120                     "wp_author_version"=>"13",
     173                    "wp_author_version"=>"14",
    121174                    "wp_author_alert_bg"=>"#FFEAA8",
    122175                    "wp_author_display_front"=>"on",
     
    126179                    "wp_author_display_pages"=>"on",
    127180                                        "wp_author_display_feed"=>"",
    128                     "wp_author_alert_border"=>"top"
     181                    "wp_author_alert_border"=>"top",
     182                                        "wp_author_social_images"=>"on"
    129183                    );
    130184        update_option('wp_about_author_settings', $tmp);
    131185    }
     186        if (!$tmp['wp_author_social_images']){
     187                $tmp['wp_author_display_feed'] = "";
     188                update_option('wp_about_author_settings', $tmp);
     189        }
    132190        if (!$tmp['wp_author_display_feed']){
    133191                $tmp['wp_author_display_feed'] = "";
Note: See TracChangeset for help on using the changeset viewer.