'; // Backend available? $backend_available = 1; // Button alt label. $button_title_array = array( 'bg' => 'Сподели в Reddit', 'cs' => 'Sdílet na Redditu', 'da' => 'Del på Reddit', 'de' => 'Bei Reddit teilen', 'en' => 'Share on Reddit', 'es' => 'Compartir en Reddit', 'fi' => 'Jaa Redditissä', 'fr' => 'Partager sur Reddit', 'hr' => 'Podijelite na Reddit', 'hu' => 'Megosztás Redditen', 'it' => 'Condividi su Reddit', 'ja' => 'Reddit上で共有', 'ko' => 'Reddit에서 공유하기', 'nl' => 'Delen op Reddit', 'no' => 'Del på Reddit', 'pl' => 'Udostępnij przez Reddit', 'pt' => 'Compartilhar no Reddit', 'ro' => 'Partajează pe Reddit', 'ru' => 'Поделиться на Reddit', 'sk' => 'Zdieľať na Reddit', 'sl' => 'Deli na Reddit', 'sr' => 'Podeli na Reddit-u', 'sv' => 'Dela på Reddit', 'tr' => 'Reddit\'ta paylaş', 'zh' => '分享至Reddit', ); } elseif ( isset( $backend ) && 1 === $backend ) { // Fetch counts. $reddit = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://www.reddit.com/api/info.json?url=' . $post_url ) ) ); $reddit_json = json_decode( $reddit, true ); // Store results, if we have some and record errors, if enabled (e.g. request from the status tab). if ( isset( $reddit_json['data']['children'] ) ) { $count = 0; foreach ( $reddit_json['data']['children'] as $child ) { $count += intval( $child['data']['score'] ); } $share_counts['reddit'] = $count; } elseif ( isset( $record_errors ) && 1 === $record_errors ) { $service_errors['reddit'] = $reddit; } }