@@ -128,8 +128,8 @@ |
||
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | //dd($request); |
| 131 | - \Event::fire(new \App\Events\SmsIntegration($request)); |
|
| 132 | - //\Event::fire(new \App\Events\PaymentGateway(['request' => $request, 'cart' => [], 'order' => $order])); |
|
| 131 | + \Event::fire(new \App\Events\SmsIntegration($request)); |
|
| 132 | + //\Event::fire(new \App\Events\PaymentGateway(['request' => $request, 'cart' => [], 'order' => $order])); |
|
| 133 | 133 | |
| 134 | 134 | } catch (\Exception $ex) { |
| 135 | 135 | return redirect()->back()->with('fails',$ex->getMessage()); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | CanResetPassword; |
| 18 | 18 | |
| 19 | 19 | // use Billable; |
| 20 | - // use CustomerBillableTrait; |
|
| 20 | + // use CustomerBillableTrait; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * The database table used by the model. |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | { |
| 128 | 128 | \DB::table('products')->delete(); |
| 129 | 129 | Product::create(['id' => 1, 'name' => 'default', 'type' => 1, 'group' => 1]); |
| 130 | - //Product::create(['id'=>2,'name'=>'none1','type'=>1,'group' =>1]); |
|
| 130 | + //Product::create(['id'=>2,'name'=>'none1','type'=>1,'group' =>1]); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Laravel - A PHP Framework For Web Artisans. |
|
| 4 | - * |
|
| 5 | - * @author Taylor Otwell <[email protected]> |
|
| 6 | - */ |
|
| 3 | + * Laravel - A PHP Framework For Web Artisans. |
|
| 4 | + * |
|
| 5 | + * @author Taylor Otwell <[email protected]> |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | /* |
| 9 | 9 | |-------------------------------------------------------------------------- |
@@ -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 |