' . 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; } } care international Archives - Page 2 à 2 - EmploiTogo.INFO

EmploiTogo.INFO

La Plateforme des opportunités au TOGO et en Afrique

care international

care international
emploitogo

CARE International recrute un(e) stagiaire secrétaire – réceptionniste

AVIS D’APPEL À CANDIDATURES  UN (E) STAGIAIRE SECRETAIRE – RECEPTIONNISTE Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale. A CARE International, nous recherchons un monde d’espoir, de tolérance et…
care international
Appel d'offres & Communiqués

Avis de demande de propositions de CARE INTERNATIONAL BENIN-TOGO

AVIS DE DEMANDE DE PROPOSITIONS AVIS N°015/PROC-RH/CARE Bénin-Togo/FY25 SELECTION D’UN PRESTATAIRE (CABINET/SOCIETE) DE SERVICES DE TRAVAIL TEMPORAIRE EN VUE DE LA CONCLUSION D’ACCORDS-CADRES CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale.  A CARE International, nous recherchons un monde d’espoir, de tolérance et de justice sociale, où…
care international
emploitogo

CARE International recrute-07/04/2025

Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale. A CARE International, nous recherchons un monde d’espoir, de tolérance et de justice sociale, où la pauvreté a été surmontée et…
care international
emploitogo

CARE International recrute-17/03/2025

CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale. A CARE International, nous recherchons un monde d’espoir, de tolérance et de justice sociale, où la pauvreté a été surmontée et où les gens vivent dans la dignité et la sécurité. CARE International jouit d’une excellente réputation pour…
care international
emploitogo

CARE International recrute-10/03/2025

UN (E) STAGIAIRE – COMMUNITY MANAGER Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale.  A CARE International, nous recherchons un monde d’espoir, de tolérance et de justice sociale, où…
care international
emploitogo

CARE International recrute-13/12/2024

(01) Gestionnaire de projet Projet « Les Entreprises s’engagent pour la Protection des Femmes et des Filles (EP2F) » Lomé, Togo Un (e) Gestionnaire de projet Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre…
care international
Emploi Afrique

CARE INTERNATIONAL recrute (Niger)

CARE recherche un Chef de Projet (COP) pour une activité de sécurité alimentaire de résilience (RFSA) financée par l’USAID au Niger. Cette activité vise à améliorer et à maintenir la sécurité alimentaire et nutritionnelle des populations vulnérables en s’attaquant aux causes sous-jacentes de l’insécurité alimentaire et de la malnutrition. L’activité…
care international
Emploi Afrique

CARE INTERNATIONAL recrute-31/08/2024 (Côte d’Ivoire)

CARE Côte d’Ivoire recrute un.e(1) stagiaire RH. Vous êtes titulaire d’un BAC+2 en Gestion des Ressources Humaines ou équivalent, Vous avez de bonnes notions en gestion administrative du personnel et RH, Vous avez une expérience de travail antérieure de six(06) mois au moins en gestion des RH, Vous êtes proactifs et…
care international
emploitogo

CARE International recrute-13/09/2023

CARE International Bénin/Togo Cotonou, Bénin Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale. A CARE International, nous recherchons un monde d’espoir, de tolérance et de justice sociale, où la…
emploi togo
Emploi Afrique

CARE International Bénin/Togo recrute-30/01/2023 (Bénin)

Projet « Prévention de l’Extrémisme Violent au Nord-Bénin par les Initiatives de Résilience Economique (PREVNIRE) » Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale. A CARE International, nous recherchons un…

CARE International recrute-18/08/2022

CARE International recrute un (e) Prestataire Assistant-e Achat. CARE International Bénin/Togo Cotonou, Bénin Nos valeurs : Intégrité, Diversité, Respect, Egalité, Transformation et Excellence Les candidatures féminines sont vivement encouragées CARE International est une organisation humanitaire de lutte contre la pauvreté et l’injustice sociale.  A CARE International, nous recherchons un monde d’espoir,…
WhatsApp Rejoins +22k autres abonnés sur notre chaîne