Plugin Directory

Changeset 1866097 for shariff


Ignore:
Timestamp:
04/29/2018 07:44:22 PM (8 years ago)
Author:
starguide
Message:

Release 4.4.3

Location:
shariff/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • shariff/trunk/changelog.txt

    r1861436 r1866097  
    22
    33== Changelog ==
     4
     5= 4.4.3 =
     6- new support for additional manual AMP integrations
     7- new support for the print button on AMP pages
     8- fixed a php error on certain server configurations
     9- fixed a markup typo
     10- minor css improvements
    411
    512= 4.4.2 =
  • shariff/trunk/css/shariff.css

    r1861436 r1866097  
    3232    background-image: none !important;
    3333    text-align: left;
     34    box-shadow: none;
     35    cursor: pointer;
    3436}
    3537.shariff a:hover {
     
    6870.shariff-button::before {
    6971    content: none !important;
     72}
     73.shariff .shariff-buttons .shariff-text-white {
     74    color: #fff;
     75}
     76.shariff .shariff-buttons .shariff-hidezero {
     77    opacity: 0;
    7078}
    7179/* theme default */
     
    152160}
    153161/* buttonsize small */
    154 .shariff .buttonsize-small li {
     162.shariff .shariff-buttons.buttonsize-small li {
    155163    height: 25px !important;
    156164}
    157 .shariff .buttonsize-small a {
     165.shariff .shariff-buttons.buttonsize-small a {
    158166    height: 25px !important;
    159167}
    160 .shariff .buttonsize-small.orientation-vertical li {
     168.shariff .shariff-buttons.buttonsize-small.orientation-vertical li {
    161169    width: 115px;
    162170}
    163 .shariff .buttonsize-small .shariff-icon svg {
     171.shariff .shariff-buttons.buttonsize-small .shariff-icon svg {
    164172    width: 22px;
    165173    height: 15px;
    166174    padding: 5px 1px;
    167175}
    168 .shariff .buttonsize-small .shariff-text,
    169 .shariff .buttonsize-small .shariff-count {
     176.shariff .shariff-buttons.buttonsize-small .shariff-text,
     177.shariff .shariff-buttons.buttonsize-small .shariff-count {
    170178    font-size: 11px;
    171179    line-height: 25px;
     
    173181    height: 23px;
    174182}
    175 .shariff .buttonsize-small .shariff-text {
     183.shariff .shariff-buttons.buttonsize-small .shariff-text {
    176184    padding-left: 1px !important;
    177185}
    178 .shariff .buttonsize-small.theme-round li {
     186.shariff .shariff-buttons.buttonsize-small.theme-round li {
    179187    width: 25px !important;
    180188}
    181 .shariff .buttonsize-small.theme-round a {
     189.shariff .shariff-buttons.buttonsize-small.theme-round a {
    182190    width: 25px !important;
    183191}
    184 .shariff .buttonsize-small.theme-round .shariff-count {
     192.shariff .shariff-buttons.buttonsize-small.theme-round .shariff-count {
    185193    padding: 0 !important;
    186194    height: 25px !important;
    187195}
    188 .shariff .theme-round.buttonsize-small.orientation-horizontal li {
     196.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li {
    189197    margin: 5px 7px
    190198}
    191 .shariff .theme-round.buttonsize-small.orientation-horizontal li:first-child {
     199.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li:first-child {
    192200    margin-left: 5px
    193201}
    194 .shariff .theme-round.buttonsize-small.orientation-horizontal li:last-child {
     202.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li:last-child {
    195203    margin-right: 5px
    196204}
     
    220228    padding-left: 1px !important;
    221229}
    222 .shariff .buttonsize-large.theme-round li {
     230.shariff .shariff-buttons.buttonsize-large.theme-round li {
    223231    width: 45px !important;
     232    height: 45px !important;
    224233}
    225234.shariff .buttonsize-large.theme-round a {
     
    231240}
    232241/* orientation vertical */
    233 /*noinspection CssUnusedSymbol*/
    234242.shariff .orientation-vertical {
    235243    flex-direction: column;
     
    272280}
    273281/* widget */
    274 .widget .shariff .theme-default li,
    275 .widget .shariff .theme-color li,
    276 .widget .shariff .theme-grey li,
    277 .widget .shariff .theme-round li {
    278     border: medium none;
     282.widget .shariff li {
     283    border: none;
    279284    font-weight: 400;
    280285}
     
    338343/* media queries */
    339344@media only screen and (max-width: 360px) {
    340     .shariff .orientation-horizontal li { width: 35px; }
    341     .shariff .orientation-horizontal.buttonsize-small li { width: 25px; }
    342     .shariff .orientation-horizontal.buttonsize-large li { width: 45px; }
    343     .shariff .orientation-horizontal .shariff-icon svg { display: block; margin: auto; }
    344     .shariff .orientation-horizontal .shariff-count { display: none; }
     345    .shariff .shariff-buttons li { width: 35px; }
     346    .shariff .shariff-buttons.buttonsize-small li { width: 25px; }
     347    .shariff .shariff-buttons.buttonsize-large li { width: 45px; }
     348    .shariff .shariff-buttons .shariff-icon svg { display: block; margin: auto; }
     349    .shariff .shariff-buttons .shariff-count { display: none; }
     350    .shariff .shariff-buttons .shariff-text { display: none; }
    345351}
    346352@media only screen and (min-width: 361px) {
    347     .shariff .orientation-horizontal li { width: 80px; }
    348     .shariff .orientation-horizontal li .shariff-text { display: block; }
    349     .shariff .orientation-horizontal li .shariff-count { display: block; }
     353    .shariff .shariff-buttons li { width: 90px; }
     354    .shariff .shariff-buttons.buttonsize-large li { width: 130px; }
    350355}
    351356@media only screen and (min-width: 768px) {
    352     .shariff .orientation-horizontal li { width: 130px; }
    353     .shariff .orientation-horizontal.buttonsize-small li { width: 105px; }
    354     .shariff .orientation-horizontal.buttonsize-large li { width: 155px; }
    355     .shariff .orientation-horizontal li .shariff-text { display: inline; }
     357    .shariff .shariff-buttons li { width: 130px; }
     358    .shariff .shariff-buttons.buttonsize-small li { width: 105px; }
     359    .shariff .shariff-buttons.buttonsize-large li { width: 155px; }
     360    .shariff .shariff-buttons li .shariff-text { display: inline; }
    356361}
    357362@media only screen and (min-device-width: 1025px) {
  • shariff/trunk/css/shariff.min.css

    r1861436 r1866097  
    1 .shariff{display:block !important;clear:both}.shariff ul{display:flex;flex-direction:row;flex-flow:row wrap;padding:0 !important;margin:0 !important}.shariff li{height:35px;box-sizing:border-box;list-style:none !important;overflow:hidden !important;margin:5px !important;padding:0 !important;text-indent:0 !important;border-left:0 none !important}.shariff a{position:relative;display:block !important;height:35px;padding:0;margin:0;box-sizing:border-box;border:0;text-decoration:none;background-image:none !important;text-align:left}.shariff a:hover{color:#fff;background-color:inherit !important;text-decoration:none !important}.shariff a:visited{color:inherit}.shariff .shariff-count{position:absolute;height:33px;top:0;right:0;margin:1px;padding:0 8px;background-color:rgba(255,255,255,0.5)}.shariff .shariff-count,.shariff .shariff-text{font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:36px;vertical-align:top}.shariff .shariff-text{padding-left:3px}.shariff .shariff-icon svg{width:32px;height:20px;padding:7px 1px;box-sizing:content-box}.shariff-button::before{content:none !important}.shariff .theme-default a{color:#fff !important}.shariff .theme-default .shariff-icon svg path{fill:#fff}.shariff .theme-color .shariff-count{background-color:transparent !important;color:#fff !important}.shariff .theme-color .shariff-icon svg path{fill:#fff}.shariff .theme-grey a{background-color:#b0b0b0 !important}.shariff .theme-grey a:hover{background-color:inherit !important}.shariff .theme-grey .shariff-count{background-color:transparent;color:#fff !important}.shariff .theme-grey .shariff-icon svg path{fill:#fff}.shariff .theme-white a{background-color:#fff !important;border:1px solid #ddd}.shariff .theme-white a:hover{background-color:#eee !important;color:inherit}.shariff .theme-white svg{fill:currentColor}.shariff .theme-white .shariff-count{background-color:transparent;margin:0}.shariff .shariff-buttons.theme-round li{width:35px !important;height:35px;border-radius:50%;margin:5px}.shariff .theme-round a{position:relative;height:35px;border-radius:50%}.shariff .theme-round .shariff-icon svg{display:block;margin:auto;padding:8px 1px}.shariff .theme-round .shariff-text{display:block}.shariff .theme-round .shariff-count{display:inline;padding:0;right:0;left:0;top:0;background-color:transparent;color:transparent !important;text-align:center}.shariff .theme-round .shariff-count:hover{background-color:inherit !important;color:#fff !important}.shariff .theme-round .shariff-icon svg path{fill:#fff}.shariff .buttonsize-small li{height:25px !important}.shariff .buttonsize-small a{height:25px !important}.shariff .buttonsize-small.orientation-vertical li{width:115px}.shariff .buttonsize-small .shariff-icon svg{width:22px;height:15px;padding:5px 1px}.shariff .buttonsize-small .shariff-text,.shariff .buttonsize-small .shariff-count{font-size:11px;line-height:25px;padding:0 5px;height:23px}.shariff .buttonsize-small .shariff-text{padding-left:1px !important}.shariff .buttonsize-small.theme-round li{width:25px !important}.shariff .buttonsize-small.theme-round a{width:25px !important}.shariff .buttonsize-small.theme-round .shariff-count{padding:0 !important;height:25px !important}.shariff .theme-round.buttonsize-small.orientation-horizontal li{margin:5px 7px}.shariff .theme-round.buttonsize-small.orientation-horizontal li:first-child{margin-left:5px}.shariff .theme-round.buttonsize-small.orientation-horizontal li:last-child{margin-right:5px}.shariff .buttonsize-large li{height:45px !important}.shariff .buttonsize-large a{height:45px !important}.shariff .buttonsize-large.orientation-vertical li{width:155px}.shariff .buttonsize-large .shariff-icon svg{width:40px;height:28px;padding:9px 2px}.shariff .buttonsize-large .shariff-text,.shariff .buttonsize-large .shariff-count{font-size:14px;line-height:45px;padding:0 10px;height:43px}.shariff .buttonsize-large .shariff-text{padding-left:1px !important}.shariff .buttonsize-large.theme-round li{width:45px !important}.shariff .buttonsize-large.theme-round a{width:45px !important}.shariff .buttonsize-large.theme-round .shariff-count{padding:0 !important;height:45px !important}.shariff .orientation-vertical{flex-direction:column}.shariff .orientation-vertical li{width:135px}.shariff.shariff-align-flex-start ul{justify-content:flex-start;align-items:flex-start}.shariff.shariff-align-center ul{justify-content:center;align-items:center}.shariff.shariff-align-flex-end ul{justify-content:flex-end;align-items:flex-end}.widget .shariff.shariff-widget-align-flex-start ul{justify-content:flex-start;align-items:flex-start}.widget .shariff.shariff-widget-align-center ul{justify-content:center;align-items:center}.widget .shariff.shariff-widget-align-flex-end ul{justify-content:flex-end;align-items:flex-end}.shariff.shariff-buttonstretch li{flex:1 0 auto !important}.shariff.shariff-buttonstretch .orientation-vertical li{width:100% !important}.widget .shariff .theme-default li,.widget .shariff .theme-color li,.widget .shariff .theme-grey li,.widget .shariff .theme-round li{border:medium none;font-weight:400}.widget .shariff .theme-default a,.widget .shariff .theme-color a,.widget .shariff .theme-grey a,.widget .shariff .theme-round a{color:#fff;display:block;font-weight:400}.widget .shariff .theme-default a:hover,.widget .shariff .theme-color a:hover,.widget .shariff .theme-grey a:hover,.widget .shariff .theme-round a:hover{color:#fff;font-weight:400}.shariff-warning{background-color:red;color:#fff;font-size:20px;font-weight:700;padding:10px;text-align:center;margin:0 auto;line-height:1.5}.shariff .info a{border:1px solid #ddd;width:35px}.shariff .shariff-button.info{width:35px;flex:0 0 auto !important}.shariff .theme-default .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .buttonsize-small .shariff-button.info{width:25px}.shariff .buttonsize-small .info a{width:25px}.shariff .buttonsize-large .shariff-button.info{width:45px}.shariff .buttonsize-large .info a{width:45px}.shariff .info .shariff-icon svg{display:block;margin:auto}@media only screen and (max-width:360px){.shariff .orientation-horizontal li{width:35px}.shariff .orientation-horizontal.buttonsize-small li{width:25px}.shariff .orientation-horizontal.buttonsize-large li{width:45px}.shariff .orientation-horizontal .shariff-icon svg{display:block;margin:auto}.shariff .orientation-horizontal .shariff-count{display:none}}@media only screen and (min-width:361px){.shariff .orientation-horizontal li{width:80px}.shariff .orientation-horizontal li .shariff-text{display:block}.shariff .orientation-horizontal li .shariff-count{display:block}}@media only screen and (min-width:768px){.shariff .orientation-horizontal li{width:130px}.shariff .orientation-horizontal.buttonsize-small li{width:105px}.shariff .orientation-horizontal.buttonsize-large li{width:155px}.shariff .orientation-horizontal li .shariff-text{display:inline}}@media only screen and (min-device-width:1025px){.shariff .shariff-mobile{display:none !important}}
     1.shariff{display:block !important;clear:both}.shariff ul{display:flex;flex-direction:row;flex-flow:row wrap;padding:0 !important;margin:0 !important}.shariff li{height:35px;box-sizing:border-box;list-style:none !important;overflow:hidden !important;margin:5px !important;padding:0 !important;text-indent:0 !important;border-left:0 none !important}.shariff a{position:relative;display:block !important;height:35px;padding:0;margin:0;box-sizing:border-box;border:0;text-decoration:none;background-image:none !important;text-align:left;box-shadow:none;cursor:pointer}.shariff a:hover{color:#fff;background-color:inherit !important;text-decoration:none !important}.shariff a:visited{color:inherit}.shariff .shariff-count{position:absolute;height:33px;top:0;right:0;margin:1px;padding:0 8px;background-color:rgba(255,255,255,0.5)}.shariff .shariff-count,.shariff .shariff-text{font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:36px;vertical-align:top}.shariff .shariff-text{padding-left:3px}.shariff .shariff-icon svg{width:32px;height:20px;padding:7px 1px;box-sizing:content-box}.shariff-button::before{content:none !important}.shariff .shariff-buttons .shariff-text-white{color:#fff}.shariff .shariff-buttons .shariff-hidezero{opacity:0}.shariff .theme-default a{color:#fff !important}.shariff .theme-default .shariff-icon svg path{fill:#fff}.shariff .theme-color .shariff-count{background-color:transparent !important;color:#fff !important}.shariff .theme-color .shariff-icon svg path{fill:#fff}.shariff .theme-grey a{background-color:#b0b0b0 !important}.shariff .theme-grey a:hover{background-color:inherit !important}.shariff .theme-grey .shariff-count{background-color:transparent;color:#fff !important}.shariff .theme-grey .shariff-icon svg path{fill:#fff}.shariff .theme-white a{background-color:#fff !important;border:1px solid #ddd}.shariff .theme-white a:hover{background-color:#eee !important;color:inherit}.shariff .theme-white svg{fill:currentColor}.shariff .theme-white .shariff-count{background-color:transparent;margin:0}.shariff .shariff-buttons.theme-round li{width:35px !important;height:35px;border-radius:50%;margin:5px}.shariff .theme-round a{position:relative;height:35px;border-radius:50%}.shariff .theme-round .shariff-icon svg{display:block;margin:auto;padding:8px 1px}.shariff .theme-round .shariff-text{display:block}.shariff .theme-round .shariff-count{display:inline;padding:0;right:0;left:0;top:0;background-color:transparent;color:transparent !important;text-align:center}.shariff .theme-round .shariff-count:hover{background-color:inherit !important;color:#fff !important}.shariff .theme-round .shariff-icon svg path{fill:#fff}.shariff .shariff-buttons.buttonsize-small li{height:25px !important}.shariff .shariff-buttons.buttonsize-small a{height:25px !important}.shariff .shariff-buttons.buttonsize-small.orientation-vertical li{width:115px}.shariff .shariff-buttons.buttonsize-small .shariff-icon svg{width:22px;height:15px;padding:5px 1px}.shariff .shariff-buttons.buttonsize-small .shariff-text,.shariff .shariff-buttons.buttonsize-small .shariff-count{font-size:11px;line-height:25px;padding:0 5px;height:23px}.shariff .shariff-buttons.buttonsize-small .shariff-text{padding-left:1px !important}.shariff .shariff-buttons.buttonsize-small.theme-round li{width:25px !important}.shariff .shariff-buttons.buttonsize-small.theme-round a{width:25px !important}.shariff .shariff-buttons.buttonsize-small.theme-round .shariff-count{padding:0 !important;height:25px !important}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li{margin:5px 7px}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li:first-child{margin-left:5px}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li:last-child{margin-right:5px}.shariff .buttonsize-large li{height:45px !important}.shariff .buttonsize-large a{height:45px !important}.shariff .buttonsize-large.orientation-vertical li{width:155px}.shariff .buttonsize-large .shariff-icon svg{width:40px;height:28px;padding:9px 2px}.shariff .buttonsize-large .shariff-text,.shariff .buttonsize-large .shariff-count{font-size:14px;line-height:45px;padding:0 10px;height:43px}.shariff .buttonsize-large .shariff-text{padding-left:1px !important}.shariff .shariff-buttons.buttonsize-large.theme-round li{width:45px !important;height:45px !important}.shariff .buttonsize-large.theme-round a{width:45px !important}.shariff .buttonsize-large.theme-round .shariff-count{padding:0 !important;height:45px !important}.shariff .orientation-vertical{flex-direction:column}.shariff .orientation-vertical li{width:135px}.shariff.shariff-align-flex-start ul{justify-content:flex-start;align-items:flex-start}.shariff.shariff-align-center ul{justify-content:center;align-items:center}.shariff.shariff-align-flex-end ul{justify-content:flex-end;align-items:flex-end}.widget .shariff.shariff-widget-align-flex-start ul{justify-content:flex-start;align-items:flex-start}.widget .shariff.shariff-widget-align-center ul{justify-content:center;align-items:center}.widget .shariff.shariff-widget-align-flex-end ul{justify-content:flex-end;align-items:flex-end}.shariff.shariff-buttonstretch li{flex:1 0 auto !important}.shariff.shariff-buttonstretch .orientation-vertical li{width:100% !important}.widget .shariff li{border:0;font-weight:400}.widget .shariff .theme-default a,.widget .shariff .theme-color a,.widget .shariff .theme-grey a,.widget .shariff .theme-round a{color:#fff;display:block;font-weight:400}.widget .shariff .theme-default a:hover,.widget .shariff .theme-color a:hover,.widget .shariff .theme-grey a:hover,.widget .shariff .theme-round a:hover{color:#fff;font-weight:400}.shariff-warning{background-color:red;color:#fff;font-size:20px;font-weight:700;padding:10px;text-align:center;margin:0 auto;line-height:1.5}.shariff .info a{border:1px solid #ddd;width:35px}.shariff .shariff-button.info{width:35px;flex:0 0 auto !important}.shariff .theme-default .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .buttonsize-small .shariff-button.info{width:25px}.shariff .buttonsize-small .info a{width:25px}.shariff .buttonsize-large .shariff-button.info{width:45px}.shariff .buttonsize-large .info a{width:45px}.shariff .info .shariff-icon svg{display:block;margin:auto}@media only screen and (max-width:360px){.shariff .shariff-buttons li{width:35px}.shariff .shariff-buttons.buttonsize-small li{width:25px}.shariff .shariff-buttons.buttonsize-large li{width:45px}.shariff .shariff-buttons .shariff-icon svg{display:block;margin:auto}.shariff .shariff-buttons .shariff-count{display:none}.shariff .shariff-buttons .shariff-text{display:none}}@media only screen and (min-width:361px){.shariff .shariff-buttons li{width:90px}.shariff .shariff-buttons.buttonsize-large li{width:130px}}@media only screen and (min-width:768px){.shariff .shariff-buttons li{width:130px}.shariff .shariff-buttons.buttonsize-small li{width:105px}.shariff .shariff-buttons.buttonsize-large li{width:155px}.shariff .shariff-buttons li .shariff-text{display:inline}}@media only screen and (min-device-width:1025px){.shariff .shariff-mobile{display:none !important}}
  • shariff/trunk/readme.txt

    r1861441 r1866097  
    55Requires PHP: 5.6
    66Tested up to: 4.9
    7 Stable tag: 4.4.2
     7Stable tag: 4.4.3
    88License: MIT
    99License URI: http://opensource.org/licenses/mit
     
    168168
    169169== Changelog ==
     170
     171= 4.4.3 =
     172- new support for additional manual AMP integrations
     173- fixed a PHP error on certain server configurations
     174- new support for the print button on AMP pages
     175- fixed a markup typo
     176- minor css improvements
    170177
    171178= 4.4.2 =
  • shariff/trunk/services/shariff-twitter.php

    r1851328 r1866097  
    7878    // Fetch counts.
    7979    if ( isset( $shariff3uu['newsharecount'] ) && 1 === $shariff3uu['newsharecount'] ) {
    80         $twitter = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://public.newsharecounts.com/count.json?url=' . $post_url ) ) );
     80        $twitter = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://public.newsharecounts.com/count.json?url=' . $post_url ) ) );
    8181    } else {
    8282        $twitter = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://opensharecount.com/count.json?url=' . $post_url ) ) );
  • shariff/trunk/shariff.php

    r1861436 r1866097  
    44 * Plugin URI: https://wordpress.org/plugins-wp/shariff/
    55 * Description: Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR).
    6  * Version: 4.4.2
     6 * Version: 4.4.3
    77 * Author: Jan-Peter Lambeck & 3UU
    88 * Author URI: https://wordpress.org/plugins/shariff/
     
    3434function shariff3uu_update() {
    3535    // Adjust code version.
    36     $code_version = '4.4.2';
     36    $code_version = '4.4.3';
    3737
    3838    // Get options.
     
    225225
    226226    // Encode the shareurl.
    227     $post_url     = rawurlencode( esc_url( $url ) );
     227    $post_url     = rawurlencode( $url );
    228228    $post_url_raw = $url;
    229229
     
    702702 */
    703703function shariff3uu_amp_css() {
     704    // Get options.
     705    $shariff3uu = $GLOBALS['shariff3uu'];
     706    // Output CSS.
    704707    ob_start();
    705     include plugins_url( '/css/shariff.min.css', __FILE__ );
     708    include dirname( __FILE__ ) . '/css/shariff.min.css';
    706709    $shariff_css = ob_get_clean();
    707710    if ( false !== $shariff_css ) {
    708711        echo esc_html( str_replace( '!important', '', $shariff_css ) );
    709712    } else {
    710         include plugins_url( '/css/shariff.min.css', __FILE__ );
    711     }
    712     // Hide print button on AMP pages.
    713     echo '.shariff .printer { display: none };';
     713        include dirname( __FILE__ ) . '/css/shariff.min.css';
     714    }
     715    if ( array_key_exists( 'dynamic_css', $shariff3uu ) && ! empty( $shariff3uu['dynamic_css'] ) ) {
     716        echo esc_html( $shariff3uu['dynamic_css'] );
     717    }
    714718}
    715719add_action( 'amp_post_template_css', 'shariff3uu_amp_css' );
     
    728732    // Get options.
    729733    $shariff3uu = $GLOBALS['shariff3uu'];
     734    if ( array_key_exists( 'dynamic_css', $shariff3uu ) && ! empty( $shariff3uu['dynamic_css'] ) ) {
     735        $dynamic_css = $shariff3uu['dynamic_css'];
     736    } else {
     737        $dynamic_css = '';
     738    }
    730739
    731740    // Stops all further actions if we are on an admin page.
     
    813822    if ( array_key_exists( 'headline', $atts ) ) {
    814823        $atts['headline'] = wp_kses( $atts['headline'], $GLOBALS['allowed_tags'] );
     824    }
     825
     826    // Remove previous added inline styles to prevent duplications.
     827    if ( wp_style_is( 'shariffcss', 'enqueued' ) ) {
     828        wp_deregister_style( 'shariffcss' );
    815829    }
    816830
     
    941955    }
    942956    $output .= '"';
     957
    943958    // Hides buttons until css is loaded.
    944     if ( array_key_exists( 'hideuntilcss', $atts ) && 1 === $atts['hideuntilcss'] ) {
     959    if ( array_key_exists( 'hideuntilcss', $atts ) && 1 === $atts['hideuntilcss'] && ( ! function_exists( 'is_amp_endpoint' ) || ( function_exists( 'is_amp_endpoint' ) && false === is_amp_endpoint() ) ) ) {
    945960        $output .= ' style="display:none"';
    946961    }
     
    10121027    $mobile_only       = '';
    10131028    $button_url        = '';
    1014     $no_custom_color   = '';
     1029    $border_radius     = '';
    10151030
    10161031    // Explodes services.
     
    10531068                include $path_service_file;
    10541069
    1055                 // Overwrites service specific colors, if custom colors are set.
    1056                 if ( array_key_exists( 'maincolor', $atts ) ) {
    1057                     $main_color = $atts['maincolor'];
    1058                 } else {
    1059                     $no_custom_color = 'shariff-nocustomcolor ';
    1060                 }
    1061                 if ( array_key_exists( 'secondarycolor', $atts ) ) {
    1062                     $secondary_color = $atts['secondarycolor'];
    1063                 }
    1064 
    1065                 // Sets the border radius for the round theme.
    1066                 if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) {
    1067                     $border_radius = '; border-radius:' . $atts['borderradius'] . '%';
    1068                 } else {
    1069                     $border_radius = '';
    1070                 }
    1071 
    10721070                // Info button for default theme.
    10731071                if ( ! array_key_exists( 'maincolor', $atts ) && 'info' === $service && ( ( array_key_exists( 'theme', $atts ) && 'default' === $atts['theme'] || ( array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) ) || ! array_key_exists( 'theme', $atts ) ) ) {
     
    10761074                }
    10771075
    1078                 // Start li.
    1079                 $output .= '<li class="shariff-button ' . $no_custom_color . $service;
     1076                // Start <li.
     1077                $output .= '<li class="shariff-button ' . $service;
     1078
     1079                // No custom colors.
     1080                if ( ! array_key_exists( 'maincolor', $atts ) ) {
     1081                    $output .= ' shariff-nocustomcolor';
     1082                }
     1083
    10801084                // Mobile only.
    10811085                if ( 1 === $mobile_only ) {
    10821086                    $output .= ' shariff-mobile';
    10831087                }
    1084                 $output .= '" style="background-color:' . $secondary_color . $border_radius . '">';
     1088
     1089                // AMP?
     1090                if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     1091                    // Custom colors?
     1092                    if ( array_key_exists( 'secondarycolor', $atts ) ) {
     1093                        $output .= ' shariff-secondary-color';
     1094                        $css     = '.shariff-secondary-color{background-color:' . $atts['secondarycolor'] . '}';
     1095                    } else {
     1096                        $output .= ' shariff-' . $service . '-secondary-color';
     1097                        $css     = '.shariff-' . $service . '-secondary-color{background-color:' . $secondary_color . '}';
     1098                    }
     1099                    if ( false === strpos( $dynamic_css, $css ) ) {
     1100                        $dynamic_css .= $css;
     1101                    }
     1102                    // Border radius?
     1103                    if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) {
     1104                        $output .= ' shariff-borderradius';
     1105                        $css     = '.shariff .shariff-buttons.theme-round .shariff-borderradius{border-radius:' . $atts['borderradius'] . '%}';
     1106                        if ( false === strpos( $dynamic_css, $css ) ) {
     1107                            $dynamic_css .= $css;
     1108                        }
     1109                    }
     1110                } else {
     1111                    $output .= '" style="';
     1112                    // Custom colors?
     1113                    if ( array_key_exists( 'secondarycolor', $atts ) ) {
     1114                        $output .= 'background-color:' . $atts['secondarycolor'];
     1115                    } else {
     1116                        $output .= 'background-color:' . $secondary_color;
     1117                    }
     1118                    // Border radius?
     1119                    if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) {
     1120                        $output       .= ';border-radius:' . $atts['borderradius'] . '%';
     1121                        $border_radius = ';border-radius:' . $atts['borderradius'] . '%';
     1122                    }
     1123                }
     1124
     1125                // End li>.
     1126                $output .= '">';
    10851127
    10861128                // Uses default button share text, if $button_text_array is empty.
     
    11061148                $button_text_array = '';
    11071149
    1108                 // Build the actual button.
    1109                 $output .= '<a href="' . $button_url . '" title="' . $button_title . '" aria-label="' . $button_title . '" role="button" rel="';
     1150                /** Build the actual button. */
     1151
     1152                // Begin <a.
     1153                $output .= '<a ';
     1154
     1155                // Check if we are on an AMP page and the print button is requested.
     1156                if ( 'printer' === $service && function_exists( 'is_amp_endpoint' ) && true === is_amp_endpoint() ) {
     1157                    $output .= 'on="tap:AMP.print" ';
     1158                } else {
     1159                    $output .= 'href="' . $button_url . '" ';
     1160                }
     1161
     1162                // Output title, label and role.
     1163                $output .= 'title="' . $button_title . '" aria-label="' . $button_title . '" role="button" rel="';
    11101164                if ( 'facebook' !== $service ) {
    11111165                    $output .= 'noopener ';
    11121166                }
    1113                 $output .= 'nofollow" class="shariff-link" ';
     1167                $output .= 'nofollow" class="shariff-link';
     1168
     1169                // AMP?
     1170                if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     1171                    $output .= ' shariff-borderradius';
     1172                    // Custom color?
     1173                    if ( array_key_exists( 'maincolor', $atts ) ) {
     1174                        $output .= ' shariff-main-color';
     1175                        $css     = '.shariff-main-color{background-color:' . $atts['maincolor'] . '}';
     1176                    } else {
     1177                        $output .= ' shariff-' . $service . '-main-color';
     1178                        $css     = '.shariff-' . $service . '-main-color{background-color:' . $main_color . '}';
     1179                    }
     1180                    if ( false === strpos( $dynamic_css, $css ) ) {
     1181                        $dynamic_css .= $css;
     1182                    }
     1183                    // Theme white?
     1184                    if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
     1185                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1186                            $output .= ' shariff-text-color"';
     1187                            $css     = '.shariff-text-color{color:' . $atts['maincolor'] . '}';
     1188                        } else {
     1189                            $output .= ' shariff-' . $service . '-text-color"';
     1190                            $css     = '.shariff-' . $service . '-text-color{color:' . $main_color . '}';
     1191                        }
     1192                        if ( false === strpos( $dynamic_css, $css ) ) {
     1193                            $dynamic_css .= $css;
     1194                        }
     1195                    } else {
     1196                        $output .= ' shariff-text-white"';
     1197                    }
     1198                } else {
     1199                    // Border radius.
     1200                    $output .= '" style="' . $border_radius;
     1201                    // Custom color?
     1202                    if ( array_key_exists( 'maincolor', $atts ) ) {
     1203                        $output .= '; background-color:' . $atts['maincolor'];
     1204                    } else {
     1205                        $output .= '; background-color:' . $main_color;
     1206                    }
     1207                    // Theme white?
     1208                    if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
     1209                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1210                            $output .= '; color:' . $atts['maincolor'] . '"';
     1211                        } else {
     1212                            $output .= '; color:' . $main_color . '"';
     1213                        }
     1214                    } else {
     1215                        $output .= '; color:#fff"';
     1216                    }
     1217                }
     1218
    11141219                // Same window?
    11151220                if ( ! isset( $same_window ) || isset( $same_window ) && 1 !== $same_window ) {
    1116                     $output .= 'target="_blank" ';
     1221                    $output .= ' target="_blank"';
    11171222                }
    1118                 $output .= 'style="background-color:' . $main_color . $border_radius;
    1119                 // Theme white?
    1120                 if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
    1121                     $output .= '; color:' . $main_color;
     1223
     1224                // End a>.
     1225                $output .= '>';
     1226
     1227                // Shariff icon.
     1228                $output .= '<span class="shariff-icon';
     1229                // AMP?
     1230                if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     1231                    // Theme white?
     1232                    if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
     1233                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1234                            $output .= ' shariff-svg-color';
     1235                            $css     = '.shariff-svg-color{fill:' . $atts['maincolor'] . '}';
     1236                        } else {
     1237                            $output .= ' shariff-' . $service . '-svg-color';
     1238                            $css     = '.shariff-' . $service . '-svg-color{fill:' . $main_color . '}';
     1239                        }
     1240                        if ( false === strpos( $dynamic_css, $css ) ) {
     1241                            $dynamic_css .= $css;
     1242                        }
     1243                    }
    11221244                } else {
    1123                     $output .= '; color:#fff';
     1245                    $output .= '" style="';
     1246                    // Theme white?
     1247                    if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
     1248                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1249                            $output .= 'fill:' . $atts['maincolor'];
     1250                        } else {
     1251                            $output .= 'fill:' . $main_color;
     1252                        }
     1253                    }
    11241254                }
    1125                 $output .= '">';
    1126                 $output .= '<span class="shariff-icon"';
    1127                 // Theme white?
    1128                 if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
    1129                     $output .= ' style="fill:' . $main_color . '"';
    1130                 }
    1131                 $output .= '>' . $svg_icon . '</span>';
    1132                 $output .= '<span class="shariff-text"';
    1133                 if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
    1134                     $output .= ' style="color:' . $main_color;
     1255                $output .= '">' . $svg_icon . '</span>';
     1256
     1257                // Shariff text.
     1258                $output .= '<span class="shariff-text';
     1259                // AMP?
     1260                if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     1261                    // Theme white?
     1262                    if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
     1263                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1264                            $output .= ' shariff-text-color';
     1265                            $css     = '.shariff-text-color{color:' . $atts['maincolor'] . '}';
     1266                        } else {
     1267                            $output .= ' shariff-' . $service . '-text-color';
     1268                            $css     = '.shariff-' . $service . '-text-color{color:' . $main_color . '}';
     1269                        }
     1270                        if ( false === strpos( $dynamic_css, $css ) ) {
     1271                            $dynamic_css .= $css;
     1272                        }
     1273                    }
     1274                } else {
     1275                    // Theme white?
     1276                    if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
     1277                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1278                            $output .= '" style="color:' . $atts['maincolor'];
     1279                        } else {
     1280                            $output .= '" style="color:' . $main_color;
     1281                        }
     1282                    }
    11351283                }
    11361284                $output .= '">' . $button_text . '</span>&nbsp;';
     1285
    11371286                // Share counts?
    11381287                if ( array_key_exists( 'sharecounts', $atts ) && 1 === $atts['sharecounts'] && 1 === $backend_available && ! isset( $shariff3uu['disable'][ $service ] ) ) {
    1139                     $output .= '<span class="shariff-count" data-service="' . $service . '" style="color:' . $main_color;
    1140                     if ( true === array_key_exists( $service, $share_counts ) && null !== $share_counts[ $service ] && '-1' !== $share_counts[ $service ] && ( ! isset( $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && '-1' !== $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && 1 === $atts['hidezero'] && $share_counts[ $service ] > 0 ) ) ) {
     1288                    $output .= '<span data-service="' . $service . '"';
     1289                    // AMP?
     1290                    if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     1291                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1292                            $output .= ' class="shariff-count shariff-text-color"';
     1293                            $css     = '.shariff-text-color{color:#fff}';
     1294                        } else {
     1295                            $output .= ' class="shariff-count shariff-' . $service . '-text-color';
     1296                            $css     = '.shariff-' . $service . '-text-color{color:' . $main_color . '}';
     1297                        }
     1298                        if ( false === strpos( $dynamic_css, $css ) ) {
     1299                            $dynamic_css .= $css;
     1300                        }
     1301                    } else {
     1302                        if ( array_key_exists( 'maincolor', $atts ) ) {
     1303                            $output .= ' style="color:#fff" class="shariff-count';
     1304
     1305                        } else {
     1306                            $output .= ' style="color:' . $main_color . '" class="shariff-count';
     1307
     1308                        }
     1309                    }
     1310                    // Hide zero?
     1311                    if ( true === array_key_exists( $service, $share_counts ) && null !== $share_counts[ $service ] && '-1' !== $share_counts[ $service ] && ( ! isset( $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && 1 !== $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && 1 === $atts['hidezero'] && $share_counts[ $service ] > 0 ) ) ) {
    11411312                        $output .= '"> ' . $share_counts[ $service ];
    11421313                    } else {
    1143                         $output .= ';opacity:0">';
     1314                        $output .= ' shariff-hidezero">';
    11441315                    }
    11451316                    $output .= '</span>&nbsp;';
     
    11471318                $output .= '</a>';
    11481319                $output .= '</li>';
     1320
    11491321                // Adds service to backend service, if available.
    11501322                if ( 1 === $backend_available && ! isset( $shariff3uu['disable'][ $service ] ) ) {
    11511323                    $backend_service_array[] = $service;
    11521324                }
     1325
    11531326                // Resets the $backend, $mobile_only and $same_window variables.
    11541327                $backend_available = '';
     
    11711344    if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) {
    11721345        $output .= '</div>';
     1346    }
     1347
     1348    // Update the dynamic css db entry if needed.
     1349    if ( ( array_key_exists( 'dynamic_css', $shariff3uu ) && $shariff3uu['dynamic_css'] !== $dynamic_css ) || ! array_key_exists( 'dynamic_css', $shariff3uu ) ) {
     1350        $shariff3uu_design                    = array_filter( $GLOBALS['shariff3uu_design'] );
     1351        $shariff3uu_design['dynamic_css']     = $dynamic_css;
     1352        $GLOBALS['shariff3uu']['dynamic_css'] = $dynamic_css;
     1353        update_option( 'shariff3uu_design', $shariff3uu_design );
    11731354    }
    11741355
Note: See TracChangeset for help on using the changeset viewer.