' . wp_json_encode( $response ) ); } $id = $response->id; $display_name = $response->first_name; $account = $response->username; $this->service = array( 'id' => $id, 'service' => $this->service_name, 'credentials' => array( 'chat_id' => $data['chat_id'], 'access_token' => $data['access_token'], 'display_name' => $display_name, ), 'available_accounts' => array( $this->service_name . '_' . $id => array( 'id' => $id, 'user' => $display_name, 'account' => $account, 'service' => $this->service_name, 'img' => apply_filters( 'rop_custom_telegram_avatar', $telegram->get_profile_photo( $id ) ), 'created' => date( 'd/m/Y H:i' ), 'active' => isset( $data['active'] ) ? $data['active'] : true, ), ), ); } catch ( \Exception $e ) { $this->logger->alert_error( 'Telegram API Error: ' . $e->getMessage() ); return false; } return true; } /** * Method for creating media posts on Telegram. * * @since 9.1.3 * @access private * * @param array $post_details The post details to be published by the service. * @param array $hashtags Hashtags. * @param array $args Optional arguments needed by the method. * @param int $chat_id The chat id. * * @return array $new_post The post contents */ private function tlg_media_post( $post_details, $hashtags, $args, $chat_id ) { $attachment_url = $post_details['post_image']; // If the post has no image but "Share as image post" is checked // share as an article post. if ( empty( $attachment_url ) ) { $this->logger->info( 'No image set for post, but "Share as Image Post" is checked. Falling back to article post' ); return $this->tlg_article_post( $post_details, $hashtags, $args, $owner_id ); } $new_post = array( 'chat_id' => $chat_id, 'caption' => $post_details['content'] . $this->get_url( $post_details ) . $hashtags, ); // If attachment is video. if ( strpos( $post_details['mimetype']['type'], 'video' ) !== false ) { $new_post['video'] = $attachment_url; } else { $new_post['photo'] = $attachment_url; } return $new_post; } /** * Method for text posts to Telegram. * * @since 9.1.3 * @access private * * @param array $post_details The post details to be published by the service. * @param array $hashtags Hashtags. * @param array $args Optional arguments needed by the method. * @param string $chat_id arguments needed by the method. * * @return array $new_post The post contents */ private function tlg_text_post( $post_details, $hashtags, $args, $chat_id ) { $new_post = array( 'chat_id' => $chat_id, 'text' => $post_details['content'] . $hashtags, ); return $new_post; } /** * Method for creating link(article) posts to Telegram. * * @since 9.1.3 * @access private * * @param array $post_details The post details to be published by the service. * @param array $hashtags Hashtags. * @param array $args arguments needed by the method. * @param string $chat_id arguments needed by the method. * * @return object */ private function tlg_article_post( $post_details, $hashtags, $args, $chat_id ) { $content = sprintf( "%s\r\n%s\r\n%s", $post_details['content'], $this->get_url( $post_details ), $hashtags ); $new_post = array( 'chat_id' => $chat_id, 'text' => $content, 'parse_mode' => 'HTML', ); return $new_post; } /** * Method for publishing with Telegram service. * * @since 9.1.3 * @access public * * @param array $post_details The post details to be published by the service. * @param array $args Optional arguments needed by the method. * * @return mixed */ public function share( $post_details, $args = array() ) { if ( Rop_Admin::rop_site_is_staging( $post_details['post_id'] ) ) { $this->logger->alert_error( Rop_I18n::get_labels( 'sharing.share_attempted_on_staging' ) ); return false; } $post_id = $post_details['post_id']; $chat_id = $args['credentials']['chat_id']; $access_token = $args['credentials']['access_token']; $post_url = $post_details['post_url']; $share_as_image_post = $post_details['post_with_image']; $model = new Rop_Post_Format_Model(); $post_format = $model->get_post_format( $post_details['account_id'] ); $hashtags = $post_details['hashtags']; if ( ! empty( $post_format['hashtags_randomize'] ) && $post_format['hashtags_randomize'] ) { $hashtags = $this->shuffle_hashtags( $hashtags ); } // Telegram link post. if ( ! empty( $post_url ) && empty( $share_as_image_post ) && get_post_type( $post_id ) !== 'attachment' ) { $new_post = $this->tlg_article_post( $post_details, $hashtags, $args, $chat_id ); } // Telegram plain text post. if ( empty( $share_as_image_post ) && empty( $post_url ) ) { $new_post = $this->tlg_text_post( $post_details, $hashtags, $args, $chat_id ); } // Telegram media post. if ( ! empty( $share_as_image_post ) || get_post_type( $post_id ) === 'attachment' ) { $new_post = $this->tlg_media_post( $post_details, $hashtags, $args, $chat_id ); } if ( empty( $new_post ) ) { $this->logger->alert_error( Rop_I18n::get_labels( 'misc.no_post_data' ) ); return false; } $api = $this->get_api( $access_token ); try { $response = $api->send_message( $new_post ); if ( $response && $response->message_id ) { // Save log. $this->save_logs_on_rop( array( 'network' => $post_details['service'], 'handle' => $args['user'], 'content' => $post_details['content'], 'link' => $post_details['post_url'], ) ); $this->logger->alert_success( sprintf( 'Successfully shared %s to %s on Telegram ', html_entity_decode( get_the_title( $post_details['post_id'] ) ), $args['user'] ) ); return true; } } catch ( \Telegram\Bot\Exceptions\TelegramSDKException $e ) { $this->logger->alert_error( 'Error sharing to Telegram: ' . $e->getMessage() ); return false; } catch ( \Exception $e ) { $this->logger->alert_error( 'Error sharing to Telegram: ' . $e->getMessage() ); return false; } } /** * Method to populate additional data. * * @since 9.1.3 * @access public * @return mixed */ public function populate_additional_data( $account ) { return $account; } } L’UNICEF recrute (03 postes) - EmploiTogo.INFO

L’UNICEF recrute (03 postes)

Vue(s): 701 L’UNICEF travaille dans plus de 190 pays et territoires pour sauver la vie des enfants, défendre leurs droits et les aider à réaliser leur potentiel, de la petite enfance à l’adolescence. À l’UNICEF, nous sommes engagés, passionnés et fiers de ce que nous faisons. Promouvoir les droits de chaque enfant n’est pas seulement un travail, c’est une vocation. Visiter notre site Web pour en savoir plus sur ce que nous faisons à l’UNICEF. L’UNICEF est un lieu où les carrières se construisent : nous offrons à nos collaborateurs diverses opportunités de développement personnel et professionnel qui les aideront à construire une carrière épanouissante tout en accomplissant une mission enrichissante. Nous sommes fiers de notre culture d’entreprise qui favorise l’épanouissement de nos collaborateurs, ainsi que d’une rémunération et d’avantages sociaux attractifs. Nous recrutons. POSTE 1 : Recrutement par lots / Chef de bureau extérieur, P4, Contrat temporaire, Lubumbashi et Mbandaka, RDC Pour chaque enfant, de l’espoir La République démocratique du Congo continue de faire face à des défis humanitaires et de développement complexes, notamment les déplacements liés au conflit, les épidémies et les risques en matière de protection, en particulier dans la province de l’Est. Dans le cadre de son engagement à obtenir des … Lire la suite de L’UNICEF recrute (03 postes)