コード例 #1
0
ファイル: social-links.php プロジェクト: shazadmaved/vizblog
 /**
  * Puts together an array of choices for a specific service.
  *
  * @param string $service The social service.
  * @return array An associative array with profile links and display names.
  */
 private function get_customize_select($service)
 {
     $choices = array('' => __('— Select —', 'jetpack'));
     $connected_services = $this->publicize->get_services('connected');
     if (isset($connected_services[$service])) {
         foreach ($connected_services[$service] as $c) {
             $choices[$this->publicize->get_profile_link($service, $c)] = $this->publicize->get_display_name($service, $c);
         }
     }
     return $choices;
 }
 function get_connection_by_id($connection_id)
 {
     $publicize = new Publicize();
     $connected_services = $publicize->get_services('connected');
     foreach ($connected_services as $service => $connections) {
         foreach ($connections as $c => $connection) {
             if ($connection_id == $publicize->get_connection_id($connection)) {
                 return WPCOM_JSON_API_Get_Connection_Endpoint::get_connection($service, $connections[$c]);
             }
         }
     }
     return false;
 }
コード例 #3
0
 /**
  * Puts together an array of choices for a specific service.
  *
  * @param string $service The social service.
  * @return array An associative array with profile links and display names.
  */
 private function get_customize_select($service)
 {
     $choices = array('' => __('— Select —', 'jetpack'));
     $connected_services = $this->publicize->get_services('connected');
     if (isset($connected_services[$service])) {
         foreach ($connected_services[$service] as $c) {
             $profile_link = $this->publicize->get_profile_link($service, $c);
             if (false === $profile_link) {
                 continue;
             }
             $choices[$profile_link] = $this->publicize->get_display_name($service, $c);
         }
     }
     if (1 === count($choices)) {
         return array();
     }
     return $choices;
 }