当前位置: 首页>>代码示例>>PHP>>正文


PHP phpFlickr::people_findByUsername方法代码示例

本文整理汇总了PHP中phpFlickr::people_findByUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::people_findByUsername方法的具体用法?PHP phpFlickr::people_findByUsername怎么用?PHP phpFlickr::people_findByUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpFlickr的用法示例。


在下文中一共展示了phpFlickr::people_findByUsername方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_images

 /**
  * get images from flickr
  * @author - Henry Addo
  * @access - public 
  * @return - Array of images
  */
 public function get_images()
 {
     $username = "";
     $photo_urls = "http://www.flickr.com/photos/eyedol/";
     $tags = "tedglobal2007";
     // create instance of phpFlickr class
     $flickr = new phpFlickr('');
     //enable caching
     $flickr->enableCache("");
     //authenticate
     //$flickr->auth();
     //get token
     //$token = $token['user']['nsid'];
     // get NSID of the username
     $nsid = $token['user']['nsid'];
     $user = $flickr->people_findByUsername($username);
     //get the friendly URL of the the users' photos
     $photos_url = $flickr->urls_getUserPhotos($username);
     // get 20 images of public images of the user
     //$photos = $flickr->photos_search( array( 'tags'=>$tags,
     //'per_page'=> 200 ) );
     $photos = $flickr->people_getPublicPhotos($username, NULL, 36);
     // loop through the photos
     foreach ((array) $photos['photo'] as $photo) {
         $this->images[] = "<li><a href=\"#\">\n        <img  alt='{$photo['title']}' title='{$photo['title']}'\n        src=\"" . $flickr->buildPhotoURL($photo, 'Square') . "\" \n        onclick=\"get_image_id('" . $flickr->buildPhotoURL($photo) . "','{$photo['title']}')\"/></a></li>";
         $owner = $flickr->people_getInfo($photo[owner]);
         $this->owner = $owner['username'];
     }
     return $this->images;
 }
开发者ID:eyedol,项目名称:flickr_viewer,代码行数:36,代码来源:get_flickr_images.php

示例2: getValidation

 function getValidation($username, $apiKey, $secretKey)
 {
     $this->loadPhpFlickrClasses();
     $service = new phpFlickr($apiKey, $secretKey);
     $nsid = $service->people_findByUsername($username);
     return $nsid;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:7,代码来源:jsn_is_flickr.php

示例3: flickrUser

function flickrUser($userName)
{
    global $site;
    $f = new phpFlickr($site["flickr"]["key"]);
    $f->enableCache("fs", $site["path"] . $site["folder"] . $site["flickr"]["cache"], $site["flickr"]["cacheduration"]);
    $user = $f->people_findByUsername($userName);
    return $user;
}
开发者ID:ntctbt,项目名称:LoremFlickr,代码行数:8,代码来源:functions.php

示例4: flickr_stream

function flickr_stream($username, $api_key)
{
    require_once "phpflickr/phpFlickr.php";
    $phpFlickrObj = new phpFlickr($api_key);
    $phpFlickrObj->enableCache("fs", TEMPLATEPATH . "/cache");
    $user = $phpFlickrObj->people_findByUsername($username);
    $user_url = $phpFlickrObj->urls_getUserPhotos($user['id']);
    $photos = $phpFlickrObj->people_getPublicPhotos($user['id'], NULL, NULL, 9);
    foreach ($photos['photos']['photo'] as $photo) {
        echo '<a href="' . $user_url . $photo['id'] . '" title="' . $photo['title'] . ' (on Flickr)" target="_blank">';
        echo '<img style="width: 64px; height: 64px; margin: 1px; padding: 2px; border: 3px solid #ddd; background: #fff;" class="wp-image" alt="' . $photo['title'] . '" src="' . $phpFlickrObj->buildPhotoURL($photo, "square") . '" />';
        echo '</a>';
    }
}
开发者ID:neerajsohal,项目名称:portraiture,代码行数:14,代码来源:helper.php

示例5: display

 function display()
 {
     $flickr = new phpFlickr(ModUtil::getVar('Content', 'flickrApiKey'));
     $flickr->enableCache("fs", System::getVar('temp'));
     // Find the NSID of the username
     $person = $flickr->people_findByUsername($this->userName);
     // Get the photos
     //$photos = $flickr->people_getPublicPhotos($person['id'], NULL, $this->photoCount);
     $photos = $flickr->photos_search(array('user_id' => $person['id'], 'tags' => $this->tags, 'per_page' => $this->photoCount));
     $photoData = array();
     foreach ((array) $photos['photo'] as $photo) {
         $photoData[] = array('title' => DataUtil::formatForDisplayHTML($this->decode($photo['title'])), 'src' => $flickr->buildPhotoURL($photo, "Square"), 'url' => "http://www.flickr.com/photos/{$photo['owner']}/{$photo['id']}");
     }
     $this->view->assign('photos', $photoData);
     return $this->view->fetch($this->getTemplate());
 }
开发者ID:robbrandt,项目名称:Content,代码行数:16,代码来源:Flickr.php

示例6: getLatestPhoto

<?php

require_once 'phpFlickr/phpFlickr.php';
$username = 'Mark and Jody Reed';
$apiKey = 'c7f9162017db946e75f485b47eb10641';
$apiSecret = '08e1ed973d7fd8f4';
$flickr = new phpFlickr($apiKey, $apiSecret);
$nsid = $flickr->people_findByUsername($username);
function getLatestPhoto($tags, $mode = 'any')
{
    global $flickr, $nsid;
    $tagList = join(",", $tags);
    $photos = $flickr->photos_search(array('user_id' => $nsid['nsid'], 'tags' => $tagList, 'tag_mode' => $mode, 'extras' => 'tags'));
    return $flickr->buildPhotoUrl($photos['photo'][0]);
    return null;
}
开发者ID:markjreed,项目名称:reedville,代码行数:16,代码来源:photos.php

示例7: widget

 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     if (empty($title)) {
         $title = false;
     }
     $flickr_api = $instance['flickr_api'];
     $flickr_id = $instance['flickr_id'];
     $number = absint($instance['number']);
     require_once get_template_directory() . "/includes/widgets/phpFlickr/phpFlickr.php";
     $f = new phpFlickr($flickr_api);
     //Insert API key here
     $f->enableCache("fs", get_template_directory() . "/includes/widgets/cache/");
     if (!empty($flickr_id)) {
         echo $before_widget;
         if ($title) {
             echo $before_title;
             echo $title;
             echo $after_title;
         }
         $apikey = $f->people_findByUsername($flickr_api);
         $person = $f->people_findByUsername($flickr_id);
         $photos_url = $f->urls_getUserPhotos($person['id']);
         $photos = $f->people_getPublicPhotos($person['id'], NULL, NULL, $number);
         echo "<ul class='flickr_images clearfix'>";
         foreach ((array) $photos['photos']['photo'] as $photo) {
             $photo_url = $f->buildPhotoURL($photo, "Large");
             echo "<li><a class='view flickr-img-link' rel='flickr-gallery' target='_blank' href={$photo_url}>";
             echo "<img class='flickr' alt='{$photo['title']}' " . "src=" . $f->buildPhotoURL($photo, "Small") . ">";
             echo "</a></li>";
         }
         echo "</ul>";
         echo $after_widget;
     }
 }
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:36,代码来源:widget-flickr.php

示例8: flickrbadge

function flickrbadge($params = array())
{
    $defaults = array('key' => false, 'username' => false, 'limit' => 10, 'format' => 'square', 'cache' => true, 'refresh' => 60 * 60 * 2);
    $options = array_merge($defaults, $params);
    // check the cache dir
    $cacheDir = c::get('root.cache') . '/flickrbadge';
    dir::make($cacheDir);
    // disable the cache if adding the cache dir failed
    if (!is_dir($cacheDir) || !is_writable($cacheDir)) {
        $options['cache'] = false;
    }
    if (!$options['key']) {
        return false;
    }
    if (!$options['username']) {
        return false;
    }
    $cacheID = 'flickrbadge/data.' . md5(serialize($options)) . '.php';
    if ($options['cache']) {
        $cache = cache::modified($cacheID) < time() - $options['refresh'] ? false : cache::get($cacheID);
    } else {
        $cache = false;
    }
    if (!empty($cache)) {
        return $cache;
    }
    $flickr = new phpFlickr($options['key']);
    $userCacheID = 'flickrbadge/user.' . md5($options['username']) . '.php';
    $userCache = $options['cache'] ? cache::get($userCacheID) : false;
    $user = false;
    $url = false;
    if (!empty($userCache)) {
        $user = a::get($userCache, 'user');
        $url = a::get($userCache, 'url');
    }
    if (!$user || !$url) {
        $user = $flickr->people_findByUsername($options['username']);
        $url = $flickr->urls_getUserPhotos($user['id']);
        if ($options['cache']) {
            cache::set($userCacheID, array('user' => $user, 'url' => $url));
        }
    }
    $photos = $flickr->people_getPublicPhotos($user['id'], NULL, NULL, $options['limit']);
    $result = array();
    foreach ($photos['photos']['photo'] as $photo) {
        $photoCacheID = 'flickrbadge/photo.' . $photo['id'] . '.php';
        $info = $options['cache'] ? cache::get($photoCacheID) : false;
        if (empty($info)) {
            $info = $flickr->photos_getInfo($photo['id']);
            if ($options['cache']) {
                cache::set($photoCacheID, $info);
            }
        }
        $info = a::get($info, 'photo', array());
        $dates = a::get($info, 'dates', array());
        $tags = array();
        foreach ((array) $info['tags']['tag'] as $t) {
            if (!empty($t['raw']) && !$t['machine_tag']) {
                $tags[] = $t['raw'];
            }
        }
        $result[] = new obj(array('url' => $url . $photo['id'], 'title' => a::get($info, 'title', $photo['title']), 'description' => @$info['description'], 'src' => $flickr->buildPhotoURL($photo, $options['format']), 'taken' => isset($dates['taken']) ? strtotime($dates['taken']) : false, 'posted' => isset($dates['posted']) ? $dates['posted'] : false, 'lastupdate' => isset($dates['lastupdate']) ? $dates['lastupdate'] : false, 'views' => a::get($info, 'views', 0), 'comments' => a::get($info, 'comments', 0), 'tags' => $tags));
    }
    $result = new obj($result);
    if ($options['cache']) {
        cache::set($cacheID, $result);
    }
    return $result;
}
开发者ID:rugk,项目名称:getkirby.com,代码行数:69,代码来源:flickrbadge.php

示例9: explode

    function save_settings()
    {
        global $wpdb;
        check_admin_referer('flickr-gallery');
        $options = explode(',', $_POST['page_options']);
        $out = array();
        include_once dirname(__FILE__) . '/phpFlickr.php';
        $phpFlickr = new phpFlickr($_POST['fg-API-key'], empty($_POST['fg-secret']) ? null : $_POST['fg-secret']);
        switch ($_POST['fg-user_id-type']) {
            case 'name':
                $user = $phpFlickr->people_findByUsername($_POST['fg-user_id']);
                $_POST['fg-user_id'] = $user['id'];
                break;
            case 'email':
                $user = $phpFlickr->people_findByEmail($_POST['fg-user_id']);
                $_POST['fg-user_id'] = $user['id'];
                break;
            case 'url':
                $user = $phpFlickr->urls_lookupUser($_POST['fg-user_id']);
                $_POST['fg-user_id'] = $user['id'];
                break;
        }
        if ($_POST['fg-db-cache'] == 1) {
            if (isset($wpdb->charset) && !empty($wpdb->charset)) {
                $charset = ' DEFAULT CHARSET=' . $wpdb->charset;
            } elseif (defined(DB_CHARSET) && DB_CHARSET != '') {
                $charset = ' DEFAULT CHARSET=' . DB_CHARSET;
            } else {
                $charset = '';
            }
            $query = '
				CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . 'phpflickr_cache` (
					`request` CHAR( 35 ) NOT NULL ,
					`response` MEDIUMTEXT NOT NULL ,
					`expiration` DATETIME NOT NULL ,
					PRIMARY KEY ( `request` )
				)  ' . $charset . '
			';
            $wpdb->query($query);
        }
        /*
        if ( empty($_POST['fg-token']) && !empty($_POST['fg-frob']) ) {
        	$token = $phpFlickr->auth_getToken($_POST['fg-frob']);
        	$_POST['fg-token'] = $token['token'];
        }
        */
        foreach ($options as $o) {
            if (get_option($o) === false) {
                add_option($o, $_POST[$o], null, no);
            } else {
                update_option($o, $_POST[$o]);
            }
            if (is_array($_POST[$o])) {
                $out[] = '"' . $o . '":["' . implode('","', $_POST[$o]) . '"]';
            } else {
                $out[] = '"' . $o . '":"' . addslashes($_POST[$o]) . '"';
            }
        }
        echo '{' . implode(', ', $out) . '}';
        exit;
    }
开发者ID:htmlgraphic,项目名称:Remodeling-Appleton,代码行数:61,代码来源:flickr-gallery.php

示例10: widget

    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $tit = empty($instance['tit']) ? '&nbsp;' : strip_tags(apply_filters('widget_tit', $instance['tit']));
        $count = empty($instance['count']) ? '8' : (int) $instance['count'];
        $cols = empty($instance['cols']) ? '4' : (int) $instance['cols'];
        $par3 = empty($instance['par3']) ? '' : $instance['par3'];
        if (empty($instance['username'])) {
        } else {
            ?>

<li class="cb4_flickr widget"><?php 
            if ($tit) {
                echo '<h3 class="tit">' . $tit . '</h3>';
            }
            ?>
 <?php 
            $username = sanitize_text_field($instance['username']);
            require_once "phpFlickr/phpFlickr.php";
            // Create new phpFlickr object
            $f = new phpFlickr("c9df4cb224dd88f2f63a2cf8ef77ed66");
            /*$f->enableCache(
             "db",
             "mysql://[username]:[password]@[server]/[database]"
             );
             */
            $i = 0;
            // Find the NSID of the username inputted via the form
            $person = $f->people_findByUsername($username);
            // Get the friendly URL of the user's photos
            $photos_url = $f->urls_getUserPhotos($person['id']);
            // Get the user's first $count public photos
            $photos = $f->people_getPublicPhotos($person['id'], NULL, NULL, $count);
            //	$photos = $f->photos_search(array("user_id"=>$person['id'],"per_page"=>$count ));
            // Loop through the photos and output the html
            foreach ((array) $photos['photos']['photo'] as $photo) {
                $i++;
                if ($par3 == 'page') {
                    $link = 'href=' . $photos_url . $photo['id'] . ' target="_blank"';
                } else {
                    $link = 'href="' . $f->buildPhotoURL($photo, "large") . '"  data-rel=pp[flickr]';
                }
                if ($i % $cols == 0) {
                    echo "<div class=\"col{$cols} fade\" style=\"margin-right:0;\"><div class=\"fade_c\"><a " . $link . " class=\"flickr_a\"><i class=\"icon-search\"></i></a></div>";
                } else {
                    echo "<div class=\"col{$cols} fade \"><div class=\"fade_c\"><a " . $link . " class=\"flickr_a\"><i class=\"icon-search\"></i></a></div>";
                }
                if ($cols > 2) {
                    echo "<img alt='{$photo['title']}' " . "src=" . $f->buildPhotoURL($photo, "thumbnail") . ">";
                } else {
                    echo "<img border='0' alt='{$photo['title']}' " . "src=" . $f->buildPhotoURL($photo, "") . ">";
                }
                echo "</div>";
                // If it reaches the $cols photo, insert a line break
                if ($i % $cols == 0) {
                    if ($cols != 1) {
                        echo "<div class=\"cl\"></div>";
                    }
                }
            }
            ?>
<div class="cl"></div></li>
<?php 
        }
    }
开发者ID:shuramita,项目名称:dhsd,代码行数:65,代码来源:widgets.php

示例11: dirname

 */
ini_set("display_errors", "on");
include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
require_once dirname(dirname(__FILE__)) . "/lib/phpFlickr/phpFlickr.php";
$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
$flickr_username = get_input("flickr_username");
$album_id = get_input("album_id");
$return_url = get_input("return_url");
$user = get_loggedin_user();
if (empty($flickr_username)) {
    register_error(elgg_echo('flickr:enterusername'));
    forward($return_url);
    die;
    //just in case
} else {
    $flickr_user = $f->people_findByUsername($flickr_username);
    if (!empty($flickr_user["id"])) {
        create_metadata($user->guid, "flickr_username", $flickr_username, "text", $user->guid, ACCESS_PUBLIC);
        create_metadata($user->guid, "flickr_id", $flickr_user["id"], "text", $user->guid, ACCESS_PUBLIC);
        if ($album_id) {
            create_metadata($user->guid, "flickr_album_id", $album_id, "text", $user->guid, ACCESS_PUBLIC);
            $album = get_entity($album_id);
        }
        system_message(sprintf(elgg_echo('flickr:savedusername'), $flickr_username));
        system_message(sprintf(elgg_echo('flickr:saveduserid'), $flickr_user["id"]));
        system_message(sprintf(elgg_echo('flickr:savedalbum'), $album->title));
    } else {
        register_error(sprintf(elgg_echo('flickr:errorusername'), $flickr_username));
    }
}
forward($_SERVER['HTTP_REFERER']);
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:31,代码来源:flickrSetup.php

示例12: getItems

 public function getItems()
 {
     jimport('joomla.filesystem.folder');
     $api_key = '2a4dbf07ad5341b2b06d60c91d44e918';
     $cache_path = JPATH_ROOT . '/cache/test/flickr';
     $nsid = '';
     $photos = array();
     // create cache folder if not exist
     JFolder::create($cache_path, 0755);
     if (!class_exists('phpFlickr')) {
         require_once 'api/phpFlickr.php';
     }
     $f = new phpFlickr($api_key);
     $f->enableCache('fs', $cache_path, $this->get('cache_time'));
     //enable caching
     if ($this->get('flickr_search_from') == 'user') {
         $username = $this->get('flickr_search_from');
         if ($username != NULL) {
             $person = $f->people_findByUsername($username);
             $nsid = $person['id'];
         } else {
             return '';
         }
         $photos = $f->people_getPublicPhotos($nsid, NULL, NULL, $this->get('item_count'));
         $source = $photos['photos']['photo'];
     }
     if ($this->get('flickr_search_from') == 'tags' or $this->get('flickr_search_from') == 'text') {
         $tags = $this->get('flickr_attrs');
         if (!empty($tags)) {
             $attrs = '';
             if ($this->get('flickr_search_from') == 'tags') {
                 $attrs = 'tags';
             }
             if ($this->get('flickr_search_from') == 'text') {
                 $attrs = 'text';
             }
             $photos = $f->photos_search(array($attrs => $tags, 'per_page' => $this->get('item_count')));
             $source = $photos['photo'];
         } else {
             return '';
         }
     }
     if ($this->get('flickr_search_from') == 'recent') {
         $photos = $f->photos_getRecent(NULL, $this->get('item_count'));
         $source = $photos['photo'];
     }
     //$extras = 'description,date_upload,owner_name,tags';
     $items = array();
     $i = 0;
     if (count($source) > 0) {
         foreach ($source as $photo) {
             $id = $photo['id'];
             $obj = new stdClass();
             $info = $f->photos_getInfo($id);
             $nsid = $info['owner']['username'];
             $obj->title = $info['title'];
             $obj->image = $f->buildPhotoURL($photo, '_b');
             $obj->link = $info['urls']['url'][0]['_content'];
             $obj->introtext = $info['description'];
             $obj->date = date('Y.M.d : H:i:s A', $info['dateuploaded']);
             $items[$i] = $obj;
             $i++;
         }
     }
     //return $items;
     var_dump($f);
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:67,代码来源:flickr.php

示例13: phpFlickr

    }
    ?>
        <?php 
    get_template_part('partial', 'links');
    ?>
      </div>
      <?php 
    $key = get_field('flickr_key');
    if (!$key) {
        $key = '2926a701327d02571c68efacf6406bf0';
    }
    $username = get_field('flickr_user');
    // $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $f = new phpFlickr($key);
    $f->enableCache('fs', TEMPLATEPATH . '/inc/cache');
    $result = $f->people_findByUsername($username);
    $nsid = $result['id'];
    // $photos = $f->people_getPublicPhotos( $nsid, NULL, NULL, 100, $page );
    $photos = $f->favorites_getPublicList($nsid, NULL, NULL, NULL, NULL, NULL, $page);
    // $pages = $photos[photos][pages];
    // $total = $photos[photos][total];
    ?>
      <div class="content">
        <div class="gallery">
          <?php 
    foreach ($photos['photos']['photo'] as $photo) {
        ?>
          <div class="gallery-item"><a href="<?php 
        echo $f->buildPhotoURL($photo, 'large');
        ?>
" class="fancy" rel="photos"><img class="lazy" data-original="<?php 
开发者ID:rdourado,项目名称:atins.me,代码行数:31,代码来源:template-photos.php

示例14: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $username = esc_attr($instance['username']);
        $api_key = esc_attr($instance['api_key']);
        $nos = esc_attr($instance['nos']);
        echo $before_widget;
        include HPATH . "/lib/phpFlickr.php";
        if ($title != "") {
            echo $before_title . " " . $title . $after_title;
        }
        if (!$api_key) {
            echo '<h4> No API KEY ADDED </h4>';
        } else {
            $f = new phpFlickr($api_key);
            $person = $f->people_findByUsername($username);
            $photos_url = $f->urls_getUserPhotos($person['id']);
            $photos = $f->people_getPublicPhotos($person['id'], NULL, NULL, 16);
            ?>
        <div class="flickr-pictures clearfix">
        <?php 
            $i = 0;
            foreach ((array) $photos['photos']['photo'] as $photo) {
                if ($i >= $nos) {
                    break;
                }
                $theImageSrc = $f->buildPhotoURL($photo, "thumbnail");
                $lb = $f->buildPhotoURL($photo, "large");
                echo "<a href='" . $lb . "' class='lightbox' rel='prettyPhoto[pp_gal]' title='{$photo['title']}' ><img src='" . $theImageSrc . "' alt=\"" . $photos_url . $photo["id"] . "\" title='' /></a>";
                $i++;
            }
            ?>
        </div>



        <?php 
        }
        echo $after_widget;
    }
开发者ID:severnrescue,项目名称:web,代码行数:41,代码来源:theme_widgets.php

示例15: array

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title');
     $username = $this->get_config('email');
     $num = $this->get_config('perpage');
     $choices = $this->get_config('numberOfChoices');
     //added 110730 by artodeto
     $useChoices = $this->get_config('useChoices');
     //added 110730 by artodeto
     $apiKey = $this->get_config('apikey');
     $apiSecret = $this->get_config('apisecret');
     $sourceimgtype = $this->get_config('sourceimgtype');
     $targetimgtype = $this->get_config('targetimgtype');
     $errors = array();
     /* 		Get image data from flickr */
     $f = new phpFlickr($apiKey, $apiSecret);
     $f->enableCache("fs", $serendipity['serendipityPath'] . 'templates_c/', $this->get_config('cachetimeout'));
     if (stristr($username, '@')) {
         $nsid = $f->people_findByEmail($username);
     } else {
         $nsid = $f->people_findByUsername($username);
     }
     if ($nsid === false) {
         $errors[] = PLUGIN_SIDEBAR_FLICKR_ERROR_WRONGUSER;
     }
     /* Can't find user */
     $photos_url = $f->urls_getUserPhotos($nsid['nsid']);
     if ($useChoices === true) {
         $photos = $f->photos_search(array("user_id" => $nsid['nsid'], "per_page" => $choices, "sort" => "date-posted-desc", "extras" => "date_taken"));
     } else {
         $photos = $f->photos_search(array("user_id" => $nsid['nsid'], "per_page" => $num, "sort" => "date-posted-desc", "extras" => "date_taken"));
     }
     if ($photos[total] > 0 && $f) {
         $sizelist = array("0" => "Square", "1" => "Thumbnail", "2" => "Small", "3" => "Medium", "4" => "Large", "5" => "Original");
         if ($useChoices === true) {
             //added 110730 by artodeto
             shuffle($photos['photo']);
             array_splice($photos['photo'], $num);
         }
         foreach ($photos['photo'] as $photo) {
             if ($photo['ispublic'] !== 1) {
                 continue;
             }
             $imgdate = strftime("%d.%m.%y %H:%M", strtotime($photo['datetaken']));
             $imgtitle = $photo['title'];
             /* 				Choose available image size */
             $sizes_available = $f->photos_getSizes($photo[id]);
             $photosize = $sourceimgtype;
             $imgsrcdata = NULL;
             while ($imgsrcdata == NULL && $photosize >= 0) {
                 $imgsrcdata = getsizedata($sizes_available, $sizelist[$photosize]);
                 $photosize--;
             }
             /* If updating from previous versions, $targetimgtype could be -1. So we set it to the next legal value 2. */
             $photosize = max($targetimgtype, 2);
             $imgtrgdata = NULL;
             while ($imgtrgdata == NULL && $photosize >= 0) {
                 $imgtrgdata = getsizedata($sizes_available, $sizelist[$photosize]);
                 $photosize--;
             }
             $img_width = $imgsrcdata['width'];
             $img_height = $imgsrcdata['height'];
             $img_url = $imgsrcdata['source'];
             if ($this->get_config('targetlink') == "JPG") {
                 $link_url = $imgtrgdata['source'];
             } else {
                 $link_url = $imgtrgdata['url'];
             }
             if ($this->get_config('showdate') || $this->get_config('showtitle')) {
                 unset($info);
                 if ($this->get_config('showdate')) {
                     $info .= '<span class="serendipity_plugin_flickr_date">' . $imgdate . '</span>';
                 }
                 if ($this->get_config('showtitle')) {
                     $info .= '<span class="serendipity_plugin_flickr_title">' . $imgtitle . '</span>';
                 }
                 if ($this->get_config('lightbox') != '') {
                     $lightbox = 'rel="' . $this->get_config('lightbox') . '" ';
                 }
                 $images .= sprintf('<dd style="width:%spx;"><a %shref="%s" ><img src="%s" width="%s" height="%s" title="%s" alt="%s"/></a></dd><dt style="width:%spx;margin-left:-%spx;">%s</dt>' . "\n", $img_width, $lightbox, $link_url, $img_url, $img_width, $img_height, $photo[title], $photo[title], $img_width, $img_width + 5, $info);
             } else {
                 $images .= sprintf('<dd style="width:%spx;"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s"/></a></dd>' . "\n", $img_width, $link_url, $img_url, $img_width, $img_height, $photo[title]);
             }
             $i++;
         }
     } else {
         $errors[] = PLUGIN_SIDEBAR_FLICKR_ERROR_NOIMG;
         /* No images available */
     }
     $content = '<dl class="serendipity_plugin_flickr">' . "\n";
     $content .= "\n" . $images;
     $content .= '</dl>';
     $footer = array();
     if ($this->get_config('showrss')) {
         $rssicon = serendipity_getTemplateFile('img/xml.gif');
         $footer[] = '<a class="serendipity_xml_icon" href="http://api.flickr.com/services/feeds/photos_public.gne?id=' . $nsid['nsid'] . '&amp;format=rss_200"><img src="' . $rssicon . '" alt="XML" style="border: 0px" /></a>' . "\n" . '<a href="http://api.flickr.com/services/feeds/photos_public.gne?id=' . $nsid['nsid'] . '&amp;format=rss_200">' . PLUGIN_SIDEBAR_FLICKR_LINK_SHOWRSS . '</a>';
     }
     if ($this->get_config('showphotostream')) {
         $footer[] = '<a href="http://www.flickr.com/photos/' . $username . '/">' . PLUGIN_SIDEBAR_FLICKR_LINK_PHOTOSTREAM . '</a>';
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_plugin_flickr.php


注:本文中的phpFlickr::people_findByUsername方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。