Plugin Directory

Changeset 828490


Ignore:
Timestamp:
12/26/2013 12:42:55 AM (12 years ago)
Author:
shen045
Message:

Updated to version 1.0.5: Added instagram and flickr

Location:
crafty-social-buttons
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • crafty-social-buttons/trunk/README.txt

    r819149 r828490  
    3030*   Etsy (link only)
    3131*   Facebook
     32*   Flickr (link only)
    3233*   Google+
     34*   Instagram (link only)
    3335*   LinkedIn
    3436*   Pinterest
     
    9092
    9193= 1.0.4 =
     94* Added Instagram and Flickr link buttons
     95
     96= 1.0.4 =
    9297* Added more link options for Craftsy - link to individual user profile, pattern store, or instructor page
    9398
     
    109114== Upgrade Notice ==
    110115
     116= 1.0.5 =
     117* Instagram and Flickr added
     118
    111119= 1.0.4 =
    112120* More link options for Craftsy
     
    125133These are the things currently in the pipeline:
    126134
     135* Add support for YouTube (for crafters who post video tutorials)
     136* Adding an option to choose image sizes for the icons
    127137* Changing the post count feature to request data only after the page is loaded so it doesn't slow things down so much.
    128 * Adding an option to choose image sizes for the icons
    129 * Add support for YouTube (for crafters who post video tutorials)
    130 * Add support for Flickr (for crafters who like to show off their creations)
    131138* Option to diplays in archives and category listings (?)
    132139* (Anything else?  You tell me!)
  • crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Admin.php

    r819149 r828490  
    1313     * Plugin version, used for cache-busting of style and script file references.
    1414     */
    15     protected $version = '1.0.2';
     15    protected $version = '1.0.5';
    1616
    1717    /**
     
    8282     function load_all_services() {
    8383           
     84            include_once('services/class-SH_Social_Service.php');
    8485            $this->all_services = array();
    8586           
     
    9394                if (preg_match("/^class-SH_(.+)\.php$/", $file, $matches)) {
    9495                    $this->all_services[] = $matches[1];
     96                    include_once('services/' . $file);
    9597                }
    9698            }   
     
    211213            // we want to add a custom description for some of the fields
    212214            $caption = $service;
    213             switch ($service) {
    214                 case "Craftsy": $description = 'Hint: www.craftsy.com/user/<strong>user-id</strong>/ (numbers). For more options see Help > Link Buttons (link top right of screen)'; break;
    215                 case "Digg": $description = "Hint: www.digg.com/<strong>user-id</strong>"; break;
    216                 case "Email": $description = "Hint: Your email address"; break;
    217                 case "Etsy": $description = 'Hint: www.etsy.com/shop/<strong>user-id</strong>/'; break;
    218                 case "Facebook": $description = 'Hint: www.facebook.com/<strong>user-id</strong>/'; break;
    219                 case "Google":
    220                     $description = "Hint: plus.google.com/u/0/<strong>user-id</strong> (it's a long number)";
    221                     $caption = "Google Plus";
    222                     break;
    223                 case "LinkedIn": $description = "Hint: www.linkedin.com/in/<strong>user-id</strong> or www.linkedin.com/<strong>company/company-id</strong>"; break;
    224                 case "Pinterest": $description = "Hint: www.pinterest.com/<strong>user-id</strong>"; break;
    225                 case "Ravelry": $description = "Hint: www.ravelry.com/people/<strong>user-id</strong>"; break;
    226                 case "Reddit": $description = "Hint: www.reddit.com/user/<strong>user-id</strong>"; break;
    227                 case "StumbleUpon": $description = "Hint: www.stumbleupon/stumbler/<strong>user-id</strong>"; break;
    228                 case "Tumblr": $description = "Hint: http://<strong>user-id</strong>.tumblr.com"; break;
    229                 case "Twitter": $description = "Hint: @<strong>user-id</strong>"; break;
    230                 default: $description = "";
    231             }
     215            $description = "";
     216            $description = $this->call_service_method($service, 'description');
     217           
    232218            add_settings_field(
    233219                $service,
     
    396382        $settings = $this->getSettings();
    397383        $image_set = ($id == 'link_services') ? $settings['link_image_set'] : $settings['share_image_set'];
     384        $shareOrLink = ($id == 'link_services') ? 'Link' : 'Share';
    398385        $value = $settings[$id];
    399386        ?>
     
    412399                    <div><span class="include-heading">Available</span> (these will <strong>not</strong> be displayed)</div>
    413400                    <ul id="csbsort1" class="connectedSortable">
    414                         <?php echo $this->get_available_services_html($value, $image_set); ?>
     401                        <?php echo $this->get_available_services_html($value, $image_set, $shareOrLink); ?>
    415402                    </ul>
    416403                    </center>
     
    509496     * Get list item HTML for all services EXCEPT those already selected
    510497     */
    511     function get_available_services_html($selectedServicesString, $image_set) {
     498    function get_available_services_html($selectedServicesString, $image_set, $shareOrLink = 'Share') {
    512499   
    513500        $htmlListItems = '';   
     
    518505       
    519506        foreach ($this->all_services as $service) {
    520             if (!in_array($service, $selectedServices)) {       
    521                 $url = plugin_dir_url(__FILE__) . "buttons/" . $image_set . "/" . $service . ".png";
    522                 $htmlListItems .= $this->get_service_icon_html($url, $service, $image_set);
    523             }
     507            if (!$this->call_service_method($service, 'can'.$shareOrLink)) continue;
     508            if (in_array($service, $selectedServices)) continue;
     509               
     510            $url = plugin_dir_url(__FILE__) . "buttons/" . $image_set . "/" . $service . ".png";
     511            $htmlListItems .= $this->get_service_icon_html($url, $service, $image_set);
     512       
    524513        }
    525514       
    526515        return $htmlListItems;
     516    }
     517   
     518    /**
     519     * Calls a static method on the given service and returns the result
     520     */
     521    function call_service_method($service, $method) {
     522        return call_user_func(array('SH_' . $service, $method));
    527523    }
    528524   
  • crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Plugin.php

    r804385 r828490  
    1313     * Plugin version, used for cache-busting of style and script file references.
    1414     */
    15     protected $version = '1.0.2';
     15    protected $version = '1.0.5';
    1616
    1717    /**
  • crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Shortcode.php

    r804385 r828490  
    1313     * Plugin version, used for cache-busting of style and script file references.
    1414     */
    15     protected $version = '1.0.2';
     15    protected $version = '1.0.5';
    1616
    1717    /**
  • crafty-social-buttons/trunk/class-SH-Crafty-Social-Buttons-Widget.php

    r804385 r828490  
    1414     * Plugin version, used for cache-busting of style and script file references.
    1515     */
    16     protected $version = '1.0.2';
     16    protected $version = '1.0.5';
    1717
    1818    /**
  • crafty-social-buttons/trunk/crafty-social-buttons.php

    r819149 r828490  
    1616 * Plugin URI:  http://github.com/sarahhenderson/crafty-social-buttons
    1717 * Description: Adds social sharing buttons and links to your site, including Ravelry, Etsy, Craftsy and Pinterest
    18  * Version:     1.0.4
     18 * Version:     1.0.5
    1919 * Author:      Sarah Henderson
    2020 * Author URI:  http://sarahhenderson.info
  • crafty-social-buttons/trunk/css/admin.min.css

    r819149 r828490  
    11/*! crafty-social-buttons  (c) Sarah Henderson 2013
    2  * Version 1.0.4 (12-12-2013) */
     2 * Version 1.0.5 (26-12-2013) */
    33
    44.crafty-social-buttons .csb-include-list{border:1px solid #ddd;background:#f1f1f1;margin-right:.5em;vertical-align:top;padding:.4em}.crafty-social-buttons .include-heading{text-align:left;font-weight:700}.crafty-social-buttons .csb-include-list ul{border:1px solid #ddd;background:#fff;padding:.5em;margin:0;min-height:60px}.crafty-social-buttons .csb-include-list ul li{display:inline-block;padding:0;margin:.3em;text-align:center;font-size:1.2em;cursor:move}.crafty-social-buttons .csb-image-preview{margin-top:.5em}.crafty-social-buttons select{width:200px}.crafty-social-buttons input[type=text]{width:350px}.crafty-social-buttons span.description{font-style:normal}.crafty-social-buttons span.description strong{font-style:italic}
  • crafty-social-buttons/trunk/css/public.min.css

    r819149 r828490  
    11/*! crafty-social-buttons  (c) Sarah Henderson 2013
    2  * Version 1.0.4 (12-12-2013) */
     2 * Version 1.0.5 (26-12-2013) */
    33
    44.crafty-social-buttons{margin:.3em 0}.crafty-social-buttons .crafty-social-caption{display:inline-block;padding-right:1em;vertical-align:top;font-size:1.2em}.crafty-social-buttons .size48 img,.crafty-social-buttons img{max-width:48px;max-height:48px}.crafty-social-buttons .size16 img{max-width:16px;max-height:16px}.crafty-social-buttons .size32 img{max-width:32px;max-height:32px}.crafty-social-buttons .size64 img{max-width:64px;max-height:64px}.crafty-social-buttons ul{display:inline-block;list-style-type:none;margin:0;padding:0}.crafty-social-buttons ul li{display:inline-block;margin:0 .2em;padding:0}.crafty-social-buttons .crafty-social-share-count:after,.crafty-social-buttons .crafty-social-share-count:before{right:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.crafty-social-buttons .crafty-social-share-count:after{border-color:rgba(224,221,221,0);border-right-color:#f5f5f5;border-width:5px;top:50%;margin-top:-5px}.crafty-social-buttons .crafty-social-share-count:before{border-color:rgba(85,94,88,0);border-right-color:#e0dddd;border-width:6px;top:50%;margin-top:-6px}.crafty-social-buttons .crafty-social-share-count{font:11px Arial,Helvetica,sans-serif;color:#555e58;padding:5px;-khtml-border-radius:6px;-o-border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;position:relative;background:#f5f5f5;border:1px solid #e0dddd}
  • crafty-social-buttons/trunk/js/admin.min.js

    r819149 r828490  
    11/*! crafty-social-buttons  (c) Sarah Henderson 2013
    2  * Version 1.0.4 (12-12-2013) */
     2 * Version 1.0.5 (26-12-2013) */
    33jQuery(document).ready(function(a){a("#csbsort1, #csbsort2").sortable({connectWith:".connectedSortable",update:function(){var b=a("#csbsort2 li").map(function(){return a(this).attr("id")}).get();a(".csb-services").val(b)}}).disableSelection(),a(".csb-services").val(a("#csbsort2 li").map(function(){return a(this).attr("id")}).get()),a(".csb-image-set").change(function(){var b=a(this).val();a(".csb-image-preview").attr("data-base"),a.each(a(".csb-services img"),function(c,d){var e=a(d).attr("src"),f=a(d).attr("data-image-set"),g=e.replace(f,b);0,a(d).attr("src",g),a(d).attr("data-image-set",b)})})});
  • crafty-social-buttons/trunk/services/class-SH_Craftsy.php

    r819149 r828490  
    1616    }
    1717
    18     public function shareButton($url, $title = '', $showCount = false) {
    19        
     18    public function shareButton($url, $title = '', $showCount = false) {       
    2019        return '';
    2120    }
     
    4342    }
    4443   
    45     public function shareCount($url) {
    46          return '0'; // Craftsy has no share count feature
     44    public static function canShare() {
     45        return false;   
     46    }
     47   
     48    public static function description() {
     49        return "Hint: www.craftsy.com/user/<strong>user-id</strong>/ (numbers). For more options see Help > Link Buttons (link top right of screen)";   
    4750    }
    4851}
  • crafty-social-buttons/trunk/services/class-SH_Digg.php

    r801913 r828490  
    4444    }
    4545   
    46     public function shareCount($url) {
    47          return '0'; // Digg has no share count feature
     46    public static function description() {
     47        return "Hint: www.digg.com/<strong>user-id</strong>";   
    4848    }
    4949}
  • crafty-social-buttons/trunk/services/class-SH_Email.php

    r801913 r828490  
    4545    }
    4646   
    47     public function shareCount($url) {
    48          return '0'; // Email has no share count feature
     47    public static function description() {
     48        return "Hint: Your email address"; 
    4949    }
    5050}
  • crafty-social-buttons/trunk/services/class-SH_Etsy.php

    r801913 r828490  
    3636    }
    3737   
    38     public function shareCount($url) {
    39         return '0';
     38    public static function canShare() {
     39        return false;   
     40    }
     41
     42    public static function description() {
     43        return "Hint: www.etsy.com/shop/<strong>user-id</strong>/";
    4044    }
    4145}
  • crafty-social-buttons/trunk/services/class-SH_Facebook.php

    r801913 r828490  
    6363         }
    6464    }
     65
     66    public static function description() {
     67        return "Hint: www.facebook.com/<strong>user-id</strong>/"; 
     68    }
    6569}
    6670?>
  • crafty-social-buttons/trunk/services/class-SH_Google.php

    r801913 r828490  
    9090    }
    9191    }
     92
     93    public static function description() {
     94        return "Hint: plus.google.com/u/0/<strong>user-id</strong> (it's a long number)";   
     95    }
    9296}
    9397?>
  • crafty-social-buttons/trunk/services/class-SH_LinkedIn.php

    r805665 r828490  
    7474         }
    7575    }
     76
     77    public static function description() {
     78        return "Hint: www.linkedin.com/in/<strong>user-id</strong> or www.linkedin.com/<strong>company/company-id</strong>";   
     79    }
    7680}
    7781
  • crafty-social-buttons/trunk/services/class-SH_Pinterest.php

    r801913 r828490  
    6363         }
    6464    }
     65    public static function description() {
     66        return "Hint: www.pinterest.com/<strong>user-id</strong>"; 
     67    }
    6568}
    6669
  • crafty-social-buttons/trunk/services/class-SH_Ravelry.php

    r801913 r828490  
    4747    }
    4848   
    49     public function shareCount($url) {
    50         return '0';
     49
     50    public static function description() {
     51        return "Hint: www.ravelry.com/people/<strong>user-id</strong>";
    5152    }
    5253}
  • crafty-social-buttons/trunk/services/class-SH_Reddit.php

    r801913 r828490  
    6464         }
    6565    }
     66    public static function description() {
     67        return "Hint: www.reddit.com/user/<strong>user-id</strong>";   
     68    }
    6669}
    6770
  • crafty-social-buttons/trunk/services/class-SH_Social_Service.php

    r801913 r828490  
    3737    }
    3838   
     39    public static function canShare() {
     40        return true;   
     41    }
     42
     43    public static function canLink() {
     44        return true;   
     45    }
     46
     47    public static function description() {
     48        return ""; 
     49    }
     50
    3951    protected function buttonImage() {
    4052        $imageUrl = $this->imagePath . trim(strtolower($this->service)) . $this->imageExtension;
  • crafty-social-buttons/trunk/services/class-SH_StumbleUpon.php

    r801913 r828490  
    6464         }
    6565    }
     66    public static function description() {
     67        return "Hint: www.stumbleupon/stumbler/<strong>user-id</strong>";   
     68    }
    6669}
    6770?>
  • crafty-social-buttons/trunk/services/class-SH_Tumblr.php

    r801913 r828490  
    5353    }
    5454   
    55     public function shareCount($url) {
    56          return '0'; // Tumblr has no share count function
     55    public static function description() {
     56        return "Hint: http://<strong>user-id</strong>.tumblr.com"; 
    5757    }
    5858}
  • crafty-social-buttons/trunk/services/class-SH_Twitter.php

    r801913 r828490  
    6666         }
    6767    }
     68   
     69    public static function description() {
     70        return "Hint: @<strong>user-id</strong>";   
     71    }
    6872}
    6973
Note: See TracChangeset for help on using the changeset viewer.