Exemplo n.º 1
0
 function fetchElement()
 {
     $this->_xml->addChild('option', 'Please choose')->addAttribute('value', 0);
     ob_start();
     $api = getNextendFacebook();
     $list = array();
     if ($api) {
         try {
             $result = $api->api('/me/albums');
             if (count($result['data'])) {
                 foreach ($result['data'] as $album) {
                     $list[$album['id']] = $album['name'];
                 }
             }
         } catch (Exception $e) {
             $list = null;
         }
     }
     if ($list) {
         ob_end_clean();
         if (count($list)) {
             foreach ($list as $id => $name) {
                 $this->_xml->addChild('option', htmlentities($name))->addAttribute('value', $id);
             }
         }
     }
     $this->_value = $this->_form->get($this->_name, $this->_default);
     $html = parent::fetchElement();
     if (!$list) {
         $html .= ob_get_clean();
     }
     return $html;
 }
Exemplo n.º 2
0
 function getData($number)
 {
     $data = array();
     $api = getNextendFacebook();
     if (!$api) {
         return $data;
     }
     $facebookpostbypage = (array) explode('||', $this->_data->get('facebookpostbypage', 'photo'));
     try {
         $result = $api->api($this->_data->get('facebookpostbypagepage', 'nextendweb') . '/posts');
         $i = 0;
         foreach ($result['data'] as $post) {
             if (!in_array($post['type'], $facebookpostbypage)) {
                 continue;
             }
             $data[$i]['link'] = isset($post['link']) ? $post['link'] : '';
             $data[$i]['description'] = isset($post['message']) ? str_replace("\n", "<br/>", $this->makeClickableLinks($post['message'])) : '';
             $data[$i]['message'] = $data[$i]['description'];
             $data[$i]['story'] = isset($post['story']) ? $this->makeClickableLinks($post['story']) : '';
             $data[$i]['type'] = $post['type'];
             $data[$i]['picture'] = isset($post['picture']) ? $post['picture'] : '';
             $i++;
         }
     } catch (Exception $e) {
     }
     return $data;
 }
Exemplo n.º 3
0
 function onNextendFacebookPageAlbums(&$data)
 {
     $page = NextendRequest::getVar('fbpage', '');
     $api = getNextendFacebook();
     $data = array();
     if ($api) {
         try {
             $result = $api->api($page . '/albums');
             if (count($result['data'])) {
                 foreach ($result['data'] as $album) {
                     $data[$album['id']] = $album['name'];
                 }
             }
         } catch (Exception $e) {
             $data = null;
         }
     }
 }
Exemplo n.º 4
0
 function getData($number)
 {
     $data = array();
     $api = getNextendFacebook();
     if (!$api) {
         return $data;
     }
     $facebookalbumsbyuser = $this->_data->get('facebookalbumsbyuser', '');
     try {
         $result = $api->api($facebookalbumsbyuser . '/photos');
         $i = 0;
         foreach ($result['data'] as $post) {
             $data[$i]['author_name'] = $data[$i]['title'] = $data[$i]['from_name'] = $post['from']['name'];
             $data[$i]['image'] = $post['images'][0]['source'];
             $data[$i]['thumbnail'] = $post['images'][count($post['images']) - 1]['source'];
             $data[$i]['description'] = isset($post['name']) ? $this->makeClickableLinks($post['name']) : '';
             $data[$i]['url'] = $data[$i]['link'] = $post['link'];
             $data[$i]['url_label'] = 'View image';
             $data[$i]['author_url'] = 'https://www.facebook.com/' . $post['from']['id'];
             $data[$i]['likes'] = isset($post['likes']) && isset($post['likes']['data']) ? count($post['likes']['data']) : 0;
             $data[$i]['comments'] = isset($post['comments']) && isset($post['comments']['data']) ? count($post['comments']['data']) : 0;
             $data[$i]['icon'] = $post['icon'];
             $data[$i]['picture'] = $post['picture'];
             $data[$i]['source'] = $post['source'];
             $x = 1;
             foreach ($post['images'] as $img) {
                 if ($x == 2 && $img["height"] < 960 && $img["width"] < 960) {
                     $data[$i]['image' . $x] = $img['source'];
                     $x++;
                 }
                 $data[$i]['image' . $x] = $img['source'];
                 $x++;
             }
             $i++;
         }
     } catch (Exception $e) {
     }
     return $data;
 }