function UserID_sets_List($user_id) { $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4'); $d = $o->photosets_getList($user_id); #print_r($d); print_r("total Sets :" . $d['total'] . "\n"); $total_sets = $d['total']; for ($set = 0; $total_sets > $set; $set++) { print "Set : {$set} "; print $d['photoset'][$set]['id']; $dir_name = $d['photoset'][$set]['title']; print $dir_name . "\n"; $dir_name = str_replace(" ", "\\ ", $dir_name); $dir_name = str_replace("'", "\\'", $dir_name); $dir_name = str_replace("/", "\\/", $dir_name); $dir_name = str_replace("(", "-", $dir_name); $dir_name = str_replace(")", "-", $dir_name); $dir_name = str_replace("|", "-", $dir_name); $dir_name = str_replace("&", "-", $dir_name); $dir_name = trim($dir_name); system("mkdir -p {$user_id}/{$dir_name}"); system("touch {$user_id}/log"); $path = $user_id . "/" . $dir_name; system("echo '{$path}' >> {$user_id}/log "); UserSets_Get_Photos($d['photoset'][$set]['id'], $path); } }
function get_data_source($data_type, $type = '') { $arr = array(); if ($data_type == 'data-2') { $arr = get_categories(); } elseif ($data_type == 'data-2-formats') { $post_formats = get_theme_support('post-formats'); $arr = $post_formats[0]; array_unshift($arr, "Select Filter"); } elseif ($data_type == 'data-3') { if (is_admin()) { global $ph_sets; if (!empty($ph_sets)) { $arr = $ph_sets['photoset']; } else { if (of_get_option('flickr_userid') != '') { require_once NV_FILES . "/adm/inc/phpFlickr/phpFlickr.php"; $f = new phpFlickr('7caca0370ede756c26832c28b266ead5'); $user = of_get_option('flickr_userid'); $ph_sets = $f->photosets_getList($user); $arr = $ph_sets['photoset']; } } if ($arr != '' && $type == 'shortcode') { array_unshift($arr, "Select Flickr Set"); } } } elseif ($data_type == 'data-4') { $args = array('numberposts' => -1, 'post_type' => 'slide-sets', 'post_status' => 'publish'); $arr = get_posts($args); } elseif ($data_type == 'data-5') { if (class_exists('Woocommerce')) { $arr = get_terms('product_cat', 'orderby=name&hide_empty=0'); } else { $arr = get_terms('wpsc_product_category', 'orderby=name&hide_empty=0'); } } elseif ($data_type == 'data-5-tags') { $arr = get_terms('product_tag', 'orderby=name&hide_empty=1'); } elseif ($data_type == 'data-6') { $arr = get_terms('portfolio-category', 'orderby=name&hide_empty=0'); } // Set the options array if (is_array($arr)) { foreach ($arr as $val) { if ($data_type == 'data-2') { if ($type == 'shortcode') { $options_array[htmlspecialchars($val->cat_name)] = $val->cat_name; } else { $options_array[htmlspecialchars($val->term_id)] = $val->cat_name; } } elseif ($data_type == 'data-3') { if ($type == 'shortcode') { if ($val == 'Select Flickr Set') { $options_array[htmlspecialchars($val)] = ''; } else { $options_array[$val['title']['_content']] = $val['id']; } } else { $options_array[$val['id']] = $val['title']['_content']; } } elseif ($data_type == 'data-4') { if ($type == 'shortcode') { $options_array[htmlspecialchars($val->post_title)] = $val->post_title; } else { $options_array[htmlspecialchars($val->ID)] = $val->post_title; } } elseif ($data_type == 'data-2-formats') { if ($type == 'shortcode') { if ($val == 'Select Filter') { $options_array[htmlspecialchars($val)] = ''; } else { $options_array[htmlspecialchars($val)] = $val; } } elseif ($type == 'blog') { if ($val != 'Select Filter') { $options_array[htmlspecialchars($val)] = $val; } } else { if ($val == 'Select Filter') { $options_array[] = array('name' => $val, 'value' => ''); } else { $options_array[] = array('name' => $val, 'value' => $val); } } } else { $options_array[htmlspecialchars($val->name)] = $val->name; } } } if (empty($options_array)) { $options_array[''] = 'No Data Found'; } return $options_array; }
function form($instance) { // Option Keys $keys = array('width', 'height', 'gallery_height', 'imgheight', 'imgwidth', 'img_align', 'timeout', 'orderby', 'sortby', 'tween', 'animation', 'animation_type', 'title', 'excerpt', 'datasource', 'attachedmedia', 'pagepost_id', 'gallerycats', 'gallerypostformat', 'flickr_set', 'slidesetid', 'productcats', 'producttags', 'mediacats', 'content_type', 'img_effect'); foreach ($keys as $key) { if (empty($instance[$key])) { $instance[$key] = ''; } } /* Set up some default widget settings. */ ?> <script type="text/javascript" charset="utf8" > // Load Sections jQuery(document).ready(function($) { var data_id = $("#<?php echo $this->get_field_id('datasource'); ?> ").val(); $( '.datasource' ).hide(); $( '#'+ data_id ).show(); $(document).delegate('.gallery-widget-data', 'click', function() { var data_id = $( this ).val(); $( '.datasource' ).hide(); $( '#'+ data_id ).show(); }); }); </script> <!-- Widget Title: Text Input --> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title: (Optional)', 'themeva'); ?> </label> <input id="<?php echo $this->get_field_id('title'); ?> " class="widefat" name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $instance['title']; ?> " style="width:96%;" /> </p> <div class="widget_column two"> <!-- Image Height: Text Input --> <p> <label for="<?php echo $this->get_field_id('height'); ?> "><?php _e('Image Height:', 'themeva'); ?> </label><br /> <input id="<?php echo $this->get_field_id('height'); ?> " class="widefat" name="<?php echo $this->get_field_name('height'); ?> " value="<?php echo $instance['height']; ?> " style="width:30px;" /><small> px <em>(170 default)</em></small> </p> </div> <div class="widget_column two last"> <!-- Image Width: Text Input --> <p> <label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Image Width:', 'themeva'); ?> </label><br /> <input id="<?php echo $this->get_field_id('width'); ?> " class="widefat" name="<?php echo $this->get_field_name('width'); ?> " value="<?php echo $instance['width']; ?> " style="width:30px;" /><small> px</small> </p> </div> <p class="clear"> <label for="<?php echo $this->get_field_id('gallery_height'); ?> "><?php _e('Gallery Height:', 'themeva'); ?> </label><br /> <input id="<?php echo $this->get_field_id('gallery_height'); ?> " class="widefat" name="<?php echo $this->get_field_name('gallery_height'); ?> " value="<?php echo $instance['gallery_height']; ?> " style="width:30px;" /><small> px (default 200)</small> </p> <p> <label for="<?php echo $this->get_field_id('datasource'); ?> "><strong><?php _e('Datasource:', 'themeva'); ?> </strong></label><br /><br /> <select id="<?php echo $this->get_field_id('datasource'); ?> " name="<?php echo $this->get_field_name('datasource'); ?> " class="widefat gallery-widget-data" style="width:100%;"> <option value="<?php echo $this->get_field_id('nodata'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('nodata')) { ?> selected="selected" <?php } ?> >Select Data Source </option> <option value="<?php echo $this->get_field_id('data-1'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-1')) { ?> selected="selected" <?php } ?> >Attached Media</option> <option value="<?php echo $this->get_field_id('data-6'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-6')) { ?> selected="selected" <?php } ?> >Gallery Media</option> <option value="<?php echo $this->get_field_id('data-2'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-2')) { ?> selected="selected" <?php } ?> >Post Categories</option> <?php if (class_exists('WPSC_Query') || class_exists('Woocommerce')) { ?> <option value="<?php echo $this->get_field_id('data-5'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-5')) { ?> selected="selected" <?php } ?> >Product Categories / Tags</option> <?php } ?> <?php if (of_get_option('flickr_userid') != '') { ?> <option value="<?php echo $this->get_field_id('data-3'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-3')) { ?> selected="selected" <?php } ?> >Flickr Set</option> <?php } ?> <option value="<?php echo $this->get_field_id('data-4'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-4')) { ?> selected="selected" <?php } ?> >Slide Set</option> <option value="<?php echo $this->get_field_id('data-8'); ?> " <?php if ($instance['datasource'] == $this->get_field_id('data-8')) { ?> selected="selected" <?php } ?> >Page / Post ID</option> </select> </p> <div id="<?php echo $this->get_field_id('nodata'); ?> "></div> <div id="<?php echo $this->get_field_id('data-1'); ?> " class="datasource"> <?php /* ------------------------------------ :: ATTACHED MEDIA ------------------------------------ */ ?> <label for="<?php echo $this->get_field_id('attachedmedia'); ?> "><strong><?php _e('Post / Page ID:', 'themeva'); ?> </strong></label><br /> <p> <input id="<?php echo $this->get_field_id('attachedmedia'); ?> " class="widefat" name="<?php echo $this->get_field_name('attachedmedia'); ?> " value="<?php echo $instance['attachedmedia']; ?> " style="width:100px;" /> <small> Comma separate for multiple</small> </p> </div> <div id="<?php echo $this->get_field_id('data-4'); ?> " class="datasource"> <?php /* ------------------------------------ :: GALLERY SLIDESET ------------------------------------ */ ?> <h4>Slide Sets</h4> <p> <?php $args = array('numberposts' => -1, 'post_type' => 'slide-sets', 'post_status' => 'publish'); $slide_sets = get_posts($args); foreach ($slide_sets as $set) { $option = '<input type="checkbox" id="' . $this->get_field_id('slidesetid') . '[]" name="' . $this->get_field_name('slidesetid') . '[]"'; if (is_array($instance['slidesetid'])) { foreach ($instance['slidesetid'] as $sets) { if ($sets == $set->ID) { $option = $option . ' checked="checked"'; } } } $option .= ' value="' . $set->ID . '" />'; $option .= ' ' . $set->post_title; $option .= '<br />'; echo $option; } ?> </p> </div> <div id="<?php echo $this->get_field_id('data-2'); ?> " class="datasource"> <?php /* ------------------------------------ :: POST CATEGORIES ------------------------------------ */ ?> <h4>Post Categories</h4> <p> <label for="<?php echo $this->get_field_id('gallerycats'); ?> "><strong><?php _e('Select Post Categories:', 'themeva'); ?> </strong></label><br /><br /> <?php $categories = get_categories(); foreach ($categories as $cat) { $option = '<input type="checkbox" id="' . $this->get_field_id('gallerycats') . '[]" name="' . $this->get_field_name('gallerycats') . '[]"'; if (is_array($instance['gallerycats'])) { foreach ($instance['gallerycats'] as $cats) { if ($cats == $cat->term_id) { $option = $option . ' checked="checked"'; } elseif ($cats == $cat->cat_name) { $option = $option . ' checked="checked"'; } } } $option .= ' value="' . $cat->cat_name . '" />'; $option .= ' ' . $cat->cat_name; $option .= ' (' . $cat->category_count . ')'; $option .= '<br />'; echo $option; } ?> </p> <p> <label for="<?php echo $this->get_field_id('gallerypostformat'); ?> "><strong><?php _e('Display & Filter by Post Format:', 'themeva'); ?> </strong></label><br /> <select name="<?php echo $this->get_field_name('gallerypostformat'); ?> " id="<?php echo $this->get_field_id('gallerypostformat'); ?> "> <option value="">Disabled</option> <?php $post_formats = get_theme_support('post-formats'); foreach ($post_formats[0] as $post_format) { ?> <option value="<?php echo $post_format; ?> " <?php if ($instance['gallerypostformat'] == $post_format) { ?> selected="selected" <?php } ?> ><?php echo $post_format; ?> </option> <?php } ?> </select> </p> </div> <?php if (of_get_option('flickr_userid') != '') { ?> <div id="<?php echo $this->get_field_id('data-3'); ?> " class="datasource"> <?php /* ------------------------------------ :: FLICKR SET ------------------------------------ */ ?> <p> <label for="<?php echo $this->get_field_id('flickrset'); ?> "><strong><?php _e('Select Flickr Set:', 'themeva'); ?> </strong></label><br /> <select name="<?php echo $this->get_field_name('flickrset'); ?> " id="<?php echo $this->get_field_id('flickrset'); ?> "> <?php if (is_admin()) { require_once NV_FILES . "/adm/inc/phpFlickr/phpFlickr.php"; //$f = new phpFlickr( of_get_option('flickr_apikey') ); // API $f = new phpFlickr('7caca0370ede756c26832c28b266ead5'); // API $user = of_get_option('flickr_userid'); $ph_sets = $f->photosets_getList($user); foreach ($ph_sets['photoset'] as $ph_set) { if (!$ph_set) { ?> <option value="">No Sets Found</option> <?php } else { ?> <option value="">Select Set</option> <option value="<?php echo $ph_set['id']; ?> " <?php if ($instance['flickrset'] == $ph_set['id']) { ?> selected="selected" <?php } ?> ><?php echo $ph_set['title']; ?> </option> <?php } } } ?> </select> </p> </div> <?php } ?> <?php if (class_exists('WPSC_Query') || class_exists('Woocommerce')) { ?> <div id="<?php echo $this->get_field_id('data-5'); ?> " class="datasource"> <?php /* ------------------------------------ :: PRODUCT CATEGORIES / TAGS ------------------------------------ */ ?> <p> <label for="<?php echo $this->get_field_id('productcats'); ?> "><strong><?php _e('Select Product Categories:', 'themeva'); ?> </strong></label><br /><br /> <?php if (class_exists('Woocommerce')) { $categories = get_terms('product_cat', 'orderby=name&hide_empty=0'); } else { $categories = get_terms('wpsc_product_category', 'orderby=name&hide_empty=0'); } foreach ($categories as $cat) { $option = '<input type="checkbox" id="' . $this->get_field_id('productcats') . '[]" name="' . $this->get_field_name('productcats') . '[]" '; if (is_array($instance['productcats'])) { foreach ($instance['productcats'] as $cats) { if ($cats == $cat->name) { $option .= 'checked="checked"'; } } } else { if ($instance['productcats'] == $cat->name) { $option .= 'checked="checked"'; } } $option .= ' value="' . $cat->name . '">'; $option .= '<small class="description">' . $cat->name; $option .= ' (' . $cat->count . ') </small><br />'; echo $option; } ?> <br /> <label for="<?php echo $this->get_field_id('producttags'); ?> "><strong><?php _e('Select Product Tags:', 'themeva'); ?> </strong></label><br /><br /> <?php $tags = get_terms('product_tag', 'orderby=name&hide_empty=1'); foreach ($tags as $tag) { $option = '<input type="checkbox" id="' . $this->get_field_id('producttags') . '[]" name="' . $this->get_field_name('producttags') . '[]" '; if (is_array($instance['producttags'])) { foreach ($instance['producttags'] as $tags) { if ($tags == $tag->name) { $option .= 'checked="checked"'; } } } else { if ($instance['producttags'] == $tag->name) { $option .= 'checked="checked"'; } } $option .= ' value="' . $tag->name . '">'; $option .= '<small class="description">' . $tag->name; $option .= ' (' . $tag->count . ') </small><br />'; echo $option; } ?> </p> </div> <?php } ?> <div id="<?php echo $this->get_field_id('data-8'); ?> " class="datasource"> <?php /* ------------------------------------ :: PAGE / POST MEDIA ------------------------------------ */ ?> <label for="<?php echo $this->get_field_id('pagepost_id'); ?> "><strong><?php _e('Page / Post ID:', 'themeva'); ?> </strong></label><br /> <p> <input id="<?php echo $this->get_field_id('pagepost_id'); ?> " class="widefat" name="<?php echo $this->get_field_name('pagepost_id'); ?> " value="<?php echo $instance['pagepost_id']; ?> " style="width:100px;" /> <small> Comma separate for multiple</small> </p> </div> <div id="<?php echo $this->get_field_id('data-6'); ?> " class="datasource"> <?php /* ------------------------------------ :: GALLERY MEDIA ------------------------------------ */ ?> <p> <label for="<?php echo $this->get_field_id('gallerymedia'); ?> "><strong><?php _e('Select Gallery Media Categories:', 'themeva'); ?> </strong></label><br /><br /> <?php $categories = get_terms('portfolio-category', 'orderby=name&hide_empty=0'); foreach ($categories as $cat) { $option = '<input type="checkbox" id="' . $this->get_field_id('mediacats') . '[]" name="' . $this->get_field_name('mediacats') . '[]" '; if (is_array($instance['mediacats'])) { foreach ($instance['mediacats'] as $cats) { if ($cats == $cat->name) { $option .= 'checked="checked"'; } } } else { if ($instance['mediacats'] == $cat->name) { $option .= 'checked="checked"'; } } $option .= ' value="' . $cat->name . '">'; $option .= '<small class="description">' . $cat->name; $option .= ' (' . $cat->count . ') </small><br />'; echo $option; } ?> </p> </div> <p> <label for="<?php echo $this->get_field_id('content_type'); ?> "><?php _e('Content Type:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('content_type'); ?> " name="<?php echo $this->get_field_name('content_type'); ?> " class="widefat" style="width:100%;"> <option value="image" <?php if ('image' == $instance['content_type']) { echo 'selected="selected"'; } ?> >Image</option> <option value="text" <?php if ('text' == $instance['content_type']) { echo 'selected="selected"'; } ?> >Text</option> <option value="textimage" <?php if ('textimage' == $instance['content_type']) { echo 'selected="selected"'; } ?> >Text/Image</option> <option value="titleimage" <?php if ('titleimage' == $instance['content_type']) { echo 'selected="selected"'; } ?> >Title/Image</option> <option value="titleoverlay" <?php if ('titleoverlay' == $instance['content_type']) { echo 'selected="selected"'; } ?> >Title Overlay Image</option> <option value="titletextoverlay" <?php if ('titletextoverlay' == $instance['content_type']) { echo 'selected="selected"'; } ?> >Title & Text Overlay Image</option> </select> </p> <p> <label for="<?php echo $this->get_field_id('img_effect'); ?> "><?php _e('Image Effect:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('img_effect'); ?> " name="<?php echo $this->get_field_name('img_effect'); ?> " class="widefat" style="width:100%;"> <option value="none" <?php if ('none' == $instance['img_effect']) { echo 'selected="selected"'; } ?> >No Effect</option> <option value="frame" <?php if ('frame' == $instance['img_effect']) { echo 'selected="selected"'; } ?> >Frame</option> <option value="shadow" <?php if ('shadow' == $instance['img_effect']) { echo 'selected="selected"'; } ?> >Shadow</option> <option value="reflection" <?php if ('reflection' == $instance['img_effect']) { echo 'selected="selected"'; } ?> >Reflection</option> <option value="shadowreflection" <?php if ('shadowreflection' == $instance['img_effect']) { echo 'selected="selected"'; } ?> >Reflection & Shadow</option> </select> </p> <p> <label for="<?php echo $this->get_field_id('img_align'); ?> "><?php _e('Image Align:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('img_align'); ?> " name="<?php echo $this->get_field_name('img_align'); ?> " class="widefat" style="width:100%;"> <option value="center" <?php if ('center' == $instance['img_align']) { echo 'selected="selected"'; } ?> >Center</option> <option value="left" <?php if ('left' == $instance['img_align']) { echo 'selected="selected"'; } ?> >Left</option> <option value="right" <?php if ('right' == $instance['img_align']) { echo 'selected="selected"'; } ?> >Right</option> </select> </p> <p> <label for="<?php echo $this->get_field_id('animation_type'); ?> "><?php _e('Animation Type:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('animation_type'); ?> " name="<?php echo $this->get_field_name('animation_type'); ?> " class="widefat" style="width:100%;"> <?php $animation_types = array("scrollHorz", "blindX", "blindY", "blindZ", "cover", "curtainX", "curtainY", "fade", "fadeZoom", "growX", "growY", "none", "scrollUp", "scrollDown", "scrollLeft", "scrollRight", "scrollHorz", "scrollVert", "shuffle", "slideX", "slideY", "toss", "turnUp", "turnDown", "turnLeft", "turnRight", "uncover", "wipe", "zoom"); foreach ($animation_types as $animation_type) { if ($instance['animation_type'] == $animation_type) { $option = '<option selected="selected" value="' . $animation_type . '">'; } else { $option = '<option value="' . $animation_type . '">'; } $option .= $animation_type; $option .= '</option>'; echo $option; } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('tween_type'); ?> "><?php _e('Tween Type:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('tween_type'); ?> " name="<?php echo $this->get_field_name('tween_type'); ?> " class="widefat" style="width:100%;"> <?php $tween_types = array("easeInOutExpo", "linear", "easeInSine", "easeOutSine", "easeInOutSine", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuint", "easeOutQuint", "easeInOutQuint", "easeInCirc", "easeOutCirc", "easeInOutCirc", "easeInBack", "easeOutBack", "easeInOutBack", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInExpo", "easeOutExpo", "easeInOutExpo", "easeInElastic", "easeOutElastic", "easeInOutElastic", "easeInBounce", "easeOutBounce", "easeInOutBounce"); foreach ($tween_types as $tween_type) { if ($instance['tween_type'] == $tween_type) { $option = '<option selected="selected" value="' . $tween_type . '">'; } else { $option = '<option value="' . $tween_type . '">'; } $option .= $tween_type; $option .= '</option>'; echo $option; } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('timeout'); ?> "><?php _e('Timeout:', 'themeva'); ?> </label><br /> <input id="<?php echo $this->get_field_id('timeout'); ?> " class="widefat" name="<?php echo $this->get_field_name('timeout'); ?> " value="<?php echo $instance['timeout']; ?> " style="width:50px" /> <small> <em>seconds</em></small> </p> <p> <label for="<?php echo $this->get_field_id('excerpt'); ?> "><?php _e('Excerpt:', 'themeva'); ?> </label><br /> <input id="<?php echo $this->get_field_id('excerpt'); ?> " class="widefat" name="<?php echo $this->get_field_name('excerpt'); ?> " value="<?php echo $instance['excerpt']; ?> " style="width:50px" /> <small><em>(55 default)</em></small> </p> <p> <label for="<?php echo $this->get_field_id('sortby'); ?> "><?php _e('Sort by:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('sortby'); ?> " name="<?php echo $this->get_field_name('sortby'); ?> " class="widefat" style="width:100%;"> <option value="date" <?php if ('date' == $instance['sortby']) { echo 'selected="selected"'; } ?> >Date</option> <option value="rand" <?php if ('rand' == $instance['sortby']) { echo 'selected="selected"'; } ?> >Random</option> <option value="title" <?php if ('title' == $instance['sortby']) { echo 'selected="selected"'; } ?> >Title</option> </select> </p> <p> <label for="<?php echo $this->get_field_id('orderby'); ?> "><?php _e('Order by:', 'themeva'); ?> </label> <select id="<?php echo $this->get_field_id('orderby'); ?> " name="<?php echo $this->get_field_name('orderby'); ?> " class="widefat" style="width:100%;"> <option value="" <?php if ('' == $instance['orderby']) { echo 'selected="selected"'; } ?> >Ascending</option> <option value="DESC" <?php if ('DESC' == $instance['orderby']) { echo 'selected="selected"'; } ?> >Descending</option> </select> </p> <?php }
case 'logout': unset($_SESSION['phpFlickr_auth_token']); $_SESSION['page_infos'][] = l10n('Logged out'); redirect(FLICKR_ADMIN . '-import'); break; // main menu // main menu case 'main': $u = $flickr->people_getInfo($u['id']); $template->assign(array('username' => $u['username'], 'profile_url' => $u['profileurl'], 'logout_url' => FLICKR_ADMIN . '-import&action=logout', 'list_albums_url' => FLICKR_ADMIN . '-import&action=list_albums', 'import_all_url' => FLICKR_ADMIN . '-import&action=list_all')); break; // list user albums // list user albums case 'list_albums': // all albums $albums = $flickr->photosets_getList($u['id']); $total_albums = $albums['total']; $albums = $albums['photoset']; foreach ($albums as &$album) { $album['U_LIST'] = FLICKR_ADMIN . '-import&action=list_photos&album=' . $album['id']; } unset($album); // not classed $wo_albums = $flickr->photos_getNotInSet(NULL, NULL, NULL, NULL, 'photos', NULL, NULL, 1); if ($wo_albums['photos']['total'] > 0) { $albums[] = array('id' => 'not_in_set', 'title' => l10n('Pictures without album'), 'description' => null, 'photos' => $wo_albums['photos']['total'], 'U_LIST' => FLICKR_ADMIN . '-import&action=list_photos&album=not_in_set'); } $template->assign(array('total_albums' => $total_albums, 'albums' => $albums)); break; // list photos of an album // list photos of an album
</div> <div class="es-carousel"> <style>.es-carousel ul li a img{ margin-top: -30px !important; } </style> <?php require_once "flickr/phpFlickr.php"; if ($flickrPrivate == "privatephotosetYes") { $f = new phpFlickr("{$flickrAPI}", "{$flickrSecret}"); $f->setToken("{$flickrToken}"); } if ($flickrPrivate == "privatephotosetNo") { $f = new phpFlickr("{$flickrAPI}"); } $ph_sets = $f->photosets_getList(); if ($flickrCache == "1") { $cacheFolderPath = JPATH_SITE . DS . 'cache' . DS . 'ResponsivePhotoGallery-' . $moduleTitle . ''; if (file_exists($cacheFolderPath) && is_dir($cacheFolderPath)) { // all OK } else { mkdir($cacheFolderPath); } $lifetime = 860 * 860; // 60 * 60=One hour $f->enableCache("fs", "{$cacheFolderPath}", "{$lifetime}"); } ?> <?php if ($flickrCaption == "1") {
$viewer = elgg_get_logged_in_user_entity(); /* Deprecated $flickr_username = get_metadata_byname( $viewer->guid, "flickr_username" ); $flickr_id = get_metadata_byname( $viewer->guid, "flickr_id" ); $album_id = get_metadata_byname( $viewer->guid, "flickr_album_id" ); */ $flickr_username = elgg_get_metadata(array('guid' => $viewer->guid, 'metadata_name' => 'flickr_username')); $flickr_id = elgg_get_metadata(array('guid' => $viewer->guid, 'metadata_name' => 'flickr_id')); $album_id = elgg_get_metadata(array('guid' => $viewer->guid, 'metadata_name' => 'flickr_album_id')); if (intval($album_id[0]->value) <= 0) { register_error(sprintf(elgg_echo('flickr:errornoalbum'), $album_id[0]->value)); forward("/mib/mod/tidypics/pages/flickr/setup.php"); } $photosets = $f->photosets_getList($flickr_id[0]->value); foreach ($photosets["photoset"] as $photoset) { $content .= "<div class='tidypics_album_images'>"; $content .= "{$photoset['title']}<br />"; $count = 0; $looper = 0; //create links to import photos 10 at a time while ($photoset["photos"] > $count) { $looper++; $content .= " <a href='/mib/mod/tidypics/actions/flickrImportPhotoset.php?set_id={$photoset['id']}&page={$looper}&album_id=" . $album_id[0]->value . "'>{$looper}</a>"; $count = $count + 10; } $content .= "<br />{$photoset['photos']} images"; $content .= "</div>"; // echo "<pre>"; var_dump( $photoset ); echo "</pre>"; die; }
define('API_KEY', ''); define('API_SECRET', ''); define('API_TOKEN', ''); // === S T E P 2 === // Fill in your Flickr user ID. You can find it here: http://idgettr.com define('UID', ''); // === S T E P 3 === // Download and include the phpFlickr project from http://code.google.com/p/phpflickr/ require 'phpFlickr/phpFlickr.php'; // === S T E P 4 === // Run the script via the command line using: "php download-all.php" // Connect to Flickr $f = new phpFlickr(API_KEY, API_SECRET, true); $f->setToken(API_TOKEN); // Get all of our photosets $sets = $f->photosets_getList(UID); foreach ($sets['photoset'] as $set) { echo "### " . $set['title'] . "\n"; @mkdir("photos/{$set['title']}", 0777, true); // Get all the photos in this set $photos = $f->photosets_getPhotos($set['id']); // And download each one... foreach ($photos['photoset']['photo'] as $photo) { $url = null; $sizes = $f->photos_getSizes($photo['id']); foreach ($sizes as $size) { if ($size['label'] == 'Original') { $url = $size['source']; } } if (!is_null($url)) {
<?php require_once "phpFlickr/phpFlickr.php"; $f = new phpFlickr("44449d9d74ed80abe095ab2a6f137dbe", "abde3a1309b8d8e1"); /* $f->enableCache( "db", "mysql://[username]:[password]@[server]/[database]" ); */ $photos_url = $f->urls_getUserPhotos('28973605@N00'); $photos = $f->people_getPublicPhotos('28973605@N00', NULL, NULL, 11); $sets = $f->photosets_getList('28973605@N00'); ?> <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="./css/reset-min.css" type="text/css" media="screen" /> <link rel="stylesheet" href="./css/style.css" type="text/css" media="screen" /> <link rel="stylesheet" href="./css/jquery.lightbox-0.5.css" type="text/css" media="screen" /> <title>上禾友</title> <script type="text/javascript" src="./js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="./js/jquery.lightbox-0.5.min.js"></script> <script type="text/javascript"> (function() { $(document).ready(function() { $('#gallery a').lightBox({fixedNavigation:true}); $('.setBox a.more').click(function() { alert($(this).attr('set_id')); return false;
function showFlickrPhotos($target) { global $blogURL, $pluginURL, $configVal; requireComponent('Textcube.Function.misc'); require_once "lib/phpFlickr.php"; $data = misc::fetchConfigVal($configVal); $flickruserid = isset($data['flickruserid']) ? $data['flickruserid'] : ""; $flickr_api_key = "d1038f051000214af2bf694014ca8f98"; //It's key for plugin. It does not change. $f = new phpFlickr($flickr_api_key); ob_start(); ?> <script type="text/javascript"> //<![CDDA[ function actionFlickr(flag){ var person = document.getElementById("person").value; var photoSets = (document.getElementById("photoSets")==undefined) ? "" : document.getElementById("photoSets").value; var length = 16; var searchKey = document.getElementById("searchKey").value; var srcTarget = document.getElementById("flickrview"); switch(flag) { case "search": var flickrQueryString = "?person=" + person + "&photoSets=" + photoSets + "&length=" + length + "&search=" + encodeURIComponent(searchKey) + "&page=1"; srcTarget.src = "<?php echo $blogURL; ?> /plugin/flickrPhotos" + flickrQueryString; break; case "allview": var flickrQueryString = "?person=" + person + "&length=" + length + "&page=1"; srcTarget.src = "<?php echo $blogURL; ?> /plugin/flickrPhotos" + flickrQueryString; break; case "refresh": default: parent.frames['flickrview'].location.reload(); break; } } //]]> </script> <div style="margin-top:10px;clear:both;"><strong>• Flickr Photos</strong></div> <?php if (!empty($flickruserid)) { ?> <div id="photosToyHeader" style="margin-top:15px;background-color:#eee;"> <?php $userInfo = $f->people_getInfo($flickruserid); echo ' Hello! <strong style="color: #36f;">', $userInfo['username'], '</strong>'; $photosUrl = $userInfo['photosurl']; ?> </div> <?php } ?> <div style="margin-top:5px;background-color:#fff;"><iframe name="flickrview" id="flickrview" src="<?php echo $blogURL; ?> /plugin/flickrPhotos" scrolling="no" style="width:100%;height:200px;margin:0;padding:0;border:0;"></iframe></div> <div id="photosToolbar" style="background-color:#eee;white-space:nowrap;padding:4px;overflow:hidden;"> <?php if (!empty($flickruserid)) { $mySets = $f->photosets_getList($flickruserid); echo 'Flickr Photosets <select id="photoSets" name="photoSets" size="1">'; foreach ((array) $mySets['photoset'] as $row) { echo '<option label="', $row['title'], '" value="', $row['id'], '">', $row['title'], '(', $row['photos'], ')</option>'; } echo '</select> '; } ?> Search <select name="person" id="person" value="1"><option label="My" value="my">My</option><option label="All" value="all">All</option></select> <input type="text" name="searchKey" id="searchKey" value="" maxlength="255" /><br /><br /> <img src="<?php echo $pluginURL; ?> /images/refresh.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('refresh');return false;" /> <img src="<?php echo $pluginURL; ?> /images/search.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('search');return false;" /> <img src="<?php echo $pluginURL; ?> /images/allview.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('allview');return false;" /> </div> <?php $script = ob_get_contents(); ob_end_clean(); return $target . $script; }
echo $photo['id']; ?> " style="margin: 0px; margin-top: 3px; margin-right: 10px; width: 300px" value="<?php echo $description; ?> " /> </li> <?php } } } elseif ($_POST['method'] == "getPhotosets") { $nsid = $f->people_findByUsername($_POST['username']); if ($f->getErrorCode()) { echo "Username \"" . $_POST['username'] . "\" not found on Flickr."; } else { $photosets = $f->photosets_getList($nsid); if (!isset($_POST['photoset_id'])) { $_POST['photoset_id'] = 0; } if (count($photosets['photoset'])) { echo '<h2>Photosets of ' . $_POST['username'] . "</h2>"; echo '<input type="hidden" id="photoset_count" value="' . count($photosets['photoset']) . '">'; echo '<input type="hidden" id="photoset_owner" value="' . $nsid . '">'; echo "<table cellpadding='3' style='border: none; width: 100%'>\n<tr>"; foreach ($photosets['photoset'] as $key => $photoset) { ?> <td style="vertical-align: top; text-align: center; width: 33%"> <a target="_blank" href="http://flickr.com/photos/<?php echo $nsid; ?> /sets/<?php