'; // Backend available? $backend_available = 1; // Button alt label. $button_title_array = array( 'bg' => 'Сподели във Facebook', 'cs' => 'Sdílet na Facebooku', 'da' => 'Del på Facebook', 'de' => 'Bei Facebook teilen', 'en' => 'Share on Facebook', 'es' => 'Compartir en Facebook', 'fi' => 'Jaa Facebookissa', 'fr' => 'Partager sur Facebook', 'hr' => 'Podijelite na Facebooku', 'hu' => 'Megosztás Facebookon', 'it' => 'Condividi su Facebook', 'ja' => 'フェイスブック上で共有', 'ko' => '페이스북에서 공유하기', 'nl' => 'Delen op Facebook', 'no' => 'Del på Facebook', 'pl' => 'Udostępnij na Facebooku', 'pt' => 'Compartilhar no Facebook', 'ro' => 'Partajează pe Facebook', 'ru' => 'Поделиться на Facebook', 'sk' => 'Zdieľať na Facebooku', 'sl' => 'Deli na Facebooku', 'sr' => 'Podeli na Facebook-u', 'sv' => 'Dela på Facebook', 'tr' => 'Facebook\'ta paylaş', 'zh' => '在Facebook上分享', ); } elseif ( isset( $backend ) && 1 === $backend ) { // Use the FB ID and Secret, if available. if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) { // On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long. if ( ( defined( PHP_INT_SIZE ) && PHP_INT_SIZE === '4' ) || ! defined( PHP_INT_SIZE ) ) { $fb_app_id = $shariff3uu['fb_id']; } else { $fb_app_id = absint( $shariff3uu['fb_id'] ); } $fb_app_secret = sanitize_text_field( $shariff3uu['fb_secret'] ); // Create the FB access token. $fb_token = $fb_app_id . '|' . $fb_app_secret; // Use the token to get the share counts. $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 ) ) ); // Decode the json response. $facebook_json = json_decode( $facebook, true ); // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided. $nofbid = '0'; } /** * Stores results - uses engagement (Graph API > 2.12) if it exists, otherwise uses share_count - ordered based on proximity of occurrence. * Records errors, if enabled (e.g. request from the status tab). */ if ( isset( $facebook_json['engagement'] ) && isset( $facebook_json['engagement']['share_count'] ) ) { $share_counts['facebook'] = intval( $facebook_json['engagement']['reaction_count'] ) + intval( $facebook_json['engagement']['comment_count'] ) + intval( $facebook_json['engagement']['share_count'] ) + intval( $facebook_json['engagement']['comment_plugin_count'] ); } elseif ( isset( $facebook_json['share'] ) && isset( $facebook_json['share']['share_count'] ) ) { $share_counts['facebook'] = intval( $facebook_json['share']['share_count'] ); } elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['total_count'] ) ) { $share_counts['facebook'] = intval( $facebook_json['data'][0]['total_count'] ); } elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['share_count'] ) ) { $share_counts['facebook'] = intval( $facebook_json['data'][0]['share_count'] ); } elseif ( isset( $facebook_json['id'] ) && ! isset( $facebook_json['error'] ) && 1 === $nofbid ) { $share_counts['facebook'] = '0'; } elseif ( isset( $record_errors ) && 1 === $record_errors ) { $service_errors['facebook'] = $facebook; } }; // End if backend.