Share

Phlickr

Tracker: Patches

5 Patch: Shortcut for "datetaken" attribute - ID: 2605089
Last Update: Tracker Item Submitted ( nonanet )


When a flickr.photo.search includes "date_taken" in the "extras" attribute,
the returned list already contains the "datetaken" attribute. The following
patch makes it accessible to the getTakenDate() method, and saves massive
number of API calls in certain scenarios.

Same would be possible for other attributes - i'm not confident about the
internals of Phlickr - but the following patch works for me.

Would apply to other attributes as well, of course.

--- Photo.php.orig 2008-12-10 01:03:15.000000000 +0100
+++ Photo.php 2009-02-16 11:34:32.646767174 +0100
@@ -242,6 +242,11 @@
* @see getTakenGranularity(), getTakenTimestamp(),
getPostedDate()
*/
public function getTakenDate() {
+ // if 'extras' includes 'date_taken' in a query, datetaken is
+ // available in the short version already as an attribute:
+ if (isset($this->_cachedXml->attributes()->datetaken)) {
+ return (string)
$this->_cachedXml->attributes()->datetaken;
+ }
if (!isset($this->_cachedXml->dates['taken'])) {
$this->load();
}


Alexander Mayrhofer ( nonanet ) - 2009-02-16 10:47

5

Open

None

Nobody/Anonymous

None

None

Public


Comments




Log in to comment.

No follow-up comments have been posted.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.