本文整理汇总了PHP中phpFlickr::people_findByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::people_findByEmail方法的具体用法?PHP phpFlickr::people_findByEmail怎么用?PHP phpFlickr::people_findByEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpFlickr
的用法示例。
在下文中一共展示了phpFlickr::people_findByEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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'] . '&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'] . '&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>';
//.........这里部分代码省略.........