'', '_t' => '1', '_m' => '2', 'NULL' => '3', ); $afg_photo_source_map = array( 'photostream' => 'Photostream', 'gallery' => 'Gallery', 'photoset' => 'Photoset', ); $afg_width_map = array( 'default' => 'Use Default', 'auto' => 'Automatic', '10' => '10 %', '20' => '20 %', '30' => '30 %', '40' => '40 %', '50' => '50 %', '60' => '60 %', '70' => '70 %', '80' => '80 %', '90' => '90 %', ); $afg_per_page_map = array( 'default' => 'Use Default', '5' => '5 ', '6' => '6 ', '7' => '7 ', '8' => '8 ', '9' => '9 ', '10' => '10 ', '11' => '11 ', '12' => '12 ', '13' => '13 ', '14' => '14 ', '15' => '15 ', '16' => '16 ', '17' => '17 ', '18' => '18 ', '19' => '19 ', '20' => '20 ', '21' => '21 ', '22' => '22 ', '23' => '23 ', '24' => '24 ', '25' => '25 ', ); $afg_photo_size_map = array( 'default' => 'Use Default', '_s' => 'Square (Max 75px)', '_t' => 'Thumbnail (Max 100px)', '_m' => 'Small (Max 240px - Recommended)', 'NULL' => 'Medium (Max 500px)', ); $afg_on_off_map = array( 'off' => 'Off ', 'on' => 'On ', 'default' => 'Use Default', ); $afg_yes_no_map = array( 'off' => 'Yes ', 'on' => 'No ', 'default' => 'Use Default', ); $afg_descr_map = array( 'off' => 'Off (Faster)', 'on' => 'On (Slower)', 'default' => 'Use Default', ); $afg_columns_map = array( 'default' => 'Use Default', '1' => '1 ', '2' => '2 ', '3' => '3 ', '4' => '4 ', '5' => '5 ', '6' => '6 ', '7' => '7 ', '8' => '8 ', ); $afg_bg_color_map = array( 'default' => 'Use Default', 'Black' => 'Black', 'White' => 'White', 'Transparent' => 'Transparent', ); $afg_text_color_map = array( 'Black' => 'White', 'White' => 'Black', ); /* Encode the params array to make them URL safe. * Example params are api_key, api, user_id etc. */ function afg_get_encoded_params($params) { $encoded_params = array(); foreach ($params as $k => $v) { $encoded_params[] = urlencode($k).'='.urlencode($v); } return $encoded_params; } function afg_get_photo_url($farm, $server, $pid, $secret, $size) { if ($size == 'NULL') { $size = ''; } return "http://farm$farm.static.flickr.com/$server/{$pid}_$secret$size.jpg"; } function afg_construct_url($encoded_params) { $url = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); return $url; } function afg_get_flickr_data($params) { $encoded_params = afg_get_encoded_params($params); $url = afg_construct_url($encoded_params); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, 0); // ignore any headers ob_start(); // use output buffering so the contents don't get sent directly to the browser curl_exec($curl); // get the file curl_close($curl); $rsp = ob_get_contents(); // save the contents of the file into $file ob_end_clean(); // turn output buffering back off return unserialize($rsp); } function afg_generate_version_line() { return "" . "

" . "  Version: " . VERSION . " |" . " FAQ |" . " Rate this plugin |" . " Support Forums |" . " Changelog |" . " Live Demo" . "

"; } function afg_generate_flickr_settings_table($photosets, $galleries, $default_photoset='', $default_gallery='') { global $afg_photo_source_map; $photosets = afg_generate_options($photosets, '', False); $galleries = afg_generate_options($galleries, '', False); return "

Flickr Settings

Gallery Source
"; } function afg_generate_gallery_settings_table() { global $afg_per_page_map, $afg_photo_size_map, $afg_on_off_map, $afg_descr_map, $afg_columns_map, $afg_bg_color_map, $afg_photo_source_map, $afg_width_map, $afg_yes_no_map; return "

Gallery Settings

Max Photos Per Page
Size of Photos
Photo Titles Photo title setting applies only to Thumbnail (and above) size photos.
Photo Descriptions Photo Description setting applies only to Small and Medium size photos. WARNING: Enabling descriptions for photos can significantly slow down loading of the gallery and hence is not recommended.
No of Columns
Background Color
Gallery Width Width of the Gallery is relative to the width of the page where Gallery is being generated. Automatic is 100% of page width.
Disable Pagination? Useful when displaying gallery in a sidebar widget where you want only few recent photos.
Add a Small Credit Note? Credit Note will appear at the bottom of the gallery as - Powered by AFG
"; } function afg_generate_options($params, $selection, $show_default=False) { $str = ''; foreach($params as $key => $value) { if ($key == 'default' && !$show_default) { continue; } if ($selection == $key) { $str .= ""; } else { $str .= ""; } } return $str; } function filter($param) { if ($param == 'default') { return ""; } else { return $param; } } function afg_box($title, $message) { return "

$title

$message
"; } function afg_usage_box($code) { return "

Usage Instructions

Just insert $code in any of the posts or page to display your Flickr gallery.
"; } function get_afg_option($gallery, $var) { if ($gallery[$var]) return $gallery[$var]; else return get_option('afg_' . $var); } function afg_donate_box() { return "

Support this plugin

It takes time and effort to keep releasing new versions of this plugin. If you like it, consider donating a few bucks (especially if you are using this plugin on a commercial website) to keep receiving new features.
\"PayPal
All major credit cards are accepted too.
"; } function afg_reference_box() { $message = "Max Photos Per Page - " . get_option('afg_per_page') . ""; $size = get_option('afg_photo_size'); if ($size == '_s') $size = 'Square'; else if ($size == '_t') $size = 'Thumbnail'; else if ($size == '_m') $size = 'Small'; else if ($size == 'NULL') $size = 'Medium'; $message .= "
Size of Photos - " . $size . ""; $message .= "
Photo Titles - " . get_option('afg_captions') . ""; $message .= "
Photo Descriptions - " . get_option('afg_descr') . ""; $message .= "
No of Columns - " . get_option('afg_columns') . ""; $message .= "
Background Color - " . get_option('afg_bg_color') . ""; $message .= "
Gallery Width - " . ((get_option('afg_width') == 'auto')?"Automatic":get_option('afg_width') . "%") . ""; $message .= "
Pagination - " . get_option('afg_pagination') . ""; $message .= "
Credit Note - " . get_option('afg_credit_note') . ""; return afg_box('Default Settings for Reference', $message); } ?>