RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

Return Licence Details for Flickr Images With PHP

This function will be referenced for various Flickr Tag: flickr related snippets and shortcodes we plan on sharing. The purpose of the function is to return licence details for particular images based on a numeric licence reference returned by Flickr. The function is intended to be used with the Flickr API or other platforms that honor their licence referencing.

1
<?php 
2
/*
3
 Return Licence Details for Flickr Images With PHP
4
 http://www.beliefmedia.com/code/php-snippets/flickr-licences
5
*/
6
 
7
function beliefmedia_licensing_array($lic) {
8
 
9
  $licence = array();
10
 
11
   switch ($lic) {
12
 
13
     case '0':
14
       $licence['licence_name'] = 'All Rights Reserved';
15
       $licence['licence_url'] = 0;
16
       break;
17
     case '1':
18
       $licence['licence_name'] = 'Attribution-NonCommercial-ShareAlike License';
19
       $licence['licence_url'] = 'http://creativecommons.org/licenses/by-nc-sa/2.0/';
20
       $licence['licence_short'] = 'CC BY-NC-SA';
21
       break;
22
     case '2':
23
       $licence['licence_name'] = 'Attribution-NonCommercial License';
24
       $licence['licence_url'] = 'http://creativecommons.org/licenses/by-nc/2.0/';
25
       $licence['licence_short'] = 'CC BY-NC';
26
       break;
27
     case '3':
28
       $licence['licence_name'] = 'Attribution-NonCommercial-NoDerivs License';
29
       $licence['licence_url'] = 'http://creativecommons.org/licenses/by-nc-nd/2.0/';
30
       $licence['licence_short'] = 'CC BY-NC-ND';
31
       break;
32
     case '4':
33
       $licence['licence_name'] = 'Attribution License';
34
       $licence['licence_url'] = 'http://creativecommons.org/licenses/by/2.0/';
35
       $licence['licence_short'] = 'CC BY';
36
       break;
37
     case '5':
38
       $licence['licence_name'] = 'Attribution-ShareAlike License';
39
       $licence['licence_url'] = 'http://creativecommons.org/licenses/by-sa/2.0/';
40
       $licence['licence_short'] = 'CC BY-SA';
41
       break;
42
     case '6':
43
       $licence['licence_name'] = 'Attribution-NoDerivs License';
44
       $licence['licence_url'] = 'http://creativecommons.org/licenses/by-nd/2.0/';
45
       $licence['licence_short'] = 'CC BY-ND';
46
       break;
47
     case '7':
48
       $licence['licence_name'] = 'No known copyright restrictions';
49
       $licence['licence_url'] = 'http://flickr.com/commons/usage/';
50
       $licence['licence_short'] = 'NIL';
51
       break;
52
     case '8':
53
       $licence['licence_name'] = 'United States Government Work';
54
       $licence['licence_url'] = 'http://www.usa.gov/copyright.shtml';
55
       $licence['licence_short'] = 'USG';
56
       break;
57
     case '9':
58
       $licence['licence_name'] = 'Public Domain Dedication (CC0)';
59
       $licence['licence_url'] = 'https://creativecommons.org/publicdomain/zero/1.0/';
60
       $licence['licence_short'] = 'CC0';
61
       break;
62
     case '10':
63
       $licence['licence_name'] = 'Public Domain Mark';
64
       $licence['licence_url'] = 'https://creativecommons.org/publicdomain/mark/1.0/';
65
       $licence['licence_short'] = 'PDM';
66
       break;
67
     default:
68
       $licence['licence_name'] = 'All Rights Reserved';
69
       $licence['licence_url'] = 0;
70
       $licence['licence_short'] = 'C';
71
       break;
72
   }
73
 
74
 return $licence;
75
}
1
<?php 
2
/* Test Usage */
3
echo print_r(beliefmedia_licensing_array('2'), true);

An example response is as follows:

1
Array
2
(
3
    [licence_name] => Attribution-NonCommercial License
4
    [licence_url] => http://creativecommons.org/licenses/by-nc/2.0/
5
    [licence_short] => CC BY-NC
6
)

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment