@@ -39,12 +39,12 @@ |
||
| 39 | 39 | |
| 40 | 40 | //*********** Padding Function ********************* |
| 41 | 41 | |
| 42 | - public function pkcs5_pad($plainText, $blockSize) |
|
| 43 | - { |
|
| 44 | - $pad = $blockSize - (strlen($plainText) % $blockSize); |
|
| 42 | + public function pkcs5_pad($plainText, $blockSize) |
|
| 43 | + { |
|
| 44 | + $pad = $blockSize - (strlen($plainText) % $blockSize); |
|
| 45 | 45 | |
| 46 | - return $plainText.str_repeat(chr($pad), $pad); |
|
| 47 | - } |
|
| 46 | + return $plainText.str_repeat(chr($pad), $pad); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | //********** Hexadecimal to Binary function for php 4.0 version ******** |
| 50 | 50 | |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | protected function schedule(Schedule $schedule) |
| 27 | 27 | { |
| 28 | 28 | $schedule->command('inspire') |
| 29 | - ->hourly(); |
|
| 29 | + ->hourly(); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -11,79 +11,79 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | class TP_facebook { |
| 14 | - /** |
|
| 15 | - * Get User ID from its URL |
|
| 16 | - * |
|
| 17 | - * @since 1.0.0 |
|
| 18 | - * @param string $user_url URL of the Page |
|
| 19 | - */ |
|
| 20 | - public function get_user_from_url($user_url){ |
|
| 21 | - $theid = str_replace("https", "", $user_url); |
|
| 22 | - $theid = str_replace("http", "", $theid); |
|
| 23 | - $theid = str_replace("://", "", $theid); |
|
| 24 | - $theid = str_replace("www.", "", $theid); |
|
| 25 | - $theid = str_replace("facebook", "", $theid); |
|
| 26 | - $theid = str_replace(".com", "", $theid); |
|
| 27 | - $theid = str_replace("/", "", $theid); |
|
| 28 | - $theid = explode("?", $theid); |
|
| 29 | - return $theid[0]; |
|
| 30 | - } |
|
| 14 | + /** |
|
| 15 | + * Get User ID from its URL |
|
| 16 | + * |
|
| 17 | + * @since 1.0.0 |
|
| 18 | + * @param string $user_url URL of the Page |
|
| 19 | + */ |
|
| 20 | + public function get_user_from_url($user_url){ |
|
| 21 | + $theid = str_replace("https", "", $user_url); |
|
| 22 | + $theid = str_replace("http", "", $theid); |
|
| 23 | + $theid = str_replace("://", "", $theid); |
|
| 24 | + $theid = str_replace("www.", "", $theid); |
|
| 25 | + $theid = str_replace("facebook", "", $theid); |
|
| 26 | + $theid = str_replace(".com", "", $theid); |
|
| 27 | + $theid = str_replace("/", "", $theid); |
|
| 28 | + $theid = explode("?", $theid); |
|
| 29 | + return $theid[0]; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Get Photosets List from User |
|
| 34 | - * |
|
| 35 | - * @since 1.0.0 |
|
| 36 | - * @param string $user_id Facebook User id (not name) |
|
| 37 | - * @param int $item_count number of photos to pull |
|
| 38 | - */ |
|
| 39 | - public function get_photo_sets($user_id,$item_count=10){ |
|
| 40 | - //photoset params |
|
| 41 | - $url = "https://graph.facebook.com/$user_id/albums"; |
|
| 42 | - $photo_sets_list = json_decode(file_get_contents($url)); |
|
| 43 | - return $photo_sets_list->data; |
|
| 44 | - } |
|
| 32 | + /** |
|
| 33 | + * Get Photosets List from User |
|
| 34 | + * |
|
| 35 | + * @since 1.0.0 |
|
| 36 | + * @param string $user_id Facebook User id (not name) |
|
| 37 | + * @param int $item_count number of photos to pull |
|
| 38 | + */ |
|
| 39 | + public function get_photo_sets($user_id,$item_count=10){ |
|
| 40 | + //photoset params |
|
| 41 | + $url = "https://graph.facebook.com/$user_id/albums"; |
|
| 42 | + $photo_sets_list = json_decode(file_get_contents($url)); |
|
| 43 | + return $photo_sets_list->data; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Get Photoset Photos |
|
| 48 | - * |
|
| 49 | - * @since 1.0.0 |
|
| 50 | - * @param string $photo_set_id Photoset ID |
|
| 51 | - * @param int $item_count number of photos to pull |
|
| 52 | - */ |
|
| 53 | - public function get_photo_set_photos($photo_set_id,$item_count=10){ |
|
| 54 | - $url = "https://graph.facebook.com/v2.0/$photo_set_id?fields=photos"; |
|
| 55 | - $photo_set_photos = json_decode(file_get_contents($url)); |
|
| 56 | - return $photo_set_photos->photos->data; |
|
| 57 | - } |
|
| 46 | + /** |
|
| 47 | + * Get Photoset Photos |
|
| 48 | + * |
|
| 49 | + * @since 1.0.0 |
|
| 50 | + * @param string $photo_set_id Photoset ID |
|
| 51 | + * @param int $item_count number of photos to pull |
|
| 52 | + */ |
|
| 53 | + public function get_photo_set_photos($photo_set_id,$item_count=10){ |
|
| 54 | + $url = "https://graph.facebook.com/v2.0/$photo_set_id?fields=photos"; |
|
| 55 | + $photo_set_photos = json_decode(file_get_contents($url)); |
|
| 56 | + return $photo_set_photos->photos->data; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Get Feed |
|
| 61 | - * |
|
| 62 | - * @since 1.0.0 |
|
| 63 | - * @param string $user User ID |
|
| 64 | - * @param int $item_count number of itmes to pull |
|
| 65 | - */ |
|
| 66 | - public function get_post_feed($user,$app_id,$app_secret,$item_count=10){ |
|
| 67 | - $oauth = file_get_contents("https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=".$app_id."&client_secret=".$app_secret); |
|
| 68 | - $url = "https://graph.facebook.com/$user/feed?".$oauth."&fields=id,from,message,picture,link,name,icon,privacy,type,status_type,object_id,application,created_time,updated_time,is_hidden,is_expired,likes,comments"; |
|
| 69 | - $feed = json_decode(file_get_contents($url)); |
|
| 70 | - return $feed->data; |
|
| 71 | - } |
|
| 59 | + /** |
|
| 60 | + * Get Feed |
|
| 61 | + * |
|
| 62 | + * @since 1.0.0 |
|
| 63 | + * @param string $user User ID |
|
| 64 | + * @param int $item_count number of itmes to pull |
|
| 65 | + */ |
|
| 66 | + public function get_post_feed($user,$app_id,$app_secret,$item_count=10){ |
|
| 67 | + $oauth = file_get_contents("https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=".$app_id."&client_secret=".$app_secret); |
|
| 68 | + $url = "https://graph.facebook.com/$user/feed?".$oauth."&fields=id,from,message,picture,link,name,icon,privacy,type,status_type,object_id,application,created_time,updated_time,is_hidden,is_expired,likes,comments"; |
|
| 69 | + $feed = json_decode(file_get_contents($url)); |
|
| 70 | + return $feed->data; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Decode URL from feed |
|
| 75 | - * |
|
| 76 | - * @since 1.0.0 |
|
| 77 | - * @param string $url facebook Output Data |
|
| 78 | - */ |
|
| 79 | - public static function decode_facebook_url($url) { |
|
| 80 | - $url = str_replace('u00253A',':',$url); |
|
| 81 | - $url = str_replace('\u00255C\u00252F','/',$url); |
|
| 82 | - $url = str_replace('u00252F','/',$url); |
|
| 83 | - $url = str_replace('u00253F','?',$url); |
|
| 84 | - $url = str_replace('u00253D','=',$url); |
|
| 85 | - $url = str_replace('u002526','&',$url); |
|
| 86 | - return $url; |
|
| 87 | - } |
|
| 73 | + /** |
|
| 74 | + * Decode URL from feed |
|
| 75 | + * |
|
| 76 | + * @since 1.0.0 |
|
| 77 | + * @param string $url facebook Output Data |
|
| 78 | + */ |
|
| 79 | + public static function decode_facebook_url($url) { |
|
| 80 | + $url = str_replace('u00253A',':',$url); |
|
| 81 | + $url = str_replace('\u00255C\u00252F','/',$url); |
|
| 82 | + $url = str_replace('u00252F','/',$url); |
|
| 83 | + $url = str_replace('u00253F','?',$url); |
|
| 84 | + $url = str_replace('u00253D','=',$url); |
|
| 85 | + $url = str_replace('u002526','&',$url); |
|
| 86 | + return $url; |
|
| 87 | + } |
|
| 88 | 88 | } |
| 89 | 89 | ?> |
| 90 | 90 | \ No newline at end of file |
@@ -11,64 +11,64 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | class TP_vimeo { |
| 14 | - /** |
|
| 15 | - * Stream Array |
|
| 16 | - * |
|
| 17 | - * @since 1.0.0 |
|
| 18 | - * @access private |
|
| 19 | - * @var array $stream Stream Data Array |
|
| 20 | - */ |
|
| 21 | - private $stream; |
|
| 14 | + /** |
|
| 15 | + * Stream Array |
|
| 16 | + * |
|
| 17 | + * @since 1.0.0 |
|
| 18 | + * @access private |
|
| 19 | + * @var array $stream Stream Data Array |
|
| 20 | + */ |
|
| 21 | + private $stream; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Get Vimeo User Videos |
|
| 25 | - * |
|
| 26 | - * @since 1.0.0 |
|
| 27 | - */ |
|
| 28 | - public function get_vimeo_videos($type,$value){ |
|
| 29 | - //call the API and decode the response |
|
| 30 | - if($type=="user"){ |
|
| 31 | - $url = "https://vimeo.com/api/v2/".$value."/videos.json"; |
|
| 32 | - } |
|
| 33 | - else{ |
|
| 34 | - $url = "https://vimeo.com/api/v2/".$type."/".$value."/videos.json"; |
|
| 35 | - } |
|
| 23 | + /** |
|
| 24 | + * Get Vimeo User Videos |
|
| 25 | + * |
|
| 26 | + * @since 1.0.0 |
|
| 27 | + */ |
|
| 28 | + public function get_vimeo_videos($type,$value){ |
|
| 29 | + //call the API and decode the response |
|
| 30 | + if($type=="user"){ |
|
| 31 | + $url = "https://vimeo.com/api/v2/".$value."/videos.json"; |
|
| 32 | + } |
|
| 33 | + else{ |
|
| 34 | + $url = "https://vimeo.com/api/v2/".$type."/".$value."/videos.json"; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - $rsp = json_decode(file_get_contents($url)); |
|
| 37 | + $rsp = json_decode(file_get_contents($url)); |
|
| 38 | 38 | |
| 39 | - return $rsp; |
|
| 40 | - } |
|
| 39 | + return $rsp; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Prepare output array $stream for Vimeo videos |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @param string $videos Vimeo Output Data |
|
| 47 | - */ |
|
| 48 | - private function vimeo_output_array($videos,$count){ |
|
| 49 | - foreach ($videos as $video) { |
|
| 50 | - if($count-- == 0) break; |
|
| 42 | + /** |
|
| 43 | + * Prepare output array $stream for Vimeo videos |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @param string $videos Vimeo Output Data |
|
| 47 | + */ |
|
| 48 | + private function vimeo_output_array($videos,$count){ |
|
| 49 | + foreach ($videos as $video) { |
|
| 50 | + if($count-- == 0) break; |
|
| 51 | 51 | |
| 52 | - $stream = array(); |
|
| 52 | + $stream = array(); |
|
| 53 | 53 | |
| 54 | - $image_url = @array( |
|
| 55 | - 'thumbnail_small' => array($video->thumbnail_small), |
|
| 56 | - 'thumbnail_medium' => array($video->thumbnail_medium), |
|
| 57 | - 'thumbnail_large' => array($video->thumbnail_large), |
|
| 58 | - ); |
|
| 54 | + $image_url = @array( |
|
| 55 | + 'thumbnail_small' => array($video->thumbnail_small), |
|
| 56 | + 'thumbnail_medium' => array($video->thumbnail_medium), |
|
| 57 | + 'thumbnail_large' => array($video->thumbnail_large), |
|
| 58 | + ); |
|
| 59 | 59 | |
| 60 | - $stream['custom-image-url'] = $image_url; //image for entry |
|
| 61 | - $stream['custom-type'] = 'vimeo'; //image, vimeo, youtube, soundcloud, html |
|
| 62 | - $stream['custom-vimeo'] = $video->id; |
|
| 63 | - $stream['post_url'] = $video->url; |
|
| 64 | - $stream['post_link'] = $video->url; |
|
| 65 | - $stream['title'] = $video->title; |
|
| 66 | - $stream['content'] = $video->description; |
|
| 67 | - $stream['date_modified'] = $video->upload_date; |
|
| 68 | - $stream['author_name'] = $video->user_name; |
|
| 60 | + $stream['custom-image-url'] = $image_url; //image for entry |
|
| 61 | + $stream['custom-type'] = 'vimeo'; //image, vimeo, youtube, soundcloud, html |
|
| 62 | + $stream['custom-vimeo'] = $video->id; |
|
| 63 | + $stream['post_url'] = $video->url; |
|
| 64 | + $stream['post_link'] = $video->url; |
|
| 65 | + $stream['title'] = $video->title; |
|
| 66 | + $stream['content'] = $video->description; |
|
| 67 | + $stream['date_modified'] = $video->upload_date; |
|
| 68 | + $stream['author_name'] = $video->user_name; |
|
| 69 | 69 | |
| 70 | - $this->stream[] = $stream; |
|
| 71 | - } |
|
| 72 | - } |
|
| 70 | + $this->stream[] = $stream; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | } |
| 74 | 74 | ?> |
| 75 | 75 | \ No newline at end of file |
@@ -12,254 +12,254 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TP_flickr { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * API key |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * @access private |
|
| 20 | - * @var string $api_key flickr API key |
|
| 21 | - */ |
|
| 22 | - private $api_key; |
|
| 15 | + /** |
|
| 16 | + * API key |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * @access private |
|
| 20 | + * @var string $api_key flickr API key |
|
| 21 | + */ |
|
| 22 | + private $api_key; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * API params |
|
| 26 | - * |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - * @access private |
|
| 29 | - * @var array $api_param_defaults Basic params to call with API |
|
| 30 | - */ |
|
| 31 | - private $api_param_defaults; |
|
| 24 | + /** |
|
| 25 | + * API params |
|
| 26 | + * |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + * @access private |
|
| 29 | + * @var array $api_param_defaults Basic params to call with API |
|
| 30 | + */ |
|
| 31 | + private $api_param_defaults; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Basic URL |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @access private |
|
| 38 | - * @var string $url Url to fetch user from |
|
| 39 | - */ |
|
| 40 | - private $flickr_url; |
|
| 33 | + /** |
|
| 34 | + * Basic URL |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @access private |
|
| 38 | + * @var string $url Url to fetch user from |
|
| 39 | + */ |
|
| 40 | + private $flickr_url; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Initialize the class and set its properties. |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @param string $api_key flickr API key. |
|
| 47 | - */ |
|
| 48 | - public function __construct($api_key) { |
|
| 49 | - $this->api_key = $api_key; |
|
| 50 | - $this->api_param_defaults = array( |
|
| 51 | - 'api_key' => $this->api_key, |
|
| 52 | - 'format' => 'json', |
|
| 53 | - 'nojsoncallback' => 1, |
|
| 54 | - ); |
|
| 55 | - } |
|
| 42 | + /** |
|
| 43 | + * Initialize the class and set its properties. |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @param string $api_key flickr API key. |
|
| 47 | + */ |
|
| 48 | + public function __construct($api_key) { |
|
| 49 | + $this->api_key = $api_key; |
|
| 50 | + $this->api_param_defaults = array( |
|
| 51 | + 'api_key' => $this->api_key, |
|
| 52 | + 'format' => 'json', |
|
| 53 | + 'nojsoncallback' => 1, |
|
| 54 | + ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Calls Flicker API with set of params, returns json |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @param array $params Parameter build for API request |
|
| 62 | - */ |
|
| 63 | - private function call_flickr_api($params){ |
|
| 64 | - //build url |
|
| 65 | - $encoded_params = array(); |
|
| 66 | - foreach ($params as $k => $v){ |
|
| 67 | - $encoded_params[] = urlencode($k).'='.urlencode($v); |
|
| 68 | - } |
|
| 57 | + /** |
|
| 58 | + * Calls Flicker API with set of params, returns json |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @param array $params Parameter build for API request |
|
| 62 | + */ |
|
| 63 | + private function call_flickr_api($params){ |
|
| 64 | + //build url |
|
| 65 | + $encoded_params = array(); |
|
| 66 | + foreach ($params as $k => $v){ |
|
| 67 | + $encoded_params[] = urlencode($k).'='.urlencode($v); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - //call the API and decode the response |
|
| 71 | - $url = "https://api.flickr.com/services/rest/?".implode('&', $encoded_params); |
|
| 72 | - $rsp = json_decode(file_get_contents($url)); |
|
| 73 | - return $rsp; |
|
| 74 | - } |
|
| 70 | + //call the API and decode the response |
|
| 71 | + $url = "https://api.flickr.com/services/rest/?".implode('&', $encoded_params); |
|
| 72 | + $rsp = json_decode(file_get_contents($url)); |
|
| 73 | + return $rsp; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Get User ID from its URL |
|
| 78 | - * |
|
| 79 | - * @since 1.0.0 |
|
| 80 | - * @param string $user_url URL of the Gallery |
|
| 81 | - */ |
|
| 82 | - public function get_user_from_url($user_url){ |
|
| 83 | - //gallery params |
|
| 84 | - $user_params = $this->api_param_defaults + array( |
|
| 85 | - 'method' => 'flickr.urls.lookupUser', |
|
| 86 | - 'url' => $user_url, |
|
| 87 | - ); |
|
| 76 | + /** |
|
| 77 | + * Get User ID from its URL |
|
| 78 | + * |
|
| 79 | + * @since 1.0.0 |
|
| 80 | + * @param string $user_url URL of the Gallery |
|
| 81 | + */ |
|
| 82 | + public function get_user_from_url($user_url){ |
|
| 83 | + //gallery params |
|
| 84 | + $user_params = $this->api_param_defaults + array( |
|
| 85 | + 'method' => 'flickr.urls.lookupUser', |
|
| 86 | + 'url' => $user_url, |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - //set User Url |
|
| 90 | - $this->flickr_url = $user_url; |
|
| 89 | + //set User Url |
|
| 90 | + $this->flickr_url = $user_url; |
|
| 91 | 91 | |
| 92 | - //get gallery info |
|
| 93 | - $user_info = $this->call_flickr_api($user_params); |
|
| 94 | - return $user_info->user->id; |
|
| 95 | - } |
|
| 92 | + //get gallery info |
|
| 93 | + $user_info = $this->call_flickr_api($user_params); |
|
| 94 | + return $user_info->user->id; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Get Group ID from its URL |
|
| 99 | - * |
|
| 100 | - * @since 1.0.0 |
|
| 101 | - * @param string $group_url URL of the Gallery |
|
| 102 | - */ |
|
| 103 | - public function get_group_from_url($group_url){ |
|
| 104 | - //gallery params |
|
| 105 | - $group_params = $this->api_param_defaults + array( |
|
| 106 | - 'method' => 'flickr.urls.lookupGroup', |
|
| 107 | - 'url' => $group_url, |
|
| 108 | - ); |
|
| 97 | + /** |
|
| 98 | + * Get Group ID from its URL |
|
| 99 | + * |
|
| 100 | + * @since 1.0.0 |
|
| 101 | + * @param string $group_url URL of the Gallery |
|
| 102 | + */ |
|
| 103 | + public function get_group_from_url($group_url){ |
|
| 104 | + //gallery params |
|
| 105 | + $group_params = $this->api_param_defaults + array( |
|
| 106 | + 'method' => 'flickr.urls.lookupGroup', |
|
| 107 | + 'url' => $group_url, |
|
| 108 | + ); |
|
| 109 | 109 | |
| 110 | - //set User Url |
|
| 111 | - $this->flickr_url = $group_url; |
|
| 110 | + //set User Url |
|
| 111 | + $this->flickr_url = $group_url; |
|
| 112 | 112 | |
| 113 | - //get gallery info |
|
| 114 | - $group_info = $this->call_flickr_api($group_params); |
|
| 115 | - return $group_info->group->id; |
|
| 116 | - } |
|
| 113 | + //get gallery info |
|
| 114 | + $group_info = $this->call_flickr_api($group_params); |
|
| 115 | + return $group_info->group->id; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Get Public Photos |
|
| 120 | - * |
|
| 121 | - * @since 1.0.0 |
|
| 122 | - * @param string $user_id flicker User id (not name) |
|
| 123 | - * @param int $item_count number of photos to pull |
|
| 124 | - */ |
|
| 125 | - public function get_public_photos($user_id,$item_count=10){ |
|
| 126 | - //public photos params |
|
| 127 | - $public_photo_params = $this->api_param_defaults + array( |
|
| 128 | - 'method' => 'flickr.people.getPublicPhotos', |
|
| 129 | - 'user_id' => $user_id, |
|
| 130 | - 'extras' => 'description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', |
|
| 131 | - 'per_page'=> $item_count, |
|
| 132 | - 'page' => 1 |
|
| 133 | - ); |
|
| 118 | + /** |
|
| 119 | + * Get Public Photos |
|
| 120 | + * |
|
| 121 | + * @since 1.0.0 |
|
| 122 | + * @param string $user_id flicker User id (not name) |
|
| 123 | + * @param int $item_count number of photos to pull |
|
| 124 | + */ |
|
| 125 | + public function get_public_photos($user_id,$item_count=10){ |
|
| 126 | + //public photos params |
|
| 127 | + $public_photo_params = $this->api_param_defaults + array( |
|
| 128 | + 'method' => 'flickr.people.getPublicPhotos', |
|
| 129 | + 'user_id' => $user_id, |
|
| 130 | + 'extras' => 'description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', |
|
| 131 | + 'per_page'=> $item_count, |
|
| 132 | + 'page' => 1 |
|
| 133 | + ); |
|
| 134 | 134 | |
| 135 | - //get photo list |
|
| 136 | - $public_photos_list = $this->call_flickr_api($public_photo_params); |
|
| 137 | - return $public_photos_list->photos->photo; |
|
| 138 | - } |
|
| 135 | + //get photo list |
|
| 136 | + $public_photos_list = $this->call_flickr_api($public_photo_params); |
|
| 137 | + return $public_photos_list->photos->photo; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Get Photosets List from User |
|
| 142 | - * |
|
| 143 | - * @since 1.0.0 |
|
| 144 | - * @param string $user_id flicker User id (not name) |
|
| 145 | - * @param int $item_count number of photos to pull |
|
| 146 | - */ |
|
| 147 | - public function get_photo_sets($user_id,$item_count=10){ |
|
| 148 | - //photoset params |
|
| 149 | - $photo_set_params = $this->api_param_defaults + array( |
|
| 150 | - 'method' => 'flickr.photosets.getList', |
|
| 151 | - 'user_id' => $user_id, |
|
| 152 | - 'per_page'=> $item_count, |
|
| 153 | - 'page' => 1 |
|
| 154 | - ); |
|
| 140 | + /** |
|
| 141 | + * Get Photosets List from User |
|
| 142 | + * |
|
| 143 | + * @since 1.0.0 |
|
| 144 | + * @param string $user_id flicker User id (not name) |
|
| 145 | + * @param int $item_count number of photos to pull |
|
| 146 | + */ |
|
| 147 | + public function get_photo_sets($user_id,$item_count=10){ |
|
| 148 | + //photoset params |
|
| 149 | + $photo_set_params = $this->api_param_defaults + array( |
|
| 150 | + 'method' => 'flickr.photosets.getList', |
|
| 151 | + 'user_id' => $user_id, |
|
| 152 | + 'per_page'=> $item_count, |
|
| 153 | + 'page' => 1 |
|
| 154 | + ); |
|
| 155 | 155 | |
| 156 | - //get photoset list |
|
| 157 | - $photo_sets_list = $this->call_flickr_api($photo_set_params); |
|
| 158 | - return $photo_sets_list->photosets->photoset; |
|
| 159 | - } |
|
| 156 | + //get photoset list |
|
| 157 | + $photo_sets_list = $this->call_flickr_api($photo_set_params); |
|
| 158 | + return $photo_sets_list->photosets->photoset; |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Get Photoset Photos |
|
| 163 | - * |
|
| 164 | - * @since 1.0.0 |
|
| 165 | - * @param string $photo_set_id Photoset ID |
|
| 166 | - * @param int $item_count number of photos to pull |
|
| 167 | - */ |
|
| 168 | - public function get_photo_set_photos($photo_set_id,$item_count=10){ |
|
| 169 | - //photoset photos params |
|
| 170 | - $photo_set_params = $this->api_param_defaults + array( |
|
| 171 | - 'method' => 'flickr.photosets.getPhotos', |
|
| 172 | - 'photoset_id' => $photo_set_id, |
|
| 173 | - 'per_page' => $item_count, |
|
| 174 | - 'page' => 1, |
|
| 175 | - 'extras' => 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o' |
|
| 176 | - ); |
|
| 161 | + /** |
|
| 162 | + * Get Photoset Photos |
|
| 163 | + * |
|
| 164 | + * @since 1.0.0 |
|
| 165 | + * @param string $photo_set_id Photoset ID |
|
| 166 | + * @param int $item_count number of photos to pull |
|
| 167 | + */ |
|
| 168 | + public function get_photo_set_photos($photo_set_id,$item_count=10){ |
|
| 169 | + //photoset photos params |
|
| 170 | + $photo_set_params = $this->api_param_defaults + array( |
|
| 171 | + 'method' => 'flickr.photosets.getPhotos', |
|
| 172 | + 'photoset_id' => $photo_set_id, |
|
| 173 | + 'per_page' => $item_count, |
|
| 174 | + 'page' => 1, |
|
| 175 | + 'extras' => 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o' |
|
| 176 | + ); |
|
| 177 | 177 | |
| 178 | - //get photo list |
|
| 179 | - $photo_set_photos = $this->call_flickr_api($photo_set_params); |
|
| 180 | - return $photo_set_photos->photoset->photo; |
|
| 181 | - } |
|
| 178 | + //get photo list |
|
| 179 | + $photo_set_photos = $this->call_flickr_api($photo_set_params); |
|
| 180 | + return $photo_set_photos->photoset->photo; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Get Groop Pool Photos |
|
| 185 | - * |
|
| 186 | - * @since 1.0.0 |
|
| 187 | - * @param string $group_id Photoset ID |
|
| 188 | - * @param int $item_count number of photos to pull |
|
| 189 | - */ |
|
| 190 | - public function get_group_photos($group_id,$item_count=10){ |
|
| 191 | - //photoset photos params |
|
| 192 | - $group_pool_params = $this->api_param_defaults + array( |
|
| 193 | - 'method' => 'flickr.groups.pools.getPhotos', |
|
| 194 | - 'group_id' => $group_id, |
|
| 195 | - 'per_page' => $item_count, |
|
| 196 | - 'page' => 1, |
|
| 197 | - 'extras' => 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o' |
|
| 198 | - ); |
|
| 183 | + /** |
|
| 184 | + * Get Groop Pool Photos |
|
| 185 | + * |
|
| 186 | + * @since 1.0.0 |
|
| 187 | + * @param string $group_id Photoset ID |
|
| 188 | + * @param int $item_count number of photos to pull |
|
| 189 | + */ |
|
| 190 | + public function get_group_photos($group_id,$item_count=10){ |
|
| 191 | + //photoset photos params |
|
| 192 | + $group_pool_params = $this->api_param_defaults + array( |
|
| 193 | + 'method' => 'flickr.groups.pools.getPhotos', |
|
| 194 | + 'group_id' => $group_id, |
|
| 195 | + 'per_page' => $item_count, |
|
| 196 | + 'page' => 1, |
|
| 197 | + 'extras' => 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o' |
|
| 198 | + ); |
|
| 199 | 199 | |
| 200 | - //get photo list |
|
| 201 | - $group_pool_photos = $this->call_flickr_api($group_pool_params); |
|
| 202 | - return $group_pool_photos->photos->photo; |
|
| 203 | - } |
|
| 200 | + //get photo list |
|
| 201 | + $group_pool_photos = $this->call_flickr_api($group_pool_params); |
|
| 202 | + return $group_pool_photos->photos->photo; |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - /** |
|
| 206 | - * Get Gallery ID from its URL |
|
| 207 | - * |
|
| 208 | - * @since 1.0.0 |
|
| 209 | - * @param string $gallery_url URL of the Gallery |
|
| 210 | - * @param int $item_count number of photos to pull |
|
| 211 | - */ |
|
| 212 | - public function get_gallery_from_url($gallery_url){ |
|
| 213 | - //gallery params |
|
| 214 | - $gallery_params = $this->api_param_defaults + array( |
|
| 215 | - 'method' => 'flickr.urls.lookupGallery', |
|
| 216 | - 'url' => $gallery_url, |
|
| 217 | - ); |
|
| 205 | + /** |
|
| 206 | + * Get Gallery ID from its URL |
|
| 207 | + * |
|
| 208 | + * @since 1.0.0 |
|
| 209 | + * @param string $gallery_url URL of the Gallery |
|
| 210 | + * @param int $item_count number of photos to pull |
|
| 211 | + */ |
|
| 212 | + public function get_gallery_from_url($gallery_url){ |
|
| 213 | + //gallery params |
|
| 214 | + $gallery_params = $this->api_param_defaults + array( |
|
| 215 | + 'method' => 'flickr.urls.lookupGallery', |
|
| 216 | + 'url' => $gallery_url, |
|
| 217 | + ); |
|
| 218 | 218 | |
| 219 | - //get gallery info |
|
| 220 | - $gallery_info = $this->call_flickr_api($gallery_params); |
|
| 221 | - return $gallery_info->gallery->id; |
|
| 222 | - } |
|
| 219 | + //get gallery info |
|
| 220 | + $gallery_info = $this->call_flickr_api($gallery_params); |
|
| 221 | + return $gallery_info->gallery->id; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * Get Gallery Photos |
|
| 226 | - * |
|
| 227 | - * @since 1.0.0 |
|
| 228 | - * @param string $gallery_id flicker Gallery id (not name) |
|
| 229 | - * @param int $item_count number of photos to pull |
|
| 230 | - */ |
|
| 231 | - public function get_gallery_photos($gallery_id,$item_count=10){ |
|
| 232 | - //gallery photos params |
|
| 233 | - $gallery_photo_params = $this->api_param_defaults + array( |
|
| 234 | - 'method' => 'flickr.galleries.getPhotos', |
|
| 235 | - 'gallery_id' => $gallery_id, |
|
| 236 | - 'extras' => 'description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', |
|
| 237 | - 'per_page'=> $item_count, |
|
| 238 | - 'page' => 1 |
|
| 239 | - ); |
|
| 224 | + /** |
|
| 225 | + * Get Gallery Photos |
|
| 226 | + * |
|
| 227 | + * @since 1.0.0 |
|
| 228 | + * @param string $gallery_id flicker Gallery id (not name) |
|
| 229 | + * @param int $item_count number of photos to pull |
|
| 230 | + */ |
|
| 231 | + public function get_gallery_photos($gallery_id,$item_count=10){ |
|
| 232 | + //gallery photos params |
|
| 233 | + $gallery_photo_params = $this->api_param_defaults + array( |
|
| 234 | + 'method' => 'flickr.galleries.getPhotos', |
|
| 235 | + 'gallery_id' => $gallery_id, |
|
| 236 | + 'extras' => 'description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', |
|
| 237 | + 'per_page'=> $item_count, |
|
| 238 | + 'page' => 1 |
|
| 239 | + ); |
|
| 240 | 240 | |
| 241 | - //get photo list |
|
| 242 | - $gallery_photos_list = $this->call_flickr_api($gallery_photo_params); |
|
| 243 | - return $gallery_photos_list->photos->photo; |
|
| 244 | - } |
|
| 241 | + //get photo list |
|
| 242 | + $gallery_photos_list = $this->call_flickr_api($gallery_photo_params); |
|
| 243 | + return $gallery_photos_list->photos->photo; |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - /** |
|
| 247 | - * Encode the flickr ID for URL (base58) |
|
| 248 | - * |
|
| 249 | - * @since 1.0.0 |
|
| 250 | - * @param string $num flickr photo id |
|
| 251 | - */ |
|
| 252 | - public static function base_encode($num, $alphabet='123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ') { |
|
| 253 | - $base_count = strlen($alphabet); |
|
| 254 | - $encoded = ''; |
|
| 255 | - while ($num >= $base_count) { |
|
| 256 | - $div = $num/$base_count; |
|
| 257 | - $mod = ($num-($base_count*intval($div))); |
|
| 258 | - $encoded = $alphabet[$mod] . $encoded; |
|
| 259 | - $num = intval($div); |
|
| 260 | - } |
|
| 261 | - if ($num) $encoded = $alphabet[$num] . $encoded; |
|
| 262 | - return $encoded; |
|
| 263 | - } |
|
| 246 | + /** |
|
| 247 | + * Encode the flickr ID for URL (base58) |
|
| 248 | + * |
|
| 249 | + * @since 1.0.0 |
|
| 250 | + * @param string $num flickr photo id |
|
| 251 | + */ |
|
| 252 | + public static function base_encode($num, $alphabet='123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ') { |
|
| 253 | + $base_count = strlen($alphabet); |
|
| 254 | + $encoded = ''; |
|
| 255 | + while ($num >= $base_count) { |
|
| 256 | + $div = $num/$base_count; |
|
| 257 | + $mod = ($num-($base_count*intval($div))); |
|
| 258 | + $encoded = $alphabet[$mod] . $encoded; |
|
| 259 | + $num = intval($div); |
|
| 260 | + } |
|
| 261 | + if ($num) $encoded = $alphabet[$num] . $encoded; |
|
| 262 | + return $encoded; |
|
| 263 | + } |
|
| 264 | 264 | } |
| 265 | 265 | ?> |
| 266 | 266 | \ No newline at end of file |
@@ -12,62 +12,62 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class TP_twitter { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Consumer Key |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * @access private |
|
| 20 | - * @var string $consumer_key Consumer Key |
|
| 21 | - */ |
|
| 22 | - private $consumer_key; |
|
| 15 | + /** |
|
| 16 | + * Consumer Key |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * @access private |
|
| 20 | + * @var string $consumer_key Consumer Key |
|
| 21 | + */ |
|
| 22 | + private $consumer_key; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Consumer Secret |
|
| 26 | - * |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - * @access private |
|
| 29 | - * @var string $consumer_secret Consumer Secret |
|
| 30 | - */ |
|
| 31 | - private $consumer_secret; |
|
| 24 | + /** |
|
| 25 | + * Consumer Secret |
|
| 26 | + * |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + * @access private |
|
| 29 | + * @var string $consumer_secret Consumer Secret |
|
| 30 | + */ |
|
| 31 | + private $consumer_secret; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Access Token |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @access private |
|
| 38 | - * @var string $access_token Access Token |
|
| 39 | - */ |
|
| 40 | - private $access_token; |
|
| 33 | + /** |
|
| 34 | + * Access Token |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @access private |
|
| 38 | + * @var string $access_token Access Token |
|
| 39 | + */ |
|
| 40 | + private $access_token; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Access Token Secret |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @access private |
|
| 47 | - * @var string $access_token_secret Access Token Secret |
|
| 48 | - */ |
|
| 49 | - private $access_token_secret; |
|
| 42 | + /** |
|
| 43 | + * Access Token Secret |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @access private |
|
| 47 | + * @var string $access_token_secret Access Token Secret |
|
| 48 | + */ |
|
| 49 | + private $access_token_secret; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Initialize the class and set its properties. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * @param string $api_key flickr API key. |
|
| 56 | - */ |
|
| 57 | - public function __construct($consumer_key,$consumer_secret,$access_token,$access_token_secret) { |
|
| 51 | + /** |
|
| 52 | + * Initialize the class and set its properties. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * @param string $api_key flickr API key. |
|
| 56 | + */ |
|
| 57 | + public function __construct($consumer_key,$consumer_secret,$access_token,$access_token_secret) { |
|
| 58 | 58 | $this->consumer_key = $consumer_key; |
| 59 | 59 | $this->consumer_secret = $consumer_secret; |
| 60 | 60 | $this->access_token = $access_token; |
| 61 | 61 | $this->access_token_secret = $access_token_secret; |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Get Tweets |
|
| 66 | - * |
|
| 67 | - * @since 1.0.0 |
|
| 68 | - * @param string $twitter_account Twitter account without trailing @ char |
|
| 69 | - */ |
|
| 70 | - public function get_public_photos($twitter_account){ |
|
| 64 | + /** |
|
| 65 | + * Get Tweets |
|
| 66 | + * |
|
| 67 | + * @since 1.0.0 |
|
| 68 | + * @param string $twitter_account Twitter account without trailing @ char |
|
| 69 | + */ |
|
| 70 | + public function get_public_photos($twitter_account){ |
|
| 71 | 71 | $twitter = new \TwitterPhp\RestApi($this->consumer_key,$this->consumer_secret,$this->access_token,$this->access_token_secret); |
| 72 | 72 | /* |
| 73 | 73 | * Connect as application |
@@ -82,41 +82,41 @@ discard block |
||
| 82 | 82 | $tweets = $connection->get('/statuses/user_timeline',array('screen_name' => $twitter_account, 'entities' => 1, 'trim_user' => 0 , 'exclude_replies' => 'true')); |
| 83 | 83 | //var_dump($tweets); |
| 84 | 84 | return $tweets; |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Find Key in array and return value (multidim array possible) |
|
| 90 | - * |
|
| 91 | - * @since 1.0.0 |
|
| 92 | - * @param string $key Needle |
|
| 93 | - * @param array $form Haystack |
|
| 94 | - */ |
|
| 95 | - public static function array_find_element_by_key($key, $form) { |
|
| 96 | - if (array_key_exists($key, $form)) { |
|
| 88 | + /** |
|
| 89 | + * Find Key in array and return value (multidim array possible) |
|
| 90 | + * |
|
| 91 | + * @since 1.0.0 |
|
| 92 | + * @param string $key Needle |
|
| 93 | + * @param array $form Haystack |
|
| 94 | + */ |
|
| 95 | + public static function array_find_element_by_key($key, $form) { |
|
| 96 | + if (array_key_exists($key, $form)) { |
|
| 97 | 97 | $ret =& $form[$key]; |
| 98 | 98 | return $ret; |
| 99 | - } |
|
| 100 | - foreach ($form as $k => $v) { |
|
| 99 | + } |
|
| 100 | + foreach ($form as $k => $v) { |
|
| 101 | 101 | if (is_array($v)) { |
| 102 | - $ret =TP_twitter::array_find_element_by_key($key, $form[$k]); |
|
| 103 | - if ($ret) { |
|
| 102 | + $ret =TP_twitter::array_find_element_by_key($key, $form[$k]); |
|
| 103 | + if ($ret) { |
|
| 104 | 104 | return $ret; |
| 105 | - } |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | - } |
|
| 108 | - return FALSE; |
|
| 109 | - } |
|
| 107 | + } |
|
| 108 | + return FALSE; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Prepare output array $stream |
|
| 113 | - * |
|
| 114 | - * @since 1.0.0 |
|
| 115 | - * @param string $tweets Twitter Output Data |
|
| 116 | - */ |
|
| 117 | - public static function makeClickableLinks($s) { |
|
| 111 | + /** |
|
| 112 | + * Prepare output array $stream |
|
| 113 | + * |
|
| 114 | + * @since 1.0.0 |
|
| 115 | + * @param string $tweets Twitter Output Data |
|
| 116 | + */ |
|
| 117 | + public static function makeClickableLinks($s) { |
|
| 118 | 118 | return preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $s); |
| 119 | - } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | 121 | } |
| 122 | 122 | ?> |
| 123 | 123 | \ No newline at end of file |
@@ -12,37 +12,37 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TP_instagram { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * API key |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * @access private |
|
| 20 | - * @var string $api_key Instagram API key |
|
| 21 | - */ |
|
| 22 | - private $api_key; |
|
| 15 | + /** |
|
| 16 | + * API key |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * @access private |
|
| 20 | + * @var string $api_key Instagram API key |
|
| 21 | + */ |
|
| 22 | + private $api_key; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Initialize the class and set its properties. |
|
| 26 | - * |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - * @param string $api_key Instagram API key. |
|
| 29 | - */ |
|
| 30 | - public function __construct($api_key) { |
|
| 31 | - $this->api_key = $api_key; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * Initialize the class and set its properties. |
|
| 26 | + * |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + * @param string $api_key Instagram API key. |
|
| 29 | + */ |
|
| 30 | + public function __construct($api_key) { |
|
| 31 | + $this->api_key = $api_key; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Get Instagram Pictures |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @param string $user_id Instagram User id (not name) |
|
| 39 | - */ |
|
| 40 | - public function get_public_photos($search_user_id){ |
|
| 41 | - //call the API and decode the response |
|
| 42 | - $url = "https://api.instagram.com/v1/users/".$search_user_id."/media/recent?access_token=".$this->api_key."&client_id=".$search_user_id; |
|
| 43 | - $rsp = json_decode(file_get_contents($url)); |
|
| 44 | - return $rsp->data; |
|
| 45 | - } |
|
| 34 | + /** |
|
| 35 | + * Get Instagram Pictures |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @param string $user_id Instagram User id (not name) |
|
| 39 | + */ |
|
| 40 | + public function get_public_photos($search_user_id){ |
|
| 41 | + //call the API and decode the response |
|
| 42 | + $url = "https://api.instagram.com/v1/users/".$search_user_id."/media/recent?access_token=".$this->api_key."&client_id=".$search_user_id; |
|
| 43 | + $rsp = json_decode(file_get_contents($url)); |
|
| 44 | + return $rsp->data; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | ?> |
| 49 | 49 | \ No newline at end of file |
@@ -12,74 +12,74 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TP_youtube { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * API key |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * @access private |
|
| 20 | - * @var string $api_key Youtube API key |
|
| 21 | - */ |
|
| 22 | - private $api_key; |
|
| 15 | + /** |
|
| 16 | + * API key |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * @access private |
|
| 20 | + * @var string $api_key Youtube API key |
|
| 21 | + */ |
|
| 22 | + private $api_key; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Channel ID |
|
| 26 | - * |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - * @access private |
|
| 29 | - * @var string $channel_id Youtube Channel ID |
|
| 30 | - */ |
|
| 31 | - private $channel_id; |
|
| 24 | + /** |
|
| 25 | + * Channel ID |
|
| 26 | + * |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + * @access private |
|
| 29 | + * @var string $channel_id Youtube Channel ID |
|
| 30 | + */ |
|
| 31 | + private $channel_id; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Initialize the class and set its properties. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @param string $api_key Youtube API key. |
|
| 38 | - */ |
|
| 39 | - public function __construct($api_key,$channel_id) { |
|
| 40 | - $this->api_key = $api_key; |
|
| 41 | - $this->channel_id = $channel_id; |
|
| 42 | - } |
|
| 33 | + /** |
|
| 34 | + * Initialize the class and set its properties. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @param string $api_key Youtube API key. |
|
| 38 | + */ |
|
| 39 | + public function __construct($api_key,$channel_id) { |
|
| 40 | + $this->api_key = $api_key; |
|
| 41 | + $this->channel_id = $channel_id; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Get Youtube Playlists |
|
| 47 | - * |
|
| 48 | - * @since 1.0.0 |
|
| 49 | - */ |
|
| 50 | - public function get_playlists(){ |
|
| 51 | - //call the API and decode the response |
|
| 52 | - $url = "https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=".$this->channel_id."&key=".$this->api_key; |
|
| 53 | - $rsp = json_decode(file_get_contents($url)); |
|
| 54 | - return $rsp->items; |
|
| 55 | - } |
|
| 45 | + /** |
|
| 46 | + * Get Youtube Playlists |
|
| 47 | + * |
|
| 48 | + * @since 1.0.0 |
|
| 49 | + */ |
|
| 50 | + public function get_playlists(){ |
|
| 51 | + //call the API and decode the response |
|
| 52 | + $url = "https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=".$this->channel_id."&key=".$this->api_key; |
|
| 53 | + $rsp = json_decode(file_get_contents($url)); |
|
| 54 | + return $rsp->items; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Get Youtube Playlist Items |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @param string $playlist_id Youtube Playlist ID |
|
| 62 | - * @param integer $count Max videos count |
|
| 63 | - */ |
|
| 64 | - public function show_playlist_videos($playlist_id,$count=50){ |
|
| 65 | - //call the API and decode the response |
|
| 66 | - $url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=".$playlist_id."&maxResults=".$count."&fields=items%2Fsnippet&key=".$this->api_key; |
|
| 67 | - $rsp = json_decode(file_get_contents($url)); |
|
| 68 | - return $rsp->items; |
|
| 69 | - } |
|
| 57 | + /** |
|
| 58 | + * Get Youtube Playlist Items |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @param string $playlist_id Youtube Playlist ID |
|
| 62 | + * @param integer $count Max videos count |
|
| 63 | + */ |
|
| 64 | + public function show_playlist_videos($playlist_id,$count=50){ |
|
| 65 | + //call the API and decode the response |
|
| 66 | + $url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=".$playlist_id."&maxResults=".$count."&fields=items%2Fsnippet&key=".$this->api_key; |
|
| 67 | + $rsp = json_decode(file_get_contents($url)); |
|
| 68 | + return $rsp->items; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Get Youtube Channel Items |
|
| 73 | - * |
|
| 74 | - * @since 1.0.0 |
|
| 75 | - * @param integer $count Max videos count |
|
| 76 | - */ |
|
| 77 | - public function show_channel_videos($count=50){ |
|
| 78 | - //call the API and decode the response |
|
| 79 | - $url = "https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=".$this->channel_id."&maxResults=".$count."&key=".$this->api_key."&order=date"; |
|
| 80 | - echo $url; |
|
| 81 | - $rsp = json_decode(file_get_contents($url)); |
|
| 82 | - return $rsp->items; |
|
| 83 | - } |
|
| 71 | + /** |
|
| 72 | + * Get Youtube Channel Items |
|
| 73 | + * |
|
| 74 | + * @since 1.0.0 |
|
| 75 | + * @param integer $count Max videos count |
|
| 76 | + */ |
|
| 77 | + public function show_channel_videos($count=50){ |
|
| 78 | + //call the API and decode the response |
|
| 79 | + $url = "https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=".$this->channel_id."&maxResults=".$count."&key=".$this->api_key."&order=date"; |
|
| 80 | + echo $url; |
|
| 81 | + $rsp = json_decode(file_get_contents($url)); |
|
| 82 | + return $rsp->items; |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | ?> |
| 86 | 86 | \ No newline at end of file |
@@ -769,7 +769,7 @@ |
||
| 769 | 769 | list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null); |
| 770 | 770 | |
| 771 | 771 | return (isset($map[$name]) ? $map[$name] : $name). |
| 772 | - ($parameters !== null ? ':'.$parameters : ''); |
|
| 772 | + ($parameters !== null ? ':'.$parameters : ''); |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |