- Timestamp:
- 07/23/2019 04:47:30 PM (7 years ago)
- Location:
- shariff/trunk
- Files:
-
- 11 edited
-
admin/admin-menu.php (modified) (5 diffs)
-
admin/admin-notices.php (modified) (1 diff)
-
changelog.txt (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
services/shariff-buffer.php (modified) (1 diff)
-
services/shariff-facebook.php (modified) (2 diffs)
-
services/shariff-flattr.php (modified) (2 diffs)
-
services/shariff-mix.php (modified) (1 diff)
-
services/shariff-whatsapp.php (modified) (1 diff)
-
shariff.php (modified) (6 diffs)
-
updates.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shariff/trunk/admin/admin-menu.php
r2058462 r2127344 13 13 14 14 // 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' ); 16 16 17 17 // Adds the actions for the admin page. … … 308 308 __( 'Twitter username for the via tag:', 'shariff' ), 309 309 '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',319 310 'shariff3uu_advanced', 320 311 'shariff3uu_advanced_section' … … 1322 1313 } 1323 1314 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' ) . '">';1336 1315 } 1337 1316 … … 1850 1829 echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Twitter via tag.', 'shariff' ) . '</div>'; 1851 1830 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>';1860 1831 // Patreonid. 1861 1832 echo '<div style="display:table-row">'; … … 2023 1994 if ( isset( $shariff3uu['disable'][ $service ] ) && 1 === $shariff3uu['disable'][ $service ] ) { 2024 1995 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>'; 2025 1998 } elseif ( ! array_key_exists( $service, $service_errors ) ) { 2026 1999 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 20 20 // Check if any services are set and if user can manage options. 21 21 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 }26 22 // Patreon. 27 23 if ( strpos( $GLOBALS['shariff3uu']['services'], 'patreon' ) !== false && empty( $GLOBALS['shariff3uu']['patreonid'] ) ) { -
shariff/trunk/changelog.txt
r2058462 r2127344 2 2 3 3 == 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 4 13 5 14 = 4.6.2 = -
shariff/trunk/readme.txt
r2058462 r2127344 4 4 Requires at least: 4.9 5 5 Requires PHP: 7.0 6 Tested up to: 5. 17 Stable tag: 4.6. 26 Tested up to: 5.2 7 Stable tag: 4.6.3 8 8 License: MIT 9 9 License URI: http://opensource.org/licenses/mit … … 152 152 153 153 == 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 154 163 155 164 = 4.6.2 = -
shariff/trunk/services/shariff-buffer.php
r2058462 r2127344 25 25 26 26 // 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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2-.7-3.2a17.7 17.7 0 0 0-8.1-2.7 15 15 0 0 0-15.2 7.2c-1.6 2.8-2 5.8-2 8.9.2 1.3-.3 1.8-1.6 1.7h-4.4c-1 0-1.4.4-1.4 1.3v7.8c0 1.1.5 1.4 1.5 1.4h4.2c1.4-.1 1.7.5 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-.96.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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1.4 1.3v7.8c0 1.1.5 1.4 1.5 1.4h4.2c1.4-.1 1.7.5 1.7 1.8v15zM.3 14.1L29.3.5a6 6 0 0 1 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.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>'; 28 28 29 29 // Backend available? -
shariff/trunk/services/shariff-facebook.php
r2035136 r2127344 59 59 ); 60 60 } 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. 62 62 if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) { 63 63 // On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long. … … 71 71 $fb_token = $fb_app_id . '|' . $fb_app_secret; 72 72 // 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 ) ) ); 74 74 // Decode the json response. 75 75 $facebook_json = json_decode( $facebook, true ); 76 76 // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided. 77 77 $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;84 78 } 85 79 -
shariff/trunk/services/shariff-flattr.php
r2035136 r2127344 14 14 if ( isset( $frontend ) && 1 === $frontend ) { 15 15 // Service URL. 16 $service_url = esc_url( 'https://flattr.com/ submit/auto' );16 $service_url = esc_url( 'https://flattr.com/domain/' ); 17 17 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' ) ); 31 20 32 21 // 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'] ); 34 23 35 24 // Colors. … … 57 46 'es' => 'Flattr!', 58 47 ); 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 }72 48 } -
shariff/trunk/services/shariff-mix.php
r2037163 r2127344 54 54 'sv' => 'Dela på Mix', 55 55 ); 56 } 56 } -
shariff/trunk/services/shariff-whatsapp.php
r2037163 r2127344 14 14 if ( isset( $frontend ) && 1 === $frontend ) { 15 15 // Service URL. 16 $service_url = 'https:// wa.me/';16 $service_url = 'https://api.whatsapp.com/send'; 17 17 18 18 // Build button URL. -
shariff/trunk/shariff.php
r2058462 r2127344 4 4 * Plugin URI: https://wordpress.org/plugins-wp/shariff/ 5 5 * Description: Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR). 6 * Version: 4.6. 26 * Version: 4.6.3 7 7 * Author: Jan-Peter Lambeck & 3UU 8 8 * Author URI: https://wordpress.org/plugins/shariff/ … … 34 34 function shariff3uu_update() { 35 35 // 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' ); 40 40 41 41 // 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 ); 43 48 // Include updates.php. 44 49 include dirname( __FILE__ ) . '/updates.php'; … … 46 51 } 47 52 add_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. 54 add_action( 'cli_init', 'shariff3uu_update' ); 48 55 49 56 /** … … 1194 1201 foreach ( $service_array as $service ) { 1195 1202 // 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 ) ) { 1199 1204 $paypal_error = 1; 1200 1205 } elseif ( 'paypalme' === $service && ! array_key_exists( 'paypalmeid', $atts ) ) { … … 1519 1524 } 1520 1525 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 }1525 1526 // Displays a warning to admins if patreon is set, but no patreon username was provided. 1526 1527 if ( 1 === $patreon_error && current_user_can( 'manage_options' ) ) { … … 1573 1574 */ 1574 1575 function shariff3uu_deactivate() { 1575 global $wpdb;1576 1576 // Checks for multisite. 1577 1577 if ( is_multisite() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) { -
shariff/trunk/updates.php
r2037163 r2127344 1 1 <?php 2 2 /** 3 * Will be included by shariff3 UU_update() only if needed.3 * Will be included by shariff3uu_update() only if needed. 4 4 * 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. 6 6 * 7 7 * @package WordPress … … 18 18 * Delete old cache directory. 19 19 */ 20 if ( isset( $ GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '2.2.5' ) ) {20 if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '2.2.5' ) ) { 21 21 22 22 // 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']; 55 55 } 56 56 57 57 // 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']; 78 78 } 79 79 80 80 // 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']; 92 92 } 93 93 94 94 // 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']; 103 103 } 104 104 // Default options should be as save as possible, same reason the statistics are disabled by default. … … 106 106 107 107 // 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'] ); 109 109 110 110 // Update version. 111 $ GLOBALS['shariff3UU']['version'] = '2.3.0';111 $shariff3uu['version'] = '2.3.0'; 112 112 } 113 113 … … 117 117 * Delete old cache directory and db entry. 118 118 */ 119 if ( isset( $ GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '3.3.0' ) ) {119 if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '3.3.0' ) ) { 120 120 121 121 // 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']; 136 136 } 137 137 … … 161 161 162 162 // Disable Twitter backend due to new service OpenShareCount.com. 163 $ GLOBALS['shariff3UU_statistic']['disable']['twitter'] = 1;163 $shariff3uu_statistic['disable']['twitter'] = 1; 164 164 165 165 // Update version. 166 $ GLOBALS['shariff3UU']['version'] = '3.3.0';166 $shariff3uu['version'] = '3.3.0'; 167 167 } 168 168 … … 199 199 * Migration < 4.0 200 200 */ 201 if ( isset( $ GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.0.0' ) ) {201 if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.0.0' ) ) { 202 202 203 203 // 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; 206 206 } 207 207 208 208 // Disable share counts if WP version < 4.4. 209 209 if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) { 210 unset( $ GLOBALS['shariff3UU_statistic']['backend'] );210 unset( $shariff3uu_statistic['backend'] ); 211 211 } 212 212 213 213 // 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 ); 216 216 } 217 217 218 218 // Update version. 219 $ GLOBALS['shariff3UU']['version'] = '4.0.0';219 $shariff3uu['version'] = '4.0.0'; 220 220 } 221 221 … … 223 223 * Migration < 4.2 224 224 */ 225 if ( isset( $ GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.2.0' ) ) {225 if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.2.0' ) ) { 226 226 // Make sure we have the $wpdb class ready. 227 227 global $wpdb; … … 260 260 * Migration < 4.5 261 261 */ 262 if ( isset( $ GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.5.0' ) ) {262 if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.5.0' ) ) { 263 263 // 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 ); 267 267 } 268 268 // Update version. 269 $ GLOBALS['shariff3UU']['version'] = '4.5.0';269 $shariff3uu['version'] = '4.5.0'; 270 270 } 271 271 … … 312 312 313 313 // 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. 319 319 */ 320 320 // Basic. 321 321 delete_option( 'shariff3uu_basic' ); 322 $shariff3uu_basic = array_filter( $ GLOBALS['shariff3uu_basic']);322 $shariff3uu_basic = array_filter( $shariff3uu_basic ); 323 323 update_option( 'shariff3uu_basic', $shariff3uu_basic ); 324 324 // Design. 325 325 delete_option( 'shariff3uu_design' ); 326 $shariff3uu_design = array_filter( $ GLOBALS['shariff3uu_design']);326 $shariff3uu_design = array_filter( $shariff3uu_design ); 327 327 update_option( 'shariff3uu_design', $shariff3uu_design ); 328 328 // Advanced. 329 329 delete_option( 'shariff3uu_advanced' ); 330 $shariff3uu_advanced = array_filter( $ GLOBALS['shariff3uu_advanced']);330 $shariff3uu_advanced = array_filter( $shariff3uu_advanced ); 331 331 update_option( 'shariff3uu_advanced', $shariff3uu_advanced ); 332 332 // Statistic. 333 333 delete_option( 'shariff3uu_statistic' ); 334 $shariff3uu_statistic = array_filter( $ GLOBALS['shariff3uu_statistic']);334 $shariff3uu_statistic = array_filter( $shariff3uu_statistic ); 335 335 update_option( 'shariff3uu_statistic', $shariff3uu_statistic ); 336 336
Note: See TracChangeset
for help on using the changeset viewer.