Example #1
0
 public function getPage()
 {
     if (is_null($this->page)) {
         $path = '/' . $this->id . '?fields=id,name,picture,access_token,can_post,likes,link,username';
         $result = $this->request($path);
         $json_result = json_decode($result, true);
         $mapping = ['id' => 'id', 'name' => 'name', 'link' => 'link', 'can_post' => 'can_post', 'access_token' => 'access_token', 'likes' => 'likes'];
         $this->page = Page::create($mapping, $json_result);
         $this->page->provider = static::$provider;
         $this->page->raw_response = $result;
     }
     return $this->page;
 }
Example #2
0
 public function getPages()
 {
     $path = '/companies:(id,name,universal-name,square-logo-url,num-followers)?is-company-admin=true&format=json';
     $result = $this->request($path);
     $json_result = json_decode($result, true);
     $pages = [];
     $mapping = ['id' => 'id', 'name' => 'name', 'picture' => 'squareLogoUrl', 'link' => 'publicProfileUrl'];
     // Make th epage IDs available as the array keys and get their picture
     if (!empty($json_result['values'])) {
         foreach ($json_result['values'] as $company) {
             $pages[$company['id']] = Page::create($mapping, $company);
             $pages[$company['id']]->link = 'http://www.linkedin.com/company/' . $company['universalName'];
             $pages[$company['id']]->provider = static::$provider;
             $pages[$company['id']]->raw_response = $result;
         }
     }
     return $pages;
 }
Example #3
0
 public function getPages()
 {
     $profile = $this->getProfile();
     $path = '/' . $profile->id . '/accounts?fields=name,picture,access_token,id,can_post,likes,link,username';
     $result = $this->request($path);
     $json_result = json_decode($result, true);
     $pages = [];
     $mapping = ['id' => 'id', 'name' => 'name', 'link' => 'link', 'can_post' => 'can_post', 'access_token' => 'access_token'];
     // Make the page IDs available as the array keys
     if (!empty($json_result['data'])) {
         foreach ($json_result['data'] as $page) {
             $pages[$page['id']] = Page::create($mapping, $page);
             $pages[$page['id']]->picture = $page['picture']['data']['url'];
             $pages[$page['id']]->provider = static::$provider;
             $pages[$page['id']]->raw_response = $result;
         }
     }
     return $pages;
 }