Plugin Directory

Changeset 2127344 for shariff


Ignore:
Timestamp:
07/23/2019 04:47:30 PM (7 years ago)
Author:
starguide
Message:

Release 4.6.3

Location:
shariff/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • shariff/trunk/admin/admin-menu.php

    r2058462 r2127344  
    1313
    1414// Set services that have a share count API / backend.
    15 $shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', 'xing', 'reddit', 'tumblr', 'vk', 'addthis', 'flattr', 'odnoklassniki', 'buffer' );
     15$shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', 'xing', 'reddit', 'tumblr', 'vk', 'addthis', 'odnoklassniki', 'buffer' );
    1616
    1717// Adds the actions for the admin page.
     
    308308        __( 'Twitter username for the via tag:', 'shariff' ),
    309309        'shariff3uu_text_twittervia_render',
    310         'shariff3uu_advanced',
    311         'shariff3uu_advanced_section'
    312     );
    313 
    314     // Flattr username.
    315     add_settings_field(
    316         'shariff3uu_text_flattruser',
    317         __( 'Flattr username:', 'shariff' ),
    318         'shariff3uu_text_flattruser_render',
    319310        'shariff3uu_advanced',
    320311        'shariff3uu_advanced_section'
     
    13221313    }
    13231314    echo '<input type="text" name="shariff3uu_advanced[twitter_via]" value="' . esc_html( $twitter_via ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
    1324 }
    1325 
    1326 /**
    1327  * Flattr username.
    1328  */
    1329 function shariff3uu_text_flattruser_render() {
    1330     if ( isset( $GLOBALS['shariff3uu_advanced']['flattruser'] ) ) {
    1331         $flattruser = $GLOBALS['shariff3uu_advanced']['flattruser'];
    1332     } else {
    1333         $flattruser = '';
    1334     }
    1335     echo '<input type="text" name="shariff3uu_advanced[flattruser]" value="' . esc_html( $flattruser ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
    13361315}
    13371316
     
    18501829            echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Twitter via tag.', 'shariff' ) . '</div>';
    18511830        echo '</div>';
    1852         // Flattruser.
    1853         echo '<div style="display:table-row">';
    1854             echo '<div style="display:table-cell;border:1px solid;padding:10px">flattruser</div>';
    1855             echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
    1856             echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
    1857             echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff flattruser="your_username"]</div>';
    1858             echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Flattr username.', 'shariff' ) . '</div>';
    1859         echo '</div>';
    18601831        // Patreonid.
    18611832        echo '<div style="display:table-row">';
     
    20231994            if ( isset( $shariff3uu['disable'][ $service ] ) && 1 === $shariff3uu['disable'][ $service ] ) {
    20241995                echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . esc_html__( 'Disabled', 'shariff' ) . '</div></div>';
     1996            } elseif ( 'facebook' === $service && ( ! isset( $shariff3uu['fb_id'] ) || ! isset( $shariff3uu['fb_secret'] ) ) ) {
     1997                echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:#ff0000">' . esc_html__( 'Facebook shut down the possibility to request share counts without an APP ID and Secret. Therefore, you need to create a Facebook APP ID and Secret and enter it in the settings on the Statistic tab. Google will provide you with many tutorials. Simple search for “facebook app id secret” and you will find one in your language.', 'shariff' ) . '</div></div>';
    20251998            } elseif ( ! array_key_exists( $service, $service_errors ) ) {
    20261999                echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . esc_html__( 'OK', 'shariff' ) . '</div></div>';
  • shariff/trunk/admin/admin-notices.php

    r1851328 r2127344  
    2020    // Check if any services are set and if user can manage options.
    2121    if ( isset( $GLOBALS['shariff3uu']['services'] ) && current_user_can( 'manage_options' ) ) {
    22         // Flattr.
    23         if ( strpos( $GLOBALS['shariff3uu']['services'], 'flattr' ) !== false && empty( $GLOBALS['shariff3uu']['flattruser'] ) ) {
    24             $services[] = 'Flattr';
    25         }
    2622        // Patreon.
    2723        if ( strpos( $GLOBALS['shariff3uu']['services'], 'patreon' ) !== false && empty( $GLOBALS['shariff3uu']['patreonid'] ) ) {
  • shariff/trunk/changelog.txt

    r2058462 r2127344  
    22
    33== Changelog ==
     4
     5= 4.6.3 =
     6- updated the WhatsApp share link to work with all devices again (thanks to @hanshansenxxx)
     7- updated to Facebook Graph API v3.3
     8- updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
     9- fixed an update issue with WP CLI
     10- removed the Facebook share counts request without APP ID and Secret
     11- Facebook now always requires an APP ID and Secret for share counts
     12- removed Flattr counts due to Flattr removing the API
    413
    514= 4.6.2 =
  • shariff/trunk/readme.txt

    r2058462 r2127344  
    44Requires at least: 4.9
    55Requires PHP: 7.0
    6 Tested up to: 5.1
    7 Stable tag: 4.6.2
     6Tested up to: 5.2
     7Stable tag: 4.6.3
    88License: MIT
    99License URI: http://opensource.org/licenses/mit
     
    152152
    153153== Changelog ==
     154
     155= 4.6.3 =
     156- updated the WhatsApp share link to work with all devices again (thanks to @hanshansenxxx)
     157- updated to Facebook Graph API v3.3
     158- updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
     159- fixed an update issue with WP CLI
     160- removed the Facebook share counts request without APP ID and Secret
     161- Facebook now always requires an APP ID and Secret for share counts
     162- removed Flattr counts due to Flattr removing the API
    154163
    155164= 4.6.2 =
  • shariff/trunk/services/shariff-buffer.php

    r2058462 r2127344  
    2525
    2626    // SVG icon.
    27     $svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path fill="' . $main_color . '" d="M91-37.4V-52l1.8 1 24 11.2c1.7.8 3.3.7 4.9 0l24-11.2 1-.4c.9-.6 1-1.3 0-1.8l-3.5-1.7a6.2 6.2 0 0 0-6.2 0l-15.1 7.1c-1.7.8-3.4.9-5.1 0-4.7-2.3-9.5-4.3-14.2-6.7-2.7-1.4-5.3-1.7-8-.1-1.1.7-2.3 1.2-3.5 1.7v-14.3l25 11.6c2.2 1.1 4.2 1 6.3 0l23.5-11c.6-.3 1.5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1.7 1.8v15z"/><path fill="' . $main_color . '" d="M.3 14.1L29.3.5c1.7-.7 3.2-.6 4.9.1C43.3 5 52.5 9.1 61.5 13.5c.7.3 1.4.5 1.4 1.3 0 1-.9 1.1-1.5 1.4-8.7 4.2-17.5 8.2-26.2 12.3a7.8 7.8 0 0 1-7 0L.3 15.5v-1.4zM.3 48.8l5.1-2.6c2.2-1 4.2-.9 6.3.1l16.8 8c2.1 1 4.1 1 6.2 0l17.1-8c2.1-1 4.1-1 6.2 0l3.8 1.7c.6.3 1.4.6 1.3 1.3 0 .7-.7 1-1.3 1.3l-12.7 6-14.4 6.7c-1.8.9-3.7 1-5.6 0L2 50.9c-.6-.2-1-.7-1.6-1-.2-.2-.2-.6-.2-1z"/><path fill="' . $main_color . '" d="M.3 31.5l4-1.9c3-1.8 5.7-1.4 8.8.1 5.3 2.7 10.6 5 15.9 7.5 2 .9 3.7.9 5.6 0 5.6-2.7 11.3-5.2 16.9-8a7.2 7.2 0 0 1 6.9 0c1.2.8 2.6 1.3 3.9 2 1 .6 1 1.3 0 2l-1 .4-26.9 12.5c-1.8.9-3.6.9-5.3 0L2.2 33.6c-.7-.3-1.2-.8-1.9-1v-1z"/></svg>';
     27    $svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="' . $main_color . '" d="M91-37.4V-52l1.8 1 24 11.2c1.7.8 3.3.7 4.9 0l24-11.2 1-.4c.9-.6 1-1.3 0-1.8l-3.5-1.7a6.2 6.2 0 0 0-6.2 0l-15.1 7.1c-1.7.8-3.4.9-5.1 0-4.7-2.3-9.5-4.3-14.2-6.7-2.7-1.4-5.3-1.7-8-.1-1.1.7-2.3 1.2-3.5 1.7v-14.3l25 11.6c2.2 1.1 4.2 1 6.3 0l23.5-11c.6-.3 1.5-.4 1.4-1.3 0-.8-.8-1-1.3-1.2l-24.5-11.5a5.2 5.2 0 0 0-4.4-.1L91-68.5v-16.2c0-1.1.2-1.3 1.3-1.3h88.9l-.1 2.3v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 4.2-17.5 8.2-26.2 12.3a7.8 7.8 0 0 1-7 0L.3 15.5v-1.4zm0 34.7l5.1-2.6a7 7 0 0 1 6.3.1l16.8 8c2.1 1 4.1 1 6.2 0l17.1-8c2.1-1 4.1-1 6.2 0l3.8 1.7c.6.3 1.4.6 1.3 1.3 0 .7-.7 1-1.3 1.3l-12.7 6-14.4 6.7c-1.8.9-3.7 1-5.6 0L2 50.9c-.6-.2-1-.7-1.6-1-.2-.2-.2-.6-.2-1z"/><path fill="' . $main_color . '" d="M.3 31.5l4-1.9c3-1.8 5.7-1.4 8.8.1 5.3 2.7 10.6 5 15.9 7.5 2 .9 3.7.9 5.6 0 5.6-2.7 11.3-5.2 16.9-8a7.2 7.2 0 0 1 6.9 0c1.2.8 2.6 1.3 3.9 2 1 .6 1 1.3 0 2l-1 .4-26.9 12.5c-1.8.9-3.6.9-5.3 0L2.2 33.6c-.7-.3-1.2-.8-1.9-1v-1z"/></svg>';
    2828
    2929    // Backend available?
  • shariff/trunk/services/shariff-facebook.php

    r2035136 r2127344  
    5959    );
    6060} elseif ( isset( $backend ) && 1 === $backend ) {
    61     // Use the FB ID and Secret, if available, else use the normal way.
     61    // Use the FB ID and Secret, if available.
    6262    if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) {
    6363        // On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long.
     
    7171        $fb_token = $fb_app_id . '|' . $fb_app_secret;
    7272        // Use the token to get the share counts.
    73         $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/v3.2/?access_token=' . $fb_token . '&fields=engagement&id=' . $post_url ) ) );
     73        $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/v3.3/?access_token=' . $fb_token . '&fields=engagement&id=' . $post_url ) ) );
    7474        // Decode the json response.
    7575        $facebook_json = json_decode( $facebook, true );
    7676        // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
    7777        $nofbid = '0';
    78     } else {
    79         $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/?id=' . $post_url ) ) );
    80         // Decode the json response.
    81         $facebook_json = json_decode( $facebook, true );
    82         // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
    83         $nofbid = 1;
    8478    }
    8579
  • shariff/trunk/services/shariff-flattr.php

    r2035136 r2127344  
    1414if ( isset( $frontend ) && 1 === $frontend ) {
    1515    // Service URL.
    16     $service_url = esc_url( 'https://flattr.com/submit/auto' );
     16    $service_url = esc_url( 'https://flattr.com/domain/' );
    1717
    18     // Lang tag.
    19     if ( isset( $atts['lang'] ) ) {
    20         $lang = $atts['lang'] . '_' . strtoupper( $atts['lang'] );
    21     } else {
    22         $lang = 'en_US';
    23     }
    24 
    25     // Flattr user.
    26     if ( array_key_exists( 'flattruser', $atts ) ) {
    27         $flattruser = esc_html( $atts['flattruser'] );
    28     } else {
    29         $flattruser = '';
    30     }
     18    // Get WP URL.
     19    $wp_url = wp_parse_url( get_bloginfo( 'url' ) );
    3120
    3221    // Build button URL.
    33     $button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title . '&language=' . $lang . '&fid=' . $flattruser;
     22    $button_url = $service_url . preg_replace('#^www\.(.+\.)#i', '$1', $wp_url['host'] );
    3423
    3524    // Colors.
     
    5746        'es' => 'Flattr!',
    5847    );
    59 } elseif ( isset( $backend ) && 1 === $backend ) {
    60     // Fetch counts.
    61     $flattr      = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.flattr.com/rest/v2/things/lookup/?url=' . $post_url ) ) );
    62     $flattr_json = json_decode( $flattr, true );
    63 
    64     // Store results, if we have some. If no thing was found, set it to 0. Record errors, if enabled (e.g. request from the status tab).
    65     if ( isset( $flattr_json['flattrs'] ) ) {
    66         $share_counts['flattr'] = intval( $flattr_json['flattrs'] );
    67     } elseif ( isset( $flattr_json['description'] ) && 'No thing was found' === $flattr_json['description'] ) {
    68         $share_counts['flattr'] = 0;
    69     } elseif ( isset( $record_errors ) && 1 === $record_errors ) {
    70         $service_errors['flattr'] = $flattr;
    71     }
    7248}
  • shariff/trunk/services/shariff-mix.php

    r2037163 r2127344  
    5454        'sv' => 'Dela på Mix',
    5555    );
    56 } 
     56}
  • shariff/trunk/services/shariff-whatsapp.php

    r2037163 r2127344  
    1414if ( isset( $frontend ) && 1 === $frontend ) {
    1515    // Service URL.
    16     $service_url = 'https://wa.me/';
     16    $service_url = 'https://api.whatsapp.com/send';
    1717
    1818    // Build button URL.
  • shariff/trunk/shariff.php

    r2058462 r2127344  
    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.6.2
     6 * Version: 4.6.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.6.2';
    37 
    38     // Get options.
    39     $shariff3uu = $GLOBALS['shariff3uu'];
     36    $code_version = '4.6.3';
     37
     38    // Get basic options.
     39    $shariff3uu_basic = (array) get_option( 'shariff3uu_basic' );
    4040
    4141    // Check if the installed version is older than the code version and include updates.php if necessary.
    42     if ( empty( $shariff3uu['version'] ) || ( isset( $shariff3uu['version'] ) && version_compare( $shariff3uu['version'], $code_version ) === -1 ) ) {
     42    if ( empty( $shariff3uu_basic['version'] ) || ( isset( $shariff3uu_basic['version'] ) && version_compare( $shariff3uu_basic['version'], $code_version ) === -1 ) ) {
     43        // Get the other options.
     44        $shariff3uu_design    = (array) get_option( 'shariff3uu_design' );
     45        $shariff3uu_advanced  = (array) get_option( 'shariff3uu_advanced' );
     46        $shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
     47        $shariff3uu           = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $shariff3uu_statistic );
    4348        // Include updates.php.
    4449        include dirname( __FILE__ ) . '/updates.php';
     
    4651}
    4752add_action( 'admin_init', 'shariff3uu_update' );
     53// In case WP-CLI is used and the backend is never visited, we add it to cli_init as well.
     54add_action( 'cli_init', 'shariff3uu_update' );
    4855
    4956/**
     
    11941201    foreach ( $service_array as $service ) {
    11951202        // Check if necessary usernames are set and display warning to admins, if needed.
    1196         if ( 'flattr' === $service && ! array_key_exists( 'flattruser', $atts ) ) {
    1197             $flattr_error = 1;
    1198         } elseif ( 'paypal' === $service && ! array_key_exists( 'paypalbuttonid', $atts ) ) {
     1203        if ( 'paypal' === $service && ! array_key_exists( 'paypalbuttonid', $atts ) ) {
    11991204            $paypal_error = 1;
    12001205        } elseif ( 'paypalme' === $service && ! array_key_exists( 'paypalmeid', $atts ) ) {
     
    15191524    }
    15201525
    1521     // Displays a warning to admins if flattr is set, but no flattr username was provided.
    1522     if ( 1 === $flattr_error && current_user_can( 'manage_options' ) ) {
    1523         $output .= '<div class="shariff-warning">' . __( 'Username for Flattr is missing!', 'shariff' ) . '</div>';
    1524     }
    15251526    // Displays a warning to admins if patreon is set, but no patreon username was provided.
    15261527    if ( 1 === $patreon_error && current_user_can( 'manage_options' ) ) {
     
    15731574 */
    15741575function shariff3uu_deactivate() {
    1575     global $wpdb;
    15761576    // Checks for multisite.
    15771577    if ( is_multisite() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
  • shariff/trunk/updates.php

    r2037163 r2127344  
    11<?php
    22/**
    3  * Will be included by shariff3UU_update() only if needed.
     3 * Will be included by shariff3uu_update() only if needed.
    44 * Put all update task here. Make sure that all "older" updates are checked first.
    5  * At least you must set $GLOBALS["shariff3UU"]["version"] = [YOUR VERSION]; to avoid includes later on.
     5 * At least you must set $shariff3uu['version'] = [YOUR VERSION]; to avoid includes later on.
    66 *
    77 * @package WordPress
     
    1818 * Delete old cache directory.
    1919 */
    20 if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '2.2.5' ) ) {
     20if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '2.2.5' ) ) {
    2121
    2222    // Basic options.
    23     if ( isset( $GLOBALS['shariff3UU']['version'] ) ) {
    24         $GLOBALS['shariff3UU_basic']['version'] = $GLOBALS['shariff3UU']['version'];
    25     }
    26     if ( isset( $GLOBALS['shariff3UU']['services'] ) ) {
    27         $GLOBALS['shariff3UU_basic']['services'] = $GLOBALS['shariff3UU']['services'];
    28     }
    29     if ( isset( $GLOBALS['shariff3UU']['add_after_all_posts'] ) ) {
    30         $GLOBALS['shariff3UU_basic']['add_after']['posts'] = $GLOBALS['shariff3UU']['add_after_all_posts'];
    31     }
    32     if ( isset( $GLOBALS['shariff3UU']['add_after_all_overview'] ) ) {
    33         $GLOBALS['shariff3UU_basic']['add_after']['posts_blogpage'] = $GLOBALS['shariff3UU']['add_after_all_overview'];
    34     }
    35     if ( isset( $GLOBALS['shariff3UU']['add_after_all_pages'] ) ) {
    36         $GLOBALS['shariff3UU_basic']['add_after']['pages'] = $GLOBALS['shariff3UU']['add_after_all_pages'];
    37     }
    38     if ( isset( $GLOBALS['shariff3UU']['add_after_all_custom_type'] ) ) {
    39         $GLOBALS['shariff3UU_basic']['add_after']['custom_type'] = $GLOBALS['shariff3UU']['add_after_all_custom_type'];
    40     }
    41     if ( isset( $GLOBALS['shariff3UU']['add_before_all_posts'] ) ) {
    42         $GLOBALS['shariff3UU_basic']['add_before']['posts'] = $GLOBALS['shariff3UU']['add_before_all_posts'];
    43     }
    44     if ( isset( $GLOBALS['shariff3UU']['add_before_all_overview'] ) ) {
    45         $GLOBALS['shariff3UU_basic']['add_before']['posts_blogpage'] = $GLOBALS['shariff3UU']['add_before_all_overview'];
    46     }
    47     if ( isset( $GLOBALS['shariff3UU']['add_before_all_pages'] ) ) {
    48         $GLOBALS['shariff3UU_basic']['add_before']['pages'] = $GLOBALS['shariff3UU']['add_before_all_pages'];
    49     }
    50     if ( isset( $GLOBALS['shariff3UU']['disable_on_protected'] ) ) {
    51         $GLOBALS['shariff3UU_basic']['disable_on_protected'] = $GLOBALS['shariff3UU']['disable_on_protected'];
    52     }
    53     if ( isset( $GLOBALS['shariff3UU']['backend'] ) ) {
    54         $GLOBALS['shariff3UU_basic']['backend'] = $GLOBALS['shariff3UU']['backend'];
     23    if ( isset( $shariff3uu['version'] ) ) {
     24        $shariff3uu_basic['version'] = $shariff3uu['version'];
     25    }
     26    if ( isset( $shariff3uu['services'] ) ) {
     27        $shariff3uu_basic['services'] = $shariff3uu['services'];
     28    }
     29    if ( isset( $shariff3uu['add_after_all_posts'] ) ) {
     30        $shariff3uu_basic['add_after']['posts'] = $shariff3uu['add_after_all_posts'];
     31    }
     32    if ( isset( $shariff3uu['add_after_all_overview'] ) ) {
     33        $shariff3uu_basic['add_after']['posts_blogpage'] = $shariff3uu['add_after_all_overview'];
     34    }
     35    if ( isset( $shariff3uu['add_after_all_pages'] ) ) {
     36        $shariff3uu_basic['add_after']['pages'] = $shariff3uu['add_after_all_pages'];
     37    }
     38    if ( isset( $shariff3uu['add_after_all_custom_type'] ) ) {
     39        $shariff3uu_basic['add_after']['custom_type'] = $shariff3uu['add_after_all_custom_type'];
     40    }
     41    if ( isset( $shariff3uu['add_before_all_posts'] ) ) {
     42        $shariff3uu_basic['add_before']['posts'] = $shariff3uu['add_before_all_posts'];
     43    }
     44    if ( isset( $shariff3uu['add_before_all_overview'] ) ) {
     45        $shariff3uu_basic['add_before']['posts_blogpage'] = $shariff3uu['add_before_all_overview'];
     46    }
     47    if ( isset( $shariff3uu['add_before_all_pages'] ) ) {
     48        $shariff3uu_basic['add_before']['pages'] = $shariff3uu['add_before_all_pages'];
     49    }
     50    if ( isset( $shariff3uu['disable_on_protected'] ) ) {
     51        $shariff3uu_basic['disable_on_protected'] = $shariff3uu['disable_on_protected'];
     52    }
     53    if ( isset( $shariff3uu['backend'] ) ) {
     54        $shariff3uu_basic['backend'] = $shariff3uu['backend'];
    5555    }
    5656
    5757    // Design options.
    58     if ( isset( $GLOBALS['shariff3UU']['language'] ) ) {
    59         $GLOBALS['shariff3UU_design']['language'] = $GLOBALS['shariff3UU']['language'];
    60     }
    61     if ( isset( $GLOBALS['shariff3UU']['theme'] ) ) {
    62         $GLOBALS['shariff3UU_design']['theme'] = $GLOBALS['shariff3UU']['theme'];
    63     }
    64     if ( isset( $GLOBALS['shariff3UU']['buttonsize'] ) ) {
    65         $GLOBALS['shariff3UU_design']['buttonsize'] = $GLOBALS['shariff3UU']['buttonsize'];
    66     }
    67     if ( isset( $GLOBALS['shariff3UU']['vertical'] ) ) {
    68         $GLOBALS['shariff3UU_design']['vertical'] = $GLOBALS['shariff3UU']['vertical'];
    69     }
    70     if ( isset( $GLOBALS['shariff3UU']['align'] ) ) {
    71         $GLOBALS['shariff3UU_design']['align'] = $GLOBALS['shariff3UU']['align'];
    72     }
    73     if ( isset( $GLOBALS['shariff3UU']['align_widget'] ) ) {
    74         $GLOBALS['shariff3UU_design']['align_widget'] = $GLOBALS['shariff3UU']['align_widget'];
    75     }
    76     if ( isset( $GLOBALS['shariff3UU']['style'] ) ) {
    77         $GLOBALS['shariff3UU_design']['style'] = $GLOBALS['shariff3UU']['style'];
     58    if ( isset( $shariff3uu['language'] ) ) {
     59        $shariff3uu_design['language'] = $shariff3uu['language'];
     60    }
     61    if ( isset( $shariff3uu['theme'] ) ) {
     62        $shariff3uu_design['theme'] = $shariff3uu['theme'];
     63    }
     64    if ( isset( $shariff3uu['buttonsize'] ) ) {
     65        $shariff3uu_design['buttonsize'] = $shariff3uu['buttonsize'];
     66    }
     67    if ( isset( $shariff3uu['vertical'] ) ) {
     68        $shariff3uu_design['vertical'] = $shariff3uu['vertical'];
     69    }
     70    if ( isset( $shariff3uu['align'] ) ) {
     71        $shariff3uu_design['align'] = $shariff3uu['align'];
     72    }
     73    if ( isset( $shariff3uu['align_widget'] ) ) {
     74        $shariff3uu_design['align_widget'] = $shariff3uu['align_widget'];
     75    }
     76    if ( isset( $shariff3uu['style'] ) ) {
     77        $shariff3uu_design['style'] = $shariff3uu['style'];
    7878    }
    7979
    8080    // Advanced options.
    81     if ( isset( $GLOBALS['shariff3UU']['info_url'] ) ) {
    82         $GLOBALS['shariff3UU_advanced']['info_url'] = $GLOBALS['shariff3UU']['info_url'];
    83     }
    84     if ( isset( $GLOBALS['shariff3UU']['twitter_via'] ) ) {
    85         $GLOBALS['shariff3UU_advanced']['twitter_via'] = $GLOBALS['shariff3UU']['twitter_via'];
    86     }
    87     if ( isset( $GLOBALS['shariff3UU']['flattruser'] ) ) {
    88         $GLOBALS['shariff3UU_advanced']['flattruser'] = $GLOBALS['shariff3UU']['flattruser'];
    89     }
    90     if ( isset( $GLOBALS['shariff3UU']['default_pinterest'] ) ) {
    91         $GLOBALS['shariff3UU_advanced']['default_pinterest'] = $GLOBALS['shariff3UU']['default_pinterest'];
     81    if ( isset( $shariff3uu['info_url'] ) ) {
     82        $shariff3uu_advanced['info_url'] = $shariff3uu['info_url'];
     83    }
     84    if ( isset( $shariff3uu['twitter_via'] ) ) {
     85        $shariff3uu_advanced['twitter_via'] = $shariff3uu['twitter_via'];
     86    }
     87    if ( isset( $shariff3uu['flattruser'] ) ) {
     88        $shariff3uu_advanced['flattruser'] = $shariff3uu['flattruser'];
     89    }
     90    if ( isset( $shariff3uu['default_pinterest'] ) ) {
     91        $shariff3uu_advanced['default_pinterest'] = $shariff3uu['default_pinterest'];
    9292    }
    9393
    9494    // Mailform options.
    95     if ( isset( $GLOBALS['shariff3UU']['mail_add_post_content'] ) ) {
    96         $GLOBALS['shariff3UU_mailform']['mail_add_post_content'] = $GLOBALS['shariff3UU']['mail_add_post_content'];
    97     }
    98     if ( isset( $GLOBALS['shariff3UU']['mail_sender_name'] ) ) {
    99         $GLOBALS['shariff3UU_mailform']['mail_sender_name'] = $GLOBALS['shariff3UU']['mail_sender_name'];
    100     }
    101     if ( isset( $GLOBALS['shariff3UU']['mail_sender_from'] ) ) {
    102         $GLOBALS['shariff3UU_mailform']['mail_sender_from'] = $GLOBALS['shariff3UU']['mail_sender_from'];
     95    if ( isset( $shariff3uu['mail_add_post_content'] ) ) {
     96        $GLOBALS['shariff3UU_mailform']['mail_add_post_content'] = $shariff3uu['mail_add_post_content'];
     97    }
     98    if ( isset( $shariff3uu['mail_sender_name'] ) ) {
     99        $GLOBALS['shariff3UU_mailform']['mail_sender_name'] = $shariff3uu['mail_sender_name'];
     100    }
     101    if ( isset( $shariff3uu['mail_sender_from'] ) ) {
     102        $GLOBALS['shariff3UU_mailform']['mail_sender_from'] = $shariff3uu['mail_sender_from'];
    103103    }
    104104    // Default options should be as save as possible, same reason the statistics are disabled by default.
     
    106106
    107107    // Update global.
    108     $GLOBALS['shariff3UU'] = array_merge( $GLOBALS['shariff3UU_basic'], $GLOBALS['shariff3UU_design'], $GLOBALS['shariff3UU_advanced'], $GLOBALS['shariff3UU_mailform'] );
     108    $shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $GLOBALS['shariff3UU_mailform'] );
    109109
    110110    // Update version.
    111     $GLOBALS['shariff3UU']['version'] = '2.3.0';
     111    $shariff3uu['version'] = '2.3.0';
    112112}
    113113
     
    117117 * Delete old cache directory and db entry.
    118118 */
    119 if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '3.3.0' ) ) {
     119if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '3.3.0' ) ) {
    120120
    121121    // Update options that were moved.
    122     if ( isset( $GLOBALS['shariff3UU']['backend'] ) ) {
    123         $GLOBALS['shariff3UU_statistic']['backend'] = $GLOBALS['shariff3UU']['backend'];
    124     }
    125     if ( isset( $GLOBALS['shariff3UU']['fb_id'] ) ) {
    126         $GLOBALS['shariff3UU_statistic']['fb_id'] = $GLOBALS['shariff3UU']['fb_id'];
    127     }
    128     if ( isset( $GLOBALS['shariff3UU']['fb_secret'] ) ) {
    129         $GLOBALS['shariff3UU_statistic']['fb_secret'] = $GLOBALS['shariff3UU']['fb_secret'];
    130     }
    131     if ( isset( $GLOBALS['shariff3UU']['ttl'] ) ) {
    132         $GLOBALS['shariff3UU_statistic']['ttl'] = $GLOBALS['shariff3UU']['ttl'];
    133     }
    134     if ( isset( $GLOBALS['shariff3UU']['disable'] ) ) {
    135         $GLOBALS['shariff3UU_statistic']['disable'] = $GLOBALS['shariff3UU']['disable'];
     122    if ( isset( $shariff3uu['backend'] ) ) {
     123        $shariff3uu_statistic['backend'] = $shariff3uu['backend'];
     124    }
     125    if ( isset( $shariff3uu['fb_id'] ) ) {
     126        $shariff3uu_statistic['fb_id'] = $shariff3uu['fb_id'];
     127    }
     128    if ( isset( $shariff3uu['fb_secret'] ) ) {
     129        $shariff3uu_statistic['fb_secret'] = $shariff3uu['fb_secret'];
     130    }
     131    if ( isset( $shariff3uu['ttl'] ) ) {
     132        $shariff3uu_statistic['ttl'] = $shariff3uu['ttl'];
     133    }
     134    if ( isset( $shariff3uu['disable'] ) ) {
     135        $shariff3uu_statistic['disable'] = $shariff3uu['disable'];
    136136    }
    137137
     
    161161
    162162    // Disable Twitter backend due to new service OpenShareCount.com.
    163     $GLOBALS['shariff3UU_statistic']['disable']['twitter'] = 1;
     163    $shariff3uu_statistic['disable']['twitter'] = 1;
    164164
    165165    // Update version.
    166     $GLOBALS['shariff3UU']['version'] = '3.3.0';
     166    $shariff3uu['version'] = '3.3.0';
    167167}
    168168
     
    199199 * Migration < 4.0
    200200 */
    201 if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.0.0' ) ) {
     201if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.0.0' ) ) {
    202202
    203203    // Set new option share counts, if statistic is enabled.
    204     if ( isset( $GLOBALS['shariff3UU_statistic']['backend'] ) ) {
    205         $GLOBALS['shariff3UU_statistic']['sharecounts'] = 1;
     204    if ( isset( $shariff3uu_statistic['backend'] ) ) {
     205        $shariff3uu_statistic['sharecounts'] = 1;
    206206    }
    207207
    208208    // Disable share counts if WP version < 4.4.
    209209    if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) {
    210         unset( $GLOBALS['shariff3UU_statistic']['backend'] );
     210        unset( $shariff3uu_statistic['backend'] );
    211211    }
    212212
    213213    // Change button language to WordPress language, if it is set to auto and http_negotiate_language is not available (auto will not work without it).
    214     if ( ! isset( $GLOBALS['shariff3UU_design']['lang'] ) && ! function_exists( 'http_negotiate_language' ) ) {
    215         $GLOBALS['shariff3UU_design']['lang'] = substr( get_bloginfo( 'language' ), 0, 2 );
     214    if ( ! isset( $shariff3uu_design['lang'] ) && ! function_exists( 'http_negotiate_language' ) ) {
     215        $shariff3uu_design['lang'] = substr( get_bloginfo( 'language' ), 0, 2 );
    216216    }
    217217
    218218    // Update version.
    219     $GLOBALS['shariff3UU']['version'] = '4.0.0';
     219    $shariff3uu['version'] = '4.0.0';
    220220}
    221221
     
    223223 * Migration < 4.2
    224224 */
    225 if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.2.0' ) ) {
     225if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.2.0' ) ) {
    226226    // Make sure we have the $wpdb class ready.
    227227    global $wpdb;
     
    260260 * Migration < 4.5
    261261 */
    262 if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.5.0' ) ) {
     262if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.5.0' ) ) {
    263263    // Update language settings.
    264     if ( ! isset( $GLOBALS['shariff3UU_design']['lang'] ) ) {
    265         $GLOBALS['shariff3UU_design']['autolang'] = 1;
    266         $GLOBALS['shariff3UU_design']['lang']     = substr( get_locale(), 0, 2 );
     264    if ( ! isset( $shariff3uu_design['lang'] ) ) {
     265        $shariff3uu_design['autolang'] = 1;
     266        $shariff3uu_design['lang']     = substr( get_locale(), 0, 2 );
    267267    }
    268268    // Update version.
    269     $GLOBALS['shariff3UU']['version'] = '4.5.0';
     269    $shariff3uu['version'] = '4.5.0';
    270270}
    271271
     
    312312
    313313// Set new version.
    314 $GLOBALS['shariff3uu']['version']       = $code_version;
    315 $GLOBALS['shariff3uu_basic']['version'] = $code_version;
    316 
    317 /**
    318  * Remove empty elements and save to options table.
     314$shariff3uu['version']       = $code_version;
     315$shariff3uu_basic['version'] = $code_version;
     316
     317/**
     318 * Remove empty elements and save to options table. We had a mix up with shariff3uu and shariff3UU in the past and update_option is not case senitive. Therefore we actually need to delete and recreate it.
    319319 */
    320320// Basic.
    321321delete_option( 'shariff3uu_basic' );
    322 $shariff3uu_basic = array_filter( $GLOBALS['shariff3uu_basic'] );
     322$shariff3uu_basic = array_filter( $shariff3uu_basic );
    323323update_option( 'shariff3uu_basic', $shariff3uu_basic );
    324324// Design.
    325325delete_option( 'shariff3uu_design' );
    326 $shariff3uu_design = array_filter( $GLOBALS['shariff3uu_design'] );
     326$shariff3uu_design = array_filter( $shariff3uu_design );
    327327update_option( 'shariff3uu_design', $shariff3uu_design );
    328328// Advanced.
    329329delete_option( 'shariff3uu_advanced' );
    330 $shariff3uu_advanced = array_filter( $GLOBALS['shariff3uu_advanced'] );
     330$shariff3uu_advanced = array_filter( $shariff3uu_advanced );
    331331update_option( 'shariff3uu_advanced', $shariff3uu_advanced );
    332332// Statistic.
    333333delete_option( 'shariff3uu_statistic' );
    334 $shariff3uu_statistic = array_filter( $GLOBALS['shariff3uu_statistic'] );
     334$shariff3uu_statistic = array_filter( $shariff3uu_statistic );
    335335update_option( 'shariff3uu_statistic', $shariff3uu_statistic );
    336336
Note: See TracChangeset for help on using the changeset viewer.