'400' ,'height' => '300' ,'scale' => '1' ,'flickr_username' => '' # default username ,'flickr_user_id' => '' # default userID - you can find this by visiting http://idgettr.com ,'sort' => 'relevance' )); SDV($FlickrSlideshowROEenabled, true); # ROEPatterns - FLICKRSLIDESHOW EMBED CONVERSION # Converts pasted FlickrSlideshow embed code into valid pmwiki (:flickr:) code if ($FlickrSlideshowROEenabled) { $ROEPatterns['!!ie'] = "FlickrSlideshowROE(PSS('$0'))"; SDV($FlickrSlideshowROEFmt, '(:flickr [args] scale=1:)'); #SDV($FlickrSlideshowROEFmt, '(:flickr [args] scale=1 width='.$FlickrSlideshowDefaultParams['width'].' height='.$FlickrSlideshowDefaultParams['height'].':)'); function FlickrSlideshowROE($args) { global $FlickrSlideshowROEFmt; # switch out urlcodes for [/, ?, =, &] to make it easier to read and find certain items $args = str_replace(array("%2F","%3F","%3D","%26","%40"),array("/","?","=","&","@"),$args); # get username - photos/username/ if(preg_match('#photos/([^/]+)/#', $args, $matches)) $flickr_username = $matches[1]; # get user_id - &user_id=12345678@N03& if(preg_match('#user_id=([^&]+)&#', $args, $matches)) $flickr_user_id = " $matches[1]"; # get set_id - &set_id=12345678901234567& if(preg_match('#set_id=([^&]+)&#', $args, $matches)) $photosetID = " $matches[1]"; # get tag - /tags/blammo/ if(preg_match('#tags/([^/]+)/#', $args, $matches)) $tags = " tag=$matches[1]"; # get search & sort - ?q=searchterm& if(preg_match('#\?q\=([^&]+)&#', $args, $matches)) $search = " search=$matches[1]"; if(preg_match('#&s=([^&]+)&#', $args, $matches)) { if ($matches[1]=="rec") $sort = " sort=recent"; elseif ($matches[1]=="int") $sort = " sort=interesting"; else $sort = " sort=relevance"; } ## gathering width and height here b/c flickr offers different embed dimensions preg_match('#width=["\'](\d+)["\'] height=["\'](\d+)["\']#', $args, $matches); $size = " width=".$matches[1]." height=".$matches[2]; # output #$out = str_replace('[args]',"$flickr_username$photosetID$flickr_user_id$tags$size",$FlickrSlideshowROEFmt); $out = str_replace('[args]',"$flickr_username$photosetID$flickr_user_id$tags$size$search$sort",$FlickrSlideshowROEFmt); return $out; } } # FLICKR SLIDESHOW FUNCTION #function DisplayFlickrSlideshow($flickr_username, $flickr_user_id, $photosetID, $args, $tagsOnly) { function DisplayFlickrSlideshow($args) { global $FlickrSlideshowDefaultParams; $args = array_merge($FlickrSlideshowDefaultParams, ParseArgs($args)); # PARSE ARGS - to make things easier, parsing args here rather than in the MarkupExpr ## $args[""] contains all arguments unpreceded by "arg=" -- in this case $flickr_user_id, $photoset, and $flickr_username are located here and must be pulled out... if($args[""]) { foreach($args[""] as $k => $v) { #echo "key: $k, val: $v
"; preg_match("#(([^\\s]+@[^\\s]+)|(\d+)|([^\\s]+))#",$v,$matches); if($matches[2]) $flickr_user_id = $matches[2]; # flickr_user_id elseif($matches[3]) $photosetID = $matches[3]; # photoset elseif($matches[4]) $flickr_username = $matches[4]; # flickr_username } #echo "
"; } #echo $flickr_user_id."
".$photosetID."
".$flickr_username."
"; # use default username & user_id if not provided # don't get user info if a search is being performed, or if a tag is being looked for... may not want a specific user while searching... if (!$args["search"] && !$args["tag"]) { if (!$flickr_username) $flickr_username = $args["flickr_username"]; if (!$flickr_user_id) $flickr_user_id = $args["flickr_user_id"]; } # define width & height ## one can supply a 'scale' default different than '1', but it's not suggested, as it could be confusing to users $scale = $args['scale']; $width = $args['width'] * $scale; $height = $args['height'] * $scale; # get tag (can only provide 1 tag) - multiple words are separated by '+' $tag = $args['tag']; #echo $tag."
"; if ($tag) { $tagSlash = "tags/$tag/"; $tag = "&tags=$tag"; } # get search terms $search = $args['search']; if ($search) { $sort = $args['sort']; if ($sort=="interesting") { $sort = "int"; $sortLong = "interestingness-desc"; } elseif ($sort=="recent") { $sort = "rec"; $sortLong = "date-posted-desc"; } else { $sort = ""; $sortLong = "relevance"; } } # get jump_to - jump_to starts the slideshow at whatever pic you specify $jumpto = $args['jumpto']; # SLIDESHOW # show a photoset if ($photosetID) { $flickrArgs = "offsite=true&lang=en-us&page_show_url=/photos/$flickr_username/sets/$photosetID/show/&page_show_back_url=/photos/$flickr_username/sets/$photosetID/&set_id=$photosetID&jump_to=$jumpto"; } else { if ($flickr_user_id) $flickr_user_id_url = "&user_id=$flickr_user_id"; if ($flickr_username) $flickr_username = "$flickr_username/"; # display a user's entire photostream as slideshow if (!$search) { ### Flickr is able to display all photos on it's site that contain a single tag; Haven't yet implemented that version with this recipe, but below is some experimentation... ### # show photos from flickr with a particular tag, but with no user specified $flickrArgs = "offsite=true&lang=en-us&page_show_url=/photos/$flickr_username{$tagSlash}show/&page_show_back_url=/photos/$flickr_username$tagSlash$flickr_user_id_url$tag&jump_to=$jumpto"; # displaying a search as a slideshow } else { ### Flickr is able to display all photos on it's site that contain a single tag; Haven't yet implemented that version with this recipe, but below is some experimentation... ### # show photos from flickr with a particular tag, but with no user specified $flickrArgs = "offsite=true&lang=en-us&page_show_url=/search/show/?q=$search&w=$flickr_user_id&s=$sort&page_show_back_url=/search/?q=$search&w=$flickr_user_id&s=$sort&method=flickr.photos.search&api_params_str=&api_text=$search&api_tag_mode=bool&api_user_id=$flickr_user_id&api_media=all&api_sort=$sortLong&jump_to=$jumpto&start_index=0"; } } # output code $out = ""; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n"; return Keep($out); } #### FLICKRVID Markup('flickrvid', ' '' ,'width' => '400' ,'height' => '300' ,'scale' => '1' ,'showinfo' => '1' )); #SDV($FlickrVid_XHTMLcompliant, true); SDV($FlickrVidROEenabled, true); # ROEPatterns - FLICKRVID EMBED CONVERSION # Converts pasted FlickrVid embed code into valid pmwiki (:flickrvid:) code if ($FlickrVidROEenabled) { $ROEPatterns['!!ie'] = "FlickrVidROE(PSS('$0'))"; SDV($FlickrVidROEFmt, '(:flickrvid [args] scale=1:)'); function FlickrVidROE($args) { global $FlickrVidROEFmt; # gather other parameters - secret, id, width, height, showinfo if(preg_match('#photo_id=(\d+)#', $args, $matches)) $params = "$matches[1]"; ## gathering width and height here b/c flickrvid now offers different embed dimensions preg_match('#width=["\'](\d+)["\'] height=["\'](\d+)["\']#', $args, $matches); $params .= " width=".$matches[1]." height=".$matches[2]; if(preg_match('#photo_(secret=[^&]+)&#', $args, $matches)) $params .= " $matches[1]"; if(strpos($args,'flickr_show_info_box=true')) $params .= " showinfo=true"; $out = str_replace('[args]',$params,$FlickrVidROEFmt); return $out; } } function ShowFlickrVid($videocode, $args) { global $FlickrVidDefaultParams; $args = array_merge($FlickrVidDefaultParams, ParseArgs($args)); if(!$args['secret']) return "flickr error: you must provide the photo_secret"; # define width & height ## one can supply a 'scale' default different than '1', but it's not suggested, as it could be confusing to users $scale = $args['scale']; $width = $args['width'] * $scale; $height = $args['height'] * $scale; # flickr_show_info_box - this is an optional api-argument if ($args['showinfo']=='1' || $args['showinfo']=='true') $showinfo = "&flickr_show_info_box=true"; # ?v=NNNN doesn't seem to be necessary //$url = "http://www.flickr.com/apps/video/stewart.swf?v=1.167"; $url = "http://www.flickr.com/apps/video/stewart.swf"; $params = "intl_lang=en-us&photo_secret=".$args['secret']."&photo_id=".$videocode.$showinfo; $hw = "width='$width' height='$height'"; #echo "
$url $params $hw"; /* # XHTML 1.0 COMPLIANT ## seems like this should work, but it doesn't - commented out for now $out = "\n"; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n"; */ # NON-COMPLIANT (exactly what Flickr provides) $out = "\n"; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n "; $out .= "\n"; return Keep($out); }