Plugin Directory

Changeset 784054


Ignore:
Timestamp:
10/07/2013 03:40:02 PM (12 years ago)
Author:
dtelepathy
Message:

Add Github and Soundcloud Follow options

Location:
flare/trunk
Files:
3 added
3 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • flare/trunk/css/flare.css

    r738824 r784054  
    4949    text-indent: -999em;
    5050    text-align: left;
    51     background: url('../images/sprite-social-icons-1.2.3.png');
     51    background: url('../images/sprite-social-icons-1.2.4.png');
    5252}
    5353
     
    139139.flare-button.flare-iconstyle-round-bevel.button-type-filament .flare-button-icon { background-position: -41px -404px; }
    140140.flare-button.flare-iconstyle-round-flat-nostroke.button-type-filament .flare-button-icon { background-position: -41px -404px; }
     141
     142/** Soundcloud **/
     143.flare-button.button-type-soundcloud .flare-button-icon { background-position: 0 -444px; }
     144.flare-button.flare-iconstyle-square-flat-nostroke.button-type-soundcloud .flare-button-icon,
     145.flare-button.flare-iconstyle-rounded-square-flat-nostroke.button-type-soundcloud .flare-button-icon { background-position: 0 -444px; }
     146.flare-button.flare-iconstyle-round-flat.button-type-soundcloud .flare-button-icon,
     147.flare-button.flare-iconstyle-round-bevel.button-type-soundcloud .flare-button-icon { background-position: -41px -444px; }
     148.flare-button.flare-iconstyle-round-flat-nostroke.button-type-soundcloud .flare-button-icon { background-position: -41px -444px; }
     149
     150/** Github **/
     151.flare-button.button-type-github .flare-button-icon { background-position: 0 -484px; }
     152.flare-button.flare-iconstyle-square-flat-nostroke.button-type-github .flare-button-icon,
     153.flare-button.flare-iconstyle-rounded-square-flat-nostroke.button-type-github .flare-button-icon { background-position: 0 -484px; }
     154.flare-button.flare-iconstyle-round-flat.button-type-github .flare-button-icon,
     155.flare-button.flare-iconstyle-round-bevel.button-type-github .flare-button-icon { background-position: -41px -484px; }
     156.flare-button.flare-iconstyle-round-flat-nostroke.button-type-github .flare-button-icon { background-position: -41px -484px; }
    141157
    142158body .flare-vertical .flare-button.last.button-type-filament { margin-bottom: 10px; }
     
    184200    background: linear-gradient(to bottom,  rgba(255,255,255,0) 0%,rgba(255,255,255,0) 1%,rgba(0,0,0,0.15) 100%);
    185201}
    186 .flare-horizontal .flare-button .flare-button-icon { background-image: url('../images/sprite-social-icons-horizontal-1.2.3.png'); }
     202.flare-horizontal .flare-button .flare-button-icon { background-image: url('../images/sprite-social-icons-horizontal-1.2.4.png'); }
    187203.flare-horizontal .flare-button.button-type-twitter .flare-button-icon { background-position: -3px 0; }
    188204.flare-horizontal .flare-button.button-type-facebook .flare-button-icon { background-position: -33px 0; }
     
    611627    float: left;
    612628}
    613 .flare-follow .flare-button .flare-button-icon { background-image: url('../images/sprite-follow-icons.png'); }
     629.flare-follow .flare-button .flare-button-icon { background-image: url('../images/sprite-follow-icons-1.2.4.png'); }
    614630.flare-follow .flare-button.flare-iconsize-16 {
    615631    width: 16px;
     
    645661.flare-follow .flare-button.flare-iconsize-16.button-type-googleplus .flare-button-icon { background-position: 16px -48px; }
    646662.flare-follow .flare-button.flare-iconsize-16.button-type-rss .flare-button-icon { background-position: 16px -82px; }
     663.flare-follow .flare-button.flare-iconsize-16.button-type-soundcloud .flare-button-icon { background-position: 16px -98px; }
     664.flare-follow .flare-button.flare-iconsize-16.button-type-github .flare-button-icon { background-position: 16px -114px; }
    647665.flare-follow .flare-button.flare-iconsize-18.button-type-twitter .flare-button-icon { background-position: 34px 0; }
    648666.flare-follow .flare-button.flare-iconsize-18.button-type-facebook .flare-button-icon { background-position: 34px -18px; }
     
    650668.flare-follow .flare-button.flare-iconsize-18.button-type-googleplus .flare-button-icon { background-position: 34px -54px; }
    651669.flare-follow .flare-button.flare-iconsize-18.button-type-rss .flare-button-icon { background-position: 34px -90px; }
     670.flare-follow .flare-button.flare-iconsize-18.button-type-soundcloud .flare-button-icon { background-position: 34px -108px; }
     671.flare-follow .flare-button.flare-iconsize-18.button-type-github .flare-button-icon { background-position: 34px -126px; }
    652672.flare-follow .flare-button.flare-iconsize-24.button-type-twitter .flare-button-icon { background-position: 58px 0; }
    653673.flare-follow .flare-button.flare-iconsize-24.button-type-facebook .flare-button-icon { background-position: 58px -24px; }
     
    655675.flare-follow .flare-button.flare-iconsize-24.button-type-googleplus .flare-button-icon { background-position: 58px -72px; }
    656676.flare-follow .flare-button.flare-iconsize-24.button-type-rss .flare-button-icon { background-position: 58px -120px; }
     677.flare-follow .flare-button.flare-iconsize-24.button-type-soundcloud .flare-button-icon { background-position: 58px -144px; }
     678.flare-follow .flare-button.flare-iconsize-24.button-type-github .flare-button-icon { background-position: 58px -168px; }
    657679.flare-follow .flare-button.flare-iconsize-32.button-type-twitter .flare-button-icon { background-position: 90px 0; }
    658680.flare-follow .flare-button.flare-iconsize-32.button-type-facebook .flare-button-icon { background-position: 90px -32px; }
     
    660682.flare-follow .flare-button.flare-iconsize-32.button-type-googleplus .flare-button-icon { background-position: 90px -96px; }
    661683.flare-follow .flare-button.flare-iconsize-32.button-type-rss .flare-button-icon { background-position: 90px -160px; }
     684.flare-follow .flare-button.flare-iconsize-32.button-type-soundcloud .flare-button-icon { background-position: 90px -192px; }
     685.flare-follow .flare-button.flare-iconsize-32.button-type-github .flare-button-icon { background-position: 90px -224px; }
    662686.flare-follow .flare-button.flare-iconsize-40.button-type-twitter .flare-button-icon { background-position: 130px 0; }
    663687.flare-follow .flare-button.flare-iconsize-40.button-type-facebook .flare-button-icon { background-position: 130px -40px; }
     
    665689.flare-follow .flare-button.flare-iconsize-40.button-type-googleplus .flare-button-icon { background-position: 130px -120px; }
    666690.flare-follow .flare-button.flare-iconsize-40.button-type-rss .flare-button-icon { background-position: 130px -200px; }
     691.flare-follow .flare-button.flare-iconsize-40.button-type-soundcloud .flare-button-icon { background-position: 130px -240px; }
     692.flare-follow .flare-button.flare-iconsize-40.button-type-github .flare-button-icon { background-position: 130px -280px; }
    667693.flare-follow .flare-button.flare-iconsize-48.button-type-twitter .flare-button-icon { background-position: 178px 0; }
    668694.flare-follow .flare-button.flare-iconsize-48.button-type-facebook .flare-button-icon { background-position: 178px -48px; }
     
    670696.flare-follow .flare-button.flare-iconsize-48.button-type-googleplus .flare-button-icon { background-position: 178px -144px; }
    671697.flare-follow .flare-button.flare-iconsize-48.button-type-rss .flare-button-icon { background-position: 178px -240px; }
     698.flare-follow .flare-button.flare-iconsize-48.button-type-soundcloud .flare-button-icon { background-position: 178px -288px; }
     699.flare-follow .flare-button.flare-iconsize-48.button-type-github .flare-button-icon { background-position: 178px -336px; }
    672700.flare-follow .flare-button.flare-iconsize-64.button-type-twitter .flare-button-icon { background-position: 242px 0; }
    673701.flare-follow .flare-button.flare-iconsize-64.button-type-facebook .flare-button-icon { background-position: 242px -64px; }
     
    675703.flare-follow .flare-button.flare-iconsize-64.button-type-googleplus .flare-button-icon { background-position: 242px -192px; }
    676704.flare-follow .flare-button.flare-iconsize-64.button-type-rss .flare-button-icon { background-position: 242px -324px; }
     705.flare-follow .flare-button.flare-iconsize-64.button-type-soundcloud .flare-button-icon { background-position: 242px -388px; }
     706.flare-follow .flare-button.flare-iconsize-64.button-type-github .flare-button-icon { background-position: 242px -452px; }
    677707
    678708.flare-vertical .flare-total,
  • flare/trunk/lib/constants.php

    r738824 r784054  
    3030
    3131// Environment - change to "development" to load .dev.js JavaScript files (DON'T FORGET TO TURN IT BACK BEFORE USING IN PRODUCTION)
    32 if( !defined( 'FLARE_ENVIRONMENT' ) ) define( 'FLARE_ENVIRONMENT', 'production' );
     32if( !defined( 'FLARE_ENVIRONMENT' ) ) define( 'FLARE_ENVIRONMENT', 'development' );
    3333
    3434// Is this an AJAX request?
  • flare/trunk/models/follow.php

    r589052 r784054  
    33    static $namespace = "flare-follow";
    44    static $label = "Flare Follow";
    5    
    6    
     5
     6
    77    // The buttons available for this plugin to create
    88    static $available_buttons = array(
     
    9494            ),
    9595            'url_template' => "http://www.pinterest.com/{{username}}"
     96        ),
     97        'soundcloud' => array(
     98            'type' => "soundcloud",
     99            'label' => "Soundcloud",
     100            'description' => "",
     101            'color' => "#ff6600",
     102            'options' => array(
     103                'username' => array(
     104                    'name' => 'username',
     105                    'data' => "string",
     106                    'validate' => "/[a-zA-Z0-9\.]{1,255}/",
     107                    'validate-failure' => "Make sure you enter a valid Soundcloud profile URL name",
     108                    'type' => "text",
     109                    'value' => "",
     110                    'label' => "Your Soundcloud Profile URL: <br />https://www.soundcloud.com/",
     111                    'prefix' => "https://www.soundcloud.com/"
     112                )
     113            ),
     114            'url_template' => 'https://www.soundcloud.com/{{username}}'
     115        ),
     116        'github' => array(
     117            'type' => "github",
     118            'label' => "GitHub",
     119            'description' => "",
     120            'color' => "#171516",
     121            'options' => array(
     122                'username' => array(
     123                    'name' => 'username',
     124                    'data' => "string",
     125                    'validate' => "/[a-zA-Z0-9\.]{1,39}/",
     126                    'validate-failure' => "Make sure you enter a valid GitHub profile URL name",
     127                    'type' => "text",
     128                    'value' => "",
     129                    'label' => "Your GitHub Profile URL: <br />https://www.github.com/",
     130                    'prefix' => "https://www.github.com/"
     131                )
     132            ),
     133            'url_template' => 'https://www.github.com/{{username}}'
    96134        )
    97135    );
    98    
     136
    99137    function __construct() {
    100138        // Make namespace available as an instance variable
     
    105143        $this->available_buttons = self::$available_buttons;
    106144    }
    107    
     145
    108146    /**
    109147     * Process a button's URL template
    110      * 
     148     *
    111149     * Replaces any properties in a button model's URL template with
    112150     * user entered values.
    113      * 
     151     *
    114152     * @return string
    115153     */
    116154    function _process_url_template( $name, $params ) {
    117155        $url = $this->available_buttons[$name]['url_template'];
    118        
     156
    119157        foreach( $params as $name => $val ) {
    120158            $url = str_replace( '{{' . $name . '}}', $val, $url );
    121159        }
    122        
     160
    123161        return $url;
    124162    }
    125    
     163
    126164    function get() {
    127165        $_buttons = get_option( "{$this->namespace}_buttons", array() );
    128166        $buttons = array();
    129        
     167
    130168        foreach( $_buttons as $button_name => $button_params ) {
    131169            $button_params['url'] = $this->_process_url_template( $button_name, $button_params );
    132170            $button_params['type'] = $button_name;
    133171            $button_params['label'] = $this->available_buttons[$button_name]['label'];
    134            
     172
    135173            $buttons[$button_name] = $button_params;
    136174        }
    137        
     175
    138176        return $buttons;
    139177    }
    140    
     178
    141179    /**
    142180     * Save follow options
    143      * 
     181     *
    144182     * Saves the follow options
    145      * 
     183     *
    146184     * @param array $data The button data to be saved
    147      * 
     185     *
    148186     * @uses update_post_meta()
    149      * 
     187     *
    150188     * @return int
    151189     */
    152190    function save( $data ) {
    153191        $button_data = array();
    154        
     192
    155193        foreach( (array) $data as $service => $button_options ) {
    156194            foreach( $this->available_buttons[$service]['options'] as $option_name => $option_params ) {
    157195                // Set a default value
    158196                $button_data[$service][$option_name] = $option_params['value'];
    159                
     197
    160198                switch( $option_params['data'] ) {
    161199                    case "integer":
     
    168206                                        $button_data[$service][$option_name] = intval( $data[$service][$option_name] );
    169207                                    break;
    170                                    
     208
    171209                                    case "float":
    172210                                    case "number":
     
    177215                        }
    178216                    break;
    179                    
     217
    180218                    case "string":
    181219                        if( isset( $data[$service][$option_name] ) ) {
     
    189227                        }
    190228                    break;
    191                    
     229
    192230                    case "boolean":
    193231                        if( isset( $data[$service][$option_name] ) ) {
     
    208246            }
    209247        }
    210        
     248
    211249        update_option( "{$this->namespace}_buttons", $button_data );
    212250    }
  • flare/trunk/readme.txt

    r782692 r784054  
    7878* Updated messaging to better describe the future of Flare (Pro)
    7979* Increased width of horizontal bubbles to account for a sizing bug with the LinkedIn share button
     80* Added Github and Soundcloud follow icons
    8081
    8182= 1.2.3 =
Note: See TracChangeset for help on using the changeset viewer.