Plugin Directory

Changeset 2103525


Ignore:
Timestamp:
06/10/2019 07:51:50 PM (7 years ago)
Author:
jcrr
Message:

Social Sharing. Added compatibility with themes that still use Font Awesome 4

Location:
social-sharing-buttons-and-counters/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • social-sharing-buttons-and-counters/trunk/assets/css/jc-social-sharing-admin.css

    r1632461 r2103525  
    1 #social-list ul, #social-selected ul
    2 {
     1#social-list ul, #social-selected ul {
    32    background-color: white;
    43    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
  • social-sharing-buttons-and-counters/trunk/assets/css/jc-social-sharing.css

    r2102981 r2103525  
    3131#jcss-social-buttons .jcss-social-name { color: #fff; font-weight: 700; margin-left: 5px; }
    3232
    33 @media (max-width: 768px){
     33@media (max-width: 768px) {
    3434    .jcss-social-name { display: none; }
    3535}
  • social-sharing-buttons-and-counters/trunk/assets/js/jc-social-sharing.js

    r2098504 r2103525  
    2323   
    2424    var buttons = document.getElementsByClassName("jcss-button");
    25     for (var i = 0; i< buttons.length; i++)
    26     {
     25    for (var i = 0; i< buttons.length; i++) {
    2726        buttons[i].addEventListener("click", function(e) {   
    2827            e.preventDefault();
    29             if (this.id == "jcss-whatsapp" && !isMobile.any())
    30             {
     28            if (this.id == "jcss-whatsapp" && !isMobile.any()) {
    3129                return false;
    3230            }
  • social-sharing-buttons-and-counters/trunk/inc/admin-page.php

    r2102981 r2103525  
    1717            <a href="?page=social-sharing-buttons-jc&tab=buttons" class="nav-tab <?php echo $active_tab == 'buttons' ? 'nav-tab-active' : ''; ?>">
    1818                <?php _e('Buttons', 'social-sharing-buttons-jc'); ?>
     19            </a>
     20            <a href="?page=social-sharing-buttons-jc&tab=advanced" class="nav-tab <?php echo $active_tab == 'advanced' ? 'nav-tab-active' : ''; ?>">
     21                <?php _e('Advanced', 'social-sharing-buttons-jc'); ?>
    1922            </a>
    2023            <a href="?page=social-sharing-buttons-jc&tab=animation" class="nav-tab <?php echo $active_tab == 'animation' ? 'nav-tab-active' : ''; ?>">
     
    145148                </table>
    146149                <?php submit_button(); ?>             
     150            </form> <?php
     151        } else if ( $active_tab === 'advanced' ) {
     152            $options = jcss_get_advanced_options(); ?>
     153            <form action="options.php" method="post">
     154                <?php
     155                    settings_fields( 'jcss_plugin_options' );
     156                ?>       
     157                <table class="form-table">         
     158                    <tbody>
     159                        <tr>
     160                            <th scope="row">
     161                                <label for="use-fa4"><?php _e('Font Awesome 4 compatibility', 'social-sharing-buttons-jc') ?></label>
     162                            </th>
     163                            <td id="use-fa4">       
     164                                <label>
     165                                    <input type="checkbox" name="jcss_advanced_options[fa4]" <?php checked( $options['fa4'] === 'on' ) ?>>
     166                                    <?php _e("Check ONLY if your theme still uses Font Awesome 4, take into account that some icons might not be rendered.", 'social-sharing-buttons-jc') ?>
     167                                </label>
     168                            </td>           
     169                        </tr>
     170                    </tbody>
     171                </table>
     172                <?php submit_button(); ?>
    147173            </form> <?php
    148174        } else if ( $active_tab === 'animation' ) {
     
    150176            <form action="options.php" method="post">         
    151177                <?php
    152                     settings_fields( 'jcss_plugin_options' );
     178                    settings_fields( 'jcss_plugin_options' );   
    153179                ?>       
    154180                <table class="form-table">         
  • social-sharing-buttons-and-counters/trunk/inc/admin.php

    r2102981 r2103525  
    2929function jcss_register_options() {
    3030    register_setting('jcss_plugin_options', 'jcss_buttons_options', 'jcss_sanitize_buttons');
     31    register_setting('jcss_plugin_options', 'jcss_advanced_options', 'jcss_sanitize_advanced');
    3132    register_setting('jcss_plugin_options', 'jcss_animation_options', 'jcss_sanitize_animations');
    3233}
  • social-sharing-buttons-and-counters/trunk/inc/functions.php

    r2102981 r2103525  
    4141}
    4242
     43function jcss_get_advanced_options() {
     44    $options = array();
     45    try {
     46        $db_options = get_option('jcss_advanced_options');
     47        $options = array( 
     48            'fa4' => isset($db_options['fa4']) ? $db_options['fa4'] : '0'
     49        );
     50    } catch( Exception $e ) {}
     51    return $options;
     52}
     53
    4354function jcss_get_animation_options() {
    4455    $options = array();
     
    5364    } catch( Exception $e ) {}
    5465    return $options;
     66}
     67
     68function jcss_get_fa_classnames($advanced, $social) {
     69    $fa_classname =  $advanced['fa4'] === 'on' ? 'fa ' : 'fab ';
     70    switch ($social) {
     71        case 'facebook' : return $fa_classname . ($advanced['fa4'] === 'on' ? 'fa-facebook' : 'fa-facebook-f');
     72        case 'linkedin' : return $fa_classname . ($advanced['fa4'] === 'on' ? 'fa-linkedin' : 'fa-linkedin-in');
     73        default: return $fa_classname . "fa-$social"; 
     74    }
    5575}
    5676
     
    7595
    7696    $html = '';
    77     if ($include_values)
    78     {
    79         foreach ($values_array as &$value)
    80         {   
     97    if ($include_values) {
     98        foreach ($values_array as &$value) {   
    8199            if (in_array($value, $socials)) 
    82100                $html .= '<div id="'.$value.'" class="social-list-item"><li><span class="jcss-card">'.$value.'</span></li></div>';       
    83101        }
    84102    }
    85     else
    86     {   
    87         foreach ($socials as &$social)
    88         {
     103    else {   
     104        foreach ($socials as &$social) {
    89105            if (!in_array($social, $values_array) )
    90106                $html .= '<div id="'.$social.'" class="social-list-item"><li><span class="jcss-card">'.$social.'</span></li></div>';
     
    111127}
    112128
     129function jcss_sanitize_advanced($input) {
     130    $options = jcss_get_advanced_options();
     131    if( isset( $input['fa4'] ) ) $options['fa4'] = sanitize_text_field( $input['fa4'] );
     132    else $options['fa4'] = '0';
     133    return $options;
     134}
     135
    113136function jcss_sanitize_animations($input) {
    114137    $options = jcss_get_animation_options();
  • social-sharing-buttons-and-counters/trunk/inc/plugin.php

    r2102981 r2103525  
    66}
    77
    8 function stylesheet_installed($array_css)
    9 {
     8function stylesheet_installed($array_css) {
    109    global $wp_styles;
    1110   
    12     foreach( $wp_styles->queue as $style )
    13     {
    14         foreach ($array_css as $css)
    15         {
    16             if (false !== strpos( $wp_styles->registered[$style]->src, $css ))
    17             {
     11    foreach( $wp_styles->queue as $style ) {
     12        foreach ($array_css as $css) {
     13            if (false !== strpos( $wp_styles->registered[$style]->src, $css )) {
    1814                return 1;
    1915            }
     
    2319}
    2420
    25 function jcss_scripts()
    26 {
     21function jcss_scripts() {
    2722    $options = jcss_get_buttons_options();
    2823   
     
    3126        /* enqueue styles to head, font-awesome only if wasn't enqueued before */
    3227        $font_awesome = array('font-awesome', 'fontawesome');       
    33         if (stylesheet_installed($font_awesome) === 0)
    34         {
     28        if (stylesheet_installed($font_awesome) === 0) {
    3529            wp_enqueue_style('jcss-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css');
    3630        }     
  • social-sharing-buttons-and-counters/trunk/inc/template-functions.php

    r2102981 r2103525  
    99   
    1010    $options = jcss_get_buttons_options();
     11    $advanced = jcss_get_advanced_options();
    1112   
    1213    $title = urlencode(html_entity_decode(get_the_title()));
     
    3435                case "Facebook": ?>
    3536                    <a id="jcss-facebook" rel="external nofollow" class="jcss-button" href="http://www.facebook.com/sharer.php?u=<?php echo $url; ?>" target="_blank" >
    36                     <i class="fab fa-facebook-f"></i>
     37                        <i class="<?php echo jcss_get_fa_classnames($advanced, 'facebook'); ?>"></i>
    3738                        <?php jcss_get_social_name($options, $social); ?>
    3839                    </a>  <?php
     
    4041                case "Twitter": ?>
    4142                    <a id="jcss-twitter" rel="external nofollow" class="jcss-button" href="http://twitter.com/intent/tweet/?text=<?php echo $title; ?>&url=<?php echo $url; if(!empty($twitter_username)) { echo '&via=' . $twitter_username; } ?>" target="_blank" >
    42                         <i class="fab fa-twitter"></i>   
     43                        <i class="<?php echo jcss_get_fa_classnames($advanced, 'twitter'); ?>"></i>   
    4344                        <?php jcss_get_social_name($options, $social); ?>
    4445                    </a>  <?php
     
    4647                case "LinkedIn": ?>
    4748                    <a id="jcss-linkedin" rel="external nofollow" class="jcss-button" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo $title; ?>" target="_blank" >
    48                         <i class="fab fa-linkedin-in"></i>
     49                        <i class="<?php echo jcss_get_fa_classnames($advanced, 'linkedin'); ?>"></i>
    4950                        <?php jcss_get_social_name($options, $social);  ?>
    5051                    </a>  <?php
     
    5253                case "Buffer": ?>
    5354                    <a id="jcss-buffer" rel="external nofollow" class="jcss-button" href="https://bufferapp.com/add?text=<?php echo $title; ?>&url=<?php echo $url; ?>" target="_blank" >
    54                         <i class="fab fa-buffer"></i>
     55                        <i class="<?php echo jcss_get_fa_classnames($advanced, 'buffer'); ?>"></i>
    5556                        <?php jcss_get_social_name($options, $social);  ?>
    5657                    </a>  <?php
     
    5859                case "WhatsApp": ?>
    5960                    <a id="jcss-whatsapp" rel="external nofollow" class="jcss-button" href="whatsapp://send?text=<?php echo $title.' – '.$url ?>" data-action = "share/whatsapp/share" target="_blank" >
    60                         <i class="fab fa-whatsapp"></i>
     61                        <i class="<?php echo jcss_get_fa_classnames($advanced, 'whatsapp'); ?>"></i>
    6162                        <?php jcss_get_social_name($options, $social); ?>
    6263                    </a>  <?php
     
    6566        }  ?>
    6667        </div>
    67         <?php echo jcss_set_animation(); ?>
     68        <?php echo jcss_set_animation($advanced); ?>
    6869    </div>
    6970    <?php
     
    7475}
    7576
    76 function jcss_set_animation() {
     77function jcss_set_animation($advanced) {
    7778    $animation = jcss_get_animation_options();
    78     $style_icon = sprintf('#jcss-buttons-container a:hover .fab {animation: %1$s %2$s linear; }', $animation['animation'], $animation['duration']);
     79    $style_icon = sprintf('#jcss-buttons-container a:hover %3$s {animation: %1$s %2$s linear; }', $animation['animation'], $animation['duration'], $advanced['fa4'] === 'on' ? '.fa' : '.fab');
    7980    $style = sprintf('<style>
    8081        %1$s
  • social-sharing-buttons-and-counters/trunk/languages/social-sharing-buttons-jc-es_ES.po

    r2102981 r2103525  
    44"Project-Id-Version: Social sharing buttons and counters v1.0.0\n"
    55"Report-Msgid-Bugs-To: Translator Name <[email protected]>\n"
    6 "POT-Creation-Date: 2019-06-09 19:11+0200\n"
     6"POT-Creation-Date: 2019-06-10 21:41+0200\n"
    77"PO-Revision-Date: \n"
    88"Last-Translator: JC <[email protected]>\n"
     
    2828
    2929#: inc/admin-page.php:21
     30msgid "Advanced"
     31msgstr "Avanzado"
     32
     33#: inc/admin-page.php:24
    3034msgid "Animation"
    3135msgstr "Animación"
    3236
    33 #: inc/admin-page.php:39
     37#: inc/admin-page.php:42
    3438msgid "Social buttons"
    3539msgstr "Redes sociales"
    3640
    37 #: inc/admin-page.php:47
     41#: inc/admin-page.php:50
    3842msgid "Drop below the sharing buttons you want to add"
    3943msgstr "Arrastra abajo las redes sociales que quieres añadir"
    4044
    41 #: inc/admin-page.php:56
     45#: inc/admin-page.php:59
    4246msgid "Twitter username"
    4347msgstr "Usuario de Twitter"
    4448
    45 #: inc/admin-page.php:58
     49#: inc/admin-page.php:61
    4650msgid "username without @"
    4751msgstr "usuario sin la @"
    4852
    49 #: inc/admin-page.php:59
     53#: inc/admin-page.php:62
    5054msgid "Enter your username if you wanted it to be appended to the tweets"
    5155msgstr "Introduce tu nombre si quieres que sea añadido a los tweets"
    5256
    53 #: inc/admin-page.php:69
     57#: inc/admin-page.php:72
    5458msgid "Buttons text "
    5559msgstr "Textos en los botones "
    5660
    57 #: inc/admin-page.php:72 inc/admin-page.php:159
     61#: inc/admin-page.php:75 inc/admin-page.php:185
    5862msgid "Yes"
    5963msgstr "Sí"
    6064
    61 #: inc/admin-page.php:73 inc/admin-page.php:160
     65#: inc/admin-page.php:76 inc/admin-page.php:186
    6266msgid "No"
    6367msgstr "No"
    6468
    65 #: inc/admin-page.php:74
     69#: inc/admin-page.php:77
    6670msgid ""
    6771"Display social network names? You can hide them if you don't have enough "
     
    7175"espacio para los botones"
    7276
    73 #: inc/admin-page.php:80
     77#: inc/admin-page.php:83
    7478msgid "Buttons location"
    7579msgstr "Ubicación de los botones"
    7680
    77 #: inc/admin-page.php:84
     81#: inc/admin-page.php:87
    7882msgid "Before content"
    7983msgstr "Antes del contenido"
    8084
    81 #: inc/admin-page.php:85
     85#: inc/admin-page.php:88
    8286msgid "After content"
    8387msgstr "Después del contenido"
    8488
    85 #: inc/admin-page.php:92
     89#: inc/admin-page.php:95
    8690msgid "Add buttons to"
    8791msgstr "Añadir los botones a"
    8892
    89 #: inc/admin-page.php:111
     93#: inc/admin-page.php:114
    9094msgid "Sharing text"
    9195msgstr "Texto junto a los botones"
    9296
    93 #: inc/admin-page.php:115
     97#: inc/admin-page.php:118
    9498msgid "Share this!"
    9599msgstr "¡Compártelo!"
    96100
    97 #: inc/admin-page.php:116
     101#: inc/admin-page.php:119
    98102msgid ""
    99103"Left the field empty if you don't want to display a text before the sharing "
     
    103107"botones"
    104108
    105 #: inc/admin-page.php:123
     109#: inc/admin-page.php:126
    106110msgid "Sharing text position"
    107111msgstr "Posición del texto"
    108112
    109 #: inc/admin-page.php:127
     113#: inc/admin-page.php:130
    110114msgid "Left"
    111115msgstr "A la izquierda"
    112116
    113 #: inc/admin-page.php:128
     117#: inc/admin-page.php:131
    114118msgid "Above"
    115119msgstr "Arriba"
    116120
    117 #: inc/admin-page.php:134
     121#: inc/admin-page.php:137
    118122msgid "Sharing text weight"
    119123msgstr "Espesor del texto"
    120124
    121 #: inc/admin-page.php:157
     125#: inc/admin-page.php:161
     126msgid "Font Awesome 4 compatibility"
     127msgstr "Compatibilidad con Font Awesome 4"
     128
     129#: inc/admin-page.php:166
     130msgid ""
     131"Check ONLY if your theme still uses Font Awesome 4, take into account that "
     132"some icons might not be rendered."
     133msgstr ""
     134"Marca esta casilla SOLO si tu tema tiene instalado Font Awesome 4, ten en "
     135"cuenta que algunos iconos pueden que no se muestren."
     136
     137#: inc/admin-page.php:183
    122138msgid "Play animations?"
    123139msgstr "¿Usar animaciones?"
    124140
    125 #: inc/admin-page.php:163
     141#: inc/admin-page.php:189
    126142msgid ""
    127143"Here you can decide whether or not to play animations when hovering over the "
     
    131147"sobre los botones."
    132148
    133 #: inc/admin-page.php:168
     149#: inc/admin-page.php:194
    134150msgid "Animation Style"
    135151msgstr "Estilo de la animación"
    136152
    137 #: inc/admin-page.php:172
     153#: inc/admin-page.php:198
    138154msgid "Fade"
    139155msgstr ""
    140156
    141 #: inc/admin-page.php:173
     157#: inc/admin-page.php:199
    142158msgid "Slide"
    143159msgstr ""
    144160
    145 #: inc/admin-page.php:174
     161#: inc/admin-page.php:200
    146162msgid "Bounce"
    147163msgstr ""
    148164
    149 #: inc/admin-page.php:175
     165#: inc/admin-page.php:201
    150166msgid "Spin"
    151167msgstr ""
    152168
    153 #: inc/admin-page.php:181
     169#: inc/admin-page.php:207
    154170msgid "Animation Duration"
    155171msgstr "Duración de la animación"
    156172
    157 #: inc/admin-page.php:185
     173#: inc/admin-page.php:211
    158174msgid "300 miliseconds"
    159175msgstr "300 milisegundos"
    160176
    161 #: inc/admin-page.php:186
     177#: inc/admin-page.php:212
    162178msgid "500 miliseconds"
    163179msgstr "500 milisegundos"
    164180
    165 #: inc/admin-page.php:187
     181#: inc/admin-page.php:213
    166182msgid "700 miliseconds"
    167183msgstr "700 milisegundos"
    168184
    169 #: inc/admin-page.php:188
     185#: inc/admin-page.php:214
    170186msgid "1 second"
    171187msgstr "1 segundo"
    172188
    173 #: inc/admin-page.php:189
     189#: inc/admin-page.php:215
    174190msgid "2 seconds"
    175191msgstr "2 segundos"
    176192
    177 #: inc/admin-page.php:190
     193#: inc/admin-page.php:216
    178194msgid "3 seconds"
    179195msgstr "3 segundos"
    180196
    181 #: inc/admin-page.php:200
     197#: inc/admin-page.php:226
    182198msgid ""
    183199"The shortcode <strong>[jc_buttons]</strong> will render the sharing buttons "
  • social-sharing-buttons-and-counters/trunk/readme.txt

    r2102996 r2103525  
    55Requires at least: 4.0
    66Tested up to: 5.2
    7 Stable tag: 1.2.1
     7Stable tag: 1.2.2
    88License: GPL3
    99License URI: https://www.gnu.org/licenses/gpl.html
     
    5252
    5353== Changelog ==
     54
     55= 1.2.2, date 2019-06-10 =
     56- Added compatibility with themes that still use Font Awesome 4.
    5457
    5558= 1.2.1, date 2019-06-09 =
  • social-sharing-buttons-and-counters/trunk/social-sharing-buttons-and-counters.php

    r2102981 r2103525  
    33Plugin Name: Social Sharing Buttons
    44Description: A lightweight SEO-friendly plugin that allows you to share your posts and get more traffic
    5 Version:     1.2.1
     5Version:     1.2.2
    66Author:      JC
    7 Author URI:  https://josecarlosroman.com/wordpress
     7Author URI:  https://josecarlosroman.com/
    88License:     GPL3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • social-sharing-buttons-and-counters/trunk/uninstall.php

    r2098504 r2103525  
    66 
    77delete_option('jcss_buttons_options');
     8delete_option('jcss_advanced_options');
    89delete_option('jcss_animation_options');
Note: See TracChangeset for help on using the changeset viewer.